public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: kvmarm@lists.linux.dev
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, qperret@google.com, maz@kernel.org,
	oliver.upton@linux.dev, joey.gouly@arm.com,
	suzuki.poulose@arm.com, yuzenghui@huawei.com,
	catalin.marinas@arm.com, will@kernel.org, shan.gavin@gmail.com
Subject: Re: [PATCH] KVM: arm64: Drop sort_memblock_regions()
Date: Thu, 8 May 2025 18:59:50 +1000	[thread overview]
Message-ID: <8a05e7da-3640-4e79-b215-c705b879472f@redhat.com> (raw)
In-Reply-To: <20250311043718.91004-1-gshan@redhat.com>

Hi Marc/Oliver,

On 3/11/25 2:37 PM, Gavin Shan wrote:
> Drop sort_memblock_regions() and avoid sorting the copied memory
> regions to be ascending order on their base addresses, because the
> source memory regions should have been sorted correctly when they
> are added by memblock_add() or its variants.
> 
> This is generally reverting commit a14307f5310c ("KVM: arm64: Sort
> the hypervisor memblocks"). No functional changes intended.
> 
> Signed-off-by: Gavin Shan <gshan@redhat.com>
> ---
>   arch/arm64/kvm/pkvm.c | 19 -------------------
>   1 file changed, 19 deletions(-)
> 

Please let me know if I need to resend after a rebase, or anything I need to
do so that it can be merged? :-)

Thanks,
Gavin

> diff --git a/arch/arm64/kvm/pkvm.c b/arch/arm64/kvm/pkvm.c
> index 930b677eb9b0..d9c9174f89a1 100644
> --- a/arch/arm64/kvm/pkvm.c
> +++ b/arch/arm64/kvm/pkvm.c
> @@ -10,7 +10,6 @@
>   #include <asm/kvm_mmu.h>
>   #include <linux/memblock.h>
>   #include <linux/mutex.h>
> -#include <linux/sort.h>
>   
>   #include <asm/kvm_pkvm.h>
>   
> @@ -24,23 +23,6 @@ static unsigned int *hyp_memblock_nr_ptr = &kvm_nvhe_sym(hyp_memblock_nr);
>   phys_addr_t hyp_mem_base;
>   phys_addr_t hyp_mem_size;
>   
> -static int cmp_hyp_memblock(const void *p1, const void *p2)
> -{
> -	const struct memblock_region *r1 = p1;
> -	const struct memblock_region *r2 = p2;
> -
> -	return r1->base < r2->base ? -1 : (r1->base > r2->base);
> -}
> -
> -static void __init sort_memblock_regions(void)
> -{
> -	sort(hyp_memory,
> -	     *hyp_memblock_nr_ptr,
> -	     sizeof(struct memblock_region),
> -	     cmp_hyp_memblock,
> -	     NULL);
> -}
> -
>   static int __init register_memblock_regions(void)
>   {
>   	struct memblock_region *reg;
> @@ -52,7 +34,6 @@ static int __init register_memblock_regions(void)
>   		hyp_memory[*hyp_memblock_nr_ptr] = *reg;
>   		(*hyp_memblock_nr_ptr)++;
>   	}
> -	sort_memblock_regions();
>   
>   	return 0;
>   }


  parent reply	other threads:[~2025-05-08  9:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11  4:37 [PATCH] KVM: arm64: Drop sort_memblock_regions() Gavin Shan
2025-03-13  2:53 ` Anshuman Khandual
2025-03-13  6:09   ` Gavin Shan
2025-03-13 11:26 ` Will Deacon
2025-03-13 19:08 ` Quentin Perret
2025-05-08  8:59 ` Gavin Shan [this message]
2025-05-08 10:32 ` Marc Zyngier

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=8a05e7da-3640-4e79-b215-c705b879472f@redhat.com \
    --to=gshan@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=oliver.upton@linux.dev \
    --cc=qperret@google.com \
    --cc=shan.gavin@gmail.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.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