From: Wei Liu Subject: Designing the N-level event channel registration interface Date: Fri, 11 Jan 2013 12:34:23 +0000 Message-ID: <1357907663.27635.46.camel@iceland> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: wei.liu2@citrix.com, ian.campbell@citrix.com, jbeulich@suse.com, david.vrabel@citrix.com List-Id: xen-devel@lists.xenproject.org Hi all, I have been thinking about the N-level event channel interface for some time and could not make up my mind. As people suggested in my RFC patch, there should be compat checking / handling for the interface. The interface I have in mind at the moment: /* * EVTCHNOP_register_nlevel: Register N-level event channel * NOTES: * 1. Currently only 3-level is supported. * 2. Should fall back to 2-level if this call fails. */ /* 64 bit guests need 8 pages for evtchn_pending and evtchn_mask for * 256k event channels while 32 bit ones only need 1 page for 32k * event channels. */ #define EVTCHN_MAX_L3_PAGES 8 struct evtchn_register_3level { /* IN parameters */ uint32_t nr_pages; XEN_GUEST_HANDLE(xen_pfn_t) evtchn_pending; XEN_GUEST_HANDLE(xen_pfn_t) evtchn_mask; uint32_t nr_vcpus; XEN_GUEST_HANDLE(void) l2sel; }; struct evtchn_register_nlevel { /* IN parameters. */ uint32_t level; union { struct evtchn_register_3level l3; } u; }; typedef struct evtchn_register_nlevel evtchn_register_nlevel_t; There are 3 XEN_GUEST_HANDLEs in evtchn_register_3level. evtchn_pending / evtchn_mask points to an array which is used to stored pending / mask mfns. l2sel points to an array storing per-vcpu variable for 2nd level selectors. This interface is still very primitive and padding is not accounted for. One way to achieve compat is to write compat/event_channel.c. As other interfaces in event_channel.c don't need compat handling, re-compiling event_channel.c is probably not a good idea. Jan is worried about this. Ian suggested I use XEN_GUEST_HANDLE_64 to get 64-bit clean version and avoid compat layer. Any input is welcomed. Thanks Wei.