diff mbox

[Xen-devel,2/2] xen/arm: call vcpu_yield on WFE trap

Message ID 1406117103-10584-2-git-send-email-stefano.stabellini@eu.citrix.com
State New
Headers show

Commit Message

Stefano Stabellini July 23, 2014, 12:05 p.m. UTC
No need to call vcpu_force_reschedule, is too expensive.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen/arch/arm/traps.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

George Dunlap July 23, 2014, 1:11 p.m. UTC | #1
On Wed, Jul 23, 2014 at 1:05 PM, Stefano Stabellini
<stefano.stabellini@eu.citrix.com> wrote:
> No need to call vcpu_force_reschedule, is too expensive.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
>  xen/arch/arm/traps.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index 3dfabd0..8cd06cc 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -1805,7 +1805,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
>          }
>          if ( hsr.wfi_wfe.ti ) {
>              /* Yield the VCPU for WFE */
> -            vcpu_force_reschedule(current);
> +            vcpu_yield(current);

Actually, sorry -- why are you wanting to yield here?

At the moment "yield" is only initiated by the guest itself, and the
individual schedulers are notified that the guest has called "yield".
If what you want to do is yield for some other reason, it might be
better to have a slightly separate path for that.

 -George
Stefano Stabellini July 23, 2014, 1:13 p.m. UTC | #2
On Wed, 23 Jul 2014, George Dunlap wrote:
> On Wed, Jul 23, 2014 at 1:05 PM, Stefano Stabellini
> <stefano.stabellini@eu.citrix.com> wrote:
> > No need to call vcpu_force_reschedule, is too expensive.
> >
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > ---
> >  xen/arch/arm/traps.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> > index 3dfabd0..8cd06cc 100644
> > --- a/xen/arch/arm/traps.c
> > +++ b/xen/arch/arm/traps.c
> > @@ -1805,7 +1805,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
> >          }
> >          if ( hsr.wfi_wfe.ti ) {
> >              /* Yield the VCPU for WFE */
> > -            vcpu_force_reschedule(current);
> > +            vcpu_yield(current);
> 
> Actually, sorry -- why are you wanting to yield here?
> 
> At the moment "yield" is only initiated by the guest itself, and the
> individual schedulers are notified that the guest has called "yield".
> If what you want to do is yield for some other reason, it might be
> better to have a slightly separate path for that.
 
It is a very similar situation: WFE means "wait for event" and it is
used in the implementation of spin_locks, for example.
I think that trapping the instruction and yielding is what we want.
George Dunlap July 23, 2014, 1:29 p.m. UTC | #3
On 07/23/2014 02:13 PM, Stefano Stabellini wrote:
> On Wed, 23 Jul 2014, George Dunlap wrote:
>> On Wed, Jul 23, 2014 at 1:05 PM, Stefano Stabellini
>> <stefano.stabellini@eu.citrix.com> wrote:
>>> No need to call vcpu_force_reschedule, is too expensive.
>>>
>>> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>>> ---
>>>   xen/arch/arm/traps.c |    2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
>>> index 3dfabd0..8cd06cc 100644
>>> --- a/xen/arch/arm/traps.c
>>> +++ b/xen/arch/arm/traps.c
>>> @@ -1805,7 +1805,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
>>>           }
>>>           if ( hsr.wfi_wfe.ti ) {
>>>               /* Yield the VCPU for WFE */
>>> -            vcpu_force_reschedule(current);
>>> +            vcpu_yield(current);
>> Actually, sorry -- why are you wanting to yield here?
>>
>> At the moment "yield" is only initiated by the guest itself, and the
>> individual schedulers are notified that the guest has called "yield".
>> If what you want to do is yield for some other reason, it might be
>> better to have a slightly separate path for that.
>   
> It is a very similar situation: WFE means "wait for event" and it is
> used in the implementation of spin_locks, for example.
> I think that trapping the instruction and yielding is what we want.

Right -- sounds good then.

  -George
diff mbox

Patch

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 3dfabd0..8cd06cc 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1805,7 +1805,7 @@  asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
         }
         if ( hsr.wfi_wfe.ti ) {
             /* Yield the VCPU for WFE */
-            vcpu_force_reschedule(current);
+            vcpu_yield(current);
         } else {
             /* Block the VCPU for WFI */
             vcpu_block_unless_event_pending(current);