Re: [PATCH 1/2] kvm-s390: Implement the directed yield (diag 9c) hypervisor call for KVM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25.04.2012, at 15:30, Christian Borntraeger wrote:

> From: Konstantin Weitz <WEITZKON@xxxxxxxxxx>
> 
> This patch implements the directed yield hypercall found on other
> System z hypervisors. It delegates execution time to the virtual cpu
> specified in the instruction's parameter.
> 
> Useful to avoid long spinlock waits in the guest.
> 
> Christian Borntraeger: moved common code in virt/kvm/
> 
> Signed-off-by: Konstantin Weitz <WEITZKON@xxxxxxxxxx>
> Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
> ---
> arch/s390/include/asm/kvm_host.h |    1 +
> arch/s390/kvm/diag.c             |   25 +++++++++++++++++++++++
> arch/s390/kvm/kvm-s390.c         |    1 +
> include/linux/kvm_host.h         |    1 +
> virt/kvm/kvm_main.c              |   42 +++++++++++++++++++++++---------------
> 5 files changed, 54 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
> index 7343872..dd17537 100644
> --- a/arch/s390/include/asm/kvm_host.h
> +++ b/arch/s390/include/asm/kvm_host.h
> @@ -148,6 +148,7 @@ struct kvm_vcpu_stat {
> 	u32 instruction_sigp_restart;
> 	u32 diagnose_10;
> 	u32 diagnose_44;
> +	u32 diagnose_9c;
> };
> 
> struct kvm_s390_io_info {
> diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
> index a353f0e..2d2ae32 100644
> --- a/arch/s390/kvm/diag.c
> +++ b/arch/s390/kvm/diag.c
> @@ -53,6 +53,29 @@ static int __diag_time_slice_end(struct kvm_vcpu *vcpu)
> 	return 0;
> }
> 
> +static int __diag_time_slice_end_directed(struct kvm_vcpu *vcpu)
> +{
> +	struct kvm *kvm = vcpu->kvm;
> +	struct kvm_vcpu *tcpu;
> +	int tid;
> +	int i;
> +
> +	tid = vcpu->run->s.regs.gprs[(vcpu->arch.sie_block->ipa & 0xf0) >> 4];
> +	vcpu->stat.diagnose_9c++;
> +	VCPU_EVENT(vcpu, 5, "diag time slice end directed to %d", tid);
> +
> +	if (tid == vcpu->vcpu_id)
> +		return 0;
> +
> +	kvm_for_each_vcpu(i, tcpu, kvm)
> +		if (tcpu->vcpu_id == tid) {

Wouldn't

  kvm_get_vcpu(kvm, tid)

be what you want here?

Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux