Xen: FIFO-based event channel ABI
cover Xen: FIFO-based event channel ABI
This is an RFC of the FIFO-based event channel ABI described in this design document:
http://xenbits.xen.org/people/dvrabel/event-channels-C.pdf
Changes since draft B are:
- Queue tail is now private to Xen.
- Guest pages are specified by MFN in the hypercalls.
- Updated link/unlink algorithm to avoid races when adding an event to a queue that is becoming empty.
Patch 1-5 do some preparatory work for supporting alternate ABIs.
Patch 6 is a hack to allow it to build.
Patch 7-8 add the ABI and the implementation. Patch 8 list some of the known limitations with this RFC implementation.
David
PATCH 1/8 debug: remove some event channel info from the 'i' and 'q' debug keys
From: David Vrabel <[email protected]>
With different event channel ABIs, showing the 2-level selector word may be misleading (if a different ABI is in use).
When dumping domain information, printing the state of the VIRQ_DEBUG port is redundant -- this information is available via the 'e' key.
--- xen/arch/x86/irq.c | 5 +---- xen/common/keyhandler.c | 11 ++--------- 2 files changed, 3 insertions(+), 13 deletions(-)
xen/arch/x86/irq.c +1 -4
@@ -2088,14 +2088,11 @@ static void dump_irqs(unsigned char key) d = action->guest[i]; pirq =domain_irq_to_pirq (d, irq); info =pirq_info (d, pirq); -printk ("%u:%3d(%c%c%c%c)" , +printk ("%u:%3d(%c%c%c)" , d->domain_id, pirq, (test_bit (info->evtchn, &shared_info (d, evtchn_pending)) ?'P' :'-' ), - (test_bit (info->evtchn /BITS_PER_EVTCHN_WORD (d), - &vcpu_info (d->vcpu[0 ], evtchn_pending_sel)) ? -'S' :'-' ), (test_bit (info->evtchn, &shared_info (d, evtchn_mask)) ?'M' :'-' ), (info->masked ?'M' :'-' ));
xen/common/keyhandler.c +2 -9
@@ -299,16 +299,9 @@ static void dump_domains(unsigned char key) { for_each_vcpu ( d, v ) { -printk ("Notifying guest %d:%d (virq %d, port %d, stat %d/%d/%d)\n" , +printk ("Notifying guest %d:%d (virq %d, port %d)\n" , d->domain_id, v->vcpu_id, -VIRQ_DEBUG , v->virq_to_evtchn[VIRQ_DEBUG ], -test_bit (v->virq_to_evtchn[VIRQ_DEBUG ], - &shared_info (d, evtchn_pending)), -test_bit (v->virq_to_evtchn[VIRQ_DEBUG ], - &shared_info (d, evtchn_mask)), -test_bit (v->virq_to_evtchn[VIRQ_DEBUG ] / -BITS_PER_EVTCHN_WORD (d), - &vcpu_info (v, evtchn_pending_sel))); +VIRQ_DEBUG , v->virq_to_evtchn[VIRQ_DEBUG ]);send_guest_vcpu_virq (v,VIRQ_DEBUG ); } }
Signature · 1 line
1.7.2.5
PATCH 2/8 evtchn: refactor low-level event channel port ops
In reply to David VrabelFrom: David Vrabel <[email protected]>
Use functions for the low-level event channel port operations (set/clear pending, unmask, is_pending and is_masked).
Group these functions into a struct evtchn_port_op so they can be replaced by alternate implementations (for different ABIs) on a per-domain basis.
--- xen/arch/x86/irq.c | 11 ++--- xen/common/Makefile | 1 + xen/common/event_channel.c | 65 +++++--------------------- xen/common/event_port.c | 108 ++++++++++++++++++++++++++++++++++++++++++++ xen/common/schedule.c | 3 +- xen/include/xen/event.h | 40 ++++++++++++++++ xen/include/xen/sched.h | 4 ++ 7 files changed, 172 insertions(+), 60 deletions(-) create mode 100644 xen/common/event_port.c
xen/arch/x86/irq.c +5 -6
@@ -1452,7 +1452,7 @@ int pirq_guest_unmask(struct domain *d) { pirq = pirqs[i]->pirq;if ( pirqs[i]->masked && - !test_bit (pirqs[i]->evtchn, &shared_info (d, evtchn_mask)) ) + !evtchn_port_is_masked (d,evtchn_from_port (d, pirqs[i]->evtchn)) )pirq_guest_eoi (pirqs[i]); } }while ( ++pirq < d->nr_pirqs && n ==ARRAY_SIZE (pirqs) );
@@ -2046,6 +2046,7 @@ static void dump_irqs(unsigned char key)int i, irq, pirq;struct irq_desc *desc;irq_guest_action_t *action; +struct evtchn *evtchn;struct domain *d;const struct pirq *info;unsigned long flags;
@@ -2088,13 +2089,11 @@ static void dump_irqs(unsigned char key) d = action->guest[i]; pirq =domain_irq_to_pirq (d, irq); info =pirq_info (d, pirq); + evtchn =evtchn_from_port (d, info->evtchn);printk ("%u:%3d(%c%c%c)" , d->domain_id, pirq, - (test_bit (info->evtchn, - &shared_info (d, evtchn_pending)) ? -'P' :'-' ), - (test_bit (info->evtchn, &shared_info (d, evtchn_mask)) ? -'M' :'-' ), + (evtchn_port_is_pending (d, evtchn) ?'P' :'-' ), + (evtchn_port_is_masked (d, evtchn) ?'M' :'-' ), (info->masked ?'M' :'-' ));if ( i != action->nr_guests )printk ("," );
xen/common/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(HAS_DEVICE_TREE) += device_tree.o obj-y += domctl.o obj-y += domain.o obj-y += event_channel.o +obj-y += event_port.o obj-y += grant_table.o obj-y += irq.o obj-y += kernel.o
xen/common/event_channel.c +12 -53
108 lines not on this page · raw message
xen/common/event_port.c new file +108 -0
108 lines not on this page · raw message
xen/common/schedule.c +2 -1
@@ -33,6 +33,7 @@#include <xen/multicall.h> #include <xen/cpu.h> #include <xen/preempt.h> +#include <xen/event.h> #include <public/sched.h> #include <xsm/xsm.h>
@@ -693,7 +694,7 @@ static long do_poll(struct sched_poll *sched_poll) goto out; rc =0 ; -if (test_bit (port, &shared_info (d, evtchn_pending)) ) +if (evtchn_port_is_pending (d,evtchn_from_port (d, port)) ) goto out; }
xen/include/xen/event.h +40 -0
@@ -102,4 +102,44 @@ void notify_via_xen_event_channel(struct domain *ld, int lport);mb ();/* set blocked status /then/ caller does his work */ \ } while ( 0 ) +/* +* Low-level event channel port ops. +*/ +struct evtchn_port_ops { +void (*set_pending)(struct vcpu *v,struct evtchn *evtchn); +void (*clear_pending)(struct domain *d,struct evtchn *evtchn); +void (*unmask)(struct domain *d,struct evtchn *evtchn); +bool_t (*is_pending)(struct domain *d,const struct evtchn *evtchn); +bool_t (*is_masked)(struct domain *d,const struct evtchn *evtchn); +}; + +extern struct evtchn_port_ops evtchn_port_ops_2l; + +static inline void evtchn_port_set_pending (struct vcpu *v,struct evtchn *evtchn) +{ + v->domain->evtchn_port_ops->set_pending (v, evtchn); +} + +static inline void evtchn_port_clear_pending (struct domain *d,struct evtchn *evtchn) +{ + d->evtchn_port_ops->clear_pending (d, evtchn); +} + +static inline void evtchn_port_unmask (struct domain *d, +const struct evtchn *evtchn) +{ + d->evtchn_port_ops->unmask (d, evtchn); +} + +static inline bool_t evtchn_port_is_pending (struct domain *d, +const struct evtchn *evtchn) +{ +return d->evtchn_port_ops->is_pending (d, evtchn); +} + +static inline bool_t evtchn_port_is_masked (struct domain *d,struct evtchn *evtchn) +{ +return d->evtchn_port_ops->is_masked (d, evtchn); +} +#endif /* __XEN_EVENT_H__ */
xen/include/xen/sched.h +4 -0
@@ -81,6 +81,7 @@ struct evtchn } pirq;/* state == ECS_PIRQ */ u16 virq;/* state == ECS_VIRQ */ } u; +u32 port;#ifdef FLASK_ENABLE void *ssid;#endif
@@ -230,6 +231,8 @@ struct mem_event_per_domainstruct mem_event_domain access; }; +struct evtchn_port_ops ; +struct domain {domid_t domain_id;
@@ -262,6 +265,7 @@ struct domain/* Event channel information. */ struct evtchn *evtchn[NR_EVTCHN_BUCKETS ];spinlock_t event_lock; +struct evtchn_port_ops *evtchn_port_ops;struct grant_table *grant_table;
Signature · 1 line
1.7.2.5
Re: [PATCH 2/8] evtchn: refactor low-level event channel port ops
xen/common/event_port.c
Quoted 3 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/common/event_port.c new file +0
-0
Is this really a good name? Wouldn't it be better to have a separate file per ABI (e.g. this one being evt_port_2l.c)?
xen/include/xen/sched.h struct evtchn · line 84
Quoted 7 lines
xen/include/xen/sched.h +1
-0@@ -81,6 +81,7 @@ struct evtchn } pirq;/* state == ECS_PIRQ */ u16 virq;/* state == ECS_VIRQ */ } u; +u32 port;
The need for this field doesn't become obvious after going through the entire patch - if it really needs adding here, the description should say why, I would think.
Jan
Re: [PATCH 2/8] evtchn: refactor low-level event channel port ops
Quoted 6 lines · Jan Beulich
xen/common/event_port.c
Quoted 3 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/common/event_port.c new file +0
-0Is this really a good name? Wouldn't it be better to have a separate file per ABI (e.g. this one being
evt_port_2l.c)?
Agreed. I did this on the Linux side and it's better.
Quoted 11 lines
xen/include/xen/sched.h struct evtchn · line 84
Quoted 7 lines
xen/include/xen/sched.h +1
-0@@ -81,6 +81,7 @@ struct evtchn } pirq;/* state == ECS_PIRQ */ u16 virq;/* state == ECS_VIRQ */ } u; +u32 port;The need for this field doesn't become obvious after going through the entire patch - if it really needs adding here, the description should say why, I would think.
The evtchn_ops calls all take a struct evtchn * as a parameter so we need this field to get the port.
David
Re: [PATCH 2/8] evtchn: refactor low-level event channel port ops
In reply to David Vrabelxen/include/xen/sched.h struct domain · line 268
Quoted 6 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/include/xen/sched.h +1
-0@@ -262,6 +265,7 @@ struct domain/* Event channel information. */ struct evtchn *evtchn[NR_EVTCHN_BUCKETS ];spinlock_t event_lock; +struct evtchn_port_ops *evtchn_port_ops;
const ...
Jan
Quoted 3 lines
xen/include/xen/sched.h +0
-0struct grant_table *grant_table;
PATCH 3/8 evtchn: add a hook to bind an event port to a VCPU
In reply to David VrabelFrom: David Vrabel <[email protected]>
The upcoming FIFO-based event channel ABI will require binding ports to a specific per-VCPU queue, so add a port op (bind_to_vcpu) for this. Call this new op when events are bound and when they are moved to a different VCPU.
--- xen/common/event_channel.c | 7 +++++++ xen/include/xen/event.h | 9 +++++++++ 2 files changed, 16 insertions(+), 0 deletions(-)
xen/common/event_channel.c +7 -0
@@ -236,10 +236,12 @@ static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)if ( rc ) goto out; +evtchn_port_bind_to_vcpu (ld, lchn, ld->vcpu[lchn->notify_vcpu_id]); lchn->u.interdomain.remote_dom = rd; lchn->u.interdomain.remote_port = (u16 )rport; lchn->state =ECS_INTERDOMAIN ; +evtchn_port_bind_to_vcpu (rd, rchn, rd->vcpu[rchn->notify_vcpu_id]); rchn->u.interdomain.remote_dom = ld; rchn->u.interdomain.remote_port = (u16 )lport; rchn->state =ECS_INTERDOMAIN ;
@@ -290,6 +292,7 @@ static long evtchn_bind_virq(evtchn_bind_virq_t *bind)ERROR_EXIT (port); chn =evtchn_from_port (d, port); +evtchn_port_bind_to_vcpu (d, chn, v); chn->state =ECS_VIRQ ; chn->notify_vcpu_id = vcpu; chn->u.virq = virq;
@@ -320,6 +323,7 @@ static long evtchn_bind_ipi(evtchn_bind_ipi_t *bind)ERROR_EXIT (port); chn =evtchn_from_port (d, port); +evtchn_port_bind_to_vcpu (d, chn, d->vcpu[vcpu]); chn->state =ECS_IPI ; chn->notify_vcpu_id = vcpu;
@@ -397,6 +401,7 @@ static long evtchn_bind_pirq(evtchn_bind_pirq_t *bind) goto out; } +evtchn_port_bind_to_vcpu (d, chn, v); chn->state =ECS_PIRQ ; chn->u.pirq.irq = pirq;link_pirq_port (port, chn, v);
@@ -876,6 +881,8 @@ long evtchn_bind_vcpu(unsigned int port, unsigned int vcpu_id) rc = -EINVAL ;break ; } +if ( rc ==0 ) +evtchn_port_bind_to_vcpu (d, chn, d->vcpu[vcpu_id]); out:spin_unlock (&d->event_lock);
xen/include/xen/event.h +9 -0
@@ -111,6 +111,8 @@ struct evtchn_port_ops {void (*unmask)(struct domain *d,struct evtchn *evtchn);bool_t (*is_pending)(struct domain *d,const struct evtchn *evtchn);bool_t (*is_masked)(struct domain *d,const struct evtchn *evtchn); +void (*bind_to_vcpu)(struct domain *d,struct evtchn *evtchn, +struct vcpu *vcpu); };extern struct evtchn_port_ops evtchn_port_ops_2l;
@@ -142,4 +144,11 @@ static inline bool_t evtchn_port_is_masked(struct domain *d, struct evtchn *evtc return d->evtchn_port_ops->is_masked(d, evtchn); } +static inline void evtchn_port_bind_to_vcpu (struct domain *d,struct evtchn *evtchn, +struct vcpu *vcpu) +{ +if ( d->evtchn_port_ops->bind_to_vcpu ) + d->evtchn_port_ops->bind_to_vcpu (d, evtchn, vcpu); +} +#endif /* __XEN_EVENT_H__ */
Signature · 1 line
1.7.2.5
PATCH 4/8 evtchn: Dynamically allocate d->evtchn
In reply to David VrabelFrom: Wei Liu <[email protected]>
As we move to extended evtchn ABI we need bigger d->evtchn, as a result this will bloat struct domain. So move this array out of struct domain and allocate a dedicated array for it.
--- xen/common/event_channel.c | 14 ++++++++++++++ xen/include/xen/sched.h | 2 +- 2 files changed, 15 insertions(+), 1 deletions(-)
xen/common/event_channel.c +14 -0
@@ -1136,15 +1136,27 @@ void notify_via_xen_event_channel(struct domain *ld, int lport)int evtchn_init (struct domain *d) { +BUILD_BUG_ON (sizeof (struct evtchn *) *NR_EVTCHN_BUCKETS >PAGE_SIZE ); + d->evtchn = xzalloc_array(struct evtchn *, NR_EVTCHN_BUCKETS); + +if ( d->evtchn ==NULL ) +return -ENOMEM ; +spin_lock_init (&d->event_lock);if (get_free_port (d) !=0 ) + { +xfree (d->evtchn);return -EINVAL ; + }evtchn_from_port (d,0 )->state =ECS_RESERVED ;#if MAX_VIRT_CPUS >BITS_PER_LONG d->poll_mask = xmalloc_array(unsigned long, BITS_TO_LONGS(MAX_VIRT_CPUS));if ( !d->poll_mask ) + { +xfree (d->evtchn);return -ENOMEM ; + }bitmap_zero (d->poll_mask,MAX_VIRT_CPUS );#endif
@@ -1180,6 +1192,8 @@ void evtchn_destroy(struct domain *d)spin_unlock (&d->event_lock);clear_global_virq_handlers (d); + +xfree (d->evtchn); }
xen/include/xen/sched.h +1 -1
@@ -263,7 +263,7 @@ struct domainspinlock_t rangesets_lock;/* Event channel information. */ -struct evtchn *evtchn[NR_EVTCHN_BUCKETS ]; +struct evtchn **evtchn;spinlock_t event_lock;struct evtchn_port_ops *evtchn_port_ops;
Signature · 1 line
1.7.2.5
Re: [PATCH 4/8] evtchn: Dynamically allocate d->evtchn
Quoted 6 lines · David Vrabel
From: Wei Liu <[email protected]>
As we move to extended evtchn ABI we need bigger
d->evtchn, as a result this will bloat struct domain. So move this array out of struct domain and allocate a dedicated array for it.
Please check out the patch series I sent yesterday. I modified the internal object store for event channel, which can save space when your domain only has small number of event channels, which is the case for FIFO-based ABI.
Wei.
Quoted 61 lines
Signed-off-by Wei Liu <[email protected]>Signed-off-by David Vrabel <[email protected]>--- xen/common/event_channel.c | 14 ++++++++++++++ xen/include/xen/sched.h | 2 +- 2 files changed, 15 insertions(+), 1 deletions(-)xen/common/event_channel.c +14
-0@@ -1136,15 +1136,27 @@ void notify_via_xen_event_channel(struct domain *ld, int lport)int evtchn_init (struct domain *d) { +BUILD_BUG_ON (sizeof (struct evtchn *) *NR_EVTCHN_BUCKETS >PAGE_SIZE ); + d->evtchn = xzalloc_array(struct evtchn *, NR_EVTCHN_BUCKETS); + +if ( d->evtchn ==NULL ) +return -ENOMEM ; +spin_lock_init (&d->event_lock);if (get_free_port (d) !=0 ) + { +xfree (d->evtchn);return -EINVAL ; + }evtchn_from_port (d,0 )->state =ECS_RESERVED ;#if MAX_VIRT_CPUS >BITS_PER_LONG d->poll_mask = xmalloc_array(unsigned long, BITS_TO_LONGS(MAX_VIRT_CPUS));if ( !d->poll_mask ) + { +xfree (d->evtchn);return -ENOMEM ; + }bitmap_zero (d->poll_mask,MAX_VIRT_CPUS );#endif @@ -1180,6 +1192,8 @@ void evtchn_destroy(struct domain *d)spin_unlock (&d->event_lock);clear_global_virq_handlers (d); + +xfree (d->evtchn); }xen/include/xen/sched.h +1
-1@@ -263,7 +263,7 @@ struct domainspinlock_t rangesets_lock;/* Event channel information. */ -struct evtchn *evtchn[NR_EVTCHN_BUCKETS ]; +struct evtchn **evtchn;spinlock_t event_lock;struct evtchn_port_ops *evtchn_port_ops;
PATCH 5/8 evtchn: use a per-domain variable for the max number of event channels
In reply to David VrabelFrom: David Vrabel <[email protected]>
Instead of the MAX_EVTCHNS(d) macro, use d->max_evtchns instead. This avoids having to repeatedly check the ABI type.
--- xen/common/event_channel.c | 7 +++++-- xen/common/schedule.c | 2 +- xen/include/xen/event.h | 2 +- xen/include/xen/sched.h | 1 + 4 files changed, 8 insertions(+), 4 deletions(-)
xen/common/event_channel.c +5 -2
@@ -134,7 +134,7 @@ static int get_free_port(struct domain *d)if (evtchn_from_port (d, port)->state ==ECS_FREE )return port; -if ( port ==MAX_EVTCHNS (d) ) +if ( port == d->max_evtchns )return -ENOSPC ; chn = xzalloc_array(struct evtchn, EVTCHNS_PER_BUCKET);
@@ -1136,6 +1136,8 @@ void notify_via_xen_event_channel(struct domain *ld, int lport)int evtchn_init (struct domain *d) { + d->max_evtchns =MAX_EVTCHNS (d); +BUILD_BUG_ON (sizeof (struct evtchn *) *NR_EVTCHN_BUCKETS >PAGE_SIZE ); d->evtchn = xzalloc_array(struct evtchn *, NR_EVTCHN_BUCKETS);
@@ -1160,6 +1162,7 @@ int evtchn_init(struct domain *d)bitmap_zero (d->poll_mask,MAX_VIRT_CPUS );#endif +/* Default to N-level ABI. */ d->evtchn_port_ops = &evtchn_port_ops_2l;return 0 ;
@@ -1236,7 +1239,7 @@ static void domain_dump_evtchn_info(struct domain *d)spin_lock (&d->event_lock); -for ( port =1 ; port <MAX_EVTCHNS (d); ++port ) +for ( port =1 ; port < d->max_evtchns; ++port ) {const struct evtchn *chn;char *ssid;
xen/common/schedule.c +1 -1
@@ -690,7 +690,7 @@ static long do_poll(struct sched_poll *sched_poll) goto out; rc = -EINVAL ; -if ( port >=MAX_EVTCHNS (d) ) +if ( port >= d->max_evtchns ) goto out; rc =0 ;
xen/include/xen/event.h +1 -1
@@ -73,7 +73,7 @@ void notify_via_xen_event_channel(struct domain *ld, int lport);#define bucket_from_port (d,p) \ ((d)->evtchn[(p)/EVTCHNS_PER_BUCKET])#define port_is_valid (d,p) \ - (((p) >= 0) && ((p) < MAX_EVTCHNS(d)) && \ + (((p) >= 0) && ((p) < d->max_evtchns) && \ (bucket_from_port(d,p) != NULL))#define evtchn_from_port (d,p) \ (&(bucket_from_port(d,p))[(p)&(EVTCHNS_PER_BUCKET-1)])
xen/include/xen/sched.h +1 -0
@@ -264,6 +264,7 @@ struct domain/* Event channel information. */ struct evtchn **evtchn; +unsigned max_evtchns;spinlock_t event_lock;struct evtchn_port_ops *evtchn_port_ops;
Signature · 1 line
1.7.2.5
Re: [PATCH 5/8] evtchn: use a per-domain variable for the max number of event channels
xen/common/event_channel.c void notify_via_xen_event_channel(struct domain *ld, int lport) · line 1139
Quoted 6 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/common/event_channel.c +1
-0@@ -1136,6 +1136,8 @@ void notify_via_xen_event_channel(struct domain *ld, int lport)int evtchn_init (struct domain *d) { + d->max_evtchns =MAX_EVTCHNS (d);
With MAX_EVTCHNS() only being needed here now (and not supposed to be used elsewhere), is there no way to restrict its visibility to just this source file (i.e. move the definition out of the header)?
Jan
PATCH 6/8 HACK! evtchn: increase number of buckets to support the FIFO ABI
In reply to David VrabelFrom: David Vrabel <[email protected]>
Increase NR_EVTCHN_BUCKETS so 2^17 event channels are possible. This required increasing EVTCHN_PER_BUCKET so the bucket list fits into a page.
HACK! because each bucket is now > PAGE_SIZE.
--- xen/include/xen/sched.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
xen/include/xen/sched.h +3 -2
@@ -51,8 +51,9 @@ extern struct domain *dom0;#define BITS_PER_EVTCHN_WORD (d) (has_32bit_shinfo(d) ? 32 : BITS_PER_LONG)#endif #define MAX_EVTCHNS (d) (BITS_PER_EVTCHN_WORD(d) * BITS_PER_EVTCHN_WORD(d)) -#define EVTCHNS_PER_BUCKET 128 -#define NR_EVTCHN_BUCKETS (NR_EVENT_CHANNELS / EVTCHNS_PER_BUCKET) +/* FIXME: this causes each bucket to be > PAGE_SIZE. */ +#define EVTCHNS_PER_BUCKET 256 +#define NR_EVTCHN_BUCKETS ((1 << EVTCHN_FIFO_LINK_BITS) / EVTCHNS_PER_BUCKET)struct evtchn {
Signature · 1 line
1.7.2.5
PATCH 7/8 evtchn: add FIFO-based event channel ABI
In reply to David VrabelFrom: David Vrabel <[email protected]>
Add the event channel hypercall sub-ops and the definitions for the shared data structures for the FIFO-based event channel ABI.
The design document for this new ABI is available here:
http://xenbits.xen.org/people/dvrabel/event-channels-C.pdf
In summary, events are reported using a per-domain shared event array of event words. Each event word has PENDING, LINKED and MASKED bits and a LINK field for pointing to the next event in the event queue.
There are 16 event queues (with different priorities) per-VCPU.
Key advantages of this new ABI include:
- Support for over 100,000 events (2^17).
- 16 different event priorities.
- Improved fairness in event latency through the use of FIFOs.
--- xen/include/public/event_channel.h | 70 ++++++++++++++++++++++++++++++++++++ 1 files changed, 70 insertions(+), 0 deletions(-)
xen/include/public/event_channel.h +70 -0
@@ -71,6 +71,10 @@#define EVTCHNOP_bind_vcpu 8#define EVTCHNOP_unmask 9#define EVTCHNOP_reset 10 +#define EVTCHNOP_init_control 11 +#define EVTCHNOP_expand_array 12 +#define EVTCHNOP_set_priority 13 +#define EVTCHNOP_set_limit 14/* ` } */ typedef uint32_t evtchn_port_t ;
@@ -258,6 +262,46 @@ struct evtchn_reset {typedef struct evtchn_reset evtchn_reset_t ;/* +* EVTCHNOP_init_control: initialize the control block for the FIFO ABI. +*/ +struct evtchn_init_control { +/* IN parameters. */ +uint64_t control_mfn; +uint32_t offset; +uint32_t vcpu; +}; +typedef struct evtchn_init_control evtchn_init_control_t ; + +/* +* EVTCHNOP_expand_array: add an additional page to the event array. +*/ +struct evtchn_expand_array { +/* IN parameters. */ +uint64_t array_mfn; +}; +typedef struct evtchn_expand_array evtchn_expand_array_t ; + +/* +* EVTCHNOP_set_priority: set the priority for an event channel. +*/ +struct evtchn_set_priority { +/* IN parameters. */ +uint32_t port; +uint32_t priority; +}; +typedef struct evtchn_set_priority evtchn_set_priority_t ; + +/* +* EVTCHNOP_set_limit: set the maximum event channel port that may be bound. +*/ +struct evtchn_set_limit { +/* IN parameters. */ +uint32_t domid; +uint32_t max_port; +}; +typedef struct evtchn_set_limit evtchn_set_limit_t ; + +/* * ` enum neg_errnoval * ` HYPERVISOR_event_channel_op_compat(struct evtchn_op *op) * `
@@ -281,6 +325,32 @@ struct evtchn_op {typedef struct evtchn_op evtchn_op_t ;DEFINE_XEN_GUEST_HANDLE (evtchn_op_t); +/* +* FIFO ABI +*/ + +/* Events may have priorities from 0 (highest) to 15 (lowest). */ +#define EVTCHN_FIFO_PRIORITY_MIN 15 +#define EVTCHN_FIFO_PRIORITY_DEFAULT 7 + +#define EVTCHN_FIFO_MAX_QUEUES (EVTCHN_FIFO_PRIORITY_MIN + 1) + +typedef uint32_t event_word_t ; + +#define EVTCHN_FIFO_PENDING 31 +#define EVTCHN_FIFO_MASKED 30 +#define EVTCHN_FIFO_LINKED 29 + +#define EVTCHN_FIFO_LINK_BITS 17 +#define EVTCHN_FIFO_LINK_MASK ((1 << EVTCHN_FIFO_LINK_BITS) - 1) + +struct evtchn_fifo_control_block { +uint32_t ready; +uint32_t _rsvd1; +uint32_t head[EVTCHN_FIFO_MAX_QUEUES ]; +}; +typedef struct evtchn_fifo_control_block evtchn_fifo_control_block_t ; +#endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */ /*
Signature · 1 line
1.7.2.5
Re: [PATCH 7/8] evtchn: add FIFO-based event channel ABI
Quoted 14 lines
Quoted 1 line
Quoted 1 line · David Vrabel
From: David Vrabel <[email protected]>
Add the event channel hypercall sub-ops and the definitions for the shared data structures for the FIFO-based event channel ABI.
The design document for this new ABI is available here:
http://xenbits.xen.org/people/dvrabel/event-channels-C.pdf
In summary, events are reported using a per-domain shared event array of event words. Each event word has PENDING, LINKED and MASKED bits and a LINK field for pointing to the next event in the event queue.
Quoted 5 lines
There are 16 event queues (with different priorities) per-VCPU.
Key advantages of this new ABI include:
- Support for over 100,000 events (2^17).
As said in a comment on the design doc B, I'm missing a way for the guest to learn the width of the involved mask (17 here, but obviously there is nothing preventing this from being 16, 18, or yet some other implementation specific value <= 29).
Jan
Re: [PATCH 7/8] evtchn: add FIFO-based event channel ABI
Quoted 16 lines · Jan Beulich
Quoted 16 lines
Quoted 1 line
Quoted 1 line · David Vrabel
From: David Vrabel <[email protected]>
Add the event channel hypercall sub-ops and the definitions for the shared data structures for the FIFO-based event channel ABI.
The design document for this new ABI is available here:
http://xenbits.xen.org/people/dvrabel/event-channels-C.pdf
In summary, events are reported using a per-domain shared event array of event words. Each event word has PENDING, LINKED and MASKED bits and a LINK field for pointing to the next event in the event queue.
There are 16 event queues (with different priorities) per-VCPU.
Quoted 8 lines
Quoted 3 lines
Key advantages of this new ABI include:
- Support for over 100,000 events (2^17).
As said in a comment on the design doc B, I'm missing a way for the guest to learn the width of the involved mask (17 here, but obviously there is nothing preventing this from being 16, 18, or yet some other implementation specific value <= 29).
I haven't forgotten this. I was focusing on the core implementation so not all the design review feedback has been incorporated yet.
David
PATCH 8/8 evtchn: add FIFO-based event channel hypercalls and port ops
In reply to David VrabelFrom: David Vrabel <[email protected]>
Add the implementation for the FIFO-based event channel ABI. The new hypercall sub-ops (EVTCHNOP_init_control, EVTCHNOP_expand_array, EVTCHNOP_set_priority) and the required evtchn_ops (set_pending, unmask, etc.).
This current implementation has three main limitations:
- EVTCHNOP_set_limit is not yet implemented so any guest will be able to use up to 2^17 (requiring 128 global mapping pages for a fully populated event array).
- The control block frames are not required to be shared with the vcpu_info structure. This requires an additional global mapping page per-VCPU. This does makes the guest implementation cleaner though so perhaps we do not need to fix this?
- The allocation of the struct evtchns requires > PAGE_SIZE allocations. I plan to take Wei's "evtchn: alter internal object handling scheme" patch for this.
--- xen/common/Makefile | 1 + xen/common/event_channel.c | 35 +++++ xen/common/event_fifo.c | 313 ++++++++++++++++++++++++++++++++++++++++++ xen/common/event_port.c | 187 +++++++++++++++++++++++++ xen/include/xen/event.h | 13 +- xen/include/xen/event_fifo.h | 56 ++++++++ xen/include/xen/sched.h | 4 + 7 files changed, 604 insertions(+), 5 deletions(-) create mode 100644 xen/common/event_fifo.c create mode 100644 xen/include/xen/event_fifo.h
xen/common/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(HAS_DEVICE_TREE) += device_tree.o obj-y += domctl.o obj-y += domain.o obj-y += event_channel.o +obj-y += event_fifo.o obj-y += event_port.o obj-y += grant_table.o obj-y += irq.o
xen/common/event_channel.c +35 -0
@@ -26,6 +26,7 @@#include <xen/compat.h> #include <xen/guest_access.h> #include <xen/keyhandler.h> +#include <xen/event_fifo.h> #include <asm/current.h> #include <public/xen.h>
@@ -1042,6 +1043,38 @@ long do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)break ; } +case EVTCHNOP_init_control: { +struct evtchn_init_control init_control; +if (copy_from_guest (&init_control, arg,1 ) !=0 ) +return -EFAULT ; + rc =evtchn_fifo_init_control (&init_control); +break ; + } + +case EVTCHNOP_expand_array: { +struct evtchn_expand_array expand_array; +if (copy_from_guest (&expand_array, arg,1 ) !=0 ) +return -EFAULT ; + rc =evtchn_fifo_expand_array (&expand_array); +break ; + } + +case EVTCHNOP_set_priority: { +struct evtchn_set_priority set_priority; +if (copy_from_guest (&set_priority, arg,1 ) !=0 ) +return -EFAULT ; + rc =evtchn_fifo_set_priority (&set_priority); +break ; + } + +case EVTCHNOP_set_limit: { +struct evtchn_set_limit set_limit; +if (copy_from_guest (&set_limit, arg,1 ) !=0 ) +return -EFAULT ; + rc =evtchn_fifo_set_limit (&set_limit); +break ; + } +default : rc = -ENOSYS ;break ;
@@ -1184,6 +1217,8 @@ void evtchn_destroy(struct domain *d) (void )__evtchn_close (d, i); } +evtchn_fifo_destroy (d); +/* Free all event-channel buckets. */ spin_lock (&d->event_lock);for ( i =0 ; i <NR_EVTCHN_BUCKETS ; i++ )
xen/common/event_fifo.c new file +313 -0
313 lines not on this page · raw message
xen/common/event_port.c +187 -0
196 lines not on this page · raw message
xen/include/xen/event.h +8 -5
@@ -116,19 +116,21 @@ struct evtchn_port_ops { };extern struct evtchn_port_ops evtchn_port_ops_2l; +extern struct evtchn_port_ops evtchn_port_ops_fifo; -static inline void evtchn_port_set_pending (struct vcpu *v,struct evtchn *evtchn) +static inline void evtchn_port_set_pending (struct vcpu *v, +struct evtchn *evtchn) { v->domain->evtchn_port_ops->set_pending (v, evtchn); } -static inline void evtchn_port_clear_pending (struct domain *d,struct evtchn *evtchn) +static inline void evtchn_port_clear_pending (struct domain *d, +struct evtchn *evtchn) { d->evtchn_port_ops->clear_pending (d, evtchn); } -static inline void evtchn_port_unmask (struct domain *d, -const struct evtchn *evtchn) +static inline void evtchn_port_unmask (struct domain *d,struct evtchn *evtchn) { d->evtchn_port_ops->unmask (d, evtchn); }
@@ -139,7 +141,8 @@ static inline bool_t evtchn_port_is_pending(struct domain *d,return d->evtchn_port_ops->is_pending (d, evtchn); } -static inline bool_t evtchn_port_is_masked (struct domain *d,struct evtchn *evtchn) +static inline bool_t evtchn_port_is_masked (struct domain *d, +const struct evtchn *evtchn) {return d->evtchn_port_ops->is_masked (d, evtchn); }
xen/include/xen/event_fifo.h new file +56 -0
56 lines not on this page · raw message
xen/include/xen/sched.h +4 -0
@@ -83,6 +83,7 @@ struct evtchnu16 virq;/* state == ECS_VIRQ */ } u;u32 port; +struct evtchn_fifo_queue *queue;#ifdef FLASK_ENABLE void *ssid;#endif
@@ -189,6 +190,8 @@ struct vcpustruct waitqueue_vcpu *waitqueue_vcpu; +struct evtchn_fifo_vcpu *evtchn_fifo; +struct arch_vcpu arch; };
@@ -268,6 +271,7 @@ struct domainunsigned max_evtchns;spinlock_t event_lock;struct evtchn_port_ops *evtchn_port_ops; +struct evtchn_fifo_domain *evtchn_fifo;struct grant_table *grant_table;
Signature · 1 line
1.7.2.5
Re: [PATCH 8/8] evtchn: add FIFO-based event channel hypercalls and port ops
xen/common/event_fifo.c line 79
Quoted 8 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/common/event_fifo.c new file +7
-0+static int setup_control_block (struct vcpu *v,uint64_t gfn,uint32_t offset) +{ +struct domain *d = v->domain; +struct evtchn_fifo_vcpu *efv; +struct page_info *page; +void *virt; +int i;
unsigned int (also elsewhere)
xen/include/xen/event_fifo.h line 13
Quoted 2 lines
xen/include/xen/event_fifo.h new file +2
-0+struct evtchn_fifo_queue { +volatile uint32_t *head;/* points into control block */
I still think that explicit barriers are the way to go. Unless Linux'es view on this has changed, you'll have issues getting the Linux folks to accept this.
xen/include/xen/sched.h struct evtchn · line 86
Quoted 5 lines
xen/include/xen/sched.h +1
-0@@ -83,6 +83,7 @@ struct evtchnu16 virq;/* state == ECS_VIRQ */ } u;u32 port; +struct evtchn_fifo_queue *queue;
Wouldn't it be better (more space efficient) to store the queue array index rather than a pointer, considering that you expect to have thousands of event channels?
Jan
Re: [PATCH 8/8] evtchn: add FIFO-based event channel hypercalls and port ops
Quoted 7 lines · Jan Beulich
xen/include/xen/event_fifo.h line 13
Quoted 3 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/include/xen/event_fifo.h new file +2
-0+struct evtchn_fifo_queue { +volatile uint32_t *head;/* points into control block */ I still think that explicit barriers are the way to go. Unless Linux'es view on this has changed, you'll have issues getting the Linux folks to accept this.
This volatile can just be removed. head is only written by Xen in one place and it is immediately followed by a spin_unlock() which is a barrier.
Quoted 9 lines
xen/include/xen/sched.h struct evtchn · line 86
Quoted 5 lines
xen/include/xen/sched.h +1
-0@@ -83,6 +83,7 @@ struct evtchnu16 virq;/* state == ECS_VIRQ */ } u;u32 port; +struct evtchn_fifo_queue *queue;Wouldn't it be better (more space efficient) to store the queue array index rather than a pointer, considering that you expect to have thousands of event channels?
Yes.
David
Re: [PATCH 8/8] evtchn: add FIFO-based event channel hypercalls and port ops
Quoted 6 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 4 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/include/xen/event_fifo.h new file +2
-0+struct evtchn_fifo_queue { +volatile uint32_t *head;/* points into control block */
Quoted 6 lines
Quoted 3 lines
I still think that explicit barriers are the way to go. Unless Linux'es view on this has changed, you'll have issues getting the Linux folks to accept this.
This volatile can just be removed. head is only written by Xen in one place and it is immediately followed by a
spin_unlock()which is a barrier.
A release type barrier only, but that presumably is sufficient for the purposes here.
Jan
Re: [PATCH 8/8] evtchn: add FIFO-based event channel hypercalls and port ops
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 7 lines · Jan Beulich
xen/include/xen/event_fifo.h line 13
Quoted 3 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/include/xen/event_fifo.h new file +2
-0+struct evtchn_fifo_queue { +volatile uint32_t *head;/* points into control block */ I still think that explicit barriers are the way to go. Unless Linux'es view on this has changed, you'll have issues getting the Linux folks to accept this.
Quoted 5 lines
Quoted 2 lines
This volatile can just be removed. head is only written by Xen in one place and it is immediately followed by a
spin_unlock()which is a barrier.A release type barrier only, but that presumably is sufficient for the purposes here.
You might have to use an atomic_t or similar if the consumer might be confused by partial updates.
Tim.
Re: [PATCH 8/8] evtchn: add FIFO-based event channel hypercalls and port ops
Quoted 11 lines · Tim Deegan
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 7 lines · Jan Beulich
xen/include/xen/event_fifo.h line 13
Quoted 3 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/include/xen/event_fifo.h new file +2
-0+struct evtchn_fifo_queue { +volatile uint32_t *head;/* points into control block */ I still think that explicit barriers are the way to go. Unless Linux'es view on this has changed, you'll have issues getting the Linux folks to accept this.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
This volatile can just be removed. head is only written by Xen in one place and it is immediately followed by a
spin_unlock()which is a barrier.A release type barrier only, but that presumably is sufficient for the purposes here.
You might have to use an
atomic_tor similar if the consumer might be confused by partial updates.
I have assumed that reads and writes to 32-bit words are atomic on all interesting architectures.
David
Re: [PATCH 8/8] evtchn: add FIFO-based event channel hypercalls and port ops
Quoted 15 lines · David Vrabel
Quoted 14 lines · Tim Deegan
Quoted 13 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 7 lines · Jan Beulich
xen/include/xen/event_fifo.h line 13
Quoted 3 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/include/xen/event_fifo.h new file +2
-0+struct evtchn_fifo_queue { +volatile uint32_t *head;/* points into control block */ I still think that explicit barriers are the way to go. Unless Linux'es view on this has changed, you'll have issues getting the Linux folks to accept this.
This volatile can just be removed. head is only written by Xen in one place and it is immediately followed by a
spin_unlock()which is a barrier.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
A release type barrier only, but that presumably is sufficient for the purposes here.
You might have to use an
atomic_tor similar if the consumer might be confused by partial updates.I have assumed that reads and writes to 32-bit words are atomic on all interesting architectures.
True, but unless you explicitly tell it to, the compiler isn't required to update a 32-bit variable using 32-bit operations, or to avoid weird-looking intermediate values. It seems unlikely that it would do anything other than straightforwardly write the new value, but we've seen compilers do some unlikely things. :)
Tim.
Re: [PATCH 8/8] evtchn: add FIFO-based event channel hypercalls and port ops
Quoted 22 lines · Tim Deegan
Quoted 21 lines · David Vrabel
Quoted 19 lines · Tim Deegan
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 7 lines · Jan Beulich
Review
Quoted 3 lines
Quoted 1 line
Quoted 1 line · David Vrabel
(quoted diff) +2
-0+struct evtchn_fifo_queue { + volatile uint32_t *head; /* points into control block */I still think that explicit barriers are the way to go. Unless Linux'es view on this has changed, you'll have issues getting the Linux folks to accept this.
Quoted 5 lines
Quoted 2 lines
This volatile can just be removed. head is only written by Xen in one place and it is immediately followed by a
spin_unlock()which is a barrier.A release type barrier only, but that presumably is sufficient for the purposes here.
You might have to use an
atomic_tor similar if the consumer might be confused by partial updates.
Quoted 8 lines
Quoted 2 lines
I have assumed that reads and writes to 32-bit words are atomic on all interesting architectures.
True, but unless you explicitly tell it to, the compiler isn't required to update a 32-bit variable using 32-bit operations, or to avoid weird-looking intermediate values. It seems unlikely that it would do anything other than straightforwardly write the new value, but we've seen compilers do some unlikely things. :)
Ok. Looks like I need to use write_atomic() to update the head in Xen.
David
Re: [PATCH 8/8] evtchn: add FIFO-based event channel hypercalls and port ops
Quoted 6 lines · David Vrabel
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
You might have to use an
atomic_tor similar if the consumer might be confused by partial updates.I have assumed that reads and writes to 32-bit words are atomic on all interesting architectures.
Quoted 7 lines
Quoted 5 lines
True, but unless you explicitly tell it to, the compiler isn't required to update a 32-bit variable using 32-bit operations, or to avoid weird-looking intermediate values. It seems unlikely that it would do anything other than straightforwardly write the new value, but we've seen compilers do some unlikely things. :)
Ok. Looks like I need to use
write_atomic()to update the head in Xen.
Yes, I introduced {read,write}_atomic() precisely to deal with this possibility. No doubt we are missing some places it ought to be used, but at least we fix them when we spot them and new code should make use of them.
It also provides some form of documentation about memory locations involved in lock-free communication/synchronisation.
-- Keir
Re: [PATCH 8/8] evtchn: add FIFO-based event channel hypercalls and port ops
In reply to David VrabelQuoted 7 lines · David Vrabel
From: David Vrabel <[email protected]>
Add the implementation for the FIFO-based event channel ABI. The new hypercall sub-ops (
EVTCHNOP_init_control,EVTCHNOP_expand_array,EVTCHNOP_set_priority) and the requiredevtchn_ops(set_pending, unmask, etc.).
Quoted 6 lines
This current implementation has three main limitations:
-
EVTCHNOP_set_limitis not yet implemented so any guest will be able to use up to 2^17 (requiring 128 global mapping pages for a fully populated event array).
How can a guest know its limit? What if the limit change when a guest is running?
Quoted 11 lines
- The control block frames are not required to be shared with the
vcpu_infostructure. This requires an additional global mapping page per-VCPU. This does makes the guest implementation cleaner though so perhaps we do not need to fix this?- The allocation of the struct evtchns requires >
PAGE_SIZEallocations. I plan to take Wei's "evtchn: alter internal object handling scheme" patch for this.Signed-off-by David Vrabel <[email protected]>---
...
xen/common/event_fifo.c line 22
Quoted 4 lines
xen/common/event_fifo.c new file +4
-0+ +#include <public/event_channel.h> + +static int map_guest_page(struct domain *d, uint64_t gfn,
^^^^^^^^
xen_pfn_t?Review
Quoted 2 lines
(quoted diff) +2
-0+ struct page_info **page, void **virt) +{
You can use vmap() and vunmap() for all mapping / unmapping routines to simplify your code. In that case you can also eliminate the "page" field in your control structures.
Quoted 6 lines
xen/common/event_fifo.c new file +6
-0+struct page_info *p; + + p =get_page_from_gfn (d, gfn,NULL ,P2M_ALLOC ); +if ( !p ) +return -EINVAL ; +
...
xen/common/event_fifo.c line 83
Quoted 11 lines
xen/common/event_fifo.c new file +11
-0+static int setup_control_block (struct vcpu *v,uint64_t gfn,uint32_t offset) +{ +struct domain *d = v->domain; +struct evtchn_fifo_vcpu *efv; +struct page_info *page; +void *virt; +int i; +int rc; + +if ( v->evtchn_fifo ) +return -EINVAL ;
How about using EBUSY?
Quoted 3 lines
xen/common/event_fifo.c new file +3
-0+ + efv = xzalloc(struct evtchn_fifo_vcpu); +if ( efv ==NULL )
...
xen/common/event_fifo.c line 130
Quoted 8 lines
xen/common/event_fifo.c new file +8
-0+ +/* +* Some ports may already be bound, bind them to the correct VCPU so +* they have a valid queue. +* +* Note: any events that are currently pending will not be resent and +* will be lost. +*/
Does this need to be fixed? Can you scan the bitmap and pick up pending events if there are any?
This function is called when setting up first control block. So, consider:
(a) guest can only setup control block at start of day, this function will not be necessary.
(b) guest is allowed to switch ABI when there are some pending events, IMO re-injection is necessary.
xen/common/event_fifo.c line 141
Quoted 11 lines
xen/common/event_fifo.c new file +11
-0+static void rebind_all_ports (struct domain *d) +{ +int port; + +for ( port =1 ; port < d->max_evtchns; port++ ) + { +struct evtchn *evtchn; + +if ( !port_is_valid (d, port) ) +break ; +
"continue", not "break".
Quoted 14 lines
xen/common/event_fifo.c new file +14
-0+ evtchn =evtchn_from_port (d, port); +switch ( evtchn->state ) + { +case ECS_INTERDOMAIN : +case ECS_PIRQ : +case ECS_VIRQ : +evtchn_port_bind_to_vcpu (d, evtchn, d->vcpu[evtchn->notify_vcpu_id]); +break ; +default : +break ; + } + } +} +
...
Quoted 16 lines
xen/common/event_port.c +3
-0@@ -13,6 +13,9 @@#include <xen/errno.h> #include <xen/sched.h> #include <xen/event.h> +#include <xen/event_fifo.h> + +#include <public/event_channel.h> static void evtchn_check_pollers (struct domain *d,int port) {@@ -106,3 +109,187 @@ struct evtchn_port_ops evtchn_port_ops_2l = .is_pending = evtchn_2l_is_pending,
xen/common/event_port.c struct evtchn_port_ops evtchn_port_ops_2l = · line 119
Quoted 10 lines
xen/common/event_port.c +8
-0.is_masked = evtchn_2l_is_masked, }; + +static inline event_word_t *evtchn_fifo_word_from_port (struct domain *d,int port) +{ +int p, w; + +if (unlikely (port >= d->evtchn_fifo->num_evtchns) ) +return NULL ; +
Should also check against d->max_evtchns? Or you need to keep d->max_evtchns and num_evtchns in sync.
Wei.
Quoted 4 lines · David Vrabel
This is an RFC of the FIFO-based event channel ABI described in this design document:
Nice! :) It seems not massively more code than the 3-level implementation, although granted it's not fully baked yet. But I like it.
-- Keir
Quoted 18 lines
Changes since draft B are:
- Queue tail is now private to Xen.
- Guest pages are specified by MFN in the hypercalls.
- Updated link/unlink algorithm to avoid races when adding an event to a queue that is becoming empty.
Patch 1-5 do some preparatory work for supporting alternate ABIs.
Patch 6 is a hack to allow it to build.
Patch 7-8 add the ABI and the implementation. Patch 8 list some of the known limitations with this RFC implementation.
David
Quoted 11 lines
Quoted 1 line
Quoted 1 line · David Vrabel
This is an RFC of the FIFO-based event channel ABI described in this design document:
http://xenbits.xen.org/people/dvrabel/event-channels-C.pdf
Changes since draft B are:
- Queue tail is now private to Xen.
- Guest pages are specified by MFN in the hypercalls.
I think this should be GMFN universally (also in the field names). The fact that GMFN == MFN for non-translated guests is well known anyway.
Jan
Quoted 17 lines
- Updated link/unlink algorithm to avoid races when adding an event to a queue that is becoming empty.
Patch 1-5 do some preparatory work for supporting alternate ABIs.
Patch 6 is a hack to allow it to build.
Patch 7-8 add the ABI and the implementation. Patch 8 list some of the known limitations with this RFC implementation.
David
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel