From: Jacob Gorm Hansen Subject: Re: [PATCH] Allow mini-os to unbind all evtchns Date: Thu, 30 Nov 2006 17:38:36 +0100 Message-ID: <1164904716.32151.3.camel@localhost.localdomain> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-hw2AA096bgAxzi5RMzSB" Return-path: 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 , Grzegorz Milos List-Id: xen-devel@lists.xenproject.org --=-hw2AA096bgAxzi5RMzSB Content-Type: text/plain Content-Transfer-Encoding: 7bit On Wed, 2006-11-29 at 12:25 +0000, Keir Fraser wrote: > On 29/11/06 12:16, "Grzegorz Milos" wrote: > > > The patch looks good to me. I only have one comment: it would be good > > to have unbind_all_ports in the events header file. > > It looked bogus to me. What if event channels are bound/unbound/bound > multiple times during the mini-os lifetime (can't happen right now, but > maybe in future). The port array will overflow. Perhaps it should be a > bitmap instead (set on bind; clear on unbind)? I have attached a new version that uses a bitmap instead and declares unbind_all_ports() in events.h. regards, Jacob --=-hw2AA096bgAxzi5RMzSB Content-Disposition: attachment; filename=miniosunbindall_bitmap.patch Content-Type: text/x-patch; name=miniosunbindall_bitmap.patch; charset=us-ascii Content-Transfer-Encoding: 7bit Signed-off-by: Jacob Gorm Hansen diff -r 52ae8dd4bc75 extras/mini-os/events.c --- a/extras/mini-os/events.c Tue Oct 17 22:09:52 2006 +0100 +++ b/extras/mini-os/events.c Thu Nov 30 17:34:29 2006 +0100 @@ -31,10 +31,26 @@ typedef struct _ev_action_t { u32 count; } ev_action_t; +unsigned long bound_ports[NR_EVS/(8*sizeof(unsigned long))]; static ev_action_t ev_actions[NR_EVS]; void default_handler(evtchn_port_t port, struct pt_regs *regs, void *data); +void unbind_all_ports(void) +{ + int i; + + for(i=0; i