On Wed, 19 Nov 2025 14:40:41 +0100 Petr Machata wrote:
@@ -163,7 +162,7 @@ KSFT_DISRUPTIVE = True entry = global_defer_queue.pop() try: entry.exec_only()
except:
except Exception:This used to catch KsftTerminate, which we use for SIGTERM handling, now it doesn't anymore. I think it could legitimately appear in that context if SIGTERM si delivered while exec_only() is running.
IMHO it should catch BaseException, like ksft_run() already does.
TBH I haven't thought of this. Are you thinking that we shouldn't interrupt the execution of deferred cleanups when SIGTERM arrives? Fair point, but I think we'd need more code to handle that properly 🤔️ Right now we ignore SIGTERM which isn't great. After this patch we'll no longer ignore it and have the whole test exit. Neither actually catches the exception and sets stop=True in ksft_run()..
WDYT about leaving this patch as is and doing this on top:
diff --git a/tools/testing/selftests/net/lib/py/ksft.py b/tools/testing/selftests/net/lib/py/ksft.py index 83b1574f7719..5a667ad22ef4 100644 --- a/tools/testing/selftests/net/lib/py/ksft.py +++ b/tools/testing/selftests/net/lib/py/ksft.py @@ -268,7 +268,12 @@ KSFT_DISRUPTIVE = True KSFT_RESULT = False cnt_key = 'fail'
- ksft_flush_defer() + try: + ksft_flush_defer() + except BaseException as e: + stop |= isinstance(e, KeyboardInterrupt) + # Flush was interrupted, try to finish the job best we can + ksft_flush_defer()
if not cnt_key: cnt_key = 'pass' if KSFT_RESULT else 'fail'