Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1173652rwp; Thu, 13 Jul 2023 07:13:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlG47an+5lNh2QMjXbT5z+2rfVtuXrXvfj/9I1DYJyoL/BfT0lEmfGL3THgo8YfIGNRwLeqH X-Received: by 2002:a17:906:208d:b0:983:cb6c:8aa3 with SMTP id 13-20020a170906208d00b00983cb6c8aa3mr1545265ejq.59.1689257587492; Thu, 13 Jul 2023 07:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689257587; cv=none; d=google.com; s=arc-20160816; b=xyIgCkXtgGkKUlh5X5M4CJrQkKp/nNeESzmN8+VJIIPjcRBokBjIZrM7dTWp3Eaaa2 1M/17T9NM31+6OqwhhbbvYUBVDP0YWo05Oq6IN58dlNFUNot8lcsZxE8Ad1OXV++XJrW VP01fE9S77x6vzGFQIW6vNGJUhEpGuri4gM6y1TJ7evUpk5Z/NQW/kE0whqGsixIU6qc Ljv4iY4bMWQ1atcUSZxsRdQcY2ITIMCGevRHbRk8hYx1inhG3rf3nF9+Oh1XfCLTS8Q4 jEa4kKqG9k1foXQvvRM73aHY0Hl356TJ6pEPa2q8EZp2R7QrjHdn45L2nn4iUxodcNQT u0gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=KxdXHhZkRJEwrXWIjK24zGSqZZm5q31b08WQriCK7TE=; fh=ZKehgUBdjD9L1smPM/16P4b2hHuyqppG+2v6zAMMLik=; b=GOtYCpNRwGMnAxSyhL0rsDBeyKYEWn6odyhzPPKNk/ABKlAsRya8hmMJrE0KK+Ihyz xrTMRLYz2APY69iDyey8kntEKGFW8/mrnbZ97FqcY6JvUaQzAM7LCG87KoxSBpXgqQxX h7yYTf048ZBi8Bcu1bdURy3Q9FXUpu9zaYZv7q4aWmcfKh36qrxTwj1AdGDkJ+VRJMdp IfRwAuAqnEs3LLBIUx6piY92Hcb++gXVLFEkGnT+ZaoeVvANh++V4qLTrjOy3W+Jxzs2 IlToYi79RBiAybpiai6L87peRSRB3zWpB5njFHlkszLAbBnaQT+Ri2/GzO4szDbx6EpV IG9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=Eh24wZck; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id uz12-20020a170907118c00b00989a806b3fasi7601758ejb.1031.2023.07.13.07.12.43; Thu, 13 Jul 2023 07:13:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=Eh24wZck; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232007AbjGMOAn (ORCPT + 99 others); Thu, 13 Jul 2023 10:00:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232012AbjGMOAk (ORCPT ); Thu, 13 Jul 2023 10:00:40 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5D921995 for ; Thu, 13 Jul 2023 07:00:38 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1b9ecf0cb4cso4417015ad.2 for ; Thu, 13 Jul 2023 07:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1689256838; x=1691848838; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=KxdXHhZkRJEwrXWIjK24zGSqZZm5q31b08WQriCK7TE=; b=Eh24wZckl+J5lQ354MGGwh6dIpIuG9CT5Ug1406jQ0tiXocc5dFbfpMlfLPk82RpQ+ vRocFCfYe2tvzhHRRZuF4qSZkVVfboyg5RiWAERmb0tWHUSDeOdYaeK41h47B9JY2uoi 2V1iv9jXaJ59lc2nU9cAyo5II6vdTdWw/gZJtkzLM+jeWGqzXABJam44+vUtkJ4oAZHc LSu1bbt96KB7x0/6DZVSFgQntmO4q8n4meF4w7iBhlIceR6jaLPW48c741ICBAhw/JsW 3yMQr5gO/g0JUJAe8dKBtog0FT1agnniy+2M/qQr+LICCB4iIvDvhYS/VrFbz0yYsIG2 0PEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689256838; x=1691848838; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KxdXHhZkRJEwrXWIjK24zGSqZZm5q31b08WQriCK7TE=; b=IAobQP9zoav73WhzXSOq3r68v0Pvo0OJ3fOR3a3OXN3/Tg4TbGLPVbN339w6eIfuDf TCXoA7Ek4aKO25QetRVMHRAD4hzBNaBYapBaVY3odhlu6doLTfSY7AJ/Mfu7GE1qNFo8 dz3H3RlREo8kqFsnJ0AQeVBZqKLPg0o5C+Nv9Cy91Lo6pudNS7KbhPUsw+faerZgac0e fvOYKeZooioEhtyM0W0uNIJFnadEaMeQiwz+xA8h4JXKjNdmpINv7lJ2RhUaoWxGB7bT SYq1FxtoRKr6Xe4KEU6ylsZRB6e8UMMhay+031cz+l+t63DvfT1CqKx1lrxZD0HOQ76Z pHWg== X-Gm-Message-State: ABy/qLaKxgwzRfOgPshYrtxrRv8WD2qkBRAfhP87F8T/+zK61V8Xwiuu Sx38DM3SHLObGuENpWlP0Idwyw== X-Received: by 2002:a17:903:228b:b0:1b8:a70d:412a with SMTP id b11-20020a170903228b00b001b8a70d412amr1104745plh.67.1689256838037; Thu, 13 Jul 2023 07:00:38 -0700 (PDT) Received: from localhost ([50.38.6.230]) by smtp.gmail.com with ESMTPSA id ij15-20020a170902ab4f00b001b8ad8382a4sm6044735plb.216.2023.07.13.07.00.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 07:00:37 -0700 (PDT) Date: Thu, 13 Jul 2023 07:00:37 -0700 (PDT) X-Google-Original-Date: Thu, 13 Jul 2023 06:59:52 PDT (-0700) Subject: Re: [PATCH] sparc: mark __arch_xchg() as __always_inline In-Reply-To: CC: arnd@kernel.org, davem@davemloft.net, keescook@chromium.org, peterz@infradead.org, Arnd Bergmann , linux@roeck-us.net, geert@linux-m68k.org, mingo@kernel.org, andi.shyti@linux.intel.com, andrzej.hajda@intel.com, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org From: Palmer Dabbelt To: Mark Rutland Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Wed, 28 Jun 2023 04:45:43 PDT (-0700), Mark Rutland wrote: > On Wed, Jun 28, 2023 at 11:49:18AM +0200, Arnd Bergmann wrote: >> From: Arnd Bergmann >> >> An otherwise correct change to the atomic operations uncovered an >> existing bug in the sparc __arch_xchg() function, which is calls >> __xchg_called_with_bad_pointer() when its arguments are unknown at >> compile time: >> >> ERROR: modpost: "__xchg_called_with_bad_pointer" [lib/atomic64_test.ko] undefined! >> >> This now happens because gcc determines that it's better to not inline the >> function. Avoid this by just marking the function as __always_inline >> to force the compiler to do the right thing here. >> >> Reported-by: Guenter Roeck >> Link: https://lore.kernel.org/all/c525adc9-6623-4660-8718-e0c9311563b8@roeck-us.net/ >> Fixes: d12157efc8e08 ("locking/atomic: make atomic*_{cmp,}xchg optional") >> Signed-off-by: Arnd Bergmann > > Aha; you saved me writing a patch! :) > > We should probably do likewise for all the other bits like __cmpxchg(), but > either way: > > Acked-by: Mark Rutland Acked-by: Palmer Dabbelt Though I'm not sure that means a whole lot over here ;) > Mark. > >> --- >> arch/sparc/include/asm/cmpxchg_32.h | 2 +- >> arch/sparc/include/asm/cmpxchg_64.h | 2 +- >> 2 files changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h >> index 7a1339533d1d7..d0af82c240b73 100644 >> --- a/arch/sparc/include/asm/cmpxchg_32.h >> +++ b/arch/sparc/include/asm/cmpxchg_32.h >> @@ -15,7 +15,7 @@ >> unsigned long __xchg_u32(volatile u32 *m, u32 new); >> void __xchg_called_with_bad_pointer(void); >> >> -static inline unsigned long __arch_xchg(unsigned long x, __volatile__ void * ptr, int size) >> +static __always_inline unsigned long __arch_xchg(unsigned long x, __volatile__ void * ptr, int size) >> { >> switch (size) { >> case 4: >> diff --git a/arch/sparc/include/asm/cmpxchg_64.h b/arch/sparc/include/asm/cmpxchg_64.h >> index 66cd61dde9ec1..3de25262c4118 100644 >> --- a/arch/sparc/include/asm/cmpxchg_64.h >> +++ b/arch/sparc/include/asm/cmpxchg_64.h >> @@ -87,7 +87,7 @@ xchg16(__volatile__ unsigned short *m, unsigned short val) >> return (load32 & mask) >> bit_shift; >> } >> >> -static inline unsigned long >> +static __always_inline unsigned long >> __arch_xchg(unsigned long x, __volatile__ void * ptr, int size) >> { >> switch (size) { >> -- >> 2.39.2 >>