From: Marc Zyngier <maz@kernel.org>
To: Eric Auger <eauger@redhat.com>
Cc: kvmarm@lists.cs.columbia.edu,
linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org,
Ricardo Koller <ricarkol@google.com>,
James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Alexandru Elisei <alexandru.elisei@arm.com>,
Oliver Upton <oupton@google.com>,
kernel-team@android.com
Subject: Re: [PATCH 2/3] KVM: arm64: Replace vgic_v3_uaccess_read_pending with vgic_uaccess_read_pending
Date: Tue, 07 Jun 2022 12:10:00 +0100 [thread overview]
Message-ID: <87mteo4tmf.wl-maz@kernel.org> (raw)
In-Reply-To: <168da62b-51c0-b883-0912-15139f24d31f@redhat.com>
On Thu, 02 Jun 2022 21:06:42 +0100,
Eric Auger <eauger@redhat.com> wrote:
>
> Hi Marc,
> On 6/2/22 10:30, Marc Zyngier wrote:
> > Now that GICv2 has a proper userspace accessor for the pending state,
> > switch GICv3 over to it, dropping the local version.
> >
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > ---
> > arch/arm64/kvm/vgic/vgic-mmio-v3.c | 40 ++----------------------------
> > 1 file changed, 2 insertions(+), 38 deletions(-)
> >
> > diff --git a/arch/arm64/kvm/vgic/vgic-mmio-v3.c b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
> > index f7aa7bcd6fb8..f15e29cc63ce 100644
> > --- a/arch/arm64/kvm/vgic/vgic-mmio-v3.c
> > +++ b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
> > @@ -353,42 +353,6 @@ static unsigned long vgic_mmio_read_v3_idregs(struct kvm_vcpu *vcpu,
> > return 0;
> > }
> >
> > -static unsigned long vgic_v3_uaccess_read_pending(struct kvm_vcpu *vcpu,
> > - gpa_t addr, unsigned int len)
> > -{
> > - u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
> > - u32 value = 0;
> > - int i;
>
> > -
> > - /*
> > - * pending state of interrupt is latched in pending_latch variable.
> > - * Userspace will save and restore pending state and line_level
> > - * separately.
> > - * Refer to Documentation/virt/kvm/devices/arm-vgic-v3.rst
> > - * for handling of ISPENDR and ICPENDR.
> Don't know if you want a derivative of this comment in
> vgic_uaccess_read_pending()?
I don't find it specially helpful, but at the same time, it doesn't
hurt to move it around.
> > - */
> > - for (i = 0; i < len * 8; i++) {
> > - struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i);
> > - bool state = irq->pending_latch;
> > -
> > - if (irq->hw && vgic_irq_is_sgi(irq->intid)) {
> > - int err;
> > -
> in __read_pending(), irq->irq_lock is hold which looks safer at 1st
> sight. If potentially fixing something this can be documented in the
> commit msg.
I don't think it fixes anything. The idea is that if you are
accessing the state from userspace, you already have stopped the VM,
and thus there is no concurrent modifications if the state.
> > - err = irq_get_irqchip_state(irq->host_irq,
> > - IRQCHIP_STATE_PENDING,
> > - &state);
> > - WARN_ON(err);
> > - }
> > -
> in __read_pending(), irq_is_pending(irq) is used instead of
> irq->pending_latch. for level sensitive IRQ this is not identical. This
> may also deserve some comment. The nuance may be related to the above
> comment.
That is a good point, and we should unify the userspace behaviours
between GICv2 and v3.
I'll respin the series shortly.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-07 11:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-02 8:30 [PATCH 0/3] KVM: arm64: Fix userspace access to HW pending state Marc Zyngier
2022-06-02 8:30 ` [PATCH 1/3] KVM: arm64: Don't read a HW interrupt pending state in user context Marc Zyngier
2022-06-02 19:40 ` Eric Auger
2022-06-02 20:08 ` Eric Auger
2022-06-02 8:30 ` [PATCH 2/3] KVM: arm64: Replace vgic_v3_uaccess_read_pending with vgic_uaccess_read_pending Marc Zyngier
2022-06-02 20:06 ` Eric Auger
2022-06-07 11:10 ` Marc Zyngier [this message]
2022-06-02 8:30 ` [PATCH 3/3] KVM: arm64: Warn if accessing timer pending state outside of vcpu context Marc Zyngier
2022-06-02 19:39 ` Eric Auger
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=87mteo4tmf.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=alexandru.elisei@arm.com \
--cc=eauger@redhat.com \
--cc=james.morse@arm.com \
--cc=kernel-team@android.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=oupton@google.com \
--cc=ricarkol@google.com \
--cc=suzuki.poulose@arm.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;
as well as URLs for NNTP newsgroup(s).