[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen/arm: introduce vwfi parameter



On Tue, 2017-02-21 at 18:17 +0000, George Dunlap wrote:
> On 21/02/17 17:49, Stefano Stabellini wrote:
> > I don't know the inner working of the scheduler, but does it always
> > send
> > an interrupt to other pcpu to schedule something?
> 
> Letting a guest call WFI is as safe as letting a guest
> `while(1);`.  Xen
> *always* has to set a timer interrupt before switching to the guest
> context to make sure that it can pre-empt the vcpu -- otherwise any
> vcpu
> could perform a DoS by simply continually executing instructions.
> 
Yes, ensuring preemption happens is indeed Xen responsibility, and it
will indeed happen, as far as interrupts are enabled, as George says.

> > What if there are 2 vcpu pinned to the same pcpu? This cannot be
> > fair.
> 
> From the scheduler's perspective, the WFI would be the same as the
> `while(1)`.  
>
It is, provided you charge the vCPU for the time it spent in WFI, the
same as you'd charge it for time spend in a `while(1)`. This is
*probably* what happens already if we let WFI run on hardware, but I'd
double check and test.

> If you had two vcpus doing while(1) on the same vcpu, the
> credit2 scheduler would (approximately) let one run for 2ms, then the
> other for 2ms, and so on, each getting 50%.  
>
If you're talking about MAX_TIMER, it's 10ms these days. But yes, this
still means 50% each.

> If ARM had the equivalent of posted interrupts, then a pinned guest
> could efficiently wait for interrupts with no additional latency from
> virtualization without having to poll.
> 
> (Speaking of which -- that could be an interesting optimization even
> on
> x86... if a pcpu has no vcpus waiting to run, then disable HLT exit.)
> 
Sorry, this sounds interesting but I'm not sure I understand what you
mean (but let's not hijack this thread, maybe, and talk about it
somewhere else. :-)

Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.