xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andres Lagar-Cavilla <andres@lagarcavilla.org>
To: xen-devel@lists.xensource.com
Cc: george.dunlap@eu.citrix.com, andres@gridcentric.ca,
	keir.xen@gmail.com, tim@xen.org, adin@gridcentric.ca
Subject: [PATCH 0 of 7] Synchronized p2m lookups v2
Date: Thu, 09 Feb 2012 00:45:45 -0500	[thread overview]
Message-ID: <patchbomb.1328766345@xdev.gridcentric.ca> (raw)

Changes from v1 posted Feb 2nd 2012
<Mostly Acked-by and comments>

- patch 1:
 + Clarified comments in header regarding shadow mode
 + Clarified error checking in hap_update_paging_modes
 + Updated comment about lockng discipline between p2m and page sharing

- patch 2:
 + Fixed one instance of gfn_unlock when it should have been p2m_unlock
 + Added Acked-by

- patch 4:
 + Added comments explaining new argument to p2m_mem_access_check
 + Added Acked-by

- patch 5:
 + Added Acked-by

- Added patch 6 to the series, previously posted separately as "x86/mm:
  Refactor possibly deadlocking get_gfn calls"
 + Simplified logic of get_two_gfns
 + Made get_two_gfns struct stack vars rather than dynamically allocated

- Added patch 7 to the series, previously posted separately as "x86/mm: When
  removing/adding a page from/to the physmap, keep in mind it could be shared"
 + Added a missing p2m unlock

Description from original post follows:

Up until now, p2m lookups (get_gfn*) in the x86 architecture were not
synchronized against concurrent updates. With the addition of sharing and
paging subsystems that can dynamically modify the p2m, the need for
synchronized lookups becomes more pressing.

Without synchronized lookups, we've encountered host crashes triggered by race
conditions, particularly when exercising the sharing subsystem.

In this patch series we make p2m lookups fully synchronized. We still use a
single per-domain p2m lock (profiling work tbd may or may not indicate the need
for fine-grained locking).

We only enforce locking of p2m queries for hap-assisted domains. These are the
domains (in the case of EPT) that can exercise the paging and sharing
subsystems and thus most in need of synchronized lookups.

While the code *should* work for domains relying on shadow paging, it has not
been tested, hence we do not enable this at the moment.

Finally, the locking discipline in the PoD subsystem has been updated, since
PoD relied on some assumptions about the way the p2m lock is used.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Adin Scannell <adin@scannell.ca>

 xen/arch/x86/mm/hap/hap.c        |    8 ++
 xen/arch/x86/mm/mm-locks.h       |   40 ++++++++-----
 xen/arch/x86/mm/p2m.c            |   21 ++++++-
 xen/include/asm-x86/mm.h         |    6 +-
 xen/include/asm-x86/p2m.h        |   47 ++++++++++------
 xen/arch/x86/mm/mem_sharing.c    |    2 -
 xen/arch/x86/mm/mm-locks.h       |    4 +-
 xen/arch/x86/mm/p2m-ept.c        |   33 +----------
 xen/arch/x86/mm/p2m-pod.c        |   14 +++-
 xen/arch/x86/mm/p2m-pt.c         |   45 ++-------------
 xen/arch/x86/mm/p2m.c            |   62 +++++++++++----------
 xen/arch/x86/mm/mm-locks.h       |   10 +++
 xen/arch/x86/mm/p2m-pod.c        |  110 +++++++++++++++++++++++---------------
 xen/arch/x86/mm/p2m-pt.c         |    1 +
 xen/arch/x86/mm/p2m.c            |    8 ++-
 xen/include/asm-x86/p2m.h        |   27 ++------
 xen/arch/x86/hvm/emulate.c       |    2 +-
 xen/arch/x86/hvm/hvm.c           |   25 ++++++--
 xen/arch/x86/mm.c                |   10 +-
 xen/arch/x86/mm/guest_walk.c     |    2 +-
 xen/arch/x86/mm/hap/guest_walk.c |    6 +-
 xen/arch/x86/mm/mem_access.c     |   10 +++
 xen/arch/x86/mm/mem_event.c      |    5 +
 xen/arch/x86/mm/p2m.c            |   52 ++++++++++--------
 xen/common/grant_table.c         |    2 +-
 xen/common/memory.c              |    2 +-
 xen/include/asm-x86/mem_access.h |    1 +
 xen/include/asm-x86/mem_event.h  |    3 +
 xen/include/asm-x86/p2m.h        |   10 ++-
 xen/arch/x86/mm/p2m.c            |    4 +-
 xen/arch/x86/hvm/emulate.c       |   33 ++++------
 xen/arch/x86/mm/mem_sharing.c    |   24 +++----
 xen/include/asm-x86/p2m.h        |   60 +++++++++++++++++++++
 xen/arch/x86/mm/p2m.c            |   26 ++++++++-
 34 files changed, 427 insertions(+), 288 deletions(-)

             reply	other threads:[~2012-02-09  5:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09  5:45 Andres Lagar-Cavilla [this message]
2012-02-09  5:45 ` [PATCH 1 of 7] Make p2m lookups fully synchronized wrt modifications Andres Lagar-Cavilla
2012-02-10 15:33   ` Tim Deegan
2012-02-09  5:45 ` [PATCH 2 of 7] Clean up locking now that p2m lockups are fully synchronized Andres Lagar-Cavilla
2012-02-09  5:45 ` [PATCH 3 of 7] Rework locking in the PoD layer Andres Lagar-Cavilla
2012-02-09 12:07   ` George Dunlap
2012-02-09 14:45     ` Andres Lagar-Cavilla
2012-02-10 15:36       ` Tim Deegan
2012-02-10 15:43         ` Tim Deegan
2012-02-10 15:47           ` Andres Lagar-Cavilla
2012-02-10 15:59       ` George Dunlap
2012-02-09  5:45 ` [PATCH 4 of 7] Re-order calls to put_gfn() around wait queue invocations Andres Lagar-Cavilla
2012-02-09  5:45 ` [PATCH 5 of 7] x86/mm: Revert changeset 24582:f6c33cfe7333 Andres Lagar-Cavilla
2012-02-09  5:45 ` [PATCH 6 of 7] x86/mm: Refactor possibly deadlocking get_gfn calls Andres Lagar-Cavilla
2012-02-09  5:45 ` [PATCH 7 of 7] x86/mm: When removing/adding a page from/to the physmap, keep in mind it could be shared Andres Lagar-Cavilla
2012-02-10 15:38   ` Tim Deegan
2012-02-10 16:10 ` [PATCH 0 of 7] Synchronized p2m lookups v2 Tim Deegan

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=patchbomb.1328766345@xdev.gridcentric.ca \
    --to=andres@lagarcavilla.org \
    --cc=adin@gridcentric.ca \
    --cc=andres@gridcentric.ca \
    --cc=george.dunlap@eu.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 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).