diff mbox

[v2,04/30] xen/x86: allow calling {sh/hap}_set_allocation with the idle domain

Message ID 1474991845-27962-5-git-send-email-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné Sept. 27, 2016, 3:56 p.m. UTC
... and using the "preempted" parameter. The solution relies on just calling
softirq_pending if the current domain is the idle domain.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/hap/hap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jan Beulich Sept. 29, 2016, 10:43 a.m. UTC | #1
>>> On 27.09.16 at 17:56, <roger.pau@citrix.com> wrote:
> --- a/xen/arch/x86/mm/hap/hap.c
> +++ b/xen/arch/x86/mm/hap/hap.c
> @@ -379,7 +379,9 @@ hap_set_allocation(struct domain *d, unsigned long pages, int *preempted)
>              break;
>  
>          /* Check to see if we need to yield and try again */
> -        if ( preempted && hypercall_preempt_check() )
> +        if ( preempted &&
> +             (is_idle_vcpu(current) ? softirq_pending(smp_processor_id()) :
> +                                      hypercall_preempt_check()) )

So what is the supposed action for the caller to take in this case?
I think this should at least be spelled out in the commit message.

Jan
Roger Pau Monné Sept. 29, 2016, 2:37 p.m. UTC | #2
On Thu, Sep 29, 2016 at 04:43:07AM -0600, Jan Beulich wrote:
> >>> On 27.09.16 at 17:56, <roger.pau@citrix.com> wrote:
> > --- a/xen/arch/x86/mm/hap/hap.c
> > +++ b/xen/arch/x86/mm/hap/hap.c
> > @@ -379,7 +379,9 @@ hap_set_allocation(struct domain *d, unsigned long pages, int *preempted)
> >              break;
> >  
> >          /* Check to see if we need to yield and try again */
> > -        if ( preempted && hypercall_preempt_check() )
> > +        if ( preempted &&
> > +             (is_idle_vcpu(current) ? softirq_pending(smp_processor_id()) :
> > +                                      hypercall_preempt_check()) )
> 
> So what is the supposed action for the caller to take in this case?
> I think this should at least be spelled out in the commit message.

I'm not sure I follow, but I assume you mean in the idle vcpu case?

In that case the caller should call process_pending_softirqs. I will modify 
the commit message to include it.

Roger.
Jan Beulich Sept. 29, 2016, 4:10 p.m. UTC | #3
>>> On 29.09.16 at 16:37, <roger.pau@citrix.com> wrote:
> On Thu, Sep 29, 2016 at 04:43:07AM -0600, Jan Beulich wrote:
>> >>> On 27.09.16 at 17:56, <roger.pau@citrix.com> wrote:
>> > --- a/xen/arch/x86/mm/hap/hap.c
>> > +++ b/xen/arch/x86/mm/hap/hap.c
>> > @@ -379,7 +379,9 @@ hap_set_allocation(struct domain *d, unsigned long 
> pages, int *preempted)
>> >              break;
>> >  
>> >          /* Check to see if we need to yield and try again */
>> > -        if ( preempted && hypercall_preempt_check() )
>> > +        if ( preempted &&
>> > +             (is_idle_vcpu(current) ? softirq_pending(smp_processor_id()) 
> :
>> > +                                      hypercall_preempt_check()) )
>> 
>> So what is the supposed action for the caller to take in this case?
>> I think this should at least be spelled out in the commit message.
> 
> I'm not sure I follow, but I assume you mean in the idle vcpu case?

Yes. Right now it is expected to schedule a hypercall continuation.

> In that case the caller should call process_pending_softirqs. I will modify 
> the commit message to include it.

Thanks.

Jan
George Dunlap Sept. 30, 2016, 4:56 p.m. UTC | #4
On 27/09/16 16:56, Roger Pau Monne wrote:
> ... and using the "preempted" parameter. The solution relies on just calling
> softirq_pending if the current domain is the idle domain.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

You probably also want to add something to the effect of:

"This allows us to call *_set_allocation() when building domain 0."

Someone doing archeology doesn't want to dig out this series to figure
out how it would be possible to call hap_set_allocation() while idle. :-)

 -George
George Dunlap Sept. 30, 2016, 4:56 p.m. UTC | #5
On 30/09/16 17:56, George Dunlap wrote:
> On 27/09/16 16:56, Roger Pau Monne wrote:
>> ... and using the "preempted" parameter. The solution relies on just calling
>> softirq_pending if the current domain is the idle domain.
>>
>> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> 
> You probably also want to add something to the effect of:
> 
> "This allows us to call *_set_allocation() when building domain 0."
> 
> Someone doing archeology doesn't want to dig out this series to figure
> out how it would be possible to call hap_set_allocation() while idle. :-)

Oh, but when the comments have been addressed, you can add:

Acked-by: George Dunlap <george.dunlap@citrix.com>
diff mbox

Patch

diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index b6d2c61..2dc82f5 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -379,7 +379,9 @@  hap_set_allocation(struct domain *d, unsigned long pages, int *preempted)
             break;
 
         /* Check to see if we need to yield and try again */
-        if ( preempted && hypercall_preempt_check() )
+        if ( preempted &&
+             (is_idle_vcpu(current) ? softirq_pending(smp_processor_id()) :
+                                      hypercall_preempt_check()) )
         {
             *preempted = 1;
             return 0;