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. I also checked the file: arch\x86\xen\spinlock.c, it has: static unsigned lock_timeout = 1 << 10; #define TIMEOUT lock_timeout. Is this the timeout value talked in [1] to prevent the lhp? If the yield function is used to prevent lhp, how does it connect with the spinlock? I am relatively new to this lhp problem and any help would be appreciated. Thanks very much! Sisu [1] "Thomas Friebel: Preventing Guests from Spinning Around<http://www.xen.org/files/xensummitboston08/LHP.pdf>" in Xen Summit 2008 -- Sisu Xi, PhD Candidate http://www.cse.wustl.edu/~xis/ Department of Computer Science and Engineering Campus Box 1045 Washington University in St. Louis One Brookings Drive St. Louis, MO 63130 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
On Fri, Mar 29, 2013 at 9:43 PM, Sisu Xi <xisisu@gmail.com> 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. -George
Hi, George: Thanks for your reply! I''ll dig into the code. Sisu On Tue, Apr 2, 2013 at 5:57 AM, George Dunlap <dunlapg@umich.edu> wrote:> On Fri, Mar 29, 2013 at 9:43 PM, Sisu Xi <xisisu@gmail.com> 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. > > -George >-- Sisu Xi, PhD Candidate http://www.cse.wustl.edu/~xis/ Department of Computer Science and Engineering Campus Box 1045 Washington University in St. Louis One Brookings Drive St. Louis, MO 63130 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel