Ian Pratt
2005-Jun-07 10:38 UTC
RE: [Xen-devel] [PATCH] Yield to VCPU hcall, spinlock yielding
> You can only use spinlock accounting for dealing with locking > issues in kernel (unless you are willing to change > application level programs and libs). If preemption > notification overhead is not prohibitive, the fact that it > solves the application problem as well as the kernel problem > seems like a compelling advantage over spinlock accounting, > doesn''t it?Orran, Are you assuming the pre-emption notification is going to get propagated to user-space as a signal, and that user space applications would be modified to take advantage of the signal? (possibly this could be hidden in the pthread library?} Since the kernel doesn''t know when user space has an application lock or not, that''s going to be a lot of signals. Cheers, Ian _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Bryan S Rosenburg
2005-Jun-08 15:19 UTC
RE: [Xen-devel] [PATCH] Yield to VCPU hcall, spinlock yielding
"Ian Pratt" <m+Ian.Pratt@cl.cam.ac.uk> wrote on 06/07/2005 06:38:14 AM:> > > You can only use spinlock accounting for dealing with locking > > issues in kernel (unless you are willing to change > > application level programs and libs). If preemption > > notification overhead is not prohibitive, the fact that it > > solves the application problem as well as the kernel problem > > seems like a compelling advantage over spinlock accounting, > > doesn''t it? > > Orran, > > Are you assuming the pre-emption notification is going to get propagated > to user-space as a signal, and that user space applications would be > modified to take advantage of the signal? (possibly this could be hidden > in the pthread library?} Since the kernel doesn''t know when user space > has an application lock or not, that''s going to be a lot of signals. > > Cheers, > IanWe''re certainly *not* proposing that preemption notifications be propagated to user-space as signals. We''re not proposing any changes at all to the user/kernel interface. Preemption notifications to the kernel will allow Linux to support its multiprocessor applications as well as (but not better than) it does today running natively. The key point is that with kernel-level preemption notification, VCPUs are always in kernel mode when suspended, never in user mode. Application state is always saved in Linux, not in Xen, and is available to be resumed on another VCPU if Linux so chooses. - Bryan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Orran Y Krieger
2005-Jun-09 12:54 UTC
RE: [Xen-devel] [PATCH] Yield to VCPU hcall, spinlock yielding
xen-devel-bounces@lists.xensource.com wrote on 06/07/2005 06:38:14 AM:> Orran, > > Are you assuming the pre-emption notification is going to get propagated > to user-space as a signal, and that user space applications would be > modified to take advantage of the signal? (possibly this could be hidden > in the pthread library?} Since the kernel doesn''t know when user space > has an application lock or not, that''s going to be a lot of signals.Nope, we reviewed a couple of alternatives for notification to user level and for now are not persuing any of them. The pre-emption notification goes to the kernel, and its an OS specific thing what it chooses to do with it. Our current plan in Linux is to run a high priority thread in the kernel which makes a hypervisor call to yield back the processor. Hence, the application thread context is not hidden in the hypervisor, but the application thread is marked by linux as ready to run. Now if the thread is a high priority thread holding an application lock normal linux mechanisms will cause it to be scheduled on some other processor. Without the preemption notification, or if we yield back at interrupt level, the application thread register state is buried in the hypervisor, and of course the thread appears to Linux to be running... Everything seems to just fall out nicely in Linux as long as we make the call back on a kernel thread. Different OSes, of course, will have different techniques they can use given a notification of an attempt to preempt. -- Orran _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel