From: Andres Lagar-Cavilla <andres@lagarcavilla.org>
To: xen-devel@lists.xensource.com
Cc: ian.campbell@citrix.com, andres@gridcentric.ca, tim@xen.org,
keir.xen@gmail.com, JBeulich@suse.com, ian.jackson@citrix.com,
adin@gridcentric.ca
Subject: [PATCH 1 of 5] Allow decrease_reservation to be preempted if remove_page returns negative
Date: Tue, 29 Nov 2011 16:55:10 -0500 [thread overview]
Message-ID: <8d67f4d5bafa3b75f01f.1322603710@xdev.gridcentric.ca> (raw)
In-Reply-To: <patchbomb.1322603709@xdev.gridcentric.ca>
xen/common/memory.c | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
This will allow for handling of full paging rings in a more graceful manner.
ATM, remove_page does not return negative values, so this code is not yet
exercised.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
diff -r 15da109b0c7d -r 8d67f4d5bafa xen/common/memory.c
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -226,6 +226,8 @@ static void decrease_reservation(struct
for ( i = a->nr_done; i < a->nr_extents; i++ )
{
+ int one_remove_succeeded = 0;
+
if ( hypercall_preempt_check() )
{
a->preempted = 1;
@@ -255,8 +257,33 @@ static void decrease_reservation(struct
continue;
for ( j = 0; j < (1 << a->extent_order); j++ )
- if ( !guest_remove_page(a->domain, gmfn + j) )
+ {
+ int rv = guest_remove_page(a->domain, gmfn + j);
+ /* negative rv is a result of a mem event ring full
+ * in the presence of paging. We preempt the hypercall */
+ if ( rv < 0 )
+ {
+ /* Indicate we're done with this extent */
+ if ((j+1) == (1 << a->extent_order))
+ i++;
+ a->preempted = 1;
+ raise_softirq(SCHEDULE_SOFTIRQ);
goto out;
+ }
+ /* rv of zero means we tried to remove a gfn with no backing
+ * mfn. It can be a bad argument, or, a continuation in the midst
+ * of an extent. Heuristically determine second case. */
+ if ( !rv )
+ {
+ /* Has to be first extent */
+ if ( i != a->nr_done )
+ goto out;
+ /* No previous remove in this extent must have succeeded */
+ if ( one_remove_succeeded )
+ goto out;
+ } else
+ one_remove_succeeded = 1;
+ }
}
out:
next prev parent reply other threads:[~2011-11-29 21:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-29 21:55 [PATCH 0 of 5] Memory event interface improvements Andres Lagar-Cavilla
2011-11-29 21:55 ` Andres Lagar-Cavilla [this message]
2011-11-29 21:55 ` [PATCH 2 of 5] Improve ring management for memory events. Do not lose guest events Andres Lagar-Cavilla
2011-11-30 12:58 ` Olaf Hering
2011-11-30 15:11 ` Andres Lagar-Cavilla
2011-12-01 15:36 ` Olaf Hering
2011-12-01 14:51 ` Olaf Hering
2011-12-01 15:25 ` Andres Lagar-Cavilla
2011-12-05 11:23 ` Olaf Hering
2011-12-05 15:27 ` Andres Lagar-Cavilla
2011-12-01 18:10 ` Tim Deegan
2011-12-01 10:19 ` Keir Fraser
2011-12-01 18:27 ` Andres Lagar-Cavilla
2011-12-01 18:23 ` Andres Lagar-Cavilla
2011-11-29 21:55 ` [PATCH 3 of 5] Create a generic callback mechanism for Xen-bound event channels Andres Lagar-Cavilla
2011-11-29 21:55 ` [PATCH 4 of 5] Make the prototype of p2m_mem_access_resume consistent Andres Lagar-Cavilla
2011-12-01 18:01 ` Tim Deegan
2011-12-01 18:05 ` Andres Lagar-Cavilla
2011-11-29 21:55 ` [PATCH 5 of 5] Allow memevent responses to be signaled via the event channel 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=8d67f4d5bafa3b75f01f.1322603710@xdev.gridcentric.ca \
--to=andres@lagarcavilla.org \
--cc=JBeulich@suse.com \
--cc=adin@gridcentric.ca \
--cc=andres@gridcentric.ca \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@citrix.com \
--cc=keir.xen@gmail.com \
--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.