All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
	Cornelia Huck <cohuck@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>, KVM <kvm@vger.kernel.org>,
	linux-s390 <linux-s390@vger.kernel.org>,
	"Collin L. Walling" <walling@linux.vnet.ibm.com>
Subject: Re: [PATCH 06/11] KVM: s390: Multiple Epoch Facility support
Date: Tue, 29 Aug 2017 14:24:24 +0200	[thread overview]
Message-ID: <705f3223-ed61-e9da-814c-238d21322f6b@redhat.com> (raw)
In-Reply-To: <1503907651-65296-3-git-send-email-borntraeger@de.ibm.com>

On 28.08.2017 10:07, Christian Borntraeger wrote:
> From: "Collin L. Walling" <walling@linux.vnet.ibm.com>
> 
> Allow for the enablement of MEF and the support for the extended
> epoch in SIE and VSIE for the extended guest TOD-Clock.
> 
> A new interface is used for getting/setting a guest's extended
> TOD-Clock that uses a single ioctl invocation, KVM_S390_VM_TOD_EXT.
> The old method of getting and setting the guest TOD-Clock is
> retained and is used when the old ioctls are called.

After talking to Christian, I understand that we have to set it in "one
shot" as we can otherwise run into problems when getting/setting the TOD
as we are looking at a moving target. This should go into the cover letter.

I need some more info regarding the architecture change.

For now, epoch was an unsigned value that is interpreted as an signed value.

a) Is that still true with multiple epoch?
b) What is the format of the epoch index? Can it also be "negative"?

Why I am asking: I can see comparison made with the epoch:

> +	if (test_kvm_facility(vcpu->kvm, 139)) {
> +		scb_s->epdx += vcpu->kvm->arch.epdx;
> +		if (scb_s->epoch < vcpu->kvm->arch.epoch)
> +			scb_s->epdx += 1;
> +	}

or

> +	if (kvm->arch.epoch > gtod->tod)
> +		kvm->arch.epdx -= 1;


If I remember correctly, such comparisons won't work correctly when
having this signed/unsigned duality. But I might be wrong.


> 
> Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>
> Reviewed-by: Janosch Frank <frankja@linux.vnet.ibm.com>
> Reviewed-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
> Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---

[...]
>  
>  /* implemented in kvm-s390.c */
> +void kvm_s390_set_tod_clock_ext(struct kvm *kvm,
> +				 const struct kvm_s390_vm_tod_clock *gtod);
>  void kvm_s390_set_tod_clock(struct kvm *kvm, u64 tod);
>  long kvm_arch_fault_in_page(struct kvm_vcpu *vcpu, gpa_t gpa, int writable);
>  int kvm_s390_store_status_unloaded(struct kvm_vcpu *vcpu, unsigned long addr);
> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> index 715c19c..681d06e 100644
> --- a/arch/s390/kvm/vsie.c
> +++ b/arch/s390/kvm/vsie.c
> @@ -349,6 +349,9 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>  		scb_s->eca |= scb_o->eca & ECA_IB;
>  	if (test_kvm_cpu_feat(vcpu->kvm, KVM_S390_VM_CPU_FEAT_CEI))
>  		scb_s->eca |= scb_o->eca & ECA_CEI;
> +	/* Epoch Extension */
> +	if (test_kvm_facility(vcpu->kvm, 139))
> +		scb_s->ecd |= scb_o->ecd & ECD_MEF;
>  
>  	prepare_ibc(vcpu, vsie_page);
>  	rc = shadow_crycb(vcpu, vsie_page);
> @@ -919,6 +922,13 @@ static void register_shadow_scb(struct kvm_vcpu *vcpu,
>  	 */
>  	preempt_disable();
>  	scb_s->epoch += vcpu->kvm->arch.epoch;
> +
> +	if (test_kvm_facility(vcpu->kvm, 139)) {

Although scb_s->epdx won't be interpreted without ECD_MEF, this should
be (so data is only copied if really enabled).

if (scb_s->ecd | ECD_MEF)

> +		scb_s->epdx += vcpu->kvm->arch.epdx;
> +		if (scb_s->epoch < vcpu->kvm->arch.epoch)
> +			scb_s->epdx += 1;
> +	}
> +
>  	preempt_enable();
>  }
>  
> diff --git a/arch/s390/tools/gen_facilities.c b/arch/s390/tools/gen_facilities.c
> index 181db5b..601bfcf 100644
> --- a/arch/s390/tools/gen_facilities.c
> +++ b/arch/s390/tools/gen_facilities.c
> @@ -81,6 +81,7 @@ static struct facility_def facility_defs[] = {
>  			130, /* instruction-execution-protection */
>  			131, /* enhanced-SOP 2 and side-effect */
>  			138, /* configuration z/architecture mode (czam) */
> +			139, /* multiple epoch facility */
>  			146, /* msa extension 8 */
>  			-1  /* END */
>  		}
> 


