[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <198860d65d277dbd30552526a707576db4281b29.camel@intel.com>
Date: Thu, 23 Jun 2022 12:08:55 +1200
From: Kai Huang <kai.huang@...el.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
kvm-devel <kvm@...r.kernel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Dave Hansen <dave.hansen@...el.com>,
Len Brown <len.brown@...el.com>,
Tony Luck <tony.luck@...el.com>,
Rafael Wysocki <rafael.j.wysocki@...el.com>,
Reinette Chatre <reinette.chatre@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Andi Kleen <ak@...ux.intel.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
isaku.yamahata@...el.com, Tom Lendacky <thomas.lendacky@....com>
Subject: Re: [PATCH v5 03/22] cc_platform: Add new attribute to prevent ACPI
memory hotplug
On Wed, 2022-06-22 at 13:45 +0200, Rafael J. Wysocki wrote:
> On Wed, Jun 22, 2022 at 1:16 PM Kai Huang <kai.huang@...el.com> wrote:
> >
> > Platforms with confidential computing technology may not support ACPI
> > memory hotplug when such technology is enabled by the BIOS. Examples
> > include Intel platforms which support Intel Trust Domain Extensions
> > (TDX).
> >
> > If the kernel ever receives ACPI memory hotplug event, it is likely a
> > BIOS bug. For ACPI memory hot-add, the kernel should speak out this is
> > a BIOS bug and reject the new memory. For hot-removal, for simplicity
> > just assume the kernel cannot continue to work normally, and just BUG().
> >
> > Add a new attribute CC_ATTR_ACPI_MEMORY_HOTPLUG_DISABLED to indicate the
> > platform doesn't support ACPI memory hotplug, so that kernel can handle
> > ACPI memory hotplug events for such platform.
> >
> > In acpi_memory_device_{add|remove}(), add early check against this
> > attribute and handle accordingly if it is set.
> >
> > Signed-off-by: Kai Huang <kai.huang@...el.com>
> > ---
> > drivers/acpi/acpi_memhotplug.c | 23 +++++++++++++++++++++++
> > include/linux/cc_platform.h | 10 ++++++++++
> > 2 files changed, 33 insertions(+)
> >
> > diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
> > index 24f662d8bd39..94d6354ea453 100644
> > --- a/drivers/acpi/acpi_memhotplug.c
> > +++ b/drivers/acpi/acpi_memhotplug.c
> > @@ -15,6 +15,7 @@
> > #include <linux/acpi.h>
> > #include <linux/memory.h>
> > #include <linux/memory_hotplug.h>
> > +#include <linux/cc_platform.h>
> >
> > #include "internal.h"
> >
> > @@ -291,6 +292,17 @@ static int acpi_memory_device_add(struct acpi_device *device,
> > if (!device)
> > return -EINVAL;
> >
> > + /*
> > + * If the confidential computing platform doesn't support ACPI
> > + * memory hotplug, the BIOS should never deliver such event to
> > + * the kernel. Report ACPI CPU hot-add as a BIOS bug and ignore
> > + * the memory device.
> > + */
> > + if (cc_platform_has(CC_ATTR_ACPI_MEMORY_HOTPLUG_DISABLED)) {
>
> Same comment as for the acpi_processor driver: this will affect the
> initialization too and it would be cleaner to reset the
> .hotplug.enabled flag of the scan handler.
>
>
Hi Rafael,
Thanks for review. The same to the ACPI CPU hotplug handling, this is illegal
also during kernel boot. If we just want to disable, then perhaps something
like below?
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -366,6 +366,9 @@ static bool __initdata acpi_no_memhotplug;
void __init acpi_memory_hotplug_init(void)
{
+ if (cc_platform_has(CC_ATTR_ACPI_MEMORY_HOTPLUG_DISABLED))
+ acpi_no_memhotplug = true;
+
if (acpi_no_memhotplug) {
memory_device_handler.attach = NULL;
acpi_scan_add_handler(&memory_device_handler);
--
Thanks,
-Kai
Powered by blists - more mailing lists