Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp18972979rwd; Wed, 28 Jun 2023 03:20:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5mxd/wQ6eNnk7KKunnCAenkTCUrFHb8ZvYKpiXiQdKt5QI8LtnPVqTN2r+3bOHMydgEmWm X-Received: by 2002:a17:903:2281:b0:1b8:3590:358a with SMTP id b1-20020a170903228100b001b83590358amr2121094plh.19.1687947650648; Wed, 28 Jun 2023 03:20:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687947650; cv=none; d=google.com; s=arc-20160816; b=uJOw2R70TUUZcJ1a8bVQzTVf4OlRFHD6f5Vfk9p0D4EYQ0bRRwOi0eQ4p6D4qGcL66 uCzq8sC1d8R8juzwrrk3FUGgk859NQ1hxUF6yZMmQzna5OCE/t+6FhSaGY3XVC4L1KT9 NylamseZoMsuyVm4DQydWassrlwXIZqr7IAFoXkdW+sOKnxTfPkswlA8+Hu0JX7i9ObE t5tWnqS8pJr7gtOo0lolhnKeNhPim8efc1IK1jfEJJpeDRLKQtUQ5fvoSlFrNg+Gz3Ta 0Mg03W20ydnDAyvFLOrQKZ6/GVXAuIsNb1S70UEAZhOTDIGEFiknFnWB2f0HsI8Mbvvm D24A== 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:date:subject:cc:to:from:dkim-signature; bh=+9kVjURCHFrdWMia37Js/lqdKw/zow8aqFX1OIVKzKA=; fh=GTRzeVWDRAj2xnIRwh9JLxYvhtxkLedsxZDUCeyiTZM=; b=EpXsNrrj0Ak0MyZuU2yaYzPP4Sz12GrS/LWvoAHSCP5T1slk+JDXSZZEAIWINDSDSO 4e9piW+RQcX3y6RloDGBjFdtS6cbwkH4jWFCZ3wHypL4YOjTRHgwQdo64Go2csp9U0Hv 6rRGtK8PPRRBeKZ/CNDxIY/J8yMNq1wwRAPAeteK7n0FxfYcgOVSZc+kh9fYWBRXLATn T1Fz7sh5hoMMck63QMKsTVNbYw2d7KdNz6xZqbFvp1lvUt9IkOvSLZhZdmMtzFwseybW Onk+p7B2xKCFx0vSCWBzixq6Yg3EtKSfOAAyTuv/thiUi/1zaG6uuPg+L6tcyzHI6izo csJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f+0sJIxI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o6-20020a170902778600b001b042e93c11si8348575pll.262.2023.06.28.03.20.38; Wed, 28 Jun 2023 03:20:50 -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=@kernel.org header.s=k20201202 header.b=f+0sJIxI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234370AbjF1J5r (ORCPT + 99 others); Wed, 28 Jun 2023 05:57:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233512AbjF1Jy1 (ORCPT ); Wed, 28 Jun 2023 05:54:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 941DC30FC; Wed, 28 Jun 2023 02:49:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 246EE61260; Wed, 28 Jun 2023 09:49:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7838BC433C0; Wed, 28 Jun 2023 09:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687945792; bh=rQo+ivr1Jk6fLZn+NaRy01I9YN0NbBC+DKUTXazksTM=; h=From:To:Cc:Subject:Date:From; b=f+0sJIxIinYqm1D3xPb+WilOJAfna6B8zybTiF74kKZTT5Pgszfx3sVzUtxjl9PQW a1dVvDHbOipjBf7ktFnDjAyxjI3e8Gn01OwfBu3S61V/MlqeQfBpKyTyzI5XkvLggg nAnZr6J4bU6PIQ13rsscic0Q4RTDF2rq6R8/KwYHYqPHgJUkOFJ/x8S3BCJ0sxxal1 5LLku+cMm6zV8wXuIO/5cym+y03rplp+d8FYpcHV4QwDlD6FMHf3gvPhpRbSRHBgvY ryjTzj9lfAzZ6NbkI/Yd884E9FOkI91GTF4EDlWts1vnk1r0TOGaXN3AMMuNooL0zV wCB3QXsHF4ykw== From: Arnd Bergmann To: "David S. Miller" , Kees Cook , Mark Rutland , "Peter Zijlstra (Intel)" Cc: Arnd Bergmann , Guenter Roeck , Geert Uytterhoeven , Ingo Molnar , Andi Shyti , Andrzej Hajda , Palmer Dabbelt , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] sparc: mark __arch_xchg() as __always_inline Date: Wed, 28 Jun 2023 11:49:18 +0200 Message-Id: <20230628094938.2318171-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 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 --- 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