-- 

Thanks,

David

  parent reply	other threads:[~2017-08-29 12:24 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-28  8:07 [PATCH 00/11] KVM: s390: Fixes and features for 4.14 Christian Borntraeger
2017-08-28  8:07 ` [PATCH 05/11] KVM: s390: Support Configuration z/Architecture Mode Christian Borntraeger
2017-08-28  9:07   ` Cornelia Huck
2017-08-28  9:11     ` Christian Borntraeger
2017-08-28  9:14       ` Christian Borntraeger
2017-08-28 11:33       ` Cornelia Huck
2017-08-28 11:35   ` Cornelia Huck
2017-08-28 14:06   ` David Hildenbrand
2017-08-28 14:24     ` Christian Borntraeger
2017-08-28 14:38       ` David Hildenbrand
2017-08-28 14:42         ` Christian Borntraeger
2017-08-28 19:27   ` David Hildenbrand
2017-08-28 19:35     ` Christian Borntraeger
2017-08-28 19:38       ` Christian Borntraeger
2017-08-28 19:42         ` David Hildenbrand
2017-08-29  7:18           ` Christian Borntraeger
2017-08-29 12:08             ` David Hildenbrand
2017-08-29 12:21               ` Christian Borntraeger
2017-08-29 12:24                 ` David Hildenbrand
2017-08-29 14:31                 ` [PATCH] KVM: s390: we are always in czam mode David Hildenbrand
2017-08-29 14:40                   ` Cornelia Huck
2017-08-29 14:48                   ` Christian Borntraeger
2017-08-28 19:41       ` [PATCH 05/11] KVM: s390: Support Configuration z/Architecture Mode David Hildenbrand
2017-08-28  8:07 ` [PATCH 06/11] KVM: s390: Multiple Epoch Facility support Christian Borntraeger
2017-08-28 11:21   ` Cornelia Huck
2017-08-28 11:36     ` Christian Borntraeger
2017-08-28 11:45       ` Cornelia Huck
2017-08-29 12:24   ` David Hildenbrand [this message]
2017-08-29 12:46     ` Christian Borntraeger
2017-08-29 12:54       ` David Hildenbrand
2017-08-29 12:59       ` Christian Borntraeger
2017-08-28  8:07 ` [PATCH 10/11] KVM: s390: sthyi: remove invalid guest write access Christian Borntraeger
2017-08-28 11:39   ` Cornelia Huck
2017-08-28  8:07 ` [PATCH 11/11] KVM: s390: expose no-DAT to guest and migration support Christian Borntraeger
2017-08-28 12:12   ` Cornelia Huck
2017-08-28 12:17 ` [PATCH 00/11] KVM: s390: Fixes and features for 4.14 Cornelia Huck

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=705f3223-ed61-e9da-814c-238d21322f6b@redhat.com \
    --to=david@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=walling@linux.vnet.ibm.com \
    /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.