From: John Levon Subject: Re: [PATCH] SCHEDOP_block_masked Date: Fri, 10 Mar 2006 13:41:47 +0000 Message-ID: <20060310134147.GA23953@totally.trollied.org> References: <20060310105824.GA20192@totally.trollied.org> <70594b8262bcb5576c1a1213d88e8d66@cl.cam.ac.uk> <20060310114328.GA20647@totally.trollied.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Fri, Mar 10, 2006 at 01:21:39PM +0000, Keir Fraser wrote: > >But, now you mention it, I wonder if this wouldn't be better taking an > >event channel to check on before sleeping (though we'd still wake on > >any). This would avoid the small race (which doesn't really matter in > >the context we've been using this). > > Can you give more details about the usage scenario? The debugger is calling out to the xen console driver getchar() routine. Currently it's doing something like: if (!check_for_xencons_char) HYPERVISOR_yield(); Thus as soon as we see something on the console ring buffer we can continue on (still inside the kernel debugger). Events must remain disabled during this entire operation. With HYPERVISOR_block_on(), this would look something like: clear_evtchn_pending(xencons_evtchn); if (check_for_xencons_char) break; HYPERVISOR_block_on(xencons_evtchn); Xen would check for that particular evtchn before blocking the vcpu; any event delivery would wake up the vcpu again and return to the guest domain. The clearing of the pending bit each time is obviously needed to stop block_on() from waking immediately again (and this implies that the domain needs some other way of checking for the event delivery, as above). Does that clear things up a little? regards, john