Re: [PATCH 1/1] KVM: s390: diag9c forwarding

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

 





On 1/19/21 5:53 PM, Cornelia Huck wrote:
On Mon, 18 Jan 2021 14:17:39 +0100
Christian Borntraeger <borntraeger@xxxxxxxxxx> wrote:

From: Pierre Morel <pmorel@xxxxxxxxxxxxx>

When we receive intercept a DIAG_9C from the guest we verify
that the target real CPU associated with the virtual CPU
designated by the guest is running and if not we forward the
DIAG_9C to the target real CPU.

To avoid a diag9c storm we allow a maximal rate of diag9c forwarding.

The rate is calculated as a count per second defined as a
new parameter of the s390 kvm module: diag9c_forwarding_hz .

The default value is to not forward diag9c.

Signed-off-by: Pierre Morel <pmorel@xxxxxxxxxxxxx>
Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
---
  arch/s390/include/asm/kvm_host.h |  1 +
  arch/s390/include/asm/smp.h      |  1 +
  arch/s390/kernel/smp.c           |  1 +
  arch/s390/kvm/diag.c             | 31 ++++++++++++++++++++++++++++---
  arch/s390/kvm/kvm-s390.c         |  6 ++++++
  arch/s390/kvm/kvm-s390.h         |  8 ++++++++
  6 files changed, 45 insertions(+), 3 deletions(-)


(...)

@@ -167,9 +180,21 @@ static int __diag_time_slice_end_directed(struct kvm_vcpu *vcpu)
  	if (!tcpu)
  		goto no_yield;
- /* target already running */
-	if (READ_ONCE(tcpu->cpu) >= 0)
-		goto no_yield;
+	/* target VCPU already running */

Maybe make this /* target guest VPCU already running */...

+	if (READ_ONCE(tcpu->cpu) >= 0) {
+		if (!diag9c_forwarding_hz || diag9c_forwarding_overrun())
+			goto no_yield;
+
+		/* target CPU already running */

...and this /* target host CPU already running */? I just read this
several times and was confused before I spotted the difference :)

I can only agree then :) .

...


--
Pierre Morel
IBM Lab Boeblingen




[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