Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp350985rdb; Thu, 5 Oct 2023 07:48:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFahI1QyUxqURNYGROQFkls6yY5z0q7QLCvGIE3ozApUQCOI1qPny6KtlEKeHLxYg1YkZ6A X-Received: by 2002:a05:6a21:47ca:b0:160:719d:63c5 with SMTP id as10-20020a056a2147ca00b00160719d63c5mr5128140pzc.59.1696517291771; Thu, 05 Oct 2023 07:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696517291; cv=none; d=google.com; s=arc-20160816; b=KrQRlhYkyyAl7yn1/VkI+sEJzhwFCrpZzMFtp+crY7SGXx0XoVgUyQJpYahx9HxY+i KNMxV/i7VICWLoU7xql+FbWQyUI6bAOZXeeqw/LaQAydguHEUNFAY9W+y1tQB9d+TPwR D2BIH67MCEILlKqN48Fp9c4D+m+bmIKnt63CLa1OYsFnGqCViK+Eq1pWx97mfB8oUD0v 3XkSBcQdV/QEaY2+mdXyKaOG4oiQdC+20rFzuKUF3u8q2xSnxfd/sFSlqtnKUgFf5A1M EDZOMpWacf3anEzFZ7tKngbZoTpT8HhzgjWAH3ieWWDoDQ2LkczU0tD9tGSd0hJr70OL 6LLQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JBfrCIdkqWX2LqffgrsjGbs9OlMRYEtcZoyqsZWyU6A=; fh=F1gpqSS/HYttK+doOKuW4yrAifo5qykyq1MCI9SIQmQ=; b=dySNvUsVwQlE5wzOBZP9ioM3af7RtmAI0/Qnb15Vp6ghsB5b8VoEq7CMcngvBKWup5 ybQkSUjB1DWB0sof5n5d+yWNG+4xU3+/D9iKugbAXQg03UdjIhc6gP4NAK3grSN6Blux Y+TFqyS33ux2/ay4m6rM0w5MtB1k32aZuUrw6JBaDoxZnPFwwmoEwYjJDaeCQDghOUJe ZS4JiscFRTeG4w4SmA4T63jp57idlMcm0rQJVxROsgFCKq1LvRubsijOmpWBydLl3DVT MSyThVJ8kjJRpg5sDY0iBy4hsKIBuVtpEWhoS6vDTdQe3Ccyc54HGVnYHUSkPMb5ZEFL JWyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OUxVtQKW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id p6-20020a63f446000000b00578a9ea5686si1556365pgk.660.2023.10.05.07.48.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:48:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OUxVtQKW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 729EC80ED995; Thu, 5 Oct 2023 07:47:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229921AbjJEOoI (ORCPT + 99 others); Thu, 5 Oct 2023 10:44:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237278AbjJEOiw (ORCPT ); Thu, 5 Oct 2023 10:38:52 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E9656621 for ; Thu, 5 Oct 2023 07:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696514684; x=1728050684; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nsB0LfqQYj2RZjcPwh1MZGMdJcZ9TNW2jF9KJqnidVg=; b=OUxVtQKWMIP+g0iMP+8oPId3F+iUQC87X6IfZeAjARd8yoUQBpNgyzlK 4AsTFlBdaGkqIGdttsMV6cEhLEPgeazCryncFxooaFRYqIjLQJNVaVjdX UXVdUK2xzCb/5lj0hSuP7OMlFzuwEL61yPrn5IiBgjbAvWqNADx3Yfus0 W0B4RIGLuuYWrRrNomoARfx/Ys6z1YUNSF9PlFtbHZ2v4vaNRrn2to6x4 gUFP5uTCmUO5vuTICuXuQsxwVDIS38ml2z/js9/t4R3iEwecJHN5E7rDr W4UW3o+noL2ZIdg3buBqrSumOAc50tjO9hRCSvfMyMyHmsqeAVabU76GB w==; X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="380767194" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="380767194" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 06:14:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="728449270" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="728449270" Received: from skwasnia-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.251.222.71]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 06:14:23 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id 8835310A157; Thu, 5 Oct 2023 16:14:14 +0300 (+03) From: "Kirill A. Shutemov" To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: "Rafael J. Wysocki" , Peter Zijlstra , Adrian Hunter , Kuppuswamy Sathyanarayanan , Elena Reshetova , Jun Nakajima , Rick Edgecombe , Tom Lendacky , kexec@lists.infradead.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCH 12/13] x86/acpi: Do not attempt to bring up secondary CPUs in kexec case Date: Thu, 5 Oct 2023 16:14:01 +0300 Message-ID: <20231005131402.14611-13-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231005131402.14611-1-kirill.shutemov@linux.intel.com> References: <20231005131402.14611-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 05 Oct 2023 07:47:47 -0700 (PDT) ACPI MADT doesn't allow to offline CPU after it got woke up. It limits kexec: target kernel won't be able to use more than one CPU. Zero out mailbox address in the ACPI MADT wakeup structure to indicate that the mailbox is not usable. This is Linux-specific protocol and not reflected in ACPI spec. Booting the target kernel with signle CPU is enough to cover the most common case for kexec -- kdump. Signed-off-by: Kirill A. Shutemov --- arch/x86/kernel/acpi/madt_wakeup.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b/arch/x86/kernel/acpi/madt_wakeup.c index 15bdf10b1393..4e92d1d4a5fa 100644 --- a/arch/x86/kernel/acpi/madt_wakeup.c +++ b/arch/x86/kernel/acpi/madt_wakeup.c @@ -9,6 +9,11 @@ static struct acpi_madt_multiproc_wakeup_mailbox *acpi_mp_wake_mailbox; static int acpi_wakeup_cpu(int apicid, unsigned long start_ip) { + if (!acpi_mp_wake_mailbox_paddr) { + pr_warn_once("No MADT mailbox: cannot bringup secondary CPUs. Booting with kexec?\n"); + return -EOPNOTSUPP; + } + /* * Remap mailbox memory only for the first call to acpi_wakeup_cpu(). * @@ -78,6 +83,18 @@ int __init acpi_parse_mp_wake(union acpi_subtable_headers *header, /* Disable CPU onlining/offlining */ cpu_hotplug_not_supported(); + /* + * ACPI MADT doesn't allow to offline CPU after it got woke up. + * It limits kexec: target kernel won't be able to use more than + * one CPU. + * + * Zero out mailbox address in the ACPI MADT wakeup structure to + * indicate that the mailbox is not usable. + * + * This is Linux-specific protocol and not reflected in ACPI spec. + */ + mp_wake->base_address = 0; + apic_update_callback(wakeup_secondary_cpu_64, acpi_wakeup_cpu); return 0; -- 2.41.0