All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Haseeb Ashraf <haseebashraf091@gmail.com>
Cc: Haseeb Ashraf <haseeb.ashraf@siemens.com>,
	andrew.cooper3@citrix.com, anthony.perard@vates.tech,
	michal.orzel@amd.com, julien@xen.org, roger@xenproject.org,
	sstabellini@kernel.org, xen-devel@lists.xenproject.org
Subject: Re: [XEN][PATCH v5 8/8] xen/memory: copy add_to_physmap batch entries in bulk
Date: Tue, 1 Dec 2026 18:20:23 +0100	[thread overview]
Message-ID: <bf8239fd-802b-4774-b41e-e19bb77c4547@suse.com> (raw)
In-Reply-To: <e0e98f5026453b9e95501c2e5c8da98e91fe22e9.1795336377.git.haseebashraf091@gmail.com>

On 22.11.2026 10:54, Haseeb Ashraf wrote:
> --- a/xen/common/memory.c
> +++ b/xen/common/memory.c
> @@ -1077,6 +1077,14 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
>      return rc;
>  }
>  
> +/*
> + * Number of entries copied from and to the guest at a time. Every access to
> + * guest memory needs a guest virtual to machine address translation, which
> + * is very slow when Xen itself runs on top of another hypervisor, so it is
> + * not done once per entry.
> + */

This is common code, and an equivalent to AT doesn't exist on e.g. x86.
Comments here want writing in a way to applies to all arch-es.

> @@ -1120,27 +1128,52 @@ static int xenmem_add_to_physmap_batch(struct domain *d,
>  
>      while ( xatpb->size > extent )
>      {
> -        xen_ulong_t idx;
> -        xen_pfn_t gpfn;
> -        int rc;
> -
> -        if ( unlikely(__copy_from_guest_offset(&idx, xatpb->idxs,
> -                                               extent, 1)) ||
> -             unlikely(__copy_from_guest_offset(&gpfn, xatpb->gpfns,
> -                                               extent, 1)) )
> +        xen_ulong_t idxs[XENMEM_ATPB_CHUNK];
> +        xen_pfn_t gpfns[XENMEM_ATPB_CHUNK];
> +        int errs[XENMEM_ATPB_CHUNK];

This looks like a lot of data you put on the stack for something which
may not help non-Arm very much. I think if such an optimization is
wanted in the first place, it wants either demonstrating that it helps
all arch-es, or it wants making conditional, for an arch to opt in.

Jan


      reply	other threads:[~2026-12-01 17:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-08 13:55 [PATCH 0/3] xen/arm{32,64}: perform IPA-based TLBI when IPA is Haseeb Ashraf
2026-07-21  7:54 ` [XEN][RESEND][PATCH v4 0/3] xen/arm{32,64}: perform IPA-based TLBI when IPA is known Haseeb Ashraf
2026-01-18 13:33 ` [XEN PATCH v3 " Haseeb Ashraf
2025-12-08 13:55 ` [PATCH 1/3] xen/arm/p2m: " Haseeb Ashraf
2026-01-18 13:33   ` [XEN PATCH v3 " Haseeb Ashraf
2025-12-08 13:55 ` [PATCH 2/3] xen/arm: optimize stage-1,2 combined TLBI in presence of FEAT_nTLBPA Haseeb Ashraf
2026-01-18 13:33   ` [XEN PATCH v3 " Haseeb Ashraf
2025-12-08 13:55 ` [PATCH 3/3] xen/arm32: add CPU capability for IPA-based TLBI Haseeb Ashraf
2026-01-18 13:33   ` [XEN PATCH v3 " Haseeb Ashraf
2025-12-16 12:08 ` [PATCH 0/3] xen/arm{32,64}: perform IPA-based TLBI when IPA is Ashraf, Haseeb
2026-01-06  6:40   ` Ashraf, Haseeb
2026-07-21  7:54 ` [XEN][RESEND][PATCH 1/3] xen/arm/p2m: perform IPA-based TLBI when IPA is known Haseeb Ashraf
2026-07-21  7:54   ` [XEN][RESEND][PATCH 2/3] xen/arm: optimize stage-1,2 combined TLBI in presence of FEAT_nTLBPA Haseeb Ashraf
2026-07-21  7:54   ` [XEN][RESEND][PATCH 3/3] xen/arm32: use IPA-based TLBI when supported with FEAT_nTLBPA Haseeb Ashraf
2026-11-22  9:54 ` [XEN][PATCH v5 0/8] xen/arm: narrow stage-2 TLB invalidation and batch physmap updates Haseeb Ashraf
2026-11-22  9:54   ` [XEN][PATCH v5 1/8] xen/arm/p2m: perform IPA-based TLBI when IPA is known Haseeb Ashraf
2026-11-22  9:54   ` [XEN][PATCH v5 2/8] xen/arm: skip the stage-1 TLBI after IPA flush with FEAT_nTLBPA Haseeb Ashraf
2026-11-22  9:54   ` [XEN][PATCH v5 3/8] xen/arm32: use IPA-based TLBI when supported " Haseeb Ashraf
2026-11-22  9:54   ` [XEN][PATCH v5 4/8] xen/arm64: use range TLBI for IPA flush with FEAT_TLBIRANGE Haseeb Ashraf
2026-11-22  9:54   ` [XEN][PATCH v5 5/8] xen/arm: do not flush the TLBs when resolving a translation fault Haseeb Ashraf
2026-11-22  9:54   ` [XEN][PATCH v5 6/8] xen/arm: batch stage-2 removal with range flushes Haseeb Ashraf
2026-11-22  9:54   ` [XEN][PATCH v5 7/8] xen/memory: add XENMEM_remove_from_physmap_batch Haseeb Ashraf
2026-12-01 15:59     ` Jan Beulich
2026-11-22  9:54   ` [XEN][PATCH v5 8/8] xen/memory: copy add_to_physmap batch entries in bulk Haseeb Ashraf
2026-12-01 17:20     ` Jan Beulich [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=bf8239fd-802b-4774-b41e-e19bb77c4547@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=haseeb.ashraf@siemens.com \
    --cc=haseebashraf091@gmail.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger@xenproject.org \
    --cc=sstabellini@kernel.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.