Skip to contentSkip to conversation

xen/arm: livepatch: Include xen/mm.h rather than asm/mm.h

PATCH In review Julien Grall 4 participants 4 messages Jan 15, 2021 – Jan 18, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: livepatch: Include xen/mm.h rather than asm/mm.h

From: Julien Grall <[email protected]>

Livepatch fails to build on Arm after commit ced9795c6cb4 "mm: split out mfn_t / gfn_t / pfn_t definitions and helpers":

In file included from livepatch.c:13:0:
/oss/xen/xen/include/asm/mm.h:32:28: error: field ‘list’ has incomplete type

     struct page_list_entry list;
                            ^~~~
/oss/xen/xen/include/asm/mm.h:53:43: error: ‘MAX_ORDER’ undeclared here (not in a function); did you mean ‘PFN_ORDER’?
                 unsigned long first_dirty:MAX_ORDER + 1;
                                           ^~~~~~~~~
                                           PFN_ORDER
/oss/xen/xen/include/asm/mm.h:53:31: error: bit-field ‘first_dirty’ width not an integer constant
                 unsigned long first_dirty:MAX_ORDER + 1;
                               ^~~~~~~~~~~

This is happening because asm/mm.h is included directly by livepatch.c. Yet it depends on xen/mm.h to be included first so MAX_ORDER is defined.

Resolve the build failure by including xen/mm.h rather than asm/mm.h.

Fixes ced9795c6cb4 ("mm: split out mfn_t / gfn_t / pfn_t definitions and helpers")
---
 xen/arch/arm/livepatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/livepatch.c +1 -1
index 915e9d926a11..75e8adcfd6a1 100644
@@ -6,11 +6,11 @@
 #include <xen/lib.h>
 #include <xen/livepatch_elf.h>
 #include <xen/livepatch.h>
+#include <xen/mm.h>
 #include <xen/vmap.h>
 
 #include <asm/cpufeature.h>
 #include <asm/livepatch.h>
-#include <asm/mm.h>
 
 /* Override macros from asm/page.h to make them work with mfn_t */
 #undef virt_to_mfn
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Julien Grall

From: Julien Grall <[email protected]>

Livepatch fails to build on Arm after commit ced9795c6cb4 "mm: split out mfn_t / gfn_t / pfn_t definitions and helpers":

In file included from livepatch.c:13:0:
/oss/xen/xen/include/asm/mm.h:32:28: error: field ‘list’ has incomplete type

     struct page_list_entry list;
                            ^~~~
/oss/xen/xen/include/asm/mm.h:53:43: error: ‘MAX_ORDER’ undeclared here (not in a function); did you mean ‘PFN_ORDER’?
                 unsigned long first_dirty:MAX_ORDER + 1;
                                           ^~~~~~~~~
                                           PFN_ORDER
/oss/xen/xen/include/asm/mm.h:53:31: error: bit-field ‘first_dirty’ width not an integer constant
                 unsigned long first_dirty:MAX_ORDER + 1;
                               ^~~~~~~~~~~
Quoted 6 lines

This is happening because asm/mm.h is included directly by livepatch.c. Yet it depends on xen/mm.h to be included first so MAX_ORDER is defined.

Resolve the build failure by including xen/mm.h rather than asm/mm.h.

Fixes ced9795c6cb4 ("mm: split out mfn_t / gfn_t / pfn_t definitions and helpers")

Thank you!

Quoted 25 lines
---
 xen/arch/arm/livepatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/livepatch.c +1 -1
index 915e9d926a11..75e8adcfd6a1 100644
@@ -6,11 +6,11 @@
 #include <xen/lib.h>
 #include <xen/livepatch_elf.h>
 #include <xen/livepatch.h>
+#include <xen/mm.h>
 #include <xen/vmap.h>
 
 #include <asm/cpufeature.h>
 #include <asm/livepatch.h>
-#include <asm/mm.h>
 
 /* Override macros from asm/page.h to make them work with mfn_t */
 #undef virt_to_mfn
Signature · 1 line
2.17.1
#2 lore raw
Quoted 18 lines · Konrad Rzeszutek Wilk
Quoted 17 lines · Julien Grall

From: Julien Grall <[email protected]>

Livepatch fails to build on Arm after commit ced9795c6cb4 "mm: split out mfn_t / gfn_t / pfn_t definitions and helpers":

In file included from livepatch.c:13:0:
/oss/xen/xen/include/asm/mm.h:32:28: error: field ‘list’ has incomplete type

     struct page_list_entry list;
                            ^~~~
/oss/xen/xen/include/asm/mm.h:53:43: error: ‘MAX_ORDER’ undeclared here (not in a function); did you mean ‘PFN_ORDER’?
                 unsigned long first_dirty:MAX_ORDER + 1;
                                           ^~~~~~~~~
                                           PFN_ORDER
/oss/xen/xen/include/asm/mm.h:53:31: error: bit-field ‘first_dirty’ width not an integer constant
                 unsigned long first_dirty:MAX_ORDER + 1;
                               ^~~~~~~~~~~
Quoted 7 lines
Quoted 6 lines

This is happening because asm/mm.h is included directly by livepatch.c. Yet it depends on xen/mm.h to be included first so MAX_ORDER is defined.

Resolve the build failure by including xen/mm.h rather than asm/mm.h.

Fixes ced9795c6cb4 ("mm: split out mfn_t / gfn_t / pfn_t definitions and helpers")
Quoted 27 lines

Thank you!

Quoted 25 lines
---
 xen/arch/arm/livepatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/livepatch.c +1 -1
index 915e9d926a11..75e8adcfd6a1 100644
@@ -6,11 +6,11 @@
 #include <xen/lib.h>
 #include <xen/livepatch_elf.h>
 #include <xen/livepatch.h>
+#include <xen/mm.h>
 #include <xen/vmap.h>
 
 #include <asm/cpufeature.h>
 #include <asm/livepatch.h>
-#include <asm/mm.h>
 
 /* Override macros from asm/page.h to make them work with mfn_t */
 #undef virt_to_mfn
Signature · 1 line
2.17.1
#3 lore raw
In reply to Julien Grall
Quoted 17 lines · Julien Grall

From: Julien Grall <[email protected]>

Livepatch fails to build on Arm after commit ced9795c6cb4 "mm: split out mfn_t / gfn_t / pfn_t definitions and helpers":

In file included from livepatch.c:13:0:
/oss/xen/xen/include/asm/mm.h:32:28: error: field ‘list’ has incomplete type

     struct page_list_entry list;
                            ^~~~
/oss/xen/xen/include/asm/mm.h:53:43: error: ‘MAX_ORDER’ undeclared here (not in a function); did you mean ‘PFN_ORDER’?
                 unsigned long first_dirty:MAX_ORDER + 1;
                                           ^~~~~~~~~
                                           PFN_ORDER
/oss/xen/xen/include/asm/mm.h:53:31: error: bit-field ‘first_dirty’ width not an integer constant
                 unsigned long first_dirty:MAX_ORDER + 1;
                               ^~~~~~~~~~~
Quoted 7 lines

This is happening because asm/mm.h is included directly by livepatch.c. Yet it depends on xen/mm.h to be included first so MAX_ORDER is defined.

Resolve the build failure by including xen/mm.h rather than asm/mm.h.

Fixes ced9795c6cb4 ("mm: split out mfn_t / gfn_t / pfn_t definitions and helpers")

Thanks for the quick fix, and I'm sorry for the breakage. I'll try to make sure I'll also check building with livepatch enabled down the road.

Jan