xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Tim Deegan <tim@xen.org>
To: Andres Lagar-Cavilla <andreslc@gridcentric.ca>
Cc: Andres Lagar-Cavilla <andres@lagarcavilla.org>,
	Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xen.org>
Subject: Re: get_gfn_query() locking
Date: Tue, 30 Oct 2012 15:06:12 +0000	[thread overview]
Message-ID: <20121030150612.GC34613@ocelot.phlegethon.org> (raw)
In-Reply-To: <4E449D48-D643-46FB-91BD-B15EF21AAC57@gridcentric.ca>

At 10:53 -0400 on 30 Oct (1351594401), Andres Lagar-Cavilla wrote:
> >> And then again, with the p2m lock being recursive these
> >> days, I don't think there's any harm calling the other methods
> >> here with that lock held.
> 
> Is the patch you refer to http://www.gossamer-threads.com/lists/xen/devel/261025 and the hunk in question the following?
> + get_gfn_query(d, pfn, &pt); 
> + p2m_change_type(d, pfn, pt, p2m_ram_broken); 
> + put_gfn(d, pfn); 
> 
> There really is no way to get rid of that p2m lock-protected critical
> section if the domain allows for paging etc. You might want to
> introduce a syntactically cleaner unconditional p2m_change_type
> variant that doesn't cmpxchg with the previous type -- that is
> effectively what goes on here. Should be a tiny amount of refactoring
> and the code will be cleaner, no need for query or put.

I don't think that change-type is even what's wanted here.  You want to
use some more raw form of set_p2m_entry(), since keeping the MFN is not
important.  How about:

 guest_physmap_add_entry(d, pfn, MFN_INVALID, p2m_ram_broken);

?

> > 
> > True, but it wouldn't be safe to call it with the paging lock held.
> > OTOH since we're not seeing any crashes from the lock-ordering
> > constraints maybe we don't do that.
> > 
> > Andres, what do you think?  Can we just drop/amend that comment?
> > 
> 
> If you refer to removing the ordering constraints

Noooooooooooooo! :)

I think we should drop the comment that says it's OK to call
get_gfn_query() with the paging lock held (and audit to check that we
don't do that anywhere).

Tim.

  reply	other threads:[~2012-10-30 15:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30  9:23 get_gfn_query() locking Jan Beulich
2012-10-30  9:36 ` Tim Deegan
2012-10-30 14:53   ` Andres Lagar-Cavilla
2012-10-30 15:06     ` Tim Deegan [this message]
2012-10-31 17:04       ` Andres Lagar-Cavilla
2012-10-31 17:07         ` Tim Deegan
2012-10-30 15:09     ` Jan Beulich
2012-10-31 17:05       ` 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=20121030150612.GC34613@ocelot.phlegethon.org \
    --to=tim@xen.org \
    --cc=JBeulich@suse.com \
    --cc=andres@lagarcavilla.org \
    --cc=andreslc@gridcentric.ca \
    --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).