Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3983028pxb; Tue, 25 Jan 2022 00:38:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRUlTAl3qTXVsxrWDgyQMm/vOKekAdQokL+wFsRHvSpuNNRPNGNX0EqbjAL9x5CCpJFHv0 X-Received: by 2002:a17:907:6eac:: with SMTP id sh44mr15702835ejc.179.1643099904639; Tue, 25 Jan 2022 00:38:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099904; cv=none; d=google.com; s=arc-20160816; b=gyuaeT3eLo4B7pCzPpLrJkYuvMNXDJe7uO6e1pczEwuEe8UcKAFkLhtxSa7e6XE5sZ FAx4aeN9qOVocxAjq8gqFqiboc8FT4ZS1c4HQdxqNUCTIEULYysfUvSKyu7vjUDTLFPC Q01rjAt44RYIJez6Ya2TxabA14UDvaYj6IdXDUzqyzvKjHI8VoUQ+nw2w3hijBjrL9JT HvshAJl6u6FgcWaN/QY5HJm26DkJKq3CZJbHE6UQe2J62mUMWQusU9hviL3UIGWjITq5 rqcEwU+3jA7Qp0DG62BtJZR2hwrAHXtu7bfP234b8JHO5ANn5iUQdX6F5wi3qZe90z5o oNgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=VZaPHXcs4AKK5BLpVfYz4NzfEAov84KWj5W0WyXbiq0=; b=fIp0+2FLR0qeLUSFb0WF24w4g+VpS3+PzENwWMrRVFs919Dltm4qWvWboZ7CoccDUk 7HDh++JMB0ADk0hfsNuHIBv35jRsIWCXuwZi87KWdlDlprPQnNR1Dcmr+kAX/lW9CKZL uXAY9HzFO/XQpQGrKFULn1lvGIIWH3IWcB6MGWEzMnhBZTlXqDXbf/RLWIoDXdIJQznI h+vsNxN14JjINWsWg9M6QAQoZErD4FVhgPoe/P07h2pVLm1LdVqYGsSF9bvDGyLms0+u 70R2N5EeYCKFdNs+K8sL4QHX2vZQxnbroTosjQL4gXVGIN043USddjwDf2TOEoyY51L2 Axkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BB8Mpx1L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s7si8861902ejm.351.2022.01.25.00.37.59; Tue, 25 Jan 2022 00:38:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BB8Mpx1L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315780AbiAYCyS (ORCPT + 99 others); Mon, 24 Jan 2022 21:54:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S3408501AbiAYAWz (ORCPT ); Mon, 24 Jan 2022 19:22:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 352DBC036BE4; Mon, 24 Jan 2022 14:06:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C2767615CF; Mon, 24 Jan 2022 22:06:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ACCBC340F8; Mon, 24 Jan 2022 22:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643061989; bh=s0Q2iLX9dyK6zBfXvE6AmOg6Y4MPmiUDjoi2MZ8nbRI=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=BB8Mpx1LnwvDuTkbA0cXddeZ/rQmtoz8pUu0UU6grzafB6tLVMViJeDK0RQZji0pa ALjXmDrGSFz3XxbxVxzAwQI37Jrd1WyjAs4m0uinFAz/wQMNAGxQ+XlElHAM7N9Z2O CNuHrOf/n3Osqripl7Pwbn+uu34DRbgdl8p2qx+km9d9A51sLduueP3C2eCmviHrQM kWhX/ZhSpD9LMiR/NvcdNf5eocL/fFS9RK/MFN7rIxhtS4ddTPaXsHQfQq7uGT86Nf TVaZfoKOH0mQklFjLmq4GHpu0BEGXBmTNPAQqUG/7IbD9zXl2timujV65yhcCpbQFr HTcL+lDGlz7Yg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id DDF295C0FCD; Mon, 24 Jan 2022 14:06:28 -0800 (PST) Date: Mon, 24 Jan 2022 14:06:28 -0800 From: "Paul E. McKenney" To: Alexander Aring Cc: Dan Carpenter , Randy Dunlap , kernel test robot , kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, David Teigland , cluster-devel , linux-sparse@vger.kernel.org, rcu@vger.kernel.org Subject: Re: fs/dlm/midcomms.c:913:22: sparse: sparse: restricted __le32 degrades to integer Message-ID: <20220124220628.GL4285@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <202201221028.YKA8kSdm-lkp@intel.com> <91901e7b-7d82-116c-aaf2-c74c6a6b999c@infradead.org> <20220124124530.GS1951@kadam> <20220124201417.GI4285@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 24, 2022 at 04:36:55PM -0500, Alexander Aring wrote: > Hi, > > On Mon, Jan 24, 2022 at 3:23 PM Paul E. McKenney wrote: > > > > On Mon, Jan 24, 2022 at 12:41:04PM -0500, Alexander Aring wrote: > > > Hi, > > > > > > On Mon, Jan 24, 2022 at 12:36 PM Alexander Aring wrote: > > > > > > > > Hi, > > > > > > > > On Mon, Jan 24, 2022 at 12:21 PM Alexander Aring wrote: > > > > > > > > > > Hi, > > > > > > > > > > On Mon, Jan 24, 2022 at 7:46 AM Dan Carpenter wrote: > > > > > > > > > > > > On Sun, Jan 23, 2022 at 01:41:52PM -0500, Alexander Aring wrote: > > > > > > > > > > > > > > I see also: > > > > > > > > > > > > > > fs/dlm/midcomms.c:213:1: sparse: sparse: symbol > > > > > > > '__srcu_struct_nodes_srcu' was not declared. Should it be static? > > > > > > > > > > > > > > > > > > > Why not just do this? (Untested. Maybe I don't understand?) > > > > > > > > > > > > diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h > > > > > > index cb1f4351e8ba..a164089abec4 100644 > > > > > > --- a/include/linux/srcutree.h > > > > > > +++ b/include/linux/srcutree.h > > > > > > @@ -121,7 +121,7 @@ struct srcu_struct { > > > > > > #ifdef MODULE > > > > > > # define __DEFINE_SRCU(name, is_static) \ > > > > > > is_static struct srcu_struct name; \ > > > > > > - struct srcu_struct * const __srcu_struct_##name \ > > > > > > + is_static struct srcu_struct * const __srcu_struct_##name \ > > > > > > __section("___srcu_struct_ptrs") = &name > > > > > > #else > > > > > > # define __DEFINE_SRCU(name, is_static) \ > > > > > > > > > > > > > > > > I tried it and yes it will fix the issue and introduce another one > > > > > about "is_static struct srcu_struct * const __srcu_struct_##name" is > > > > > unused ("-Wunused-const-variable"). > > > > > I added a __maybe_unused after the introduced is_static and it seems > > > > > to fix the introduced issue, now it compiles and sparse is happy. I am > > > > > not sure if this is the right fix? > > > > > > > > it is obviously unused, but it has something to do with > > > > "__section("___srcu_struct_ptrs")" and during module loading it, I > > > > suppose, srcu tries to access it to find whatever needs to be > > > > registered? > > > > > > Sorry, but if this is true then it can't be declared as static... and > > > we are at the beginning again. > > > > Welcome to my world!!! ;-) > > > > More seriously, thank you for chasing this down. But would it work to > > add a declaration just before? > > > > only if I add an "extern" in front of the declaration before, so it looks like: > > extern struct srcu_struct * const __srcu_struct_##name; > > (compile and sparse tested only) If that works for everyone, it seems worth persuing. One way to test this is as follows: 1. Build a kernel with CONFIG_RCU_TORTURE_TEST=m. Boot this and type "modprobe rcutorture torture_type=srcu". If you want to stop the torture test, type "rmmod rcutorture". This will test DEFINE_SRCU() for the module case. 2. At the top-level directory of your Linux-kernel source tree, type "tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 3 --configs 'SRCU-N' --trust-make" This will test DEFINE_SRCU() for the non-module case. If those both work, and if there are no other objections or complications, please do send a patch. Thanx, Paul