Re: [PATCH v5 3/3] ppc: Enable 2nd DAWR support on p10

David Gibson
2021-05-05T05:50:10Z

[-- Attachment #1: Type: text/plain, Size: 4083 bytes --]

On Wed, Apr 21, 2021 at 11:50:40AM +0530, Ravi Bangoria wrote:
> Hi David,
>
> On 4/19/21 10:23 AM, David Gibson wrote:
> > On Mon, Apr 12, 2021 at 05:14:33PM +0530, Ravi Bangoria wrote:
> > > As per the PAPR, bit 0 of byte 64 in pa-features property indicates
> > > availability of 2nd DAWR registers. i.e. If this bit is set, 2nd
> > > DAWR is present, otherwise not. Use KVM_CAP_PPC_DAWR1 capability to
> > > find whether kvm supports 2nd DAWR or not. If it's supported, allow
> > > user to set the pa-feature bit in guest DT using cap-dawr1 machine
> > > capability. Though, watchpoint on powerpc TCG guest is not supported
> > > and thus 2nd DAWR is not enabled for TCG mode.
> > >
> > > Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> > > Reviewed-by: Greg Kurz <groug@kaod.org>
> >
> > So, I'm actually not sure if using an spapr capability is what we want
> > to do here. The problem is that presumably the idea is to at some
> > point make the DAWR1 capability default to on (on POWER10, at least).
> > But at that point you'll no longer to be able to start TCG guests
> > without explicitly disabling it. That's technically correct, since we
> > don't implement DAWR1 in TCG, but then we also don't implement DAWR0
> > and we let that slide... which I think is probably going to cause less
> > irritation on balance.
>
> Ok. Probably something like this is what you want?
>
> Power10 behavior:
> - KVM does not support DAWR1: Boot the guest without DAWR1
> support (No warnings). Error out only if user tries with
> cap-dawr1=on.
> - KVM supports DAWR1: Boot the guest with DAWR1 support, unless
> user specifies cap-dawr1=off.
> - TCG guest: Ignore cap-dawr1 i.e. boot as if there is only
> DAWR0 (Should be fixed in future while adding PowerPC watch-
> point support in TCG mode)
>
> Power10 predecessor behavior:
> - KVM guest: Boot the guest without DAWR1 support. Error out
> if user tries with cap-dawr1=on.
> - TCG guest: Ignore cap-dawr1 i.e. boot as if there is only
> DAWR0 (Should be fixed in future while adding PowerPC watch-
> point support in TCG mode)

Sorry I've neglected this thread so long. I'm afraid the logic above
won't work. As a general rule we never want to change guest-visible
details of the platform based on KVM capabilities, because it makes a
total mess of migration across clusters.

So, if we'd introduced this along with initial POWER10 support, I
don't think we'd need a capability at all: we just present DAWR1 on
POWER10, don't otherwise. The fact it doesn't work in TCG we just
treat as a TCG bug we'll probably never get around to fixing, just
like TCG not supporting DAWR0 is a TCG bug right now.

Since we have released versions with POWER10 support, but no DAWR1, in
theory we need a capability so new qemu with old machine types don't
gain guest visible features that the same machine types on older qemus
had.

Except.. there's a loophole we might use to sidestep that. The
current POWER10 CPU modelled in qemu is a DD1 - which I strongly
suspect will never appear outside of IBM. I'm pretty sure we want to
replace that with a DD2.

While the modelled CPU is DD1, I think it's pretty reasonable to say
our POWER10 support hasn't yet stabilized, and it would therefore be
ok to simply add DAWR1 on POWER10 unconditionally, as long as we do it
before we switch over to DD2.

> > I'm wondering if we're actually just better off setting the pa feature
> > just based on the guest CPU model. TCG will be broken if you try to
> > use it, but then, it already is. AFAIK there's no inherent reason we
> > couldn't implement DAWR support in TCG, it's just never been worth the
> > trouble.
>
> Correct. Probably there is no practical usecase for DAWR in TCG mode.
>
> Thanks,
> Ravi
>

--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]