From: Thomas Huth <thuth@redhat.com>
To: Eric Farman <farman@linux.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Janosch Frank <frankja@linux.ibm.com>,
David Hildenbrand <david@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Jason Herne <jjherne@linux.ibm.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [RFC PATCH v1 1/6] KVM: s390: Simplify SIGP Set Arch handling
Date: Mon, 11 Oct 2021 08:29:26 +0200 [thread overview]
Message-ID: <912906c5-5932-c6d5-76c7-0751412c1344@redhat.com> (raw)
In-Reply-To: <20211008203112.1979843-2-farman@linux.ibm.com>
On 08/10/2021 22.31, Eric Farman wrote:
> The Principles of Operations describe the various reasons that
> each individual SIGP orders might be rejected, and the status
> bit that are set for each condition.
>
> For example, for the Set Architecture order, it states:
>
> "If it is not true that all other CPUs in the configu-
> ration are in the stopped or check-stop state, ...
> bit 54 (incorrect state) ... is set to one."
>
> However, it also states:
>
> "... if the CZAM facility is installed, ...
> bit 55 (invalid parameter) ... is set to one."
>
> Since the Configuration-z/Architecture-Architectural Mode (CZAM)
> facility is unconditionally presented, there is no need to examine
> each VCPU to determine if it is started/stopped. It can simply be
> rejected outright with the Invalid Parameter bit.
>
> Fixes: b697e435aeee ("KVM: s390: Support Configuration z/Architecture Mode")
> Signed-off-by: Eric Farman <farman@linux.ibm.com>
> ---
> arch/s390/kvm/sigp.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
> index 683036c1c92a..cf4de80bd541 100644
> --- a/arch/s390/kvm/sigp.c
> +++ b/arch/s390/kvm/sigp.c
> @@ -151,22 +151,10 @@ static int __sigp_stop_and_store_status(struct kvm_vcpu *vcpu,
> static int __sigp_set_arch(struct kvm_vcpu *vcpu, u32 parameter,
> u64 *status_reg)
> {
> - unsigned int i;
> - struct kvm_vcpu *v;
> - bool all_stopped = true;
> -
> - kvm_for_each_vcpu(i, v, vcpu->kvm) {
> - if (v == vcpu)
> - continue;
> - if (!is_vcpu_stopped(v))
> - all_stopped = false;
> - }
> -
> *status_reg &= 0xffffffff00000000UL;
>
> /* Reject set arch order, with czam we're always in z/Arch mode. */
> - *status_reg |= (all_stopped ? SIGP_STATUS_INVALID_PARAMETER :
> - SIGP_STATUS_INCORRECT_STATE);
> + *status_reg |= SIGP_STATUS_INVALID_PARAMETER;
> return SIGP_CC_STATUS_STORED;
> }
I was initially a little bit torn by this modification, since, as you
already mentioned, it could theoretically be possible that a userspace (like
an older version of QEMU) does not use CZAM bit yet. But then I read an
older version of the PoP which does not feature CZAM yet, and it reads:
"The set-architecture order is completed as follows:
• If the code in the parameter register is not 0, 1, or
2, or if the CPU is already in the architectural
mode specified by the code, the order is not
accepted. Instead, bit 55 (invalid parameter) of
the general register designated by the R 1 field of
the SIGNAL PROCESSOR instruction is set to
one, and condition code 1 is set.
• If it is not true that all other CPUs in the configu-
ration are in the stopped or check-stop state, the
order is not accepted. Instead, bit 54 (incorrect
state) of the general register designated by the
R 1 field of the SIGNAL PROCESSOR instruction
is set to one, and condition code 1 is set.
• The architectural mode of all CPUs in the config-
uration is set as specified by the code.
..."
So to me this sounds like "invalid parameter" has a higher priority than
"incorrect state" anyway, so we likely never
should have reported here "incorrect state"...?
Thus, I think it's the right way to go now:
Reviewed-by: Thomas Huth <thuth@redhat.com>
next prev parent reply other threads:[~2021-10-11 6:29 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-08 20:31 [RFC PATCH v1 0/6] Improvements to SIGP handling [KVM] Eric Farman
2021-10-08 20:31 ` [RFC PATCH v1 1/6] KVM: s390: Simplify SIGP Set Arch handling Eric Farman
2021-10-11 6:29 ` Thomas Huth [this message]
2021-10-11 7:24 ` Christian Borntraeger
2021-10-11 17:57 ` David Hildenbrand
2021-10-12 7:35 ` Claudio Imbrenda
2021-10-12 8:42 ` Christian Borntraeger
2021-10-08 20:31 ` [RFC PATCH v1 2/6] KVM: s390: Reject SIGP when destination CPU is busy Eric Farman
2021-10-11 7:27 ` Thomas Huth
2021-10-11 7:43 ` Christian Borntraeger
2021-10-11 7:52 ` Thomas Huth
2021-10-11 17:58 ` David Hildenbrand
2021-10-11 18:13 ` Eric Farman
2021-10-08 20:31 ` [RFC PATCH v1 3/6] KVM: s390: Simplify SIGP Restart Eric Farman
2021-10-11 7:45 ` Christian Borntraeger
2021-10-12 15:23 ` Thomas Huth
2021-10-12 15:31 ` Eric Farman
2021-10-13 5:54 ` Thomas Huth
2021-10-13 13:54 ` Eric Farman
2021-10-08 20:31 ` [RFC PATCH v1 4/6] KVM: s390: Restart IRQ should also block SIGP Eric Farman
2021-10-08 20:31 ` [RFC PATCH v1 5/6] KVM: s390: Give BUSY to SIGP SENSE during Restart Eric Farman
2021-10-11 18:01 ` David Hildenbrand
2021-10-08 20:31 ` [RFC PATCH v1 6/6] KVM: s390: Add a routine for setting userspace CPU state Eric Farman
2021-10-11 7:31 ` Thomas Huth
2021-10-11 7:45 ` David Hildenbrand
2021-10-12 7:45 ` Claudio Imbrenda
2021-10-12 8:44 ` Christian Borntraeger
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=912906c5-5932-c6d5-76c7-0751412c1344@redhat.com \
--to=thuth@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=farman@linux.ibm.com \
--cc=frankja@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=jjherne@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.