Message ID | 20231024142830.3226-1-ubizjak@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1981922vqx; Tue, 24 Oct 2023 07:29:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHRLVABVY6/HHGyKDQjqLYWn0mckFWh6IcyNefjKTqmKf91O2/ryossxqfMpA482FAaJZab X-Received: by 2002:a17:902:7487:b0:1c7:755d:ccc8 with SMTP id h7-20020a170902748700b001c7755dccc8mr10235172pll.29.1698157748748; Tue, 24 Oct 2023 07:29:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698157748; cv=none; d=google.com; s=arc-20160816; b=kKxY2vm+1m/w2vkwVXj4L41c0Hi3BjQAGZo8hVxKPkDGTf1UGzaADt+TvQ7nLvCjN2 xAVfmg7MuSWmvAitr3k2KvRwfwAdoQjz3dPpnuI/5sm/H0+9gko3EgE7R3nHkdryNQh4 GMtm8Rzctbl9F6RWocZzxk1GB2QoPfYC1HqbwOxgoTdpVp32r2w/LooCZJ319zuVHrh4 5u7KoQ/Ff2Y2faZn8UKyUi9ifdDcLQ74Do3zg7xDGXUR+AkIxWNnngxCJjOECB9MhrZY C06TcvSHp/KNbqRFy88sse46tMAkmnSGbM2N0A/ceGCD1itLYnlqjLtdDXkHU0eF5i8U Jt4A== 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=QgspBun1+2eUbkCbF+tTe8as0uNaaylH89IwTYG9YWY=; fh=RG81z/Hx5yQPYynbH2fyLvJdTMRM0l6VgTlyKjMN48M=; b=fGZqYoj/WJj/j+xCJtr1yNFYPcRsFBFo7xcqW1CzkXfCFxGQasP9jgxAqVKXn1ytM4 gmuzH6IpDdDeMmXgVZ4686pWKJNxwTQH7U2kxnYqNh1UDzdWATOnQFDjbFLEOcfWCONG S4EA4uBTmCEvYTX3igGUfxL5ma1k1FWjKuS1UUt2OdFiPGfpVjaPpGnaIGvxspUhCLVF /02tAkL6saDV1F/UrLmAa4IHqMaJhWBkLQizB/JWJyhJjdiydP34NDNdQymb7yVU5bJ6 LtaYHLWy6/SMeHQE8YrfDNCiPmgd2f0i5T/Vlk78NCgfQ9s3zQDRfg3XKYYiEaLQSbIo Wawg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Hff+xy0y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id x17-20020a170902ec9100b001c61a27f5b6si8712611plg.400.2023.10.24.07.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 07:29:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Hff+xy0y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 1B67780CD738; Tue, 24 Oct 2023 07:29:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234706AbjJXO2o (ORCPT <rfc822;a1648639935@gmail.com> + 26 others); Tue, 24 Oct 2023 10:28:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234603AbjJXO2m (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 24 Oct 2023 10:28:42 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 661D2111 for <linux-kernel@vger.kernel.org>; Tue, 24 Oct 2023 07:28:40 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-991c786369cso675312066b.1 for <linux-kernel@vger.kernel.org>; Tue, 24 Oct 2023 07:28:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698157719; x=1698762519; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QgspBun1+2eUbkCbF+tTe8as0uNaaylH89IwTYG9YWY=; b=Hff+xy0y034vF74B1B1Vb+9PTtJkund58SL+9FabknU5TDbAzMx5ulew/f3Vo+Wae+ w139P3alvu6o3xNlsaytMMp2II72L4zUG2XWoOVQS4Lu7zvCS178Hn9QCVwAL7GoHdEp z8z/RVm1iezDr4V79jY9eQIKajJSKsyzvYZNpYYtPiR8gV0XOWEcJunDoDSNvsjVNpwb /SwowLQO98Ffn4s0nz6zgzccxgzIv/0eF3WBfYJN+pIoa+U4hnH+GLrdgNdfZSLEol5k AsARfleI9IB6DqIdbwC9o0soKrdRvi8TgwZUAInRO8eJp4RrksdsAJkq7twerco4TZdI HEDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698157719; x=1698762519; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QgspBun1+2eUbkCbF+tTe8as0uNaaylH89IwTYG9YWY=; b=GoeL+EGdlGDA4RwdzQXJeO18wmaJquWY1b22OZNep0UDM3XTUax4UPr+lDtCZAQLV8 qchfXl5x7uSDi/DUy5vnpsejySfCD4qoV10Q7VpptUAWcyPmGyjpHlh94Qdexe6NypCu 3woLTzvpLY4CZEAYz5DOlPfwUzG2F5cngN7Amftvcneesn5SfEgt9h74JW8gq91P/Q8D IpIkzMZESsJBddeX91qvxFAw2gVfu+HTZyXavouj3Htva6SmM9Qb6S/Zp4LfFnl0xwDT K9ob8uyI2XLWcYw/HTrIgjH828bfzm2JZ7+42obNfkDxI4kYdp2IUYzuHaUcN5Tlg1oy AySw== X-Gm-Message-State: AOJu0Yx0M6nS1W+2nIH+NQvQb5rQk4xunRfIow1nO+5h3v2OELoG/rUj fRlN+Yns1mT0WESChgGQNcM= X-Received: by 2002:a17:907:360d:b0:9ae:406c:3420 with SMTP id bk13-20020a170907360d00b009ae406c3420mr9839238ejc.30.1698157718632; Tue, 24 Oct 2023 07:28:38 -0700 (PDT) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id j20-20020a170906051400b009bf7a4d591dsm8284585eja.32.2023.10.24.07.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 07:28:38 -0700 (PDT) From: Uros Bizjak <ubizjak@gmail.com> To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Uros Bizjak <ubizjak@gmail.com>, Andy Lutomirski <luto@kernel.org>, Brian Gerst <brgerst@gmail.com>, Denys Vlasenko <dvlasenk@redhat.com>, Ingo Molnar <mingo@kernel.org>, "H . Peter Anvin" <hpa@zytor.com>, Linus Torvalds <torvalds@linux-foundation.org>, Peter Zijlstra <peterz@infradead.org>, Thomas Gleixner <tglx@linutronix.de>, Josh Poimboeuf <jpoimboe@redhat.com> Subject: [PATCH] x86/percpu: Return correct variable from current_top_of_stack() Date: Tue, 24 Oct 2023 16:28:14 +0200 Message-ID: <20231024142830.3226-1-ubizjak@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 24 Oct 2023 07:29:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780647459041604373 X-GMAIL-MSGID: 1780647459041604373 |
Series |
x86/percpu: Return correct variable from current_top_of_stack()
|
|
Commit Message
Uros Bizjak
Oct. 24, 2023, 2:28 p.m. UTC
current_top_of_stack() should return variable from _seg_gs
qualified named address space when CONFIG_USE_X86_SEG_SUPPORT
is enbled.
Fixes: ed2f752e0e0a ("x86/percpu: Introduce const-qualified const_pcpu_hot to micro-optimize code generation")
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
---
arch/x86/include/asm/processor.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Oct 24, 2023 at 04:28:14PM +0200, Uros Bizjak wrote: > current_top_of_stack() should return variable from _seg_gs > qualified named address space when CONFIG_USE_X86_SEG_SUPPORT > is enbled. I presume you're sending those two in order to fix stuff like the splat below which fires in my guest with latest Linus + latest tip/master lineup. Because disabling CONFIG_USE_X86_SEG_SUPPORT fixes it. I'm wondering that close to the merge window whether we should delay all that new and fancy percpu stuff one more round until it is tested more widely... [ 1.623994] kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible. [ 1.627398] HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages [ 1.627101] BUG: unable to handle page fault for address: 000000000002f0d8 [ 1.629645] HugeTLB: 16380 KiB vmemmap can be freed for a 1.00 GiB page [ 1.628158] #PF: supervisor read access in kernel mode [ 1.628161] #PF: error_code(0x0000) - not-present page [ 1.628163] PGD 0 P4D 0 [ 1.628167] Oops: 0000 [#1] PREEMPT SMP [ 1.628171] CPU: 1 PID: 10 Comm: kworker/u32:0 Not tainted 6.6.0-rc7+ #1 [ 1.631566] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages [ 1.629156] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 [ 1.632494] HugeTLB: 28 KiB vmemmap can be freed for a 2.00 MiB page [ 1.629990] Workqueue: ftrace_check_wq ftrace_check_work_func [ 1.631041] RIP: 0010:raw_irqentry_exit_cond_resched+0x16/0x50 [ 1.631041] Code: 00 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 65 f7 05 d4 ff ef 7e ff ff ff 7f 75 21 <48> 8b 05 db ff ef 7e 48 29 e0 48 3d ff 3f 00 00 77 19 65 48 8b 05 [ 1.631041] RSP: 0018:ffffc9000005bab8 EFLAGS: 00010046 [ 1.631041] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 000000000002f900 [ 1.631041] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffc9000005bac8 [ 1.631041] RBP: 0000000000000000 R08: 0000000000000002 R09: 0000000000000001 [ 1.631041] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000 [ 1.631041] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 [ 1.631041] FS: 0000000000000000(0000) GS:ffff88807da40000(0000) knlGS:0000000000000000 [ 1.631041] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1.631041] CR2: 000000000002f0d8 CR3: 0000000002416000 CR4: 00000000003506f0 [ 1.631041] Call Trace: [ 1.631041] <TASK> [ 1.631041] ? __die+0x31/0x80 [ 1.631041] ? page_fault_oops+0x160/0x440 [ 1.631041] ? exc_page_fault+0x74/0x150 [ 1.631041] ? asm_exc_page_fault+0x26/0x30 [ 1.631041] ? raw_irqentry_exit_cond_resched+0x16/0x50 [ 1.631041] irqentry_exit+0x21/0x60 [ 1.631041] asm_sysvec_apic_timer_interrupt+0x1a/0x20 [ 1.631041] RIP: 0010:get_symbol_offset+0x26/0x60 [ 1.631041] Code: 90 90 90 90 0f 1f 44 00 00 48 89 f8 48 c1 e8 08 8b 04 85 80 4f 0b 82 48 05 88 af f1 81 81 e7 ff 00 00 00 74 25 31 c9 0f b6 10 <84> d2 79 0e 0f b6 70 01 83 e2 7f c1 e6 07 09 f2 ff c2 ff c2 ff c1
On Tue, Oct 24, 2023 at 5:56 PM Borislav Petkov <bp@alien8.de> wrote: > > On Tue, Oct 24, 2023 at 04:28:14PM +0200, Uros Bizjak wrote: > > current_top_of_stack() should return variable from _seg_gs > > qualified named address space when CONFIG_USE_X86_SEG_SUPPORT > > is enbled. > > I presume you're sending those two in order to fix stuff like the splat > below which fires in my guest with latest Linus + latest tip/master > lineup. Yes, the first one is the fix, the second one is only tangentially related to the fix. > Because disabling CONFIG_USE_X86_SEG_SUPPORT fixes it. > > I'm wondering that close to the merge window whether we should delay > all that new and fancy percpu stuff one more round until it is tested > more widely... The percpu stuff won't be merged for 6.7, it will have to sit out until 6.8. Thanks, Uros. > > [ 1.623994] kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible. > [ 1.627398] HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages > [ 1.627101] BUG: unable to handle page fault for address: 000000000002f0d8 > [ 1.629645] HugeTLB: 16380 KiB vmemmap can be freed for a 1.00 GiB page > [ 1.628158] #PF: supervisor read access in kernel mode > [ 1.628161] #PF: error_code(0x0000) - not-present page > [ 1.628163] PGD 0 P4D 0 > [ 1.628167] Oops: 0000 [#1] PREEMPT SMP > [ 1.628171] CPU: 1 PID: 10 Comm: kworker/u32:0 Not tainted 6.6.0-rc7+ #1 > [ 1.631566] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages > [ 1.629156] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 > [ 1.632494] HugeTLB: 28 KiB vmemmap can be freed for a 2.00 MiB page > [ 1.629990] Workqueue: ftrace_check_wq ftrace_check_work_func > [ 1.631041] RIP: 0010:raw_irqentry_exit_cond_resched+0x16/0x50 > [ 1.631041] Code: 00 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 65 f7 05 d4 ff ef 7e ff ff ff 7f 75 21 <48> 8b 05 db ff ef 7e 48 29 e0 48 3d ff 3f 00 00 77 19 65 48 8b 05 > [ 1.631041] RSP: 0018:ffffc9000005bab8 EFLAGS: 00010046 > [ 1.631041] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 000000000002f900 > [ 1.631041] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffc9000005bac8 > [ 1.631041] RBP: 0000000000000000 R08: 0000000000000002 R09: 0000000000000001 > [ 1.631041] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000 > [ 1.631041] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 > [ 1.631041] FS: 0000000000000000(0000) GS:ffff88807da40000(0000) knlGS:0000000000000000 > [ 1.631041] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 1.631041] CR2: 000000000002f0d8 CR3: 0000000002416000 CR4: 00000000003506f0 > [ 1.631041] Call Trace: > [ 1.631041] <TASK> > [ 1.631041] ? __die+0x31/0x80 > [ 1.631041] ? page_fault_oops+0x160/0x440 > [ 1.631041] ? exc_page_fault+0x74/0x150 > [ 1.631041] ? asm_exc_page_fault+0x26/0x30 > [ 1.631041] ? raw_irqentry_exit_cond_resched+0x16/0x50 > [ 1.631041] irqentry_exit+0x21/0x60 > [ 1.631041] asm_sysvec_apic_timer_interrupt+0x1a/0x20 > [ 1.631041] RIP: 0010:get_symbol_offset+0x26/0x60 > [ 1.631041] Code: 90 90 90 90 0f 1f 44 00 00 48 89 f8 48 c1 e8 08 8b 04 85 80 4f 0b 82 48 05 88 af f1 81 81 e7 ff 00 00 00 74 25 31 c9 0f b6 10 <84> d2 79 0e 0f b6 70 01 83 e2 7f c1 e6 07 09 f2 ff c2 ff c2 ff c1 > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index a807025a4dee..4b130d894cb6 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -534,7 +534,7 @@ static __always_inline unsigned long current_top_of_stack(void) * entry trampoline. */ if (IS_ENABLED(CONFIG_USE_X86_SEG_SUPPORT)) - return pcpu_hot.top_of_stack; + return const_pcpu_hot.top_of_stack; return this_cpu_read_stable(pcpu_hot.top_of_stack); }