All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Chen <Wei.Chen@arm.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: nd <nd@arm.com>, "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: RE: [PATCH v2 1/9] xen/x86: introduce a helper to update memory hotplug end
Date: Wed, 13 Jul 2022 08:22:47 +0000	[thread overview]
Message-ID: <PAXPR08MB74209F2975388E5A181C12B09E899@PAXPR08MB7420.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <115e36f9-fb73-9692-a6c6-35ad683805bd@suse.com>

Hi Jan,

> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: 2022年7月12日 19:54
> To: Wei Chen <Wei.Chen@arm.com>
> Cc: nd <nd@arm.com>; Andrew Cooper <andrew.cooper3@citrix.com>; Roger Pau
> Monné <roger.pau@citrix.com>; Wei Liu <wl@xen.org>; xen-
> devel@lists.xenproject.org
> Subject: Re: [PATCH v2 1/9] xen/x86: introduce a helper to update memory
> hotplug end
> 
> On 08.07.2022 16:54, Wei Chen wrote:
> > x86 provides a mem_hotplug variable to maintain the memory hotplug
> > end address. We want to move some codes from x86 to common, so that
> > it can be reused by other architectures. But not all architectures
> > have supported memory hotplug. So in this patch, we introduce this
> > helper to replace mem_hotplug direct access in these codes. This
> > will give the ability of stubbing this helper to those architectures
> > without memory hotplug support.
> 
> What remains unclear to me is why Arm can't simply gain the necessary
> variable. Sooner or later you'll want to support hotplug there anyway,

I am not sure my limited memory hotplug knowledge can answer your question
or not. As memory hotplug depends on hardware and firmware support. Now
for Arm, we only have ACPI firmware that can notify OS through GED event
(not very sure). But ACPI and device tree couldn't be enabled at the same
time from OS booting. In device tree based NUMA, we will enable device
tree, ACPI service will not be initialized, that means we can not get
notification of memory hotplug events from ACPI firmware. 

Of course, adding GED device nodes to the device tree, and getting these
events through GED interrupts should not be a big technical problem. But
there may be other reasons, and no one is planning to add memory hotplug
support to the device tree (perhaps need an ACPI-like specification or a
firmware abstraction interface). So if we want to implement Xen Arm memory
hotplug, it should also start from ACPI. So currently even if we gain the
variable in Arm, it will not be used. Device tree does not have property
to indicate a memory block can be hotplug or not.

> I suppose. Mechanically the change is fine. Albeit maybe "top" instead
> of "boundary", and maybe also pass "node" even if x86 doesn't need it?
> 

Sorry, I am not very clear about these comments:
It makes sense to use mem_hotplug_update_top instead
of mem_hotplug_update_boundary. But how can I understand pass "node"?
did you mean mem_hotplug_update_top(node, end)? But mem_hotplug is
a global top for memory hotplug ranges. I don't think pass "node"
to this function can be useful.

Cheers,
Wei Chen

