Message ID | 20221108060126.2505-1-guoj17@chinatelecom.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2513294wru; Mon, 7 Nov 2022 22:14:48 -0800 (PST) X-Google-Smtp-Source: AMsMyM5qLMIbZFbr+D7bjhJ5WkhBStgCHAxVZ+6jkZ9Q6Rv7slClGiFPcb7OtL8RNbTUC/9O820J X-Received: by 2002:a17:907:d10:b0:79a:a1fe:8be5 with SMTP id gn16-20020a1709070d1000b0079aa1fe8be5mr51850568ejc.125.1667888087864; Mon, 07 Nov 2022 22:14:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667888087; cv=none; d=google.com; s=arc-20160816; b=k1viC5feDpVQ31E4lZR3Mn0jUf8qtwEotYYWiu6jWg2dFAZQXuSTG4py7Uu13Vpz1A f0w8+ohvCF6hLMVtfGu84w//Qgcak62SmPHbXhE0dJBWkuMJi287zycdHFLh2FMq7FAe iBT7zlC6O5OiT5JWMkatwlaGzNMVVIjtBycHMP/v3qAXKWIACnMkhTUASZGOxWvHR/cm ZMUd/SXmR5q6I3mnzyVMeAxdlvtel1pqyJtToGrAgGDhSKfsmso3+Qz8ZRR+LAVyJePp 6ZWCJlSc98VJSteI7jC+yP6/y7TPTkP56b0qorgG7bQpD2FzJqPyreQCiEOJNZFGA7OB PLaw== 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:sender:hmm_source_type :hmm_attache_num:hmm_source_ip; bh=CP1n6jXW98rTX0mN6vyOFWqDtOhd+2ngXiBVyxfoJdM=; b=RL8Sxtdh1whMXEty2AlA5ZdzGhEuv1m6SfCONNwpcu8C7dgy8cKkvID5vLSFA3BjFx 8l2wkqj5Jf/kEg6PqLObXwC52aZMR7Tg2CxDj6wLr8LP+xp4jKRix3VlSpVrjBEXFWeZ 7k6EDhtbV2MUTnO+vzD35B6x6tOxYcN0N04Fbdcenr3F/FWGyfjA5dn4xC6TrEJCl3ry r0ekcGNJHqJ5Dr8QJ6/qoBwhn4hhGqHG1VcP/Z7uTiBx8Z3E7CWNXXxBNObbNZ6omAlT UR/6Gdnm+6oRdf6O2t6JzfV+81WgKe6WZ6oTJYUrZRMydfZHksWmV0gFBVMKOgpOzWdz nfpQ== ARC-Authentication-Results: i=1; mx.google.com; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa12-20020a170907868c00b0079194d8b1f6si12908805ejc.892.2022.11.07.22.14.22; Mon, 07 Nov 2022 22:14:47 -0800 (PST) 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; 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 S233095AbiKHGCv (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Tue, 8 Nov 2022 01:02:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232411AbiKHGCs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 8 Nov 2022 01:02:48 -0500 Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.220]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CBCCB317CA for <linux-kernel@vger.kernel.org>; Mon, 7 Nov 2022 22:02:45 -0800 (PST) HMM_SOURCE_IP: 172.18.0.48:45518.1913755082 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-10.133.8.199 (unknown [172.18.0.48]) by chinatelecom.cn (HERMES) with SMTP id 01E5B28009C; Tue, 8 Nov 2022 14:02:21 +0800 (CST) X-189-SAVE-TO-SEND: +guoj17@chinatelecom.cn Received: from ([10.133.8.199]) by app0024 with ESMTP id 014bcb9567d94db7a99521152a8399a7 for peterz@infradead.org; Tue, 08 Nov 2022 14:02:41 CST X-Transaction-ID: 014bcb9567d94db7a99521152a8399a7 X-Real-From: guoj17@chinatelecom.cn X-Receive-IP: 10.133.8.199 X-MEDUSA-Status: 0 Sender: guoj17@chinatelecom.cn From: guoj17@chinatelecom.cn To: peterz@infradead.org, mingo@redhat.com, will@kernel.org, tglx@linutronix.de, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org Cc: longman@redhat.com, boqun.feng@gmail.com, linux-kernel@vger.kernel.org, hpa@zytor.com, nathan@kernel.org, ndesaulniers@google.com, trix@redhat.com, llvm@lists.linux.dev, huyd12@chinatelecom.cn, Guo Jin <guoj17@chinatelecom.cn> Subject: [PATCH] locking: fix kernel/locking/ inline asm error Date: Tue, 8 Nov 2022 14:01:26 +0800 Message-Id: <20221108060126.2505-1-guoj17@chinatelecom.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748907419786943472?= X-GMAIL-MSGID: =?utf-8?q?1748907419786943472?= |
Series |
locking: fix kernel/locking/ inline asm error
|
|
Commit Message
guoj17@chinatelecom.cn
Nov. 8, 2022, 6:01 a.m. UTC
From: Guo Jin <guoj17@chinatelecom.cn> When compiling linux 6.1.0-rc3 configured with CONFIG_64BIT=y and CONFIG_PARAVIRT_SPINLOCKS=y on x86_64 using LLVM 11.0, an error: "<inline asm> error: changed section flags for .spinlock.text, expected:: 0x6" occurred. The reason is the .spinlock.text in kernel/locking/qspinlock.o is used many times, but its flags are omitted in subsequent use. LLVM 11.0 assembler didn't permit to leave out flags in subsequent uses of the same sections. So this patch adds the corresponding flags to avoid above error. Signed-off-by: Guo Jin <guoj17@chinatelecom.cn> --- arch/x86/include/asm/qspinlock_paravirt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Nov 08, 2022 at 02:01:26PM +0800, guoj17@chinatelecom.cn wrote: > From: Guo Jin <guoj17@chinatelecom.cn> > > When compiling linux 6.1.0-rc3 configured with CONFIG_64BIT=y > and CONFIG_PARAVIRT_SPINLOCKS=y on x86_64 using LLVM 11.0, > an error: "<inline asm> error: changed section flags for > .spinlock.text, expected:: 0x6" occurred. > > The reason is the .spinlock.text in kernel/locking/qspinlock.o > is used many times, but its flags are omitted in subsequent use. > > LLVM 11.0 assembler didn't permit to > leave out flags in subsequent uses of the same sections. > > So this patch adds the corresponding flags to avoid above error. > > Signed-off-by: Guo Jin <guoj17@chinatelecom.cn> Right, my reverse bisect tells me that this error was fixed by [1] in LLVM, which landed in 12.0.0 and was backported to LLVM 11.0.1 [2]. We could bump the minimum supported version of LLVM for building the kernel to 11.0.1 over this, just to avoid further issues like this down the road, as the kernel will always be adding new sections for various things. That change would not appear to be disruptive, as all the major distros either have 11.0.1 or newer or older than the current minimum of 11.0.0, so they need to get clang from elsewhere already. archlinux:latest: clang version 14.0.6 debian:oldoldstable-slim: clang version 3.8.1-24 (tags/RELEASE_381/final) debian:oldstable-slim: clang version 7.0.1-8+deb10u2 (tags/RELEASE_701/final) debian:stable-slim: Debian clang version 11.0.1-2 debian:testing-slim: Debian clang version 14.0.6-2 debian:unstable-slim: Debian clang version 14.0.6-7 fedora:35: clang version 13.0.1 (Fedora 13.0.1-1.fc35) fedora:latest: clang version 14.0.5 (Fedora 14.0.5-1.fc36) fedora:rawhide: clang version 15.0.4 (Fedora 15.0.4-1.fc38) opensuse/leap:15: clang version 13.0.1 opensuse/leap:latest: clang version 13.0.1 opensuse/tumbleweed:latest: clang version 15.0.3 ubuntu:bionic: clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) ubuntu:focal: clang version 10.0.0-4ubuntu1 ubuntu:latest: Ubuntu clang version 14.0.0-1ubuntu1 ubuntu:kinetic: Ubuntu clang version 15.0.2-1 ubuntu:rolling: Ubuntu clang version 15.0.2-1 ubuntu:devel: Ubuntu clang version 15.0.2-1 At the same time, you are clearly using LLVM 11.0.0, so I think this is a reasonable fix in the immediate term. Reviewed-by: Nathan Chancellor <nathan@kernel.org> [1]: https://github.com/llvm/llvm-project/commit/1deff4009e0ae661b03682901bf6932297ce7ea1 [2]: https://github.com/llvm/llvm-project/commit/700baa009dc685a0adc5f94d258be4ae24742471 > --- > arch/x86/include/asm/qspinlock_paravirt.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/include/asm/qspinlock_paravirt.h b/arch/x86/include/asm/qspinlock_paravirt.h > index 60ece592b220..dbb38a6b4dfb 100644 > --- a/arch/x86/include/asm/qspinlock_paravirt.h > +++ b/arch/x86/include/asm/qspinlock_paravirt.h > @@ -37,7 +37,7 @@ __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text"); > * rsi = lockval (second argument) > * rdx = internal variable (set to 0) > */ > -asm (".pushsection .spinlock.text;" > +asm (".pushsection .spinlock.text, \"ax\";" > ".globl " PV_UNLOCK ";" > ".type " PV_UNLOCK ", @function;" > ".align 4,0x90;" > -- > 2.25.1 >
Thanks your comments, And if any concern to apply it on upstream? Yadi -----邮件原件----- 发件人: nathan@kernel.org <nathan@kernel.org> 发送时间: 2022年11月9日 6:40 收件人: guoj17@chinatelecom.cn 抄送: peterz@infradead.org; mingo@redhat.com; will@kernel.org; tglx@linutronix.de; bp@alien8.de; dave.hansen@linux.intel.com; x86@kernel.org; longman@redhat.com; boqun.feng@gmail.com; linux-kernel@vger. kernel.org; hpa@zytor.com; ndesaulniers@google.com; trix@redhat.com; llvm@lists.linux.dev; huyd12@chinatelecom.cn 主题: Re: [PATCH] locking: fix kernel/locking/ inline asm error On Tue, Nov 08, 2022 at 02:01:26PM +0800, guoj17@chinatelecom.cn wrote: > From: Guo Jin <guoj17@chinatelecom.cn> > > When compiling linux 6.1.0-rc3 configured with CONFIG_64BIT=y and > CONFIG_PARAVIRT_SPINLOCKS=y on x86_64 using LLVM 11.0, an error: > "<inline asm> error: changed section flags for .spinlock.text, > expected:: 0x6" occurred. > > The reason is the .spinlock.text in kernel/locking/qspinlock.o is used > many times, but its flags are omitted in subsequent use. > > LLVM 11.0 assembler didn't permit to > leave out flags in subsequent uses of the same sections. > > So this patch adds the corresponding flags to avoid above error. > > Signed-off-by: Guo Jin <guoj17@chinatelecom.cn> Right, my reverse bisect tells me that this error was fixed by [1] in LLVM, which landed in 12.0.0 and was backported to LLVM 11.0.1 [2]. We could bump the minimum supported version of LLVM for building the kernel to 11.0.1 over this, just to avoid further issues like this down the road, as the kernel will always be adding new sections for various things. That change would not appear to be disruptive, as all the major distros either have 11.0.1 or newer or older than the current minimum of 11.0.0, so they need to get clang from elsewhere already. archlinux:latest: clang version 14.0.6 debian:oldoldstable-slim: clang version 3.8.1-24 (tags/RELEASE_381/final) debian:oldstable-slim: clang version 7.0.1-8+deb10u2 (tags/RELEASE_701/final) debian:stable-slim: Debian clang version 11.0.1-2 debian:testing-slim: Debian clang version 14.0.6-2 debian:unstable-slim: Debian clang version 14.0.6-7 fedora:35: clang version 13.0.1 (Fedora 13.0.1-1.fc35) fedora:latest: clang version 14.0.5 (Fedora 14.0.5-1.fc36) fedora:rawhide: clang version 15.0.4 (Fedora 15.0.4-1.fc38) opensuse/leap:15: clang version 13.0.1 opensuse/leap:latest: clang version 13.0.1 opensuse/tumbleweed:latest: clang version 15.0.3 ubuntu:bionic: clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) ubuntu:focal: clang version 10.0.0-4ubuntu1 ubuntu:latest: Ubuntu clang version 14.0.0-1ubuntu1 ubuntu:kinetic: Ubuntu clang version 15.0.2-1 ubuntu:rolling: Ubuntu clang version 15.0.2-1 ubuntu:devel: Ubuntu clang version 15.0.2-1 At the same time, you are clearly using LLVM 11.0.0, so I think this is a reasonable fix in the immediate term. Reviewed-by: Nathan Chancellor <nathan@kernel.org> [1]: https://github.com/llvm/llvm-project/commit/1deff4009e0ae661b03682901bf69322 97ce7ea1 [2]: https://github.com/llvm/llvm-project/commit/700baa009dc685a0adc5f94d258be4ae 24742471 > --- > arch/x86/include/asm/qspinlock_paravirt.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/include/asm/qspinlock_paravirt.h > b/arch/x86/include/asm/qspinlock_paravirt.h > index 60ece592b220..dbb38a6b4dfb 100644 > --- a/arch/x86/include/asm/qspinlock_paravirt.h > +++ b/arch/x86/include/asm/qspinlock_paravirt.h > @@ -37,7 +37,7 @@ __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text"); > * rsi = lockval (second argument) > * rdx = internal variable (set to 0) > */ > -asm (".pushsection .spinlock.text;" > +asm (".pushsection .spinlock.text, \"ax\";" > ".globl " PV_UNLOCK ";" > ".type " PV_UNLOCK ", @function;" > ".align 4,0x90;" > -- > 2.25.1 >
On Thu, Nov 10, 2022 at 06:05:13PM +0800, huyd12@chinatelecom.cn wrote: > > Thanks your comments, > And if any concern to apply it on upstream? Unfortunately, I am not the one who gets to make that decision; one of the maintainers of this file will have to pick it up, assuming they see no issue with it. Cheers, Nathan > -----邮件原件----- > 发件人: nathan@kernel.org <nathan@kernel.org> > 发送时间: 2022年11月9日 6:40 > 收件人: guoj17@chinatelecom.cn > 抄送: peterz@infradead.org; mingo@redhat.com; will@kernel.org; > tglx@linutronix.de; bp@alien8.de; dave.hansen@linux.intel.com; > x86@kernel.org; longman@redhat.com; boqun.feng@gmail.com; linux-kernel@vger. > kernel.org; hpa@zytor.com; ndesaulniers@google.com; trix@redhat.com; > llvm@lists.linux.dev; huyd12@chinatelecom.cn > 主题: Re: [PATCH] locking: fix kernel/locking/ inline asm error > > On Tue, Nov 08, 2022 at 02:01:26PM +0800, guoj17@chinatelecom.cn wrote: > > From: Guo Jin <guoj17@chinatelecom.cn> > > > > When compiling linux 6.1.0-rc3 configured with CONFIG_64BIT=y and > > CONFIG_PARAVIRT_SPINLOCKS=y on x86_64 using LLVM 11.0, an error: > > "<inline asm> error: changed section flags for .spinlock.text, > > expected:: 0x6" occurred. > > > > The reason is the .spinlock.text in kernel/locking/qspinlock.o is used > > many times, but its flags are omitted in subsequent use. > > > > LLVM 11.0 assembler didn't permit to > > leave out flags in subsequent uses of the same sections. > > > > So this patch adds the corresponding flags to avoid above error. > > > > Signed-off-by: Guo Jin <guoj17@chinatelecom.cn> > > Right, my reverse bisect tells me that this error was fixed by [1] in LLVM, > which landed in 12.0.0 and was backported to LLVM 11.0.1 [2]. > > We could bump the minimum supported version of LLVM for building the kernel > to 11.0.1 over this, just to avoid further issues like this down the road, > as the kernel will always be adding new sections for various things. That > change would not appear to be disruptive, as all the major distros either > have 11.0.1 or newer or older than the current minimum of 11.0.0, so they > need to get clang from elsewhere already. > > archlinux:latest: clang version 14.0.6 > > debian:oldoldstable-slim: clang version 3.8.1-24 (tags/RELEASE_381/final) > debian:oldstable-slim: clang version 7.0.1-8+deb10u2 > (tags/RELEASE_701/final) > debian:stable-slim: Debian clang version 11.0.1-2 > debian:testing-slim: Debian clang version 14.0.6-2 > debian:unstable-slim: Debian clang version 14.0.6-7 > > fedora:35: clang version 13.0.1 (Fedora 13.0.1-1.fc35) > fedora:latest: clang version 14.0.5 (Fedora 14.0.5-1.fc36) > fedora:rawhide: clang version 15.0.4 (Fedora 15.0.4-1.fc38) > > opensuse/leap:15: clang version 13.0.1 > opensuse/leap:latest: clang version 13.0.1 > opensuse/tumbleweed:latest: clang version 15.0.3 > > ubuntu:bionic: clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) > ubuntu:focal: clang version 10.0.0-4ubuntu1 > ubuntu:latest: Ubuntu clang version 14.0.0-1ubuntu1 > ubuntu:kinetic: Ubuntu clang version 15.0.2-1 > ubuntu:rolling: Ubuntu clang version 15.0.2-1 > ubuntu:devel: Ubuntu clang version 15.0.2-1 > > At the same time, you are clearly using LLVM 11.0.0, so I think this is a > reasonable fix in the immediate term. > > Reviewed-by: Nathan Chancellor <nathan@kernel.org> > > [1]: > https://github.com/llvm/llvm-project/commit/1deff4009e0ae661b03682901bf69322 > 97ce7ea1 > [2]: > https://github.com/llvm/llvm-project/commit/700baa009dc685a0adc5f94d258be4ae > 24742471 > > > --- > > arch/x86/include/asm/qspinlock_paravirt.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/x86/include/asm/qspinlock_paravirt.h > > b/arch/x86/include/asm/qspinlock_paravirt.h > > index 60ece592b220..dbb38a6b4dfb 100644 > > --- a/arch/x86/include/asm/qspinlock_paravirt.h > > +++ b/arch/x86/include/asm/qspinlock_paravirt.h > > @@ -37,7 +37,7 @@ > __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, > ".spinlock.text"); > > * rsi = lockval (second argument) > > * rdx = internal variable (set to 0) > > */ > > -asm (".pushsection .spinlock.text;" > > +asm (".pushsection .spinlock.text, \"ax\";" > > ".globl " PV_UNLOCK ";" > > ".type " PV_UNLOCK ", @function;" > > ".align 4,0x90;" > > -- > > 2.25.1 > > >
diff --git a/arch/x86/include/asm/qspinlock_paravirt.h b/arch/x86/include/asm/qspinlock_paravirt.h index 60ece592b220..dbb38a6b4dfb 100644 --- a/arch/x86/include/asm/qspinlock_paravirt.h +++ b/arch/x86/include/asm/qspinlock_paravirt.h @@ -37,7 +37,7 @@ __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text"); * rsi = lockval (second argument) * rdx = internal variable (set to 0) */ -asm (".pushsection .spinlock.text;" +asm (".pushsection .spinlock.text, \"ax\";" ".globl " PV_UNLOCK ";" ".type " PV_UNLOCK ", @function;" ".align 4,0x90;"