On Thu, 24 Mar 2022, Bjoern A. Zeeb wrote:
Hi,
On Mon, 14 Feb 2022, Mark Johnston wrote:
Hi,
sorry I had lost track ..
On Sat, Feb 12, 2022 at 12:16:45AM +0000, Bjoern A. Zeeb wrote:
On Fri, 11 Feb 2022, Mark Johnston wrote:
It appears to be sufficient to simply move the kld_load hook to before
module registration, patch below. In the case of a subsequent error,
the unload hook is called so DTrace gets a chance to clean up. I can't
see any reasons not to move it, though there's at least one non-dtrace
consumer that needs a look.
HWPMC?
Yes.
It does work for my case with -Z which will ease work massively.
I can't wait for the "morning" and more time then to look at things :-)
Please put me on subscribers should you put up a review.
So there's one wrinkle I haven't thought through: when FBT probes are
enabled in a KLD, we use the kld_unload_try eventhandler to block
unloading of the module. Now, if we permit FBT probes to be enabled in
a KLD before its sysinits run, then the kldload might fail, and the
kernel linker will try to unload the module. But then FBT will block
the unload. What's the right thing to do there?
I dunno.
I can only say that the local change has helped quite a few times in the
last month in my dev tree.
Shall we add a PR or review and track progress there with a possibly
wider audience?
I just got bitten by this again running some older scripts missing
output.
Thankfully remembered the adjustment.
Is there any way we can solve this proper?
/bz
Thanks a lot Mark and a happy weekend!
Bjoern
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 2e4c95f16c8f..55661b9f9aa2 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -452,6 +452,7 @@ linker_load_file(const char *filename, linker_file_t
*result)
if (error != ENOENT)
foundfile = 1;
if (lf) {
+ EVENTHANDLER_INVOKE(kld_load, lf);
error = linker_file_register_modules(lf);
if (error == EEXIST) {
linker_file_unload(lf, LINKER_UNLOAD_FORCE);
@@ -472,7 +473,6 @@ linker_load_file(const char *filename, linker_file_t
*result)
return (ENOEXEC);
}
linker_file_enable_sysctls(lf);
- EVENTHANDLER_INVOKE(kld_load, lf);
*result = lf;
return (0);
}
--
Bjoern A. Zeeb r15:7
--
Bjoern A. Zeeb r15:7