[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v7 2/3] xen/events: modify struct evtchn layout
In order to avoid latent races when updating an event channel put xen_consumer and pending fields in different bytes. At the same time move some other fields around to have less implicit paddings and to keep related fields more closely together. Signed-off-by: Juergen Gross <jgross@xxxxxxxx> --- xen/include/xen/sched.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index a345cc01f8..e6d09aa055 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -80,8 +80,7 @@ extern domid_t hardware_domid; #define EVTCHNS_PER_GROUP (BUCKETS_PER_GROUP * EVTCHNS_PER_BUCKET) #define NR_EVTCHN_GROUPS DIV_ROUND_UP(MAX_NR_EVTCHNS, EVTCHNS_PER_GROUP) -#define XEN_CONSUMER_BITS 3 -#define NR_XEN_CONSUMERS ((1 << XEN_CONSUMER_BITS) - 1) +#define NR_XEN_CONSUMERS 8 struct evtchn { @@ -94,9 +93,10 @@ struct evtchn #define ECS_VIRQ 5 /* Channel is bound to a virtual IRQ line. */ #define ECS_IPI 6 /* Channel is bound to a virtual IPI line. */ u8 state; /* ECS_* */ - u8 xen_consumer:XEN_CONSUMER_BITS; /* Consumer in Xen if nonzero */ - u8 pending:1; - u16 notify_vcpu_id; /* VCPU for local delivery notification */ +#ifndef NDEBUG + u8 old_state; /* State when taking lock in write mode. */ +#endif + u8 xen_consumer; /* Consumer in Xen if nonzero */ u32 port; union { struct { @@ -113,11 +113,13 @@ struct evtchn } pirq; /* state == ECS_PIRQ */ u16 virq; /* state == ECS_VIRQ */ } u; - u8 priority; -#ifndef NDEBUG - u8 old_state; /* State when taking lock in write mode. */ -#endif - u32 fifo_lastq; /* Data for fifo events identifying last queue. */ + + /* FIFO event channels only. */ + u8 pending; + u8 priority; + u16 notify_vcpu_id; /* VCPU for local delivery notification */ + u32 fifo_lastq; /* Data for identifying last queue. */ + #ifdef CONFIG_XSM union { #ifdef XSM_NEED_GENERIC_EVTCHN_SSID -- 2.26.2
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |