From: Wei Liu <wei.liu2@citrix.com>
To: xen-devel@lists.xen.org
Cc: Wei Liu <wei.liu2@citrix.com>,
david.vrabel@citrix.com, jbeulich@suse.com,
ian.campbell@citrix.com
Subject: [RFC PATCH V5 11/15] evtchn: use pointers to reference evtchn_pending/mask
Date: Tue, 19 Mar 2013 15:15:36 +0000 [thread overview]
Message-ID: <1363706140-26989-12-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1363706140-26989-1-git-send-email-wei.liu2@citrix.com>
This allows better code sharing between 2/3-level event channel ABIs.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
xen/arch/arm/domain.c | 1 +
xen/arch/x86/domain.c | 1 +
xen/common/event_channel.c | 6 ++++++
xen/common/evtchn_bitmap_abi.c | 14 +++++++-------
xen/include/xen/event.h | 3 +++
xen/include/xen/sched.h | 2 ++
6 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index bca3d89..f6a5560 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -471,6 +471,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
d->arch.vmpidr = boot_cpu_data.mpidr.bits;
clear_page(d->shared_info);
+ evtchn_set_default_bitmap(d);
share_xen_page_with_guest(
virt_to_page(d->shared_info), d, XENSHARE_writable);
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 8d30d08..d7912b3 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -547,6 +547,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
goto fail;
clear_page(d->shared_info);
+ evtchn_set_default_bitmap(d);
share_xen_page_with_guest(
virt_to_page(d->shared_info), d, XENSHARE_writable);
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 4d02fc7..152b77a 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -1177,6 +1177,12 @@ void evtchn_set_abi(struct domain *d, uint64_t abi)
}
}
+void evtchn_set_default_bitmap(struct domain *d)
+{
+ d->evtchn_pending = (xen_ulong_t *)shared_info(d, evtchn_pending);
+ d->evtchn_mask = (xen_ulong_t *)shared_info(d, evtchn_mask);
+}
+
int evtchn_init(struct domain *d)
{
spin_lock_init(&d->event_lock);
diff --git a/xen/common/evtchn_bitmap_abi.c b/xen/common/evtchn_bitmap_abi.c
index 0d747bc..180a4bc 100644
--- a/xen/common/evtchn_bitmap_abi.c
+++ b/xen/common/evtchn_bitmap_abi.c
@@ -24,12 +24,12 @@
int evtchn_bitmap_is_pending(struct domain *d, int port)
{
- return test_bit(port, &shared_info(d, evtchn_pending));
+ return test_bit(port, d->evtchn_pending);
}
int evtchn_bitmap_is_masked(struct domain *d, int port)
{
- return test_bit(port, &shared_info(d, evtchn_mask));
+ return test_bit(port, d->evtchn_mask);
}
void evtchn_bitmap_set_pending(struct vcpu *v, int port)
@@ -44,10 +44,10 @@ void evtchn_bitmap_set_pending(struct vcpu *v, int port)
* others may require explicit memory barriers.
*/
- if ( test_and_set_bit(port, &shared_info(d, evtchn_pending)) )
+ if ( test_and_set_bit(port, d->evtchn_pending) )
return;
- if ( !test_bit (port, &shared_info(d, evtchn_mask)) &&
+ if ( !test_bit (port, d->evtchn_mask) &&
!test_and_set_bit(port / BITS_PER_EVTCHN_WORD(d),
&vcpu_info(v, evtchn_pending_sel)) )
{
@@ -75,7 +75,7 @@ void evtchn_bitmap_set_pending(struct vcpu *v, int port)
void evtchn_bitmap_clear_pending(struct domain *d, int port)
{
- clear_bit(port, &shared_info(d, evtchn_pending));
+ clear_bit(port, d->evtchn_pending);
}
int evtchn_bitmap_unmask(unsigned int port)
@@ -94,8 +94,8 @@ int evtchn_bitmap_unmask(unsigned int port)
* These operations must happen in strict order. Based on
* include/xen/event.h:evtchn_set_pending().
*/
- if ( test_and_clear_bit(port, &shared_info(d, evtchn_mask)) &&
- test_bit (port, &shared_info(d, evtchn_pending)) &&
+ if ( test_and_clear_bit(port, d->evtchn_mask) &&
+ test_bit (port, d->evtchn_pending) &&
!test_and_set_bit (port / BITS_PER_EVTCHN_WORD(d),
&vcpu_info(v, evtchn_pending_sel)) )
{
diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
index 9531029..2387461 100644
--- a/xen/include/xen/event.h
+++ b/xen/include/xen/event.h
@@ -135,6 +135,9 @@ void notify_via_xen_event_channel(struct domain *ld, int lport);
mb(); /* set blocked status /then/ caller does his work */ \
} while ( 0 )
+/* This is called after domain's shared info page is setup */
+void evtchn_set_default_bitmap(struct domain *d);
+
/* 2-level ABI routines */
int evtchn_bitmap_is_pending(struct domain *d, int port);
int evtchn_bitmap_is_masked(struct domain *d, int port);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 6bf96bd..71eebb6 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -270,6 +270,8 @@ struct domain
struct evtchn **evtchn[NR_EVTCHN_GROUPS];
const struct evtchn_port_ops *evtchn_ops;
spinlock_t event_lock;
+ xen_ulong_t *evtchn_pending;
+ xen_ulong_t *evtchn_mask;
unsigned int max_evtchns;
unsigned int evtchn_extended;
--
1.7.10.4
next prev parent reply other threads:[~2013-03-19 15:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-19 15:15 [RFC PATCH V5 00/15] Implement 3-level event channel ABI in Xen Wei Liu
2013-03-19 15:15 ` [RFC PATCH V5 01/15] Clean up trailing whitespaces Wei Liu
2013-03-19 15:15 ` [RFC PATCH V5 02/15] evtchn: reset bucket if xsm_alloc_security_evtchn fails Wei Liu
2013-03-19 15:15 ` [RFC PATCH V5 03/15] evtchn: alter internal object handling scheme Wei Liu
2013-03-20 9:22 ` Jan Beulich
2013-03-19 15:15 ` [RFC PATCH V5 04/15] evtchn: generalize event channel operations Wei Liu
2013-03-20 9:31 ` Jan Beulich
2013-03-19 15:15 ` [RFC PATCH V5 05/15] evtchn: add d->max_evtchns Wei Liu
2013-03-19 15:15 ` [RFC PATCH V5 06/15] evtchn: implement extended event channel ABIs query Wei Liu
2013-03-19 15:15 ` [RFC PATCH V5 07/15] evtchn: define 3-level event channel registration interface Wei Liu
2013-03-19 15:15 ` [RFC PATCH V5 08/15] evtchn: add evtchn_extended in struct domain Wei Liu
2013-03-19 15:15 ` [RFC PATCH V5 09/15] evtchn: calculate max event channels for EVTCHN_EXTENDED_L3 Wei Liu
2013-03-19 15:15 ` [RFC PATCH V5 10/15] evtchn: update Xen public header xen.h Wei Liu
2013-03-19 15:15 ` Wei Liu [this message]
2013-03-19 15:15 ` [RFC PATCH V5 12/15] evtchn: introduce EVTCHN_WORD_BITORDER macro Wei Liu
2013-03-19 15:15 ` [RFC PATCH V5 13/15] evtchn: infrastructure to manipulate 3-level event channel pages Wei Liu
2013-03-19 15:15 ` [RFC PATCH V5 14/15] evtchn: implement 3-level event channel routines Wei Liu
2013-03-19 15:15 ` [RFC PATCH V5 15/15] evtchn: only allow 3-level event channel on Dom0 Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1363706140-26989-12-git-send-email-wei.liu2@citrix.com \
--to=wei.liu2@citrix.com \
--cc=david.vrabel@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=jbeulich@suse.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).