From: Matt Wilson <msw@linux.com>
To: xen-devel@lists.xenproject.org
Cc: "Felipe Franciosi" <felipe.franciosi@citrix.com>,
"Anthony Liguori" <aliguori@amazon.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"David Vrabel" <david.vrabel@citrix.com>,
"Jan Beulich" <jbeulich@suse.com>, "Keir Fraser" <keir@xen.org>,
"Matt Wilson" <msw@amazon.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [RFC PATCH 1/2] gnttab: lock the local grant table earlier in __gnttab_unmap_common()
Date: Mon, 11 Nov 2013 18:03:11 -0800 [thread overview]
Message-ID: <1384221792-3456-2-git-send-email-msw@linux.com> (raw)
In-Reply-To: <1384221792-3456-1-git-send-email-msw@linux.com>
From: Matt Wilson <msw@amazon.com>
Luckily today maptrack_limit never shrinks. But if at some point in
the future this were to change, checking maptrack_limit without
holding the grant table spinlock would no longer be safe.
Cc: xen-devel@lists.xenproject.org
Cc: Keir Fraser <keir@xen.org>
Cc: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony Liguori <aliguori@amazon.com>
Signed-off-by: Matt Wilson <msw@amazon.com>
---
v1->v2:
* updated summary to use "local" instead of "left"
---
xen/common/grant_table.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 21c6a14..ef10ff4 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -842,15 +842,16 @@ __gnttab_unmap_common(
op->frame = (unsigned long)(op->dev_bus_addr >> PAGE_SHIFT);
+ spin_lock(&lgt->lock);
if ( unlikely(op->handle >= lgt->maptrack_limit) )
{
+ spin_unlock(&lgt->lock);
gdprintk(XENLOG_INFO, "Bad handle (%d).\n", op->handle);
op->status = GNTST_bad_handle;
return;
}
op->map = &maptrack_entry(lgt, op->handle);
- spin_lock(&lgt->lock);
if ( unlikely(!op->map->flags) )
{
--
1.7.9.5
next prev parent reply other threads:[~2013-11-12 2:03 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-12 2:03 [RFC PATCH 0/2] gnttab: refactor locking for better scalability Matt Wilson
2013-11-12 2:03 ` Matt Wilson [this message]
2013-11-12 2:03 ` [RFC PATCH 2/2] " Matt Wilson
2013-11-12 5:37 ` Keir Fraser
2013-11-12 7:18 ` Matt Wilson
2013-11-12 8:07 ` Keir Fraser
2013-11-12 9:18 ` Jan Beulich
2013-11-12 13:42 ` Keir Fraser
2013-11-12 13:58 ` Keir Fraser
2013-11-12 14:11 ` Jan Beulich
2013-11-12 14:24 ` Keir Fraser
2013-11-12 15:09 ` Felipe Franciosi
2014-06-20 20:54 ` Konrad Rzeszutek Wilk
2014-06-20 21:18 ` Matt Wilson
2013-11-12 19:06 ` Matt Wilson
2013-11-12 14:52 ` Konrad Rzeszutek Wilk
2013-11-12 15:04 ` David Vrabel
2013-11-12 16:53 ` Anthony Liguori
2013-11-12 9:26 ` Jan Beulich
2013-11-12 17:58 ` Matt Wilson
2013-11-13 7:39 ` Jan Beulich
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=1384221792-3456-2-git-send-email-msw@linux.com \
--to=msw@linux.com \
--cc=aliguori@amazon.com \
--cc=andrew.cooper3@citrix.com \
--cc=david.vrabel@citrix.com \
--cc=felipe.franciosi@citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=msw@amazon.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xenproject.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 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.