Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Sep 2020 09:14:08 -0500
From:      Kyle Evans <kevans@freebsd.org>
To:        Mark Murray <markm@freebsd.org>
Cc:        Eric McCorkle <eric@metricspace.net>,  "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>, freebsd-current <freebsd-current@freebsd.org>
Subject:   Re: Problem with zfs.ko: lockstat_enabled symbol
Message-ID:  <CACNAnaG2B0X2gM6hP2dT6skchHqS973bhwQf2K6uak2yDFG17g@mail.gmail.com>
In-Reply-To: <C0FB67C6-0712-4285-806C-C51B614F96B5@FreeBSD.org>
References:  <4140b983-3d61-e1a4-dd7f-90bce61c45cf@metricspace.net> <C0FB67C6-0712-4285-806C-C51B614F96B5@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Sep 12, 2020 at 7:55 AM Mark Murray <markm@freebsd.org> wrote:
>
> On 12 Sep 2020, at 12:18, Eric McCorkle <eric@metricspace.net> wrote:
> >
> > I recently updated my other laptop, and now I'm getting a problem
> > loading zfs.ko at boot, relating to the lockstat_enabled symbol not
> > being defined (this happens during kernel boot and prevents mounting
> > root, so I can't get an exact trace)
> >
> > Looking at the new kernel, it seems that only zfs.ko contains the symbol
> > lockstat_enabled (notably, kernel does not).  In my old kernel, zfs.ko
> > does not contain a reference to that symbol.
> >
> > Has anyone else seen this?  Is there a workaround, or was this a one-off
> > bug?
>
> I had this, and I fixed it by adding
>
> options ZFS
>
> ... to my kernel config.
>
> I found this in a nearby NOTES file; perhaps it should be in GENERIC?
>

This looks like a header bug, and the above fixes it by just compiling
in ZFS so that the undefined symbol is not an issue. See the below
patch, which moves the extern declaration of lockstat_enabled under
KDTRACE_HOOKS (you must be missing this option). I haven't even build
tested:

diff --git a/sys/sys/lockstat.h b/sys/sys/lockstat.h
index 6a5f79a2f15..d42026f9b2d 100644
--- a/sys/sys/lockstat.h
+++ b/sys/sys/lockstat.h
@@ -77,10 +77,10 @@ SDT_PROBE_DECLARE(lockstat, , , thread__spin);
 #define        LOCKSTAT_WRITER         0
 #define        LOCKSTAT_READER         1

-extern volatile bool lockstat_enabled;
-
 #ifdef KDTRACE_HOOKS

+extern volatile bool lockstat_enabled;
+
 #define        LOCKSTAT_RECORD0(probe, lp)
                \
        SDT_PROBE1(lockstat, , , probe, lp)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaG2B0X2gM6hP2dT6skchHqS973bhwQf2K6uak2yDFG17g>