From owner-freebsd-hackers@freebsd.org Sat Sep 12 14:14:20 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86CE33D919B; Sat, 12 Sep 2020 14:14:20 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BpZPS30b7z42cL; Sat, 12 Sep 2020 14:14:20 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 458C32F638; Sat, 12 Sep 2020 14:14:20 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f170.google.com with SMTP id g72so12736112qke.8; Sat, 12 Sep 2020 07:14:20 -0700 (PDT) X-Gm-Message-State: AOAM531Z/S2BAMcW+NCTDC3ebMxFo4jrtxuK+4uApD1th07Bf3zrS3o9 EZPXaRuRlZfSzZZe6nDh2Npp7j0qo96FGKU554k= X-Google-Smtp-Source: ABdhPJz7/6ss2U3SXKMHuSLRVmZBsCxOIIOY+iqQsDTxSBU2y368264Ln/zjfNPu2bpkqlU+YFICAqelP4bwz550B6I= X-Received: by 2002:a37:a189:: with SMTP id k131mr5687453qke.34.1599920059797; Sat, 12 Sep 2020 07:14:19 -0700 (PDT) MIME-Version: 1.0 References: <4140b983-3d61-e1a4-dd7f-90bce61c45cf@metricspace.net> In-Reply-To: From: Kyle Evans Date: Sat, 12 Sep 2020 09:14:08 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Problem with zfs.ko: lockstat_enabled symbol To: Mark Murray Cc: Eric McCorkle , "freebsd-hackers@freebsd.org" , freebsd-current Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2020 14:14:20 -0000 On Sat, Sep 12, 2020 at 7:55 AM Mark Murray wrote: > > On 12 Sep 2020, at 12:18, Eric McCorkle 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)