xen/arch/arm/include/asm/numa.h | 6 ------ xen/arch/ppc/include/asm/numa.h | 6 ------ xen/common/page_alloc.c | 6 ++++-- xen/include/xen/numa.h | 2 ++ 4 files changed, 6 insertions(+), 14 deletions(-)
Such declaration is moved in order to provide it for Arm and PPC,
whilst not violating MISRA C:2012 Rule 8.4 in common/page_alloc.c:
"A compatible declaration shall be visible when an object or
function with external linkage is defined".
Signed-off-by: Julien Grall <julien@xen.org>
Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
Changes in v2:
This patch is a rework of a previous one appeared in this series [1], of which
patches 1 and 2 have been committed already.
The updated patch was provided by Julien in this thread [2]. I added the commit
message and the rest of the information.
[1] https://lore.kernel.org/xen-devel/cover.1702285639.git.nicola.vetrini@bugseng.com/T/#mee6def855787d932fe2f10d5648d437dcb6f046c
[2] https://lore.kernel.org/xen-devel/cover.1702285639.git.nicola.vetrini@bugseng.com/T/#m3c5b141b806530b5920bb5e9dd53631195560317
---
xen/arch/arm/include/asm/numa.h | 6 ------
xen/arch/ppc/include/asm/numa.h | 6 ------
xen/common/page_alloc.c | 6 ++++--
xen/include/xen/numa.h | 2 ++
4 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/xen/arch/arm/include/asm/numa.h b/xen/arch/arm/include/asm/numa.h
index e2bee2bd8223..a2c1da4a82f7 100644
--- a/xen/arch/arm/include/asm/numa.h
+++ b/xen/arch/arm/include/asm/numa.h
@@ -11,12 +11,6 @@ typedef u8 nodeid_t;
#define cpu_to_node(cpu) 0
#define node_to_cpumask(node) (cpu_online_map)
-/*
- * TODO: make first_valid_mfn static when NUMA is supported on Arm, this
- * is required because the dummy helpers are using it.
- */
-extern mfn_t first_valid_mfn;
-
/* XXX: implement NUMA support */
#define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
#define node_start_pfn(nid) (mfn_x(first_valid_mfn))
diff --git a/xen/arch/ppc/include/asm/numa.h b/xen/arch/ppc/include/asm/numa.h
index 7fdf66c3da74..204180ad5b98 100644
--- a/xen/arch/ppc/include/asm/numa.h
+++ b/xen/arch/ppc/include/asm/numa.h
@@ -10,12 +10,6 @@ typedef uint8_t nodeid_t;
#define cpu_to_node(cpu) 0
#define node_to_cpumask(node) (cpu_online_map)
-/*
- * TODO: make first_valid_mfn static when NUMA is supported on PPC, this
- * is required because the dummy helpers are using it.
- */
-extern mfn_t first_valid_mfn;
-
/* XXX: implement NUMA support */
#define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
#define node_start_pfn(nid) (mfn_x(first_valid_mfn))
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 9b5df74fddab..d874525916ea 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -255,8 +255,10 @@ static PAGE_LIST_HEAD(page_broken_list);
*/
/*
- * first_valid_mfn is exported because it is use in ARM specific NUMA
- * helpers. See comment in arch/arm/include/asm/numa.h.
+ * first_valid_mfn is exported because it is used when !CONFIG_NUMA.
+ *
+ * TODO: Consider if we can conditionally export first_valid_mfn based
+ * on whether NUMA is selected.
*/
mfn_t first_valid_mfn = INVALID_MFN_INITIALIZER;
diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
index 287e81ff6666..a10d4b1778a0 100644
--- a/xen/include/xen/numa.h
+++ b/xen/include/xen/numa.h
@@ -108,6 +108,8 @@ extern void numa_set_processor_nodes_parsed(nodeid_t node);
#else
+extern mfn_t first_valid_mfn;
+
static inline nodeid_t mfn_to_nid(mfn_t mfn)
{
return 0;
--
2.34.1
On Mon, 18 Dec 2023, Nicola Vetrini wrote:
> Such declaration is moved in order to provide it for Arm and PPC,
> whilst not violating MISRA C:2012 Rule 8.4 in common/page_alloc.c:
> "A compatible declaration shall be visible when an object or
> function with external linkage is defined".
>
> Signed-off-by: Julien Grall <julien@xen.org>
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> ---
> Changes in v2:
> This patch is a rework of a previous one appeared in this series [1], of which
> patches 1 and 2 have been committed already.
>
> The updated patch was provided by Julien in this thread [2]. I added the commit
> message and the rest of the information.
>
> [1] https://lore.kernel.org/xen-devel/cover.1702285639.git.nicola.vetrini@bugseng.com/T/#mee6def855787d932fe2f10d5648d437dcb6f046c
> [2] https://lore.kernel.org/xen-devel/cover.1702285639.git.nicola.vetrini@bugseng.com/T/#m3c5b141b806530b5920bb5e9dd53631195560317
> ---
> xen/arch/arm/include/asm/numa.h | 6 ------
> xen/arch/ppc/include/asm/numa.h | 6 ------
> xen/common/page_alloc.c | 6 ++++--
> xen/include/xen/numa.h | 2 ++
> 4 files changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/xen/arch/arm/include/asm/numa.h b/xen/arch/arm/include/asm/numa.h
> index e2bee2bd8223..a2c1da4a82f7 100644
> --- a/xen/arch/arm/include/asm/numa.h
> +++ b/xen/arch/arm/include/asm/numa.h
> @@ -11,12 +11,6 @@ typedef u8 nodeid_t;
> #define cpu_to_node(cpu) 0
> #define node_to_cpumask(node) (cpu_online_map)
>
> -/*
> - * TODO: make first_valid_mfn static when NUMA is supported on Arm, this
> - * is required because the dummy helpers are using it.
> - */
> -extern mfn_t first_valid_mfn;
> -
> /* XXX: implement NUMA support */
> #define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
> #define node_start_pfn(nid) (mfn_x(first_valid_mfn))
> diff --git a/xen/arch/ppc/include/asm/numa.h b/xen/arch/ppc/include/asm/numa.h
> index 7fdf66c3da74..204180ad5b98 100644
> --- a/xen/arch/ppc/include/asm/numa.h
> +++ b/xen/arch/ppc/include/asm/numa.h
> @@ -10,12 +10,6 @@ typedef uint8_t nodeid_t;
> #define cpu_to_node(cpu) 0
> #define node_to_cpumask(node) (cpu_online_map)
>
> -/*
> - * TODO: make first_valid_mfn static when NUMA is supported on PPC, this
> - * is required because the dummy helpers are using it.
> - */
> -extern mfn_t first_valid_mfn;
> -
> /* XXX: implement NUMA support */
> #define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
> #define node_start_pfn(nid) (mfn_x(first_valid_mfn))
> diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
> index 9b5df74fddab..d874525916ea 100644
> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -255,8 +255,10 @@ static PAGE_LIST_HEAD(page_broken_list);
> */
>
> /*
> - * first_valid_mfn is exported because it is use in ARM specific NUMA
> - * helpers. See comment in arch/arm/include/asm/numa.h.
> + * first_valid_mfn is exported because it is used when !CONFIG_NUMA.
> + *
> + * TODO: Consider if we can conditionally export first_valid_mfn based
> + * on whether NUMA is selected.
> */
> mfn_t first_valid_mfn = INVALID_MFN_INITIALIZER;
>
> diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
> index 287e81ff6666..a10d4b1778a0 100644
> --- a/xen/include/xen/numa.h
> +++ b/xen/include/xen/numa.h
> @@ -108,6 +108,8 @@ extern void numa_set_processor_nodes_parsed(nodeid_t node);
>
> #else
>
> +extern mfn_t first_valid_mfn;
> +
> static inline nodeid_t mfn_to_nid(mfn_t mfn)
> {
> return 0;
> --
> 2.34.1
>
On 19.12.2023 02:48, Stefano Stabellini wrote: > On Mon, 18 Dec 2023, Nicola Vetrini wrote: >> Such declaration is moved in order to provide it for Arm and PPC, >> whilst not violating MISRA C:2012 Rule 8.4 in common/page_alloc.c: >> "A compatible declaration shall be visible when an object or >> function with external linkage is defined". >> >> Signed-off-by: Julien Grall <julien@xen.org> >> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> > > Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> I was about to submit my replacement, just to find that this was committed during my night. I have to admit that I absolutely do not understand the need for rushing here; I thought I said quite clearly that I will come forward with a patch dealing with two issues in one go. Now I need to go and re-base my change, because all of what this patch touches is also touched by my change, as the 2nd issue (the pointless presence of asm/numa.h and the need for RISC-V to introduce a 3rd instance if nothing is done up front) is still there. Jan
On Wed, 20 Dec 2023, Jan Beulich wrote: > On 19.12.2023 02:48, Stefano Stabellini wrote: > > On Mon, 18 Dec 2023, Nicola Vetrini wrote: > >> Such declaration is moved in order to provide it for Arm and PPC, > >> whilst not violating MISRA C:2012 Rule 8.4 in common/page_alloc.c: > >> "A compatible declaration shall be visible when an object or > >> function with external linkage is defined". > >> > >> Signed-off-by: Julien Grall <julien@xen.org> > >> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> > > > > Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > > I was about to submit my replacement, just to find that this was committed > during my night. I have to admit that I absolutely do not understand the > need for rushing here; I thought I said quite clearly that I will come > forward with a patch dealing with two issues in one go. Now I need to go > and re-base my change, because all of what this patch touches is also > touched by my change, as the 2nd issue (the pointless presence of > asm/numa.h and the need for RISC-V to introduce a 3rd instance if nothing > is done up front) is still there. Hi Jan, Sorry about that. As you might have noticed I typically wait at least 1-2 days but this time I wasn't sure I would be able to come back online before the Holidays and I was trying to clean things up. I apologize.
© 2016 - 2026 Red Hat, Inc.