All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>, Wei Liu <wl@xen.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [RFC PATCH] x86/p2m-pt: do type recalculations with p2m read lock
Date: Mon, 3 Apr 2023 14:39:08 +0200	[thread overview]
Message-ID: <8d976d34-8a1e-95ad-3bc9-3cb704c1fae7@suse.com> (raw)
In-Reply-To: <20230403101449.93323-1-roger.pau@citrix.com>

On 03.04.2023 12:14, Roger Pau Monne wrote:
> --- a/xen/arch/x86/mm/p2m-pt.c
> +++ b/xen/arch/x86/mm/p2m-pt.c
> @@ -486,9 +486,6 @@ static int cf_check do_recalc(struct p2m_domain *p2m, unsigned long gfn)
>          p2m_type_t ot, nt;
>          unsigned long mask = ~0UL << (level * PAGETABLE_ORDER);
>  
> -        if ( !valid_recalc(l1, e) )
> -            P2M_DEBUG("bogus recalc leaf at d%d:%lx:%u\n",
> -                      p2m->domain->domain_id, gfn, level);
>          ot = p2m_flags_to_type(l1e_get_flags(e));
>          nt = p2m_recalc_type_range(true, ot, p2m, gfn & mask, gfn | ~mask);
>          if ( nt != ot )

I'm afraid I neither understand why you make this change, nor why you
then leave the other use of valid_recalc() in place.

> @@ -538,9 +535,9 @@ int p2m_pt_handle_deferred_changes(uint64_t gpa)
>       */
>      ASSERT(!altp2m_active(current->domain));
>  
> -    p2m_lock(p2m);
> +    p2m_read_lock(p2m);
>      rc = do_recalc(p2m, PFN_DOWN(gpa));
> -    p2m_unlock(p2m);
> +    p2m_read_unlock(p2m);
>  
>      return rc;
>  }

How can this be safe, when do_recalc() involves p2m_next_level(), which
may install new (intermediate) page tables?

Jan


  reply	other threads:[~2023-04-03 12:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 10:14 [RFC PATCH] x86/p2m-pt: do type recalculations with p2m read lock Roger Pau Monne
2023-04-03 12:39 ` Jan Beulich [this message]
2023-04-03 14:27   ` Roger Pau Monné
2023-04-03 15:30     ` Jan Beulich
2023-04-03 15:42       ` Roger Pau Monné
2023-04-03 15:32 ` Jan Beulich
2023-04-03 15:38   ` Roger Pau Monné
2023-04-03 16:07     ` Jan Beulich
2023-04-04  9:49       ` Roger Pau Monné

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=8d976d34-8a1e-95ad-3bc9-3cb704c1fae7@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --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.