From: Greg Kurz <groug@kaod.org>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: Daniel Henrique Barboza <danielhb413@gmail.com>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [RFC PATCH] spapr/xive: Allocate vCPU IPIs from local context
Date: Tue, 28 Sep 2021 09:19:24 +0200 [thread overview]
Message-ID: <20210928091924.2b57bec4@bahia.huguette> (raw)
In-Reply-To: <90e2ef32-8151-e65c-d64b-de58bb5337f1@kaod.org>
On Mon, 27 Sep 2021 18:50:40 +0200
Cédric Le Goater <clg@kaod.org> wrote:
> On 9/24/21 19:13, Greg Kurz wrote:
> > On Fri, 24 Sep 2021 16:58:00 +0200
> > Cédric Le Goater <clg@kaod.org> wrote:
> >
> >> [ ... ]
> >>
> >>>> The changes only impact KVM support since we are deferring the IRQ
> >>>> initialization at the KVM level. What we have to be careful about is not
> >>>> accessing an ESB page of an interrupt that would not have been initiliazed
> >>>> in the KVM device, else QEMU gets a sigbus.
> >>>>
> >>>
> >>> Ok, so this is just needed on a path that leads to xive_esb_rw() or
> >>> kvmppc_xive_esb_trigger(), right ?
> >>>
> >>> It seems that
> >>>
> >>> h_int_esb()
> >>> kvmppc_xive_esb_rw()
> >>>
> >>> can get there with an lisn provided by the guest, and I don't see any
> >>> such check on the way : h_int_esb() only checks xive_eas_is_valid().
> >>
> >> This call is for LSI interrupts (device only) and not vCPU IPIs. see hcall
> >> h_int_get_source_info(). I agree a hcall fuzzer could reach it.
> >>
> >
> > Yes we tell the guest to use H_INT_ESB for LSIs only but I don't have
> > the impression that it is forbidden for the guest to call H_INT_ESB
> > for arbitrary interrupts.
> >
> >> An alternative solution would be to claim the vCPU IPIs on demand, like
> >> we do for the MSIs, and not in spapr_irq_init(). It's a much bigger change
> >> tough, because the H_INT hcalls consider that the interrupt numbers have
> >> been claimed.
> >>
> >
> > Maybe it would be simpler to call xive_source_is_initialized() instead of
> > xive_eas_is_valid() in cases like this, e.g. hcall code since it is shared
> > between emulation and KVM ?
>
> Yes but we need a better check than :
>
> if (lisn < SPAPR_XIRQ_BASE) {
> return !!xive_get_field64(EAS_END_INDEX, xive->eat[lisn].w);
> }
>
> This is more an heuristic than a precise test on the "validity" of
> a source at the KVM level.
>
I guess we should be able to get kvmppc_xive_irq_state::valid from
KVM by making the KVM_DEV_XIVE_GRP_SOURCE attribute readable. Would
that be enough ?
>
> Thanks,
>
> C.
next prev parent reply other threads:[~2021-09-28 7:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-22 14:41 [RFC PATCH] spapr/xive: Allocate vCPU IPIs from local context Cédric Le Goater
2021-09-23 9:12 ` Greg Kurz
2021-09-24 12:40 ` Cédric Le Goater
2021-09-24 13:49 ` Greg Kurz
2021-09-24 14:58 ` Cédric Le Goater
2021-09-24 17:13 ` Greg Kurz
2021-09-27 16:50 ` Cédric Le Goater
2021-09-28 7:19 ` Greg Kurz [this message]
2021-10-01 9:59 ` Cédric Le Goater
2021-10-01 10:38 ` Greg Kurz
2021-10-01 11:11 ` Cédric Le Goater
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=20210928091924.2b57bec4@bahia.huguette \
--to=groug@kaod.org \
--cc=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.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).