All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@suse.de>
To: catalin.marinas@arm.com
Cc: will@kernel.org,  linux-arm-kernel@lists.infradead.org,
	 broonie@kernel.org
Subject: Re: [PATCH v2] arm64: Avoid repeated AA64MMFR1_EL1 register read on pagefault path
Date: Mon, 16 Jan 2023 17:41:35 -0300	[thread overview]
Message-ID: <871qnuciv4.fsf@suse.de> (raw)
In-Reply-To: <20230109151955.8292-1-krisman@suse.de> (Gabriel Krisman Bertazi's message of "Mon, 9 Jan 2023 12:19:55 -0300")

Gabriel Krisman Bertazi <krisman@suse.de> writes:

> Accessing AA64MMFR1_EL1 is expensive in KVM guests, since it is emulated
> in the hypervisor.  In fact, ARM documentation mentions some feature
> registers are not supposed to be accessed frequently by the OS, and
> therefore should be emulated for guests [1].
>
> Commit 0388f9c74330 ("arm64: mm: Implement
> arch_wants_old_prefaulted_pte()") introduced a read of this register in
> the page fault path.  But, even when the feature of setting faultaround
> pages with the old flag is disabled for a given cpu, we are still paying
> the cost of checking the register on every pagefault. This results in an
> explosion of vmexit events in KVM guests, which directly impacts the
> performance of virtualized workloads.  For instance, running kernbench
> yields a 15% increase in system time solely due to the increased vmexit
> cycles.
>
> This patch avoids the extra cost by using the sanitized cached value.
> It should be safe to do so, since this register mustn't change for a
> given cpu.
>
> [1] https://developer.arm.com/-/media/Arm%20Developer%20Community/PDF/Learn%20the%20Architecture/Armv8-A%20virtualization.pdf?revision=a765a7df-1a00-434d-b241-357bfda2dd31
>
> Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>

Hi,

Considering the performance impact on kvm guests, unless someone
opposes, can we get this queued already for -rc5?

-- 
Gabriel Krisman Bertazi

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2023-01-16 20:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09 15:19 [PATCH v2] arm64: Avoid repeated AA64MMFR1_EL1 register read on pagefault path Gabriel Krisman Bertazi
2023-01-11  8:34 ` Anshuman Khandual
2023-01-11 13:31   ` Gabriel Krisman Bertazi
2023-01-12  2:57     ` Anshuman Khandual
2023-01-12  3:05 ` Anshuman Khandual
2023-01-16 20:41 ` Gabriel Krisman Bertazi [this message]
2023-01-17 16:14   ` Will Deacon
2023-01-18 16:08     ` Gabriel Krisman Bertazi
2023-01-18 15:44 ` Catalin Marinas
2023-01-18 16:06   ` Gabriel Krisman Bertazi
2023-01-18 16:38 ` Will Deacon
2023-01-20 16:59 ` Catalin Marinas

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=871qnuciv4.fsf@suse.de \
    --to=krisman@suse.de \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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 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.