[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c96a78c6a8caf25b01e450f139c934688d1735b0.camel@intel.com>
Date: Wed, 03 Aug 2022 14:37:18 +1200
From: Kai Huang <kai.huang@...el.com>
To: Dave Hansen <dave.hansen@...el.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: seanjc@...gle.com, pbonzini@...hat.com, len.brown@...el.com,
tony.luck@...el.com, rafael.j.wysocki@...el.com,
reinette.chatre@...el.com, dan.j.williams@...el.com,
peterz@...radead.org, ak@...ux.intel.com,
kirill.shutemov@...ux.intel.com,
sathyanarayanan.kuppuswamy@...ux.intel.com,
isaku.yamahata@...el.com
Subject: Re: [PATCH v5 07/22] x86/virt/tdx: Implement SEAMCALL function
On Thu, 2022-07-21 at 13:52 +1200, Kai Huang wrote:
> Also, if I understand correctly above, your suggestion is we want to prevent any
> CMR memory going offline so it won't be hot-removed (assuming we can get CMRs
> during boot). This looks contradicts to the requirement of being able to allow
> moving memory from core-mm to driver. When we offline the memory, we cannot
> know whether the memory will be used by driver, or later hot-removed.
Hi Dave,
The high level flow of device hot-removal is:
acpi_scan_hot_remove()
-> acpi_scan_try_to_offline()
-> acpi_bus_offline()
-> device_offline()
-> memory_subsys_offline()
-> acpi_bus_trim()
-> acpi_memory_device_remove()
And memory_subsys_offline() can also be triggered via /sysfs:
echo 0 > /sys/devices/system/memory/memory30/online
After the memory block is offline, my understanding is kernel can theoretically
move it to, i.e. ZONE_DEVICE via memremap_pages().
As you can see memory_subsys_offline() is the entry point of memory device
offline (before it the code is generic for all ACPI device), and it cannot
distinguish whether the removal is from ACPI event, or from /sysfs, so it seems
we are unable to refuse to offline memory in memory_subsys_offline() when it is
called from ACPI event.
Any comments?
--
Thanks,
-Kai
Powered by blists - more mailing lists