diff mbox series

[09/37] xen/x86: introduce two helpers to access memory hotplug end

Message ID 20210923120236.3692135-10-wei.chen@arm.com (mailing list archive)
State New, archived
Headers show
Series Add device tree based NUMA support to Arm | expand

Commit Message

Wei Chen Sept. 23, 2021, 12:02 p.m. UTC
x86 provides a mem_hotplug to maintain the end of memory hotplug
end address. This variable can be accessed out of mm.c. We want
some code out of mm.c can be reused by other architectures without
memory hotplug ability. So in this patch, we introduce these two
helpers to replace mem_hotplug direct access. This will give the
ability to stub these two API.

Signed-off-by: Wei Chen <wei.chen@arm.com>
---
 xen/include/asm-x86/mm.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Stefano Stabellini Sept. 24, 2021, 12:29 a.m. UTC | #1
+x86 maintainers

On Thu, 23 Sep 2021, Wei Chen wrote:
> x86 provides a mem_hotplug to maintain the end of memory hotplug
                            ^ variable

> end address. This variable can be accessed out of mm.c. We want
> some code out of mm.c can be reused by other architectures without
                       ^ so that it can be reused

> memory hotplug ability. So in this patch, we introduce these two
> helpers to replace mem_hotplug direct access. This will give the
> ability to stub these two API.
                            ^ APIs


> Signed-off-by: Wei Chen <wei.chen@arm.com>
> ---
>  xen/include/asm-x86/mm.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
> index cb90527499..af2fc4b0cd 100644
> --- a/xen/include/asm-x86/mm.h
> +++ b/xen/include/asm-x86/mm.h
> @@ -475,6 +475,16 @@ 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)
> +{
> +    mem_hotplug = end;
> +}
> +
> +static inline paddr_t mem_hotplug_boundary(void)
> +{
> +    return mem_hotplug;
> +}
> +
>  /******************************************************************************
>   * With shadow pagetables, the different kinds of address start
>   * to get get confusing.
> -- 
> 2.25.1
>
Wei Chen Sept. 24, 2021, 4:21 a.m. UTC | #2
On 2021/9/24 8:29, Stefano Stabellini wrote:
> +x86 maintainers
> 
> On Thu, 23 Sep 2021, Wei Chen wrote:
>> x86 provides a mem_hotplug to maintain the end of memory hotplug
>                              ^ variable
> 
>> end address. This variable can be accessed out of mm.c. We want
>> some code out of mm.c can be reused by other architectures without
>                         ^ so that it can be reused
> 
>> memory hotplug ability. So in this patch, we introduce these two
>> helpers to replace mem_hotplug direct access. This will give the
>> ability to stub these two API.
>                              ^ APIs
> 
> 

OK

>> Signed-off-by: Wei Chen <wei.chen@arm.com>
>> ---
>>   xen/include/asm-x86/mm.h | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
>> index cb90527499..af2fc4b0cd 100644
>> --- a/xen/include/asm-x86/mm.h
>> +++ b/xen/include/asm-x86/mm.h
>> @@ -475,6 +475,16 @@ 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)
>> +{
>> +    mem_hotplug = end;
>> +}
>> +
>> +static inline paddr_t mem_hotplug_boundary(void)
>> +{
>> +    return mem_hotplug;
>> +}
>> +
>>   /******************************************************************************
>>    * With shadow pagetables, the different kinds of address start
>>    * to get get confusing.
>> -- 
>> 2.25.1
>>
Jan Beulich Jan. 24, 2022, 4:24 p.m. UTC | #3
On 23.09.2021 14:02, Wei Chen wrote:
> x86 provides a mem_hotplug to maintain the end of memory hotplug
> end address. This variable can be accessed out of mm.c. We want
> some code out of mm.c can be reused by other architectures without
> memory hotplug ability. So in this patch, we introduce these two
> helpers to replace mem_hotplug direct access. This will give the
> ability to stub these two API.
> 
> Signed-off-by: Wei Chen <wei.chen@arm.com>
> ---
>  xen/include/asm-x86/mm.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
> index cb90527499..af2fc4b0cd 100644
> --- a/xen/include/asm-x86/mm.h
> +++ b/xen/include/asm-x86/mm.h
> @@ -475,6 +475,16 @@ 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)
> +{
> +    mem_hotplug = end;
> +}
> +
> +static inline paddr_t mem_hotplug_boundary(void)
> +{
> +    return mem_hotplug;
> +}
> +
>  /******************************************************************************
>   * With shadow pagetables, the different kinds of address start
>   * to get get confusing.

Imo for this to make sense you want to also use the new functions
right away in the place(s) where the direct access(es) get(s) in
your way.

Jan
Wei Chen Jan. 26, 2022, 7:53 a.m. UTC | #4
Hi Jan,

> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: 2022年1月25日 0:25
> To: Wei Chen <Wei.Chen@arm.com>
> Cc: Bertrand Marquis <Bertrand.Marquis@arm.com>; xen-
> devel@lists.xenproject.org; sstabellini@kernel.org; julien@xen.org
> Subject: Re: [PATCH 09/37] xen/x86: introduce two helpers to access memory
> hotplug end
> 
> On 23.09.2021 14:02, Wei Chen wrote:
> > x86 provides a mem_hotplug to maintain the end of memory hotplug
> > end address. This variable can be accessed out of mm.c. We want
> > some code out of mm.c can be reused by other architectures without
> > memory hotplug ability. So in this patch, we introduce these two
> > helpers to replace mem_hotplug direct access. This will give the
> > ability to stub these two API.
> >
> > Signed-off-by: Wei Chen <wei.chen@arm.com>
> > ---
> >  xen/include/asm-x86/mm.h | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
> > index cb90527499..af2fc4b0cd 100644
> > --- a/xen/include/asm-x86/mm.h
> > +++ b/xen/include/asm-x86/mm.h
> > @@ -475,6 +475,16 @@ 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)
> > +{
> > +    mem_hotplug = end;
> > +}
> > +
> > +static inline paddr_t mem_hotplug_boundary(void)
> > +{
> > +    return mem_hotplug;
> > +}
> > +
> >
> /*************************************************************************
> *****
> >   * With shadow pagetables, the different kinds of address start
> >   * to get get confusing.
> 
> Imo for this to make sense you want to also use the new functions
> right away in the place(s) where the direct access(es) get(s) in
> your way.
> 

OK, I will merge this patch with the patch that will use these
functions firstly. 

> Jan
diff mbox series

Patch

diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index cb90527499..af2fc4b0cd 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -475,6 +475,16 @@  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)
+{
+    mem_hotplug = end;
+}
+
+static inline paddr_t mem_hotplug_boundary(void)
+{
+    return mem_hotplug;
+}
+
 /******************************************************************************
  * With shadow pagetables, the different kinds of address start
  * to get get confusing.