From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Keir Fraser <keir@xen.org>,
Ian Campbell <Ian.Campbell@citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 1/3] xen/common: Introduce vcpu_{, un}pause_by_systemcontroller() helpers
Date: Thu, 24 Jul 2014 11:56:48 +0100 [thread overview]
Message-ID: <1406199410-15823-2-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1406199410-15823-1-git-send-email-andrew.cooper3@citrix.com>
Which will be used by following patches. Reorder the function declarations
for vcpu/domain pause/unpause to group by vcpu/domain and visually separate
them slightly.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Tim Deegan <tim@xen.org>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
xen/common/domain.c | 40 ++++++++++++++++++++++++++++++++++++++++
xen/include/xen/sched.h | 7 ++++++-
2 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/xen/common/domain.c b/xen/common/domain.c
index cd64aea..d7a84cf 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -878,6 +878,46 @@ void vcpu_unpause(struct vcpu *v)
vcpu_wake(v);
}
+int vcpu_pause_by_systemcontroller(struct vcpu *v)
+{
+ int old, new, prev = v->controller_pause_count;
+
+ do
+ {
+ old = prev;
+ new = old + 1;
+
+ if ( new > 255 )
+ return -EUSERS;
+
+ prev = cmpxchg(&v->controller_pause_count, old, new);
+ } while ( prev != old );
+
+ vcpu_pause(v);
+
+ return 0;
+}
+
+int vcpu_unpause_by_systemcontroller(struct vcpu *v)
+{
+ int old, new, prev = v->controller_pause_count;
+
+ do
+ {
+ old = prev;
+ new = old - 1;
+
+ if ( new < 0 )
+ return -EINVAL;
+
+ prev = cmpxchg(&v->controller_pause_count, old, new);
+ } while ( prev != old );
+
+ vcpu_unpause(v);
+
+ return 0;
+}
+
void domain_pause(struct domain *d)
{
struct vcpu *v;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 62a4785..67eb8f0 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -216,6 +216,8 @@ struct vcpu
/* VCPU paused for mem_event replies. */
atomic_t mem_event_pause_count;
+ /* VCPU paused by system controller. */
+ int controller_pause_count;
/* IRQ-safe virq_lock protects against delivering VIRQ to stale evtchn. */
evtchn_port_t virq_to_evtchn[NR_VIRQS];
@@ -768,9 +770,12 @@ void vcpu_block(void);
void vcpu_unblock(struct vcpu *v);
void vcpu_pause(struct vcpu *v);
void vcpu_pause_nosync(struct vcpu *v);
+void vcpu_unpause(struct vcpu *v);
+int vcpu_pause_by_systemcontroller(struct vcpu *v);
+int vcpu_unpause_by_systemcontroller(struct vcpu *v);
+
void domain_pause(struct domain *d);
void domain_pause_nosync(struct domain *d);
-void vcpu_unpause(struct vcpu *v);
void domain_unpause(struct domain *d);
int domain_unpause_by_systemcontroller(struct domain *d);
int __domain_pause_by_systemcontroller(struct domain *d,
--
1.7.10.4
next prev parent reply other threads:[~2014-07-24 10:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-24 10:56 [PATCH 0/3] GDBSX fixes Andrew Cooper
2014-07-24 10:56 ` Andrew Cooper [this message]
2014-07-24 10:56 ` [PATCH 2/3] x86/gdbsx: Invert preconditions for XEN_DOMCTL_gdbsx_{, un}pausevcpu hypercalls Andrew Cooper
2014-07-24 10:56 ` [PATCH 3/3] xen/gdbsx: Security audit of {, un}pausevcpu and domstatus hypercalls Andrew Cooper
2014-07-24 11:07 ` Tim Deegan
2014-07-24 11:11 ` Andrew Cooper
2014-07-24 11:16 ` [Patch v2 " Andrew Cooper
2014-07-24 11:41 ` Tim Deegan
2014-07-24 12:58 ` Jan Beulich
2014-07-24 13:02 ` Andrew Cooper
2014-07-25 1:20 ` Mukesh Rathor
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=1406199410-15823-2-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--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).