Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp109335iof; Sun, 5 Jun 2022 22:40:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPyg+17TAwcBEyYsrKUBGSvTsPgaTHV3QhR1I4tbAdbAoGycRjHE0HlJ7fl5pNfmgTXFCl X-Received: by 2002:a17:90a:6b45:b0:1e3:3cfa:3104 with SMTP id x5-20020a17090a6b4500b001e33cfa3104mr34619029pjl.113.1654494007553; Sun, 05 Jun 2022 22:40:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654494007; cv=none; d=google.com; s=arc-20160816; b=KvZJI40/u9AXmhu+4zTpyRXWVSv4dsHqV7ZDYpIHJzlMhukV4YQ9yEpfHxXcXS3bhQ isQHrt/S+M/+AYSqgZxDz2scNbmWka2PIQWrGtmTUZPLIO9jRrLN+l3pifFYr0i2R6i3 PXbBUpu2GOhP9E3er8fEUYn28xduDZhVt+n19n+hM259Ca9VsS7kUGAkszG/9/xNEKhs 53nPCEbCA0K5crbF8LuSNRue8k91LZhve+uk52Zv4XGKUuI5+I6GOQvwnkNRwbrCggH2 Mf3B5KvZBpIDJGu30LBUfaJmPU7V/cGIKhBJc0qjJfhmqT5EXDjHZbP1GTfdl/vF1PyD /MeQ== 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-transfer-encoding :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=Yq6688MzfYMkMqBbPMk0NO3LPKVtabPEPwDovUjzmGg=; b=A1+Kz3bekNV6YELdQ3fXMG6UOebBa2YD7VYaO9f3Y6X5iJ0CJp/tqtbda25w0QZCv+ Dnb95LC0TFvKHtvq4M14a97axG6myb+Z9HklLyzji6fNM8dYQh1WZvnWeVGd14UKaJ5E 14hm8uRyQEtGKgqr+Ar4JtL8wcFFGN7QakjdAn85eKkb55buJy9voBUVjYstFLr9Z1mP gkUi5HyQd8wDocDQQr9ZIYFh7/Ey5WJ2CsAVaxycrvb6lQ7g6Yu81Xy4ahoifb5ku+M3 5whR/u7ugDe/cJoYo80AIPp+Z1xqeDWqcVIqcb4v22clcHCJEYJXo8mTl69RsW4C5svS 9d8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BC1wbJ2w; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ge7-20020a17090b0e0700b001e31c6b733csi18032181pjb.19.2022.06.05.22.40.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 22:40:07 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BC1wbJ2w; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 907A22DF31C; Sun, 5 Jun 2022 21:45:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346781AbiFET6d (ORCPT + 99 others); Sun, 5 Jun 2022 15:58:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344478AbiFET6b (ORCPT ); Sun, 5 Jun 2022 15:58:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 694C449687; Sun, 5 Jun 2022 12:58:28 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id EA1ECB80DAE; Sun, 5 Jun 2022 19:58:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0F14C385A5; Sun, 5 Jun 2022 19:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654459105; bh=66jU7St7J/rQkWEC+xtYa4b2N3D8EzKe3flOReZVLn8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=BC1wbJ2wvSSXy/eC676d4HdHWx8nmKxbPExDrb/vQHSVp5GJTaUAxDCb8lovxEAP4 vU/JiuaF6m6cBrqgFMdmwR0c7XIjsMrG/xHYLa5GEoZ3FddCusZpuKfv/xPo7aMvc1 IZ5LmWcU5+dAy+iQFeDzVLP7heYTnBy4vOPNcErbj5X0SVS5lKT4hM3N7PNATvbVDX aXUN1q0r7d7wVNgpQ+QtOKCdhKOiDp3MBCWfoByYjQ0RN7LVjgYhyVYLcDUoISgyCi Pgf/ikulSSl95wy7PNnvyyvIvA8CStcsjOg2dkgo8gQf8wDA5mcuwcao87jfx/5YxQ sJAkZb5FRBJCQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 3B5FC5C0514; Sun, 5 Jun 2022 12:58:25 -0700 (PDT) Date: Sun, 5 Jun 2022 12:58:25 -0700 From: "Paul E. McKenney" To: Luc Van Oostenryck Cc: Arnd Bergmann , Andrew Morton , linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot , Toke =?iso-8859-1?Q?H=F8iland-J=F8rgensen?= Subject: Re: [PATCH] ia64: fix sparse warnings with cmpxchg() & xchg() Message-ID: <20220605195825.GW1790663@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <87h7547k8c.fsf@toke.dk> <20220605160738.79736-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220605160738.79736-1-luc.vanoostenryck@gmail.com> X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 05, 2022 at 06:07:38PM +0200, Luc Van Oostenryck wrote: > On IA64, new sparse's warnings where issued after fixing > some __rcu annotations in kernel/bpf/. > > These new warnings are false positives and appear on IA64 because > on this architecture, the macros for cmpxchg() and xchg() make > casts that ignore sparse annotations. > > This patch contains the minimal patch to fix this issue: > adding a missing cast and some missing '__force'. > > Link: https://lore.kernel.org/r/20220601120013.bq5a3ynbkc3hngm5@mail > Reported-by: kernel test robot > Cc: Toke H?iland-J?rgensen > Signed-off-by: Luc Van Oostenryck Looks good to me! Acked-by: Paul E. McKenney > --- > > Note: This patch is only compile tested on defconfig. The corresponding > binary is unchanged (except some .rodata with the kernel version) > as it should be. > > arch/ia64/include/uapi/asm/cmpxchg.h | 28 ++++++++++++++-------------- > 1 file changed, 14 insertions(+), 14 deletions(-) > > diff --git a/arch/ia64/include/uapi/asm/cmpxchg.h b/arch/ia64/include/uapi/asm/cmpxchg.h > index 2c2f3cfeaa77..ca2e02685343 100644 > --- a/arch/ia64/include/uapi/asm/cmpxchg.h > +++ b/arch/ia64/include/uapi/asm/cmpxchg.h > @@ -33,24 +33,24 @@ extern void ia64_xchg_called_with_bad_pointer(void); > \ > switch (size) { \ > case 1: \ > - __xchg_result = ia64_xchg1((__u8 *)ptr, x); \ > + __xchg_result = ia64_xchg1((__u8 __force *)ptr, x); \ > break; \ > \ > case 2: \ > - __xchg_result = ia64_xchg2((__u16 *)ptr, x); \ > + __xchg_result = ia64_xchg2((__u16 __force *)ptr, x); \ > break; \ > \ > case 4: \ > - __xchg_result = ia64_xchg4((__u32 *)ptr, x); \ > + __xchg_result = ia64_xchg4((__u32 __force *)ptr, x); \ > break; \ > \ > case 8: \ > - __xchg_result = ia64_xchg8((__u64 *)ptr, x); \ > + __xchg_result = ia64_xchg8((__u64 __force *)ptr, x); \ > break; \ > default: \ > ia64_xchg_called_with_bad_pointer(); \ > } \ > - __xchg_result; \ > + (__typeof__ (*(ptr)) __force) __xchg_result; \ > }) > > #ifndef __KERNEL__ > @@ -76,42 +76,42 @@ extern long ia64_cmpxchg_called_with_bad_pointer(void); > \ > switch (size) { \ > case 1: \ > - _o_ = (__u8) (long) (old); \ > + _o_ = (__u8) (long __force) (old); \ > break; \ > case 2: \ > - _o_ = (__u16) (long) (old); \ > + _o_ = (__u16) (long __force) (old); \ > break; \ > case 4: \ > - _o_ = (__u32) (long) (old); \ > + _o_ = (__u32) (long __force) (old); \ > break; \ > case 8: \ > - _o_ = (__u64) (long) (old); \ > + _o_ = (__u64) (long __force) (old); \ > break; \ > default: \ > break; \ > } \ > switch (size) { \ > case 1: \ > - _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \ > + _r_ = ia64_cmpxchg1_##sem((__u8 __force *) ptr, new, _o_); \ > break; \ > \ > case 2: \ > - _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \ > + _r_ = ia64_cmpxchg2_##sem((__u16 __force *) ptr, new, _o_); \ > break; \ > \ > case 4: \ > - _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \ > + _r_ = ia64_cmpxchg4_##sem((__u32 __force *) ptr, new, _o_); \ > break; \ > \ > case 8: \ > - _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \ > + _r_ = ia64_cmpxchg8_##sem((__u64 __force *) ptr, new, _o_); \ > break; \ > \ > default: \ > _r_ = ia64_cmpxchg_called_with_bad_pointer(); \ > break; \ > } \ > - (__typeof__(old)) _r_; \ > + (__typeof__(old) __force) _r_; \ > }) > > #define cmpxchg_acq(ptr, o, n) \ > -- > 2.36.1 >