From: Bryan S Rosenburg Subject: RE: SMP Guest Proposal RFC Date: Fri, 1 Apr 2005 22:49:04 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1548832945==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Pratt Cc: ryanh@us.ibm.com, xen-devel@lists.xensource.com, Orran Y Krieger List-Id: xen-devel@lists.xenproject.org This is a multipart message in MIME format. --===============1548832945== Content-Type: multipart/alternative; boundary="=_alternative 0014F46B85256FD7_=" This is a multipart message in MIME format. --=_alternative 0014F46B85256FD7_= Content-Type: text/plain; charset="us-ascii" Ian Pratt writes: > However, I'm convinced that pre-emption notifcations are not the way to > go: Kernels typically have no way to back-out of holding a lock early, > so giving them an active call-back is not very useful. No one is proposing that kernels back out of holding locks early. On receiving the notification, the kernel is expected to yield the processor when it next reaches a lock-free state. Scheduling a thread to do the yield accomplishes that in a very clean manner. > I think its better to have a counter that the VCPU increments whenever > it grabs a lock and decrements when it releases a lock. When the > pre-emption timer goes off, the hypervisor can check the counter. If its > non zero, the hypervisor can choose to hold-off the preemption for e.g. > 50us. It can also set a bit in another word indiciating that a > pre-emption is pending. Whenever the '#locks held' counter is > decremented to zero, the pre-emption pending bit can be checked, and the > VCPU should imediately yield if it is. This is in fact the mechanism described in Uhlig et al. Its main drawback is that it does nothing to address the problem of user-level lock-holder preemption. The proposed notification scheme is a single, clean mechanism that lets a kernel avoid untimely preemption of both user- and kernel-level lock holders. - Bryan --=_alternative 0014F46B85256FD7_= Content-Type: text/html; charset="us-ascii"
Ian Pratt writes:
> However, I'm convinced that pre-emption notifcations are not the way to
> go: Kernels typically have no way to back-out of holding a lock early,
> so giving them an active call-back is not very useful.


No one is proposing that kernels back out of holding locks early.  On receiving the notification, the kernel is expected to yield the processor when it next reaches a lock-free state.  Scheduling a thread to do the yield accomplishes that in a very clean manner.


> I think its better to have a counter that the VCPU increments whenever
> it grabs a lock and decrements when it releases a lock. When the
> pre-emption timer goes off, the hypervisor can check the counter. If its
> non zero, the hypervisor can choose to hold-off the preemption for e.g.
> 50us. It can also set a bit in another word indiciating that a
> pre-emption is pending. Whenever the '#locks held' counter is
> decremented to zero, the pre-emption pending bit can be checked, and the
> VCPU should imediately yield if it is.


This is in fact the mechanism described in Uhlig et al.  Its main drawback is that it does nothing to address the problem of user-level lock-holder preemption.  The proposed notification scheme is a single, clean mechanism that lets a kernel avoid untimely preemption of both user- and kernel-level lock holders.

- Bryan --=_alternative 0014F46B85256FD7_=-- --===============1548832945== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1548832945==--