xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/mm: Allow map_domain_page_global() to be used during boot
@ 2017-09-07 16:50 Andrew Cooper
  2017-09-08  9:57 ` Jan Beulich
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2017-09-07 16:50 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Wei Liu, Jan Beulich

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.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 xen/arch/x86/domain_page.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/domain_page.c b/xen/arch/x86/domain_page.c
index 0463e9a..b03c85d 100644
--- a/xen/arch/x86/domain_page.c
+++ b/xen/arch/x86/domain_page.c
@@ -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)) )
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/mm: Allow map_domain_page_global() to be used during boot
  2017-09-07 16:50 [PATCH] x86/mm: Allow map_domain_page_global() to be used during boot Andrew Cooper
@ 2017-09-08  9:57 ` Jan Beulich
  2017-09-08 11:03   ` Andrew Cooper
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2017-09-08  9:57 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Wei Liu, Xen-devel

>>> On 07.09.17 at 18:50, <andrew.cooper3@citrix.com> 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.

> --- a/xen/arch/x86/domain_page.c
> +++ b/xen/arch/x86/domain_page.c
> @@ -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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/mm: Allow map_domain_page_global() to be used during boot
  2017-09-08  9:57 ` Jan Beulich
@ 2017-09-08 11:03   ` Andrew Cooper
  2017-09-08 12:20     ` Jan Beulich
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2017-09-08 11:03 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Wei Liu, Xen-devel

On 08/09/17 10:57, Jan Beulich wrote:
>>>> On 07.09.17 at 18:50, <andrew.cooper3@citrix.com> 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.

>
>> --- a/xen/arch/x86/domain_page.c
>> +++ b/xen/arch/x86/domain_page.c
>> @@ -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.

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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/mm: Allow map_domain_page_global() to be used during boot
  2017-09-08 11:03   ` Andrew Cooper
@ 2017-09-08 12:20     ` Jan Beulich
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2017-09-08 12:20 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Wei Liu, Xen-devel

>>> On 08.09.17 at 13:03, <andrew.cooper3@citrix.com> wrote:
> On 08/09/17 10:57, Jan Beulich wrote:
>>>>> On 07.09.17 at 18:50, <andrew.cooper3@citrix.com> 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?

>>> --- a/xen/arch/x86/domain_page.c
>>> +++ b/xen/arch/x86/domain_page.c
>>> @@ -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.
> 
> 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
Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-08 12:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-07 16:50 [PATCH] x86/mm: Allow map_domain_page_global() to be used during boot Andrew Cooper
2017-09-08  9:57 ` Jan Beulich
2017-09-08 11:03   ` Andrew Cooper
2017-09-08 12:20     ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).