From: Nicholas Piggin <npiggin@gmail.com>
To: Daniel Henrique Barboza <danielhb413@gmail.com>, qemu-ppc@nongnu.org
Cc: qemu-devel@nongnu.org, David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [RFC PATCH] spapr: Add SPAPR_CAP_AIL_MODES for supported AIL modes for H_SET_MODE hcall
Date: Tue, 01 Feb 2022 16:18:46 +1000 [thread overview]
Message-ID: <1643695373.1vu1v2pdey.astroid@bobo.none> (raw)
In-Reply-To: <21b0c97c-3963-518c-e910-eb8264fe74a9@gmail.com>
Excerpts from Daniel Henrique Barboza's message of February 1, 2022 5:10 am:
>
>
> On 1/29/22 03:50, Nicholas Piggin wrote:
>> The behaviour of the Address Translation Mode on Interrupt resource is
>> not consistently supported by all CPU versions or all KVM versions. In
>> particular KVM HV only supports mode 0 on POWER7 processors, and does
>> not support mode 2 on any processors. KVM PR only supports mode 0. TCG
>> can support all modes (0,2,3).
>>
>> This leads to inconsistencies in guest behaviour and could cause
>> problems migrating guests.
>>
>> This was not too noticable for Linux guests for a long time because the
>> kernel only used mode 0 or 3, and it used to consider AIL to be somewhat
>> advisory (KVM would not always honor it either) and it kept both sets of
>> interrupt vectors around.
>>
>> Recent Linux guests depend on the AIL mode working as defined by the ISA
>> to support the SCV facility interrupt. If AIL mode 3 can not be provided,
>> then Linux must be given an error so it can disable the SCV facility.
>
> Is this the scenario where migration failures can occur? I don't understand
> what are the migration problems you cited that were possible to happen.
Maybe I'm overly concerned and nothing would practically use it (beyond
testing which we could just hack around). I was thinking of if we
implemented AIL=2 in KVM HV, or AIL=3 in PR.
>
>>
>> Add the ail-modes capability which is a bitmap of the supported values
>> for the H_SET_MODE Address Translation Mode on Interrupt resource. Add
>> a new KVM CAP that exports the same thing, and provide defaults for PR
>> and HV KVM that predate the cap.
>
> Why add a new machine cap in this case? Isn't something that the KVM capability
> should be able to handle by itself, where we always assume that we should have
> the best AIL value possible?
>
> Besides, the way it is coded here, we're adding an user-visible capability that
> mimics the exact behavior we want from h_set_mode_resource_addr_trans_mode(),
> meaning that only bits 0,1,2 and 3 of cap-ail-modes can be set, but:
>
> - bit 0 must always be set
> - bit 1 must always be cleared
> - if kvm_enabled():
> * bit 2 must always be cleared
> * bit 3 can be cleared or not depending on kvmppc_has_cap_ail_3(), which translates
> to not allowed if running with KVM_PR and allowing it if it we're running with Power8
> and newer
>
> i.e. bit 0 is always set, bit 1 is always cleared, bit 2 can be set or not for TCG but
> always cleared for KVM, and bit 3 can be set depending on the circunstances.
>
> Note that this would allow an user to set this guest in a Power9/10 machine:
>
> -machine pseries,accel=kvm,cap-ail-modes=1
>
> And the guest will end up having degraded performance because AIL=3 is being disabled.
>
> If we want to avoid this and force AIL=3 to be used in this case, then this capability
> would be used just to set or clear AIL=2 when running with TCG.
I was thinking how it could be more flexible with maybe possibly future
AIL modes and things we don't foresee. In theory AIL=0 could go away
(although unlikely in practice).
> I believe the chunks in which we check for kvm_pr and allow only AIL=0 are improvements
> of h_set_mode_resource_addr_trans_mode(), but other than that I'm afraid that exposing
> this cap to users is a bit overkill.
That said, maybe you are right and it's overkill until a real need comes
up.
I will split and submit the KVM cap part of it, at least.
Thanks,
Nick
next prev parent reply other threads:[~2022-02-01 6:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-29 6:50 [RFC PATCH] spapr: Add SPAPR_CAP_AIL_MODES for supported AIL modes for H_SET_MODE hcall Nicholas Piggin
2022-01-31 15:51 ` Fabiano Rosas
2022-02-01 6:02 ` Nicholas Piggin
2022-02-07 1:50 ` David Gibson
2022-01-31 19:10 ` Daniel Henrique Barboza
2022-02-01 6:18 ` Nicholas Piggin [this message]
2022-02-07 1:54 ` David Gibson
2022-02-07 11:33 ` Daniel Henrique Barboza
2022-02-07 1:41 ` David Gibson
2022-02-14 7:54 ` Nicholas Piggin
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=1643695373.1vu1v2pdey.astroid@bobo.none \
--to=npiggin@gmail.com \
--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).