public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Eric Farman <farman@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Jason Herne <jjherne@linux.ibm.com>,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [RFC PATCH v1 1/6] KVM: s390: Simplify SIGP Set Arch handling
Date: Tue, 12 Oct 2021 09:35:36 +0200	[thread overview]
Message-ID: <20211012093536.43b0571c@p-imbrenda> (raw)
In-Reply-To: <20211008203112.1979843-2-farman@linux.ibm.com>

On Fri,  8 Oct 2021 22:31:07 +0200
Eric Farman <farman@linux.ibm.com> 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>

I like removing and simplifying code while staying architecturally
correct :)

Reviewed-by: Claudio Imbrenda <imbrenda@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;
>  }
>  


  parent reply	other threads:[~2021-10-12  8:12 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
2021-10-11  7:24     ` Christian Borntraeger
2021-10-11 17:57   ` David Hildenbrand
2021-10-12  7:35   ` Claudio Imbrenda [this message]
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=20211012093536.43b0571c@p-imbrenda \
    --to=imbrenda@linux.ibm.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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox