Skip to contentSkip to conversation

x86/bigmem: eliminate struct domain address width restriction

PATCH Superseded Jan Beulich 3 participants 5 messages Aug 26, 2015 – Sep 1, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/bigmem: eliminate struct domain address width restriction

PDX-es are 64 bits wide in that case, and hence no limit needs to be enforced.

xen/arch/x86/domain.c +7 -0
@@ -204,6 +204,7 @@ smap_check_policy_t smap_policy_change(s
     return old_policy;
 }
 
+#ifndef CONFIG_BIGMEM
 /*
  * The hole may be at or above the 44-bit boundary, so we need to determine
  * the total bit count until reaching 32 significant (not squashed out) bits
@@ -225,10 +226,12 @@ static unsigned int __init noinline _dom
 
     return bits;
 }
+#endif
 
 struct domain *alloc_domain_struct(void)
 {
     struct domain *d;
+#ifndef CONFIG_BIGMEM
     /*
      * We pack the PDX of the domain structure into a 32-bit field within
      * the page_info structure. Hence the MEMF_bits() restriction.
@@ -237,12 +240,16 @@ struct domain *alloc_domain_struct(void)
 
     if ( unlikely(!bits) )
          bits = _domain_struct_bits();
+#else
+# define bits 0
+#endif
 
     BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
     d = alloc_xenheap_pages(0, MEMF_bits(bits));
     if ( d != NULL )
         clear_page(d);
     return d;
+#undef bits
 }
 
 void free_domain_struct(struct domain *d)

x86/bigmem: eliminate struct domain address width restriction

PDX-es are 64 bits wide in that case, and hence no limit needs to be enforced.

xen/arch/x86/domain.c +7 -0
@@ -204,6 +204,7 @@ smap_check_policy_t smap_policy_change(s
     return old_policy;
 }
 
+#ifndef CONFIG_BIGMEM
 /*
  * The hole may be at or above the 44-bit boundary, so we need to determine
  * the total bit count until reaching 32 significant (not squashed out) bits
@@ -225,10 +226,12 @@ static unsigned int __init noinline _dom
 
     return bits;
 }
+#endif
 
 struct domain *alloc_domain_struct(void)
 {
     struct domain *d;
+#ifndef CONFIG_BIGMEM
     /*
      * We pack the PDX of the domain structure into a 32-bit field within
      * the page_info structure. Hence the MEMF_bits() restriction.
@@ -237,12 +240,16 @@ struct domain *alloc_domain_struct(void)
 
     if ( unlikely(!bits) )
          bits = _domain_struct_bits();
+#else
+# define bits 0
+#endif
 
     BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
     d = alloc_xenheap_pages(0, MEMF_bits(bits));
     if ( d != NULL )
         clear_page(d);
     return d;
+#undef bits
 }
 
 void free_domain_struct(struct domain *d)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
In reply to Jan Beulich
Quoted 15 lines · Jan Beulich
xen/arch/x86/domain.c +2 -0
@@ -225,10 +226,12 @@ static unsigned int __init noinline _dom
 
     return bits;
 }
+#endif
 
 struct domain *alloc_domain_struct(void)
 {
     struct domain *d;
+#ifndef CONFIG_BIGMEM
     /*
      * We pack the PDX of the domain structure into a 32-bit field 

within
* the page_info structure. Hence the MEMF_bits() restriction.

xen/arch/x86/domain.c struct domain *alloc_domain_struct(void) · line 244

Quoted 5 lines
xen/arch/x86/domain.c +2 -0
@@ -237,12 +240,16 @@ struct domain *alloc_domain_struct(void)
 
     if ( unlikely(!bits) )
          bits = _domain_struct_bits();
+#else
+# define bits 0

const unsigned int bits = 0;

Seems nicer than the trailing #undef?

Quoted 18 lines
xen/arch/x86/domain.c +2 -0
+#endif
 
     BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
     d = alloc_xenheap_pages(0, MEMF_bits(bits));
     if ( d != NULL )
         clear_page(d);
     return d;
+#undef bits
 }
 
 void free_domain_struct(struct domain *d)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 01.09.15 at 12:57, <[email protected]> wrote:
Quoted 16 lines · Jan Beulich
xen/arch/x86/domain.c +2 -0
@@ -225,10 +226,12 @@ static unsigned int __init noinline _dom
 
     return bits;
 }
+#endif
 
 struct domain *alloc_domain_struct(void)
 {
     struct domain *d;
+#ifndef CONFIG_BIGMEM
     /*
      * We pack the PDX of the domain structure into a 32-bit field 

within
* the page_info structure. Hence the MEMF_bits() restriction.

(quoted diff) +0 -0
@@ -237,12 +240,16 @@ struct domain *alloc_domain_struct(void)
 
Quoted 8 lines

xen/arch/x86/domain.c struct domain *alloc_domain_struct(void) · line 244

Quoted 4 lines
xen/arch/x86/domain.c +2 -0
     if ( unlikely(!bits) )
          bits = _domain_struct_bits();
+#else
+# define bits 0

const unsigned int bits = 0;

Seems nicer than the trailing #undef?

Hmm, yes, in cases like this I agree (assuming that all compiler versions we care about will be intelligent enough to eliminate the variable).

Jan

#4 lore raw
Quoted 26 lines · Jan Beulich
Quoted 26 lines
Quoted 2 lines
Quoted 2 lines · On 01.09.15 at 12:57, <[email protected]> wrote:
Quoted 15 lines · Jan Beulich
xen/arch/x86/domain.c +2 -0
@@ -225,10 +226,12 @@ static unsigned int __init noinline _dom
 
     return bits;
 }
+#endif
 
 struct domain *alloc_domain_struct(void)
 {
     struct domain *d;
+#ifndef CONFIG_BIGMEM
     /*
      * We pack the PDX of the domain structure into a 32-bit field 

within
* the page_info structure. Hence the MEMF_bits() restriction.

xen/arch/x86/domain.c struct domain *alloc_domain_struct(void) · line 244

Quoted 5 lines
xen/arch/x86/domain.c +2 -0
@@ -237,12 +240,16 @@ struct domain *alloc_domain_struct(void)
 
     if ( unlikely(!bits) )
          bits = _domain_struct_bits();
+#else
+# define bits 0

const unsigned int bits = 0;

Quoted 5 lines
Quoted 1 line

Seems nicer than the trailing #undef?

Hmm, yes, in cases like this I agree (assuming that all compiler versions we care about will be intelligent enough to eliminate the variable).

Even if it weren't I don't think it would be noticeable in alloc_domain_struct().

Ian.