From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Matt Wilson <msw@linux.com>
Cc: xen-devel@lists.xenproject.org, Keir Fraser <keir@xen.org>,
Jan Beulich <jbeulich@suse.com>, Matt Wilson <msw@amazon.com>,
Anthony Liguori <aliguori@amazon.com>
Subject: Re: [PATCH] gnttab: lock the left grant table earlier in __gnttab_unmap_common()
Date: Mon, 11 Nov 2013 09:53:01 +0000 [thread overview]
Message-ID: <5280A8FD.6050707@citrix.com> (raw)
In-Reply-To: <1384135642-26301-1-git-send-email-msw@linux.com>
On 11/11/13 02:07, Matt Wilson wrote:
> 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>
> Cc: Anthony Liguori <aliguori@amazon.com>
> Signed-off-by: Matt Wilson <msw@amazon.com>
> ---
> 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) )
> {
next prev parent reply other threads:[~2013-11-11 9:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-11 2:07 [PATCH] gnttab: lock the left grant table earlier in __gnttab_unmap_common() Matt Wilson
2013-11-11 2:14 ` Anthony Liguori
2013-11-11 9:58 ` Jan Beulich
2013-11-11 14:52 ` Anthony Liguori
2013-11-11 16:23 ` Jan Beulich
2013-11-11 16:45 ` Anthony Liguori
2013-11-11 9:53 ` Andrew Cooper [this message]
2013-11-11 9:53 ` Jan Beulich
2013-11-11 10:53 ` David Vrabel
2013-11-11 14:48 ` Anthony Liguori
2013-11-11 16:29 ` David Vrabel
2013-11-11 17:21 ` Matt Wilson
2013-11-11 19:56 ` [PATCH v2] gnttab: lock the local " Matt Wilson
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=5280A8FD.6050707@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=aliguori@amazon.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=msw@amazon.com \
--cc=msw@linux.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 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).