> Jan
> 
> > Signed-off-by: Wei Chen <wei.chen@arm.com>
> > ---
> > v1 -> v2:
> > 1. Refine the commit message.
> > 2. Merge v1 patch#9,10 into one patch. Introduce the new functions
> >    in the same patch that this patch will be used first time.
> > 3. Fold if ( end > mem_hotplug ) to mem_hotplug_update_boundary,
> >    in this case, we can drop mem_hotplug_boundary.
> > ---
> >  xen/arch/x86/include/asm/mm.h | 6 ++++++
> >  xen/arch/x86/srat.c           | 3 +--
> >  2 files changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/xen/arch/x86/include/asm/mm.h
> b/xen/arch/x86/include/asm/mm.h
> > index 07b59c982b..b3dfbdb52b 100644
> > --- a/xen/arch/x86/include/asm/mm.h
> > +++ b/xen/arch/x86/include/asm/mm.h
> > @@ -476,6 +476,12 @@ static inline int get_page_and_type(struct
> page_info *page,
> >
> >  extern paddr_t mem_hotplug;
> >
> > +static inline void mem_hotplug_update_boundary(paddr_t end)
> > +{
> > +    if ( end > mem_hotplug )
> > +        mem_hotplug = end;
> > +}
> > +
> >
> /*************************************************************************
> *****
> >   * With shadow pagetables, the different kinds of address start
> >   * to get get confusing.
> > diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
> > index b62a152911..f53431f5e8 100644
> > --- a/xen/arch/x86/srat.c
> > +++ b/xen/arch/x86/srat.c
> > @@ -418,8 +418,7 @@ acpi_numa_memory_affinity_init(const struct
> acpi_srat_mem_affinity *ma)
> >  	memblk_nodeid[num_node_memblks] = node;
> >  	if (ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) {
> >  		__set_bit(num_node_memblks, memblk_hotplug);
> > -		if (end > mem_hotplug)
> > -			mem_hotplug = end;
> > +		mem_hotplug_update_boundary(end);
> >  	}
> >  	num_node_memblks++;
> >  }


  reply	other threads:[~2022-07-13  8:23 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08 14:54 [PATCH v2 0/9] Device tree based NUMA support for Arm - Part#2 Wei Chen
2022-07-08 14:54 ` [PATCH v2 1/9] xen/x86: introduce a helper to update memory hotplug end Wei Chen
2022-07-12 11:53   ` Jan Beulich
2022-07-13  8:22     ` Wei Chen [this message]
2022-07-13  8:46       ` Jan Beulich
2022-07-13  9:55         ` Wei Chen
2022-07-13 10:03           ` Jan Beulich
2022-07-08 14:54 ` [PATCH v2 2/9] xen/x86: Use enumerations to indicate NUMA status Wei Chen
2022-07-12 12:49   ` Jan Beulich
2022-07-14  9:03     ` Wei Chen
2022-07-14  9:32       ` Jan Beulich
2022-07-14  9:55         ` Wei Chen
2022-07-14  9:57           ` Jan Beulich
2022-07-14 10:26             ` Wei Chen
2022-07-14 10:37               ` Jan Beulich
2022-07-14 10:49                 ` Wei Chen
2022-07-14 10:58                   ` Jan Beulich
2022-07-15  7:18                     ` Wei Chen
2022-07-14 10:51                 ` Jan Beulich
2022-07-25  2:28                   ` Wei Chen
2022-07-08 14:54 ` [PATCH v2 3/9] xen/x86: move generically usable NUMA code from x86 to common Wei Chen
2022-07-12 13:13   ` Jan Beulich
2022-07-13 10:16     ` Wei Chen
2022-07-13 14:10     ` Jan Beulich
2022-07-08 14:54 ` [PATCH v2 4/9] xen/x86: Use ASSERT instead of VIRTUAL_BUG_ON for phys_to_nid Wei Chen
2022-07-11  6:32   ` Jan Beulich
2022-07-12  7:20     ` Wei Chen
2022-07-12  7:36       ` Jan Beulich
2022-07-08 14:54 ` [PATCH v2 5/9] xen/x86: use arch_get_memory_map to get information from E820 map Wei Chen
2022-07-12 13:40   ` Jan Beulich
2022-07-13 10:37     ` Wei Chen
2022-07-13 13:43       ` Jan Beulich
2022-07-08 14:54 ` [PATCH v2 6/9] xen/x86: move NUMA scan nodes codes from x86 to common Wei Chen
2022-07-12 14:21   ` Jan Beulich
2022-07-13 10:57     ` Wei Chen
2022-07-13 13:49       ` Jan Beulich
2022-07-08 14:54 ` [PATCH v2 7/9] xen/x86: rename bad_srat to numa_bad Wei Chen
2022-07-12 14:25   ` Jan Beulich
2022-07-14  9:17     ` Wei Chen
2022-07-08 14:54 ` [PATCH v2 8/9] xen: rename acpi_scan_nodes to numa_scan_nodes Wei Chen
2022-07-12 14:27   ` Jan Beulich
2022-07-14  9:18     ` Wei Chen
2022-07-08 14:54 ` [PATCH v2 9/9] xen: introduce a Kconfig option to configure NUMA nodes number Wei Chen
2022-07-12 14:34   ` Jan Beulich
2022-07-14 10:14     ` Wei Chen
2022-07-14 11:10       ` Jan Beulich
2022-07-14 11:27         ` Julien Grall
2022-07-18  7:51           ` Wei Chen
2022-07-18  8:10             ` Jan Beulich
2022-07-18  8:21               ` Wei Chen

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=PAXPR08MB74209F2975388E5A181C12B09E899@PAXPR08MB7420.eurprd08.prod.outlook.com \
    --to=wei.chen@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=nd@arm.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.