All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Ross Lagerwall <ross.lagerwall@citrix.com>
Cc: xen-devel@lists.xenproject.org, Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH] x86/hap: Defer P2M TLB flushes
Date: Thu, 19 Mar 2026 10:08:42 +0100	[thread overview]
Message-ID: <abu9GpEm_z-7762N@macbook.local> (raw)
In-Reply-To: <20260318171324.1362219-1-ross.lagerwall@citrix.com>

The subject should possibly mention NPT, as reading HAP one would
assume it applies to both EPT and NPT (and the EPT side is already
done here):

x86/hap: Defer NPT P2M TLB flushes

On Wed, Mar 18, 2026 at 05:13:24PM +0000, Ross Lagerwall wrote:
> Like the EPT code, defer TLB flushes to reduce the number of flushes and
> avoid holding the P2M lock while flushing. This can substantially
> improve performance in some scenarios.
> 
> The cases where the TLB needs to be flushed without deferring are
> already handled by the call to p2m_tlb_flush_sync() in p2m_free_ptp().
> 
> Suggested-by: Roger Pau Monne <roger.pau@citrix.com>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> ---
>  xen/arch/x86/mm/hap/hap.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
> index a337752bf488..1eba995c7b39 100644
> --- a/xen/arch/x86/mm/hap/hap.c
> +++ b/xen/arch/x86/mm/hap/hap.c
> @@ -813,16 +813,26 @@ static void cf_check hap_update_paging_modes(struct vcpu *v)
>  
>  static void cf_check
>  hap_write_p2m_entry_post(struct p2m_domain *p2m, unsigned int oflags)
> +{
> +    if ( oflags & _PAGE_PRESENT )
> +    {
> +        ASSERT(p2m->defer_flush);

Here I'm unsure whether we might want to do:

if ( !p2m->defer_flush )
{
    ASSERT_UNREACHABLE();
    guest_flush_tlb_mask(d, d->dirty_cpumask);
}

Instead of just asserting that the defer_flush field is set, to be on
the safe(r) side.

Thanks, Roger.


      reply	other threads:[~2026-03-19  9:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18 17:13 [PATCH] x86/hap: Defer P2M TLB flushes Ross Lagerwall
2026-03-19  9:08 ` Roger Pau Monné [this message]

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=abu9GpEm_z-7762N@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=ross.lagerwall@citrix.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 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.