All of lore.kernel.org
 help / color / mirror / Atom feed
From: Razvan Cojocaru <rcojocaru@bitdefender.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Cc: "George Dunlap" <george.dunlap@eu.citrix.com>,
	"Tamas K Lengyel" <tamas@tklengyel.com>,
	"Wei Liu" <wei.liu2@citrix.com>,
	"Jan Beulich" <JBeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH 04/14] x86/p2m: Fix locking in p2m_altp2m_lazy_copy()
Date: Wed, 21 Nov 2018 15:59:35 +0200	[thread overview]
Message-ID: <751b8be6-095e-69f9-f99f-0f18ba4e77b7@bitdefender.com> (raw)
In-Reply-To: <1542806482-24030-5-git-send-email-andrew.cooper3@citrix.com>

On 11/21/18 3:21 PM, Andrew Cooper wrote:
> The gfn references need to remain held until after the p2m_set_entry() has
> completed.  This is only a latent bug for now, because there is no per-gfn
> locking and we recursively hold the main p2m locks.
> 
> Rearrange the code to have a single exit path, and defer taking the ap2m lock
> until it is necessary to do so.  Leave some comments behind to help people
> attempting to follow the logic.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Razvan Cojocaru <rcojocaru@bitdefender.com>
> CC: Tamas K Lengyel <tamas@tklengyel.com>
> CC: George Dunlap <george.dunlap@eu.citrix.com>
> ---
>  xen/arch/x86/mm/p2m.c | 27 ++++++++++++++++++++-------
>  1 file changed, 20 insertions(+), 7 deletions(-)
> 
> diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
> index b5a59d6..ae9cb20 100644
> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -2184,24 +2184,29 @@ bool_t p2m_altp2m_lazy_copy(struct vcpu *v, paddr_t gpa,
>      unsigned long mask;
>      mfn_t mfn;
>      int rv;
> +    bool ret;

Thanks for the patches! This one looks good, except I think you'll want
to also change the return type of p2m_altp2m_lazy_copy() from bool_t to
bool.

With that:
Reviewed-by: Razvan Cojocaru <rcojocaru@bitdefender.com>


Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-11-21 13:59 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 13:21 [PATCH 00/14] XSA-277 followup Andrew Cooper
2018-11-21 13:21 ` [PATCH 01/14] x86/soft-reset: Drop gfn reference after calling get_gfn_query() Andrew Cooper
2018-11-22 14:45   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 02/14] x86/mem-sharing: Don't leave the altp2m lock held when nominating a page Andrew Cooper
2018-11-21 16:56   ` Tamas K Lengyel
2018-11-22 14:46   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 03/14] AMD/IOMMU: Fix multiple reference counting errors Andrew Cooper
2018-11-22 14:51   ` Jan Beulich
2018-11-22 17:46     ` Andrew Cooper
2018-11-23  8:23       ` Jan Beulich
2018-11-23 16:03         ` Andrew Cooper
2018-11-26  9:05           ` Jan Beulich
2019-01-31 15:59   ` Woods, Brian
2018-11-21 13:21 ` [PATCH 04/14] x86/p2m: Fix locking in p2m_altp2m_lazy_copy() Andrew Cooper
2018-11-21 13:59   ` Razvan Cojocaru [this message]
2018-11-22 15:01   ` Jan Beulich
2018-12-05 19:53     ` Andrew Cooper
2018-11-21 13:21 ` [PATCH 05/14] x86/p2m: Don't overwrite p2m_altp2m_lazy_copy()'s callers p2m pointer Andrew Cooper
2018-11-21 14:07   ` Razvan Cojocaru
2018-11-22 15:03   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 06/14] x86/hvm: Make the altp2m locking easier to follow Andrew Cooper
2018-11-21 14:43   ` Razvan Cojocaru
2018-11-22 15:08   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 07/14] x86/p2m: Coding style cleanup Andrew Cooper
2018-11-22 15:12   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 08/14] xen/memory: Drop ARM put_gfn() stub Andrew Cooper
2018-11-22 14:07   ` Julien Grall
2018-11-22 15:15   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 09/14] x86/p2m: Switch the two_gfns infrastructure to using gfn_t Andrew Cooper
2018-11-21 17:06   ` Tamas K Lengyel
2018-11-22 15:17   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 10/14] x86/mm: Switch {get, put}_gfn() " Andrew Cooper
2018-11-21 14:48   ` Razvan Cojocaru
2018-11-21 16:12   ` Paul Durrant
2018-11-22 15:34   ` Jan Beulich
2018-11-23  2:58   ` Tian, Kevin
2018-11-26 15:51   ` Woods, Brian
2018-11-21 13:21 ` [PATCH 11/14] xen/mm: Switch mfn_to_virt()/virt_to_mfn() to using mfn_t Andrew Cooper
2018-11-22 14:32   ` Julien Grall
2018-11-22 15:44   ` Jan Beulich
2018-11-22 15:49     ` Andrew Cooper
2018-11-21 13:21 ` [PATCH 12/14] xen/gnttab: Drop gnttab_create_{shared, status}_page() Andrew Cooper
2018-11-22 14:35   ` Julien Grall
2018-11-22 15:47   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 13/14] xen/gnttab: Simplify gnttab_map_frame() Andrew Cooper
2018-11-22 14:36   ` Julien Grall
2018-11-22 15:48   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 14/14] xen/gnttab: Minor improvements to arch header files Andrew Cooper
2018-11-22 15:51   ` Jan Beulich
2018-11-22 17:56   ` Andrew Cooper
2019-01-30 20:04     ` Julien Grall
2019-01-30 20:05       ` Andrew Cooper
2018-11-21 17:19 ` [PATCH 00/14] XSA-277 followup Tamas K Lengyel
2018-11-21 21:22   ` Andrew Cooper
2018-11-21 22:42     ` Tamas K Lengyel
2018-11-22  0:08       ` Andrew Cooper
2018-11-26 17:48         ` Tamas K Lengyel
2018-11-23 15:46     ` Roger Pau Monné
2019-01-30 18:36 ` Pings for 4.12 " Andrew Cooper

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=751b8be6-095e-69f9-f99f-0f18ba4e77b7@bitdefender.com \
    --to=rcojocaru@bitdefender.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=tamas@tklengyel.com \
    --cc=wei.liu2@citrix.com \
    --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 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.