Skip to contentSkip to conversation

x86/mm: Allow map_domain_page_global() to be used during boot

PATCH In review Andrew Cooper 2 participants 4 messages Sep 7, 2017 – Sep 8, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mm: Allow map_domain_page_global() to be used during boot

map_domain_page_global() uses vmap under the hood, which works fine even during very early boot. Relax the local_irq_is_enabled() part of the assertion before Xen has finished booting.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>

---
 xen/arch/x86/domain_page.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/domain_page.c +2 -1
index 0463e9a..b03c85d 100644
@@ -305,7 +305,8 @@ int mapcache_vcpu_init(struct vcpu *v)
 
 void *map_domain_page_global(mfn_t mfn)
 {
-    ASSERT(!in_irq() && local_irq_is_enabled());
+    ASSERT(!in_irq() && (system_state < SYS_STATE_active ||
+                         local_irq_is_enabled()));
 
 #ifdef NDEBUG
     if ( mfn_x(mfn) <= PFN_DOWN(__pa(HYPERVISOR_VIRT_END - 1)) )
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 07.09.17 at 18:50, <[email protected]> wrote:

map_domain_page_global() uses vmap under the hood, which works fine even during very early boot. Relax the local_irq_is_enabled() part of the assertion before Xen has finished booting.

vm_init() being called right after having reached SYS_STATE_boot makes me question the "very early" in your description.

xen/arch/x86/domain_page.c int mapcache_vcpu_init(struct vcpu *v) · line 309

Quoted 9 lines
xen/arch/x86/domain_page.c +2 -1
@@ -305,7 +305,8 @@ int mapcache_vcpu_init(struct vcpu *v)
 
 void *map_domain_page_global(mfn_t mfn)
 {
-    ASSERT(!in_irq() && local_irq_is_enabled());
+    ASSERT(!in_irq() && (system_state < SYS_STATE_active ||
+                         local_irq_is_enabled()));

Extending the assertion to also trigger on SYS_STATE_early_boot would therefore seem desirable, too. Leaving SYS_STATE_{suspend,resume} aside is hopefully going to be okay for the moment.

Jan

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

#2 lore raw
Quoted 6 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 07.09.17 at 18:50, <[email protected]> wrote:

map_domain_page_global() uses vmap under the hood, which works fine even during very early boot. Relax the local_irq_is_enabled() part of the assertion before Xen has finished booting.

vm_init() being called right after having reached SYS_STATE_boot makes me question the "very early" in your description.

Not that early. AP setup.

Quoted 5 lines
Quoted 5 lines
xen/arch/x86/domain_page.c +0 -0
@@ -305,7 +305,8 @@ int mapcache_vcpu_init(struct vcpu *v)
 
Quoted 9 lines

xen/arch/x86/domain_page.c int mapcache_vcpu_init(struct vcpu *v) · line 309

Quoted 5 lines
xen/arch/x86/domain_page.c +2 -1
 void *map_domain_page_global(mfn_t mfn)
 {
-    ASSERT(!in_irq() && local_irq_is_enabled());
+    ASSERT(!in_irq() && (system_state < SYS_STATE_active ||
+                         local_irq_is_enabled()));

Extending the assertion to also trigger on SYS_STATE_early_boot would therefore seem desirable, too. Leaving SYS_STATE_{suspend,resume} aside is hopefully going to be okay for the moment.

ASSERT(!in_irq() &&

       ((system_state >= SYS_STATE_boot &&
         system_state < SYS_STATE_active) ||
        local_irq_is_enabled()));

is about the neatest I can come up with.

~Andrew

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

Reviewed-by
#3 lore raw
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 08.09.17 at 13:03, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 07.09.17 at 18:50, <[email protected]> wrote:

map_domain_page_global() uses vmap under the hood, which works fine even during very early boot. Relax the local_irq_is_enabled() part of the assertion before Xen has finished booting.

vm_init() being called right after having reached SYS_STATE_boot makes me question the "very early" in your description.

Not that early. AP setup.

Could you clarify that then in the sentence?

Quoted 14 lines
Quoted 4 lines
Quoted 4 lines
xen/arch/x86/domain_page.c +0 -0
@@ -305,7 +305,8 @@ int mapcache_vcpu_init(struct vcpu *v)
 
Quoted 9 lines

xen/arch/x86/domain_page.c int mapcache_vcpu_init(struct vcpu *v) · line 309

Quoted 5 lines
xen/arch/x86/domain_page.c +2 -1
 void *map_domain_page_global(mfn_t mfn)
 {
-    ASSERT(!in_irq() && local_irq_is_enabled());
+    ASSERT(!in_irq() && (system_state < SYS_STATE_active ||
+                         local_irq_is_enabled()));

Extending the assertion to also trigger on SYS_STATE_early_boot would therefore seem desirable, too. Leaving SYS_STATE_{suspend,resume} aside is hopefully going to be okay for the moment.

Quoted 6 lines

ASSERT(!in_irq() &&

       ((system_state >= SYS_STATE_boot &&
         system_state < SYS_STATE_active) ||
        local_irq_is_enabled()));

is about the neatest I can come up with.

LGTM, i.e. with this

Jan

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