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

Re: [Xen-devel] yield hypercall to prevent lock holder problem ?

On Fri, Mar 29, 2013 at 9:43 PM, Sisu Xi <xisisu@xxxxxxxxx> wrote:
> Hi, all:
> Does anyone know how does the yield function works in the Xen scheduler?
> Right now only credit scheduler uses it to put it behind one lower-priority
> runnable vcpus. But what is this used for?
> I checked [1], the author also mentioned the yield function to prevent lhp.
> Is this the same function?
> On Xen part, the yield function is called in do_yield(), which is called in
> do_sched_op(), by passing in SCHEDOP_YIELD.
> However, if you grep the whole Linux Kernel Code, (3.8.0 in my case), the
> place where SCHEDOP_YIELD appears are:
> 1) drivers\tty\hvc\hvc_xen.c, domU_write_console()
> 2) arch\x86\xen\smp.c, xen_cpu_up()
> 3) arch\x86\xen\smp.c, xen_smp_send_call_function_ipi()
> 4) arch\ia64\xen\xcom_hcall.c, xencomm_hypercall_sched_op()
> None of this seems related to the spinlock.

YIELD is used by the Citrix Windows PV drivers to patch Windows
spinlocks.  The pvops kernels have a different solution to the
lock-holder problem that's a bit more complicated.   But the
lock-holder problem isn't limited only to actual locks; it's a
potential problem any time any cpu waits on another cpu.  I haven't
looked at the code, but in the case of #3, the caller spins waiting
for the other cpu to execute the function; the basic problem is the
same as the spinlock problem.  I suspect if you look at the other 3,
you'll also find someone spinning while waiting for another cpu.


Xen-devel mailing list



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