From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: "Juergen Gross" <jgross@suse.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Wei Liu" <wei.liu2@citrix.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Julien Grall" <julien.grall@arm.com>,
"Jan Beulich" <JBeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH RFC] xen/evtchn: Implement EVTCHNOP_send_imm as a companian to EVTCHNOP_send
Date: Thu, 13 Jul 2017 08:50:34 +0100 [thread overview]
Message-ID: <1499932234-6413-1-git-send-email-andrew.cooper3@citrix.com> (raw)
The event channel ABI passes a pointer to a subop-specific structure. Some of
these structures however are smaller than the pointers passed in the ABI;
EVTCHNOP_send specifically passes a 4 byte evtchn port, using a 4 or 8 byte
pointer.
For translated guests (x86 HVM and all ARM), passing the port number directly
avoids a guest pagetable walk, which can be very expensive for Xen to perform.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
CC: Juergen Gross <jgross@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
RFC: is it worth converting the close, unmask, reset (and possibly
expand_array) as well?
---
xen/common/event_channel.c | 4 ++++
xen/include/public/event_channel.h | 13 ++++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index c69f9db..79d8614 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -1098,6 +1098,10 @@ long do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
break;
}
+ case EVTCHNOP_send_imm:
+ rc = evtchn_send(current->domain, (unsigned long)arg.p);
+ break;
+
case EVTCHNOP_status: {
struct evtchn_status status;
if ( copy_from_guest(&status, arg, 1) != 0 )
diff --git a/xen/include/public/event_channel.h b/xen/include/public/event_channel.h
index 44c549d..834787a 100644
--- a/xen/include/public/event_channel.h
+++ b/xen/include/public/event_channel.h
@@ -57,6 +57,9 @@
* `
* @cmd == EVTCHNOP_* (event-channel operation).
* @args == struct evtchn_* Operation-specific extra arguments (NULL if none).
+ *
+ * For @cmd with an _imm suffix, data are passed as an integer, rather than a
+ * pointer to a structure.
*/
/* ` enum event_channel_op { // EVTCHNOP_* => struct evtchn_* */
@@ -64,7 +67,7 @@
#define EVTCHNOP_bind_virq 1
#define EVTCHNOP_bind_pirq 2
#define EVTCHNOP_close 3
-#define EVTCHNOP_send 4
+#define EVTCHNOP_send 4 /* Deprecated. Use EVTCHNOP_send_imm in preference. */
#define EVTCHNOP_status 5
#define EVTCHNOP_alloc_unbound 6
#define EVTCHNOP_bind_ipi 7
@@ -74,6 +77,7 @@
#define EVTCHNOP_init_control 11
#define EVTCHNOP_expand_array 12
#define EVTCHNOP_set_priority 13
+#define EVTCHNOP_send_imm 14
/* ` } */
typedef uint32_t evtchn_port_t;
@@ -186,8 +190,11 @@ struct evtchn_close {
typedef struct evtchn_close evtchn_close_t;
/*
- * EVTCHNOP_send: Send an event to the remote end of the channel whose local
- * endpoint is <port>.
+ * EVTCHNOP_send{,_imm}: Send an event to the remote end of the channel whose
+ * local endpoint is <port>.
+ *
+ * For EVTCHNOP_send, arg is a pointer to an evtchn_send_t. For
+ * EVTCHNOP_send_imm, arg is the port directly.
*/
struct evtchn_send {
/* IN parameters. */
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next reply other threads:[~2017-07-13 7:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-13 7:50 Andrew Cooper [this message]
2017-07-13 9:44 ` [PATCH RFC] xen/evtchn: Implement EVTCHNOP_send_imm as a companian to EVTCHNOP_send Paul Durrant
2017-07-13 10:14 ` Juergen Groß
2017-07-13 12:04 ` Wei Liu
2017-07-13 19:36 ` Jan Beulich
2017-07-14 7:35 ` Paul Durrant
2017-07-14 10:57 ` Jan Beulich
2017-07-17 18:30 ` Stefano Stabellini
2017-07-17 22:54 ` Andrew Cooper
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=1499932234-6413-1-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=jgross@suse.com \
--cc=julien.grall@arm.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wei.liu2@citrix.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).