From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [RFC PATCH V3 07/22] Add evtchn_extended in struct domain Date: Thu, 28 Feb 2013 11:55:32 +0000 Message-ID: <512F45B4.2000105@citrix.com> References: <1361975655-22295-1-git-send-email-wei.liu2@citrix.com> <1361975655-22295-8-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1361975655-22295-8-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: "Keir (Xen.org)" , Ian Campbell , "jbeulich@suse.com" , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On 27/02/13 14:34, Wei Liu wrote: > This field is a bitmap of currently in use extended event channel ABI, which > can have 0 (no extended event channel in use) 1 bit set. It is manipulated by > hypervisor only, so if anything goes wrong it is a bug. > > The default event channel ABI is EVTCHN_EXTENDED_NONE, which means no extended > event channel is used. [...] > --- a/xen/include/xen/event.h > +++ b/xen/include/xen/event.h > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > > #ifndef CONFIG_COMPAT > #define BITS_PER_EVTCHN_WORD(d) BITS_PER_LONG > @@ -22,7 +23,16 @@ > #endif > static inline unsigned int max_evtchns(struct domain *d) > { > - return BITS_PER_EVTCHN_WORD(d) * BITS_PER_EVTCHN_WORD(d); > + unsigned int ret = 0; > + switch ( d->evtchn_extended ) > + { > + case EVTCHN_EXTENDED_NONE: > + ret = BITS_PER_EVTCHN_WORD(d) * BITS_PER_EVTCHN_WORD(d); > + break; > + default: > + BUG(); > + } BUG'ing in every switch that uses d->evtchn_extended doesn't seem useful and may add extra overhead in hot paths. Perhaps an ASSERT() but this this field is written in such a limited set of places this doesn't seem useful. David