From: Gavin Shan <gshan@redhat.com>
To: Marc Zyngier <maz@kernel.org>
Cc: kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org,
will@kernel.org, alexandru.elisei@arm.com
Subject: Re: [PATCH 2/3] KVM: arm64: Don't map PUD huge page if it's not available
Date: Mon, 26 Oct 2020 09:27:36 +1100 [thread overview]
Message-ID: <3d4b80e6-95c4-4634-5e7e-a53ef3af0d75@redhat.com> (raw)
In-Reply-To: <87zh4aoc22.wl-maz@kernel.org>
Hi Marc,
On 10/25/20 9:05 PM, Marc Zyngier wrote:
> On Sun, 25 Oct 2020 01:27:38 +0100,
> Gavin Shan <gshan@redhat.com> wrote:
>>
>> PUD huge page isn't available when CONFIG_ARM64_4K_PAGES is disabled.
>> In this case, we needn't try to map the memory through PUD huge pages
>> to save some CPU cycles in the hot path.
>>
>> This also corrects the code style issue, which was introduced by
>> commit <523b3999e5f6> ("KVM: arm64: Try PMD block mappings if PUD mappings
>> are not supported").
>>
>> Signed-off-by: Gavin Shan <gshan@redhat.com>
>> ---
>> arch/arm64/kvm/mmu.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
>> index a816cb8e619b..0f51585adc04 100644
>> --- a/arch/arm64/kvm/mmu.c
>> +++ b/arch/arm64/kvm/mmu.c
>> @@ -787,9 +787,11 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
>> vma_shift = PAGE_SHIFT;
>> }
>>
>> +#ifdef CONFIG_ARM64_4K_PAGES
>> if (vma_shift == PUD_SHIFT &&
>> !fault_supports_stage2_huge_mapping(memslot, hva, PUD_SIZE))
>> - vma_shift = PMD_SHIFT;
>> + vma_shift = PMD_SHIFT;
>> +#endif
>>
>> if (vma_shift == PMD_SHIFT &&
>> !fault_supports_stage2_huge_mapping(memslot, hva, PMD_SIZE)) {
>
>
> I really don't buy the "CPU cycles" argument here either. Can you
> actually measure any difference here?
>
> You have taken a fault, gone through a full guest exit, triaged it,
> and are about to into a page mapping operation which may result in a
> TLBI, and reenter the guest. It only happen a handful of times per
> page over the lifetime of the guest unless you start swapping. Hot
> path? I don't think so.
>
Thanks for the explanation. Agreed and I will drop this in v2.
Thanks,
Gavin
next prev parent reply other threads:[~2020-10-25 22:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-25 0:27 [PATCH 0/3] KVM: arm64: Failback on unsupported huge pages Gavin Shan
2020-10-25 0:27 ` [PATCH 1/3] KVM: arm64: Check if 52-bits PA is enabled Gavin Shan
2020-10-25 9:52 ` Marc Zyngier
2020-10-25 22:23 ` Gavin Shan
2020-10-26 8:40 ` Will Deacon
2020-10-26 8:53 ` Marc Zyngier
2020-10-26 22:48 ` Gavin Shan
2020-10-25 0:27 ` [PATCH 2/3] KVM: arm64: Don't map PUD huge page if it's not available Gavin Shan
2020-10-25 10:05 ` Marc Zyngier
2020-10-25 22:27 ` Gavin Shan [this message]
2020-10-25 0:27 ` [PATCH 3/3] KVM: arm64: Failback on unsupported huge page sizes Gavin Shan
2020-10-25 10:48 ` Marc Zyngier
2020-10-25 23:04 ` Gavin Shan
2020-10-26 8:55 ` 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=3d4b80e6-95c4-4634-5e7e-a53ef3af0d75@redhat.com \
--to=gshan@redhat.com \
--cc=alexandru.elisei@arm.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®