public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] x86/acpi: fix panic while AP online later with kernel parameter maxcpus=1
@ 2024-06-28  8:21 Zhiquan Li
  2024-06-28 10:07 ` Kirill A. Shutemov
  0 siblings, 1 reply; 3+ messages in thread
From: Zhiquan Li @ 2024-06-28  8:21 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen, kirill.shutemov, x86
  Cc: rafael, hpa, linux-acpi, linux-kernel, zhiquan1.li

The issue was found on the platform that using "Multiprocessor Wakeup
Structure"[1] to startup secondary CPU, which is usually used by
encrypted guest.  When restrict boot time CPU to 1 with the kernel
parameter "maxcpus=1" and bring other CPUs online later, there will be
a kernel panic.

The variable acpi_mp_wake_mailbox, which holds the virtual address of
the MP Wakeup Structure mailbox, will be set as read-only after init.
If the first AP gets online later, after init, the attempt to update
the variable results in panic.

But it is worth noting that the memremap() function that initializes the
variable cannot be moved into acpi_parse_mp_wake() because memremap() is
not yet functional at this point in the boot process.

[1] Details about the MP Wakeup structure can be found in ACPI v6.4, in
    the "Multiprocessor Wakeup Structure" section.

Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>

---

V1: https://lore.kernel.org/all/20240626073920.176471-1-zhiquan1.li@intel.com/

Changes since V1:
- Amend the commit message as per Kirill's comments.
---
 arch/x86/kernel/acpi/madt_wakeup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b/arch/x86/kernel/acpi/madt_wakeup.c
index 6cfe762be28b..d5ef6215583b 100644
--- a/arch/x86/kernel/acpi/madt_wakeup.c
+++ b/arch/x86/kernel/acpi/madt_wakeup.c
@@ -19,7 +19,7 @@
 static u64 acpi_mp_wake_mailbox_paddr __ro_after_init;
 
 /* Virtual address of the Multiprocessor Wakeup Structure mailbox */
-static struct acpi_madt_multiproc_wakeup_mailbox *acpi_mp_wake_mailbox __ro_after_init;
+static struct acpi_madt_multiproc_wakeup_mailbox *acpi_mp_wake_mailbox;
 
 static u64 acpi_mp_pgd __ro_after_init;
 static u64 acpi_mp_reset_vector_paddr __ro_after_init;

base-commit: e2009f68e1a9d07467dc833fc2b0c3a7e9c19f37
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] x86/acpi: fix panic while AP online later with kernel parameter maxcpus=1
  2024-06-28  8:21 [PATCH v2] x86/acpi: fix panic while AP online later with kernel parameter maxcpus=1 Zhiquan Li
@ 2024-06-28 10:07 ` Kirill A. Shutemov
  2024-06-28 10:12   ` Zhiquan Li
  0 siblings, 1 reply; 3+ messages in thread
From: Kirill A. Shutemov @ 2024-06-28 10:07 UTC (permalink / raw)
  To: Zhiquan Li
  Cc: tglx, mingo, bp, dave.hansen, x86, rafael, hpa, linux-acpi,
	linux-kernel

On Fri, Jun 28, 2024 at 04:21:19PM +0800, Zhiquan Li wrote:
> The issue was found on the platform that using "Multiprocessor Wakeup
> Structure"[1] to startup secondary CPU, which is usually used by
> encrypted guest.  When restrict boot time CPU to 1 with the kernel
> parameter "maxcpus=1" and bring other CPUs online later, there will be
> a kernel panic.
> 
> The variable acpi_mp_wake_mailbox, which holds the virtual address of
> the MP Wakeup Structure mailbox, will be set as read-only after init.
> If the first AP gets online later, after init, the attempt to update
> the variable results in panic.
> 
> But it is worth noting that the memremap() function that initializes the
> variable cannot be moved into acpi_parse_mp_wake() because memremap() is
> not yet functional at this point in the boot process.

  The memremap() call that initializes the variable cannot be moved into
  acpi_parse_mp_wake() because memremap() is not functional at that point
  in the boot process.

> 
> [1] Details about the MP Wakeup structure can be found in ACPI v6.4, in
>     the "Multiprocessor Wakeup Structure" section.
> 
> Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>
> 

Otherwise looks good to me.

Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] x86/acpi: fix panic while AP online later with kernel parameter maxcpus=1
  2024-06-28 10:07 ` Kirill A. Shutemov
@ 2024-06-28 10:12   ` Zhiquan Li
  0 siblings, 0 replies; 3+ messages in thread
From: Zhiquan Li @ 2024-06-28 10:12 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: tglx, mingo, bp, dave.hansen, x86, rafael, hpa, linux-acpi,
	linux-kernel


On 2024/6/28 18:07, Kirill A. Shutemov wrote:
>   The memremap() call that initializes the variable cannot be moved into
>   acpi_parse_mp_wake() because memremap() is not functional at that point
>   in the boot process.
> 
> Otherwise looks good to me.
> 
> Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

Many thanks, Kirill.
I'll revise them into V3.

Best Regards,
Zhiquan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-28 10:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-28  8:21 [PATCH v2] x86/acpi: fix panic while AP online later with kernel parameter maxcpus=1 Zhiquan Li
2024-06-28 10:07 ` Kirill A. Shutemov
2024-06-28 10:12   ` Zhiquan Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox