From: Fan Ni <nifan.cxl@gmail.com>
To: Gregory Price <gourry@gourry.net>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
linux-acpi@vger.kernel.org, linux-mm@kvack.org,
linux-cxl@vger.kernel.org, kernel-team@meta.com,
Jonathan.Cameron@huawei.com, dan.j.williams@intel.com,
rrichter@amd.com, Terry.Bowman@amd.com, dave.jiang@intel.com,
ira.weiny@intel.com, alison.schofield@intel.com,
dave.hansen@linux.intel.com, luto@kernel.org,
peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, hpa@zytor.com, rafael@kernel.org, lenb@kernel.org,
david@redhat.com, osalvador@suse.de, gregkh@linuxfoundation.org,
akpm@linux-foundation.org, rppt@kernel.org
Subject: Re: [PATCH v6 0/3] memory,x86,acpi: hotplug memory alignment advisement
Date: Wed, 20 Nov 2024 19:20:26 +0000 [thread overview]
Message-ID: <Zz42ehwdXDcX8rIu@smc-140338-bm01> (raw)
In-Reply-To: <20241106155847.7985-1-gourry@gourry.net>
On Wed, Nov 06, 2024 at 10:58:44AM -0500, Gregory Price wrote:
> When physical address regions are not aligned to memory block size,
> the misaligned portion is lost (stranded capacity).
>
> Block size (min/max/selected) is architecture defined. Most architectures
> tend to use the minimum block size or some simplistic heurist. On x86,
> memory block size increases up to 2GB, and is otherwise fitted to the
> alignment of non-hotplug (i.e. not special purpose memory).
>
> CXL exposes its memory for management through the ACPI CEDT (CXL Early
> Detection Table) in a field called the CXL Fixed Memory Window. Per
> the CXL specification, this memory must be aligned to at least 256MB.
>
> When a CFMW aligns on a size less than the block size, this causes a
> loss of up to 2GB per CFMW on x86. It is not uncommon for CFMW to be
> allocated per-device - though this behavior is BIOS defined.
>
> This patch set provides 3 things:
> 1) implement advise/query functions in driverse/base/memory.c to
> report/query architecture agnostic hotplug block alignment advice.
> 2) update x86 memblock size logic to consider the hotplug advice
> 3) add code in acpi/numa/srat.c to report CFMW alignment advice
>
> The advisement interfaces are design to be called during arch_init
> code prior to allocator and smp_init. start_kernel will call these
> through setup_arch() (via acpi and mm/init_64.c on x86), which occurs
> prior to mm_core_init and smp_init - so no need for atomics.
>
> There's an attempt to signal callers to advise() that query has already
> occurred, but this is predicated on the notion that query actually
> occurs (which presently only happens on the x86 arch). This is to
> assist debugging future users. Otherwise, the advise() call has
> been marked __init to help static discovery of bad call times.
>
> Once query is called the first time, it will always return the same value.
>
> Interfaces return -EBUSY and 0 respectively on systems without hotplug.
>
> v6:
> - boot_cpu_has -> cpu_feature_enabled() in x86 code
> - ack tags
>
> Suggested-by: Ira Weiny <ira.weiny@intel.com>
> Suggested-by: David Hildenbrand <david@redhat.com>
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Gregory Price <gourry@gourry.net>
>
Tested on a CXL server with a directly attached cxl device, works as
expected.
Tested-by: Fan Ni <fan.ni@samsung.com>
Fan
> Gregory Price (3):
> memory: implement memory_block_advise/probe_max_size
> x86: probe memory block size advisement value during mm init
> acpi,srat: give memory block size advice based on CFMWS alignment
>
> arch/x86/mm/init_64.c | 15 ++++++++----
> drivers/acpi/numa/srat.c | 12 ++++++++-
> drivers/base/memory.c | 53 ++++++++++++++++++++++++++++++++++++++++
> include/linux/memory.h | 10 ++++++++
> 4 files changed, 84 insertions(+), 6 deletions(-)
>
> --
> 2.43.0
>
--
Fan Ni (From gmail)
prev parent reply other threads:[~2024-11-20 19:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 15:58 Gregory Price
2024-11-06 15:58 ` [PATCH v6 1/3] memory: implement memory_block_advise/probe_max_size Gregory Price
2024-11-12 21:28 ` Dan Williams
2024-11-13 4:14 ` Gregory Price
2024-11-06 15:58 ` [PATCH v6 2/3] x86: probe memory block size advisement value during mm init Gregory Price
2024-11-12 21:34 ` Dan Williams
2024-11-25 22:35 ` Gregory Price
2024-11-06 15:58 ` [PATCH v6 3/3] acpi,srat: give memory block size advice based on CFMWS alignment Gregory Price
2024-11-12 21:41 ` Dan Williams
2024-11-12 23:47 ` Gregory Price
2024-11-13 0:12 ` Dan Williams
2024-11-20 19:20 ` Fan Ni [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zz42ehwdXDcX8rIu@smc-140338-bm01 \
--to=nifan.cxl@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=Terry.Bowman@amd.com \
--cc=akpm@linux-foundation.org \
--cc=alison.schofield@intel.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=dave.jiang@intel.com \
--cc=david@redhat.com \
--cc=gourry@gourry.net \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=ira.weiny@intel.com \
--cc=kernel-team@meta.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=osalvador@suse.de \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=rppt@kernel.org \
--cc=rrichter@amd.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox