All of lore.kernel.org
 help / color / mirror / Atom feed
From: Usama Arif <usama.arif@linux.dev>
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>,
	Leonardo Bras <leo.bras@arm.com>
Cc: Wei-Lin Chang <weilin.chang@arm.com>,
	maz@kernel.org, oupton@kernel.org, fuad.tabba@linux.dev,
	joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com,
	yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org,
	mark.rutland@arm.com, kvmarm@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, riel@surriel.com,
	shakeel.butt@linux.dev, kernel-team@meta.com, rkeilty@meta.com,
	atish.patra@linux.dev, dgreid@meta.com
Subject: Re: [PATCH] KVM: arm64: Reduce the stage-2 page cache on 64 KiB hosts
Date: Fri, 27 Nov 2026 14:38:24 +0000	[thread overview]
Message-ID: <aa937018-0454-4dbb-9e32-a65b46fc7635@linux.dev> (raw)
In-Reply-To: <awmDZoqzL_t6A7go@gremlin>



On 27/11/2026 05:29, Lorenzo Stoakes (ARM) wrote:
> On Thu, Nov 26, 2026 at 06:25:43PM +0000, Leonardo Bras wrote:
>>>>> diff --git a/arch/arm64/include/asm/kvm_types.h b/arch/arm64/include/asm/kvm_types.h
>>>>> index 9a126b9e2d7c99..5b61285d317e28 100644
>>>>> --- a/arch/arm64/include/asm/kvm_types.h
>>>>> +++ b/arch/arm64/include/asm/kvm_types.h
>>>>> @@ -2,7 +2,12 @@
>>>>>  #ifndef _ASM_ARM64_KVM_TYPES_H
>>>>>  #define _ASM_ARM64_KVM_TYPES_H
>>>>>
>>>>> -#define KVM_ARCH_NR_OBJS_PER_MEMORY_CACHE 40
>>>>> +#define KVM_PGTABLE_FIRST_LEVEL		-1
>>>>> +#define KVM_PGTABLE_LAST_LEVEL		3
>>>>> +
>>>
>>> The -1 isn't needed here at all right? So why not just import
>>> KVM_PGTABLE_LAST_LEVEL and do:
>>>
>>> #define KVM_ARCH_NR_OBJS_PER_MEMORY_CACHE       KVM_PGTABLE_LAST_LEVEL
>>>
>>> ?
>>
>> Well, it kind of is :)
>> The lowest level we have in a PGTABLE is level -1. (See RKSBQV)
>>
>> It could now be mathematically correct, but it could break in the future if
>> we got a level-2, for instance. We could have (LAST - FIRST - 1), if that
>> one page makes any diference.
> 
> Yup it's level -1 but isn't that only something meaningful for stage-1 I believe
> due to concatenation? As per stage2_pgtable_levels() [where ipa is the number of
> bits not the ipa... :)].
> 
> But you make a good point re: future changes!
> 
> Anyway, Marc has made it clear he wants something based on
> kvm_mmu_cache_min_pages() at runtime, so it's all moot anyway, this needs to be
> reworked for that.
> 
> Usama - I assume you are looking at that now?
> 

Yes, sorry I didnt see this discussion until now, I was trying to prototype
something that fit Marc's suggestion [1] and measure potential cost of it.
Hopefully its reasonable.

[1] https://lore.kernel.org/all/d2b6e735-a685-4e79-bb39-2fb75ebecd09@linux.dev/

> --
> Cheers, Lorenzo


  reply	other threads:[~2026-11-27 14:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 15:28 [PATCH] KVM: arm64: Reduce the stage-2 page cache on 64 KiB hosts Usama Arif
2026-11-25 17:14 ` Leonardo Bras
2026-11-25 17:55   ` Usama Arif
2026-11-25 18:25     ` Leonardo Bras
2026-11-25 21:42       ` Usama Arif
2026-11-25 21:53         ` sashiko-bot
2026-11-26  8:06         ` Wei-Lin Chang
2026-11-26 15:19           ` Leonardo Bras
2026-11-26 15:34             ` Wei-Lin Chang
2026-11-26 15:55               ` Leonardo Bras
2026-11-26 16:45                 ` Lorenzo Stoakes (ARM)
2026-11-26 17:07                   ` Leonardo Bras
2026-11-26 17:18                     ` Lorenzo Stoakes (ARM)
2026-11-26 17:44                       ` Leonardo Bras
2026-11-26 16:30           ` Lorenzo Stoakes (ARM)
2026-11-26 16:53             ` Lorenzo Stoakes (ARM)
2026-11-26 18:25             ` Leonardo Bras
2026-11-27 13:29               ` Lorenzo Stoakes (ARM)
2026-11-27 14:38                 ` Usama Arif [this message]
2026-11-26 12:56 ` Marc Zyngier
2026-11-26 14:32   ` Usama Arif
2026-11-26 15:58     ` Marc Zyngier
2026-11-26 16:52       ` Lorenzo Stoakes (ARM)
2026-11-27 14:28       ` Usama Arif
2026-11-27 14:45         ` sashiko-bot
2026-11-30 14:21         ` Usama Arif

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=aa937018-0454-4dbb-9e32-a65b46fc7635@linux.dev \
    --to=usama.arif@linux.dev \
    --cc=atish.patra@linux.dev \
    --cc=catalin.marinas@arm.com \
    --cc=dgreid@meta.com \
    --cc=fuad.tabba@linux.dev \
    --cc=joey.gouly@arm.com \
    --cc=kernel-team@meta.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=leo.bras@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=riel@surriel.com \
    --cc=rkeilty@meta.com \
    --cc=seiden@linux.ibm.com \
    --cc=shakeel.butt@linux.dev \
    --cc=suzuki.poulose@arm.com \
    --cc=weilin.chang@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 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.