From: Andres Lagar-Cavilla <andres@lagarcavilla.org>
To: xen-devel@lists.xensource.com
Cc: andres@gridcentric.ca, keir.xen@gmail.com, tim@xen.org,
olaf@aepfle.de, adin@gridcentric.ca
Subject: [PATCH 5 of 5] Ignore memory events with an obviously invalid gfn
Date: Mon, 05 Dec 2011 10:12:04 -0500 [thread overview]
Message-ID: <790cd814bee86c717fe4.1323097924@xdev.gridcentric.ca> (raw)
In-Reply-To: <patchbomb.1323097919@xdev.gridcentric.ca>
xen/arch/x86/mm/mem_sharing.c | 2 ++
xen/arch/x86/mm/p2m.c | 4 ++++
xen/include/public/mem_event.h | 7 +++++++
3 files changed, 13 insertions(+), 0 deletions(-)
Ring semantics require that for every request, a response be put. This
allows consumer to place a dummy response if need be.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
diff -r c71f4c5b42f0 -r 790cd814bee8 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -303,6 +303,8 @@ int mem_sharing_sharing_resume(struct do
/* Get all requests off the ring */
while ( mem_event_get_response(&d->mem_event->share, &rsp) )
{
+ if ( DUMMY_MEM_EVENT_RSP(&rsp) )
+ continue;
/* Unpause domain/vcpu */
if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
vcpu_unpause(d->vcpu[rsp.vcpu_id]);
diff -r c71f4c5b42f0 -r 790cd814bee8 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1069,6 +1069,8 @@ void p2m_mem_paging_resume(struct domain
/* Pull all responses off the ring */
while( mem_event_get_response(&d->mem_event->paging, &rsp) )
{
+ if ( DUMMY_MEM_EVENT_RSP(&rsp) )
+ continue;
/* Fix p2m entry if the page was not dropped */
if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
{
@@ -1177,6 +1179,8 @@ void p2m_mem_access_resume(struct domain
/* Pull all responses off the ring */
while( mem_event_get_response(&d->mem_event->access, &rsp) )
{
+ if ( DUMMY_MEM_EVENT_RSP(&rsp) )
+ continue;
/* Unpause domain */
if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
vcpu_unpause(d->vcpu[rsp.vcpu_id]);
diff -r c71f4c5b42f0 -r 790cd814bee8 xen/include/public/mem_event.h
--- a/xen/include/public/mem_event.h
+++ b/xen/include/public/mem_event.h
@@ -76,6 +76,13 @@ typedef struct mem_event_st {
DEFINE_RING_TYPES(mem_event, mem_event_request_t, mem_event_response_t);
+#define INVALID_RSP_GFN -1UL
+
+#define DUMMY_MEM_EVENT_RSP(_r) ((_r)->gfn == INVALID_RSP_GFN)
+#define MAKE_MEM_EVENT_RSP_DUMMY(_r) ((_r)->gfn = INVALID_RSP_GFN)
+#define DECLARE_DUMMY_MEM_EVENT_RSP(_name) \
+ mem_event_response_t _name = { .gfn = INVALID_RSP_GFN }
+
#endif
/*
next prev parent reply other threads:[~2011-12-05 15:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-05 15:11 [PATCH 0 of 5] Mem event interface improvements Andres Lagar-Cavilla
2011-12-05 15:12 ` [PATCH 1 of 5] Flag events caused by foreign domains Andres Lagar-Cavilla
2011-12-05 15:12 ` [PATCH 2 of 5] Create a generic callback mechanism for Xen-bound event channels Andres Lagar-Cavilla
2011-12-05 15:12 ` [PATCH 3 of 5] Allow memevent responses to be signaled via the event channel Andres Lagar-Cavilla
2011-12-05 15:12 ` [PATCH 4 of 5] Consume multiple mem event responses off the ring Andres Lagar-Cavilla
2011-12-05 15:12 ` Andres Lagar-Cavilla [this message]
2011-12-05 16:01 ` [PATCH 5 of 5] Ignore memory events with an obviously invalid gfn Tim Deegan
2011-12-05 16:20 ` Andres Lagar-Cavilla
2011-12-06 12:23 ` [PATCH 0 of 5] Mem event interface improvements Olaf Hering
2011-12-06 20:15 ` Tim Deegan
2011-12-06 20:39 ` Andres Lagar-Cavilla
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=790cd814bee86c717fe4.1323097924@xdev.gridcentric.ca \
--to=andres@lagarcavilla.org \
--cc=adin@gridcentric.ca \
--cc=andres@gridcentric.ca \
--cc=keir.xen@gmail.com \
--cc=olaf@aepfle.de \
--cc=tim@xen.org \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.