[tip:,x86/urgent] x86/apic: Fix kernel panic when booting with intremap=off and x2apic_phys
Message ID | 168720184607.404.13278064522951862638.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3215726vqr; Mon, 19 Jun 2023 12:42:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5c9G70sZ7iF2iLzolYDuecYpjYK7XIt86GqTNp+WxXzL17XWZuHZonyNQEldZDo8r02Mcp X-Received: by 2002:a05:6a20:7290:b0:11f:626e:15b4 with SMTP id o16-20020a056a20729000b0011f626e15b4mr10827701pzk.44.1687203775069; Mon, 19 Jun 2023 12:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687203775; cv=none; d=google.com; s=arc-20160816; b=uEhcRHLPG86H+5Cl9nXaL8yQUI19PKtxqzNxWS+Q2OLoVoN+kUSzBlRD5ppPb+tcvq VPMMFtp0CZNF93znErlVNxcMIpPMfn19XM26u3sjEDr4H635E8l7tuUo1nuhppY/TPrg gOiYwnp6YcyiS919QFGgL5kYY6tRlT017n3yY1534n1GOB0tfwDeMgxYV/x0g+Ha7+Kh FyZj2QE5E4IFqUDy59Eq+Lbp7v8saAc4XvCfFkt1mwM20EjEqkzz652GV+TK/Q44wRO9 b1Ka+WpdoxxgB042MO8WgrpQPYRUsTq7U/WsMTyX+SxR2WXSZpuL77C1JFAP/TCVi1m9 CDEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=RArQM0+vEpbmY2TBMGIyzGSZCOddW5TaaQ+oLRvEaLo=; b=PMpGuloIimVmYDwzD00qtZwC+4jTLQkuSryaCT/Xl5KFDIuo5/7IWjN3tNTUllELb2 J8XxXlXbpZonFfsIRyt7ZJoVWH/JOk60lZilZO3ErD6xRZSqL1DsCxd+cheDbtqK/6DD V1HVrkb2P4ZATSfE0K1Nx11DhmeHDvMi5IiY43kYa9dkMccfgvUvbqa0PCKrwHGbInDG eajXWxI6EbZ++hy+AL5g4yLncsab/XMMZFaBR57O78gRcqso+ge0BsPI3sVkwci5vY8h R3jze8dZHdUOjRVSGf4B5ZauRhXMAhBe1Viv9ugXUVVYbIzXf6xptNE97Jfss24GPo0f pP1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="Tgb/SUOJ"; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c66-20020a633545000000b00543eeb76c52si127540pga.756.2023.06.19.12.42.42; Mon, 19 Jun 2023 12:42:55 -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=@linutronix.de header.s=2020 header.b="Tgb/SUOJ"; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232269AbjFSTKw (ORCPT <rfc822;duw91626@gmail.com> + 99 others); Mon, 19 Jun 2023 15:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229628AbjFSTKu (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 19 Jun 2023 15:10:50 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 666C39C; Mon, 19 Jun 2023 12:10:49 -0700 (PDT) Date: Mon, 19 Jun 2023 19:10:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1687201847; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RArQM0+vEpbmY2TBMGIyzGSZCOddW5TaaQ+oLRvEaLo=; b=Tgb/SUOJ229Prfl8me5zen9JUzcr4j/7IrQG3vgwTn5T7KNmmPFKSERDusZt6uCasbqT2P b0ygboVWA0pUv0bex4pmvc681Pa53fwUHbYJTF9KYna6W3z7VSG0hDgb0vVujvdf6rY5bN gRuetMIjcjV+bPX3aTfk9BOW+f+fO8mud9uZEI0hrfwzeHMOdSmCAudHm/SH5uvRKgEH+j +a0v0wj5dwmjM3YiMqWkHlgRbK8TLmQalW2elboypwZDn/92MVHXG+LdipwYCAJxWhPHwR ZHX0QyCyPLQWvkjkYfmoEVySeOMim450k9epochhO+MhDKqzRb1J1WPalHwhDA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1687201847; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RArQM0+vEpbmY2TBMGIyzGSZCOddW5TaaQ+oLRvEaLo=; b=E7pvXYdSVvDoR1MU2wlD+U7hft+Rs3RamhYeMwvFNVj3zvzx06m1SF6almagY2iM/K16Ql AJX7iqc64Bp8pbBA== From: "tip-bot2 for Dheeraj Kumar Srivastava" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/apic: Fix kernel panic when booting with intremap=off and x2apic_phys Cc: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>, "Borislav Petkov (AMD)" <bp@alien8.de>, Kishon Vijay Abraham I <kvijayab@amd.com>, Vasant Hegde <vasant.hegde@amd.com>, Cyrill Gorcunov <gorcunov@gmail.com>, Thomas Gleixner <tglx@linutronix.de>, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230616212236.1389-1-dheerajkumar.srivastava@amd.com> References: <20230616212236.1389-1-dheerajkumar.srivastava@amd.com> MIME-Version: 1.0 Message-ID: <168720184607.404.13278064522951862638.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,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: <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?1769161385666117776?= X-GMAIL-MSGID: =?utf-8?q?1769161385666117776?= |
Series |
[tip:,x86/urgent] x86/apic: Fix kernel panic when booting with intremap=off and x2apic_phys
|
|
Commit Message
tip-bot2 for Thomas Gleixner
June 19, 2023, 7:10 p.m. UTC
The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 85d38d5810e285d5aec7fb5283107d1da70c12a9 Gitweb: https://git.kernel.org/tip/85d38d5810e285d5aec7fb5283107d1da70c12a9 Author: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com> AuthorDate: Sat, 17 Jun 2023 02:52:36 +05:30 Committer: Borislav Petkov (AMD) <bp@alien8.de> CommitterDate: Mon, 19 Jun 2023 20:59:40 +02:00 x86/apic: Fix kernel panic when booting with intremap=off and x2apic_phys When booting with "intremap=off" and "x2apic_phys" on the kernel command line, the physical x2APIC driver ends up being used even when x2APIC mode is disabled ("intremap=off" disables x2APIC mode). This happens because the first compound condition check in x2apic_phys_probe() is false due to x2apic_mode == 0 and so the following one returns true after default_acpi_madt_oem_check() having already selected the physical x2APIC driver. This results in the following panic: kernel BUG at arch/x86/kernel/apic/io_apic.c:2409! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.4.0-rc2-ver4.1rc2 #2 Hardware name: Dell Inc. PowerEdge R6515/07PXPY, BIOS 2.3.6 07/06/2021 RIP: 0010:setup_IO_APIC+0x9c/0xaf0 Call Trace: <TASK> ? native_read_msr apic_intr_mode_init x86_late_time_init start_kernel x86_64_start_reservations x86_64_start_kernel secondary_startup_64_no_verify </TASK> which is: setup_IO_APIC: apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n"); for_each_ioapic(ioapic) BUG_ON(mp_irqdomain_create(ioapic)); Return 0 to denote that x2APIC has not been enabled when probing the physical x2APIC driver. [ bp: Massage commit message heavily. ] Fixes: 9ebd680bd029 ("x86, apic: Use probe routines to simplify apic selection") Signed-off-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Kishon Vijay Abraham I <kvijayab@amd.com> Reviewed-by: Vasant Hegde <vasant.hegde@amd.com> Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20230616212236.1389-1-dheerajkumar.srivastava@amd.com --- arch/x86/kernel/apic/x2apic_phys.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index 6bde05a..896bc41 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c @@ -97,7 +97,10 @@ static void init_x2apic_ldr(void) static int x2apic_phys_probe(void) { - if (x2apic_mode && (x2apic_phys || x2apic_fadt_phys())) + if (!x2apic_mode) + return 0; + + if (x2apic_phys || x2apic_fadt_phys()) return 1; return apic == &apic_x2apic_phys;