From: Salil Mehta <salil.mehta@huawei.com>
To: Peter Maydell <peter.maydell@linaro.org>,
Salil Mehta <salil.mehta@opnsrc.net>
Cc: Marc Zyngier <maz@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
"will@kernel.org" <will@kernel.org>,
"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
"mark.rutland@arm.com" <mark.rutland@arm.com>,
"james.morse@arm.com" <james.morse@arm.com>,
"sudeep.holla@arm.com" <sudeep.holla@arm.com>,
"lpieralisi@kernel.org" <lpieralisi@kernel.org>,
"jean-philippe@linaro.org" <jean-philippe@linaro.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"oliver.upton@linux.dev" <oliver.upton@linux.dev>,
"richard.henderson@linaro.org" <richard.henderson@linaro.org>,
"andrew.jones@linux.dev" <andrew.jones@linux.dev>,
"mst@redhat.com" <mst@redhat.com>,
"david@redhat.com" <david@redhat.com>,
"philmd@linaro.org" <philmd@linaro.org>,
"ardb@kernel.org" <ardb@kernel.org>,
"borntraeger@linux.ibm.com" <borntraeger@linux.ibm.com>,
"alex.bennee@linaro.org" <alex.bennee@linaro.org>,
"gustavo.romero@linaro.org" <gustavo.romero@linaro.org>,
"npiggin@gmail.com" <npiggin@gmail.com>,
"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
"karl.heubaum@oracle.com" <karl.heubaum@oracle.com>,
"miguel.luis@oracle.com" <miguel.luis@oracle.com>,
"darren@os.amperecomputing.com" <darren@os.amperecomputing.com>,
"ilkka@os.amperecomputing.com" <ilkka@os.amperecomputing.com>,
"vishnu@os.amperecomputing.com" <vishnu@os.amperecomputing.com>,
"gankulkarni@os.amperecomputing.com"
<gankulkarni@os.amperecomputing.com>,
"wangyanan (Y)" <wangyanan55@huawei.com>,
"Wangzhou (B)" <wangzhou1@hisilicon.com>,
Linuxarm <linuxarm@huawei.com>
Subject: RE: [RFC PATCH] KVM: arm64: vgic-v3: Cache ICC_CTLR_EL1 and allow lockless read when ready
Date: Tue, 14 Oct 2025 09:50:49 +0000 [thread overview]
Message-ID: <6ef5f8d7b52b4eee8dbf9186046e920c@huawei.com> (raw)
In-Reply-To: <CAFEAcA8VL4wE2w9PegPD_AVSKCZzzzx-jFru7dDOq4Tz5xs76A@mail.gmail.com>
Hi Peter,
> From: Peter Maydell <peter.maydell@linaro.org>
> Sent: Tuesday, October 14, 2025 10:31 AM
>
> On Tue, 14 Oct 2025 at 04:02, Salil Mehta <salil.mehta@opnsrc.net> wrote:
> > On Mon, Oct 13, 2025 at 4:48 PM Peter Maydell
> <peter.maydell@linaro.org> wrote:
> > > That said, QEMU's current code for this could be refactored to avoid
> > > the reset-time read of ICC_CTLR_EL1 from the kernel.
> > > We do this so we can set the userspace struct field for this
> > > register to the right value. But we could ask the kernel for that
> > > value once on VM startup since it's not going to change mid-run.
> > >
> > > That would bring ICC_CTLR_EL1 into line with the other cpuif
> > > registers, where QEMU assumes it knows what the kernel's reset value
> > > of them is (mostly "0") and doesn't bother to ask.
> > > This is different from how we handle ONE_REG sysregs, where I'm
> > > pretty sure we do ask the kernel the value of all of them on a vcpu
> > > reset. (And then write the values back again, which is a bit silly
> > > but nobody's ever said it was a performance problem for them :-))
> >
> >
> > This is effectively what the mentioned patch in the commit-log is doing.
> > Pasting here again:
> >
> > https://lore.kernel.org/qemu-devel/20251001010127.3092631-22-salil.meh
> > ta@opnsrc.net/
>
> No, that is not what I have in mind. What I mean is that we can just read the
> ICC_CTLR_EL1 value once on startup (in our realize method, I think) and then
> use that value in reset. That should not require any of that machinery to
> pause the VM and keep retrying.
Indeed and that’s what I did initially and had fetched the value once in GICv3
realize but it hung the VM initialization leg during access.
BTW, can we safely assume that value of this register will be same across all
vCPUs (i.e. is just for SMP case and ignore heterogenous)?
Best regards
Salil
>
> -- PMM
next prev parent reply other threads:[~2025-10-14 9:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-08 20:19 [RFC PATCH] KVM: arm64: vgic-v3: Cache ICC_CTLR_EL1 and allow lockless read when ready salil.mehta
2025-10-09 13:48 ` Marc Zyngier
2025-10-13 8:42 ` Peter Maydell
2025-10-13 10:54 ` Marc Zyngier
2025-10-13 16:48 ` Peter Maydell
2025-10-14 3:02 ` Salil Mehta
2025-10-14 9:31 ` Peter Maydell
2025-10-14 9:50 ` Salil Mehta [this message]
2025-10-14 7:44 ` Marc Zyngier
2025-10-14 9:33 ` Peter Maydell
2025-10-14 10:24 ` Salil Mehta
2025-10-13 15:48 ` Salil Mehta
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=6ef5f8d7b52b4eee8dbf9186046e920c@huawei.com \
--to=salil.mehta@huawei.com \
--cc=alex.bennee@linaro.org \
--cc=andrew.jones@linux.dev \
--cc=ardb@kernel.org \
--cc=borntraeger@linux.ibm.com \
--cc=catalin.marinas@arm.com \
--cc=darren@os.amperecomputing.com \
--cc=david@redhat.com \
--cc=gankulkarni@os.amperecomputing.com \
--cc=gustavo.romero@linaro.org \
--cc=ilkka@os.amperecomputing.com \
--cc=james.morse@arm.com \
--cc=jean-philippe@linaro.org \
--cc=jonathan.cameron@huawei.com \
--cc=karl.heubaum@oracle.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxarm@huawei.com \
--cc=lpieralisi@kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=miguel.luis@oracle.com \
--cc=mst@redhat.com \
--cc=npiggin@gmail.com \
--cc=oliver.upton@linux.dev \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=richard.henderson@linaro.org \
--cc=salil.mehta@opnsrc.net \
--cc=sudeep.holla@arm.com \
--cc=tglx@linutronix.de \
--cc=vishnu@os.amperecomputing.com \
--cc=wangyanan55@huawei.com \
--cc=wangzhou1@hisilicon.com \
--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;
as well as URLs for NNTP newsgroup(s).