public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL 0/2] KVM: s390: Fixes for kvm/next (3.17)
@ 2014-07-31  7:59 Christian Borntraeger
  2014-07-31  7:59 ` [GIT PULL 1/2] KVM: s390: Fix memory leak on busy SIGP stop Christian Borntraeger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christian Borntraeger @ 2014-07-31  7:59 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Alexander Graf, KVM, linux-s390, Cornelia Huck, Jens Freimann,
	Gleb Natapov, Christian Borntraeger

Paolo,

The following changes since commit b55a8144d1807f9e74c51cb584f0dd198483d86c:

  x86/kvm: Resolve shadow warning from min macro (2014-07-25 16:05:54 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-20140730

for you to fetch changes up to db3738614767e1f2dfe69afca070d7bc46266cca:

  KVM: s390: rework broken SIGP STOP interrupt handling (2014-07-31 09:20:35 +0200)

----------------------------------------------------------------
Two fixes for recently introduced regressions
- a memory leak on busy SIGP
- pontentially lost SIGP stop in rare situations (shutdown loops)

The first issue is not part of a released kernel. The 2nd issue is
present in all KVM versions, but did not trigger before commit
7dfc63cf977447e09b1072911c2 (KVM: s390: allow only one SIGP STOP
(AND STORE STATUS) at a time) with Linux as a guest.
So no need for cc stable

----------------------------------------------------------------
Christian Borntraeger (1):
      KVM: s390: Fix memory leak on busy SIGP stop

David Hildenbrand (1):
      KVM: s390: rework broken SIGP STOP interrupt handling

 arch/s390/kvm/interrupt.c | 3 +++
 arch/s390/kvm/sigp.c      | 1 +
 2 files changed, 4 insertions(+)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [GIT PULL 1/2] KVM: s390: Fix memory leak on busy SIGP stop
  2014-07-31  7:59 [GIT PULL 0/2] KVM: s390: Fixes for kvm/next (3.17) Christian Borntraeger
@ 2014-07-31  7:59 ` Christian Borntraeger
  2014-07-31  7:59 ` [GIT PULL 2/2] KVM: s390: rework broken SIGP STOP interrupt handling Christian Borntraeger
  2014-07-31 14:31 ` [GIT PULL 0/2] KVM: s390: Fixes for kvm/next (3.17) Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Borntraeger @ 2014-07-31  7:59 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Alexander Graf, KVM, linux-s390, Cornelia Huck, Jens Freimann,
	Gleb Natapov, Christian Borntraeger

commit 7dfc63cf977447e09b1072911c22564f900fc578
(KVM: s390: allow only one SIGP STOP (AND STORE STATUS) at a time)
introduced a memory leak if a sigp stop is already pending. Free
the allocated inti structure.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
---
 arch/s390/kvm/sigp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
index c6f1c2b..cf243ba 100644
--- a/arch/s390/kvm/sigp.c
+++ b/arch/s390/kvm/sigp.c
@@ -139,6 +139,7 @@ static int __inject_sigp_stop(struct kvm_vcpu *dst_vcpu, int action)
 	spin_lock(&li->lock);
 	if (li->action_bits & ACTION_STOP_ON_STOP) {
 		/* another SIGP STOP is pending */
+		kfree(inti);
 		rc = SIGP_CC_BUSY;
 		goto out;
 	}
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [GIT PULL 2/2] KVM: s390: rework broken SIGP STOP interrupt handling
  2014-07-31  7:59 [GIT PULL 0/2] KVM: s390: Fixes for kvm/next (3.17) Christian Borntraeger
  2014-07-31  7:59 ` [GIT PULL 1/2] KVM: s390: Fix memory leak on busy SIGP stop Christian Borntraeger
@ 2014-07-31  7:59 ` Christian Borntraeger
  2014-07-31 14:31 ` [GIT PULL 0/2] KVM: s390: Fixes for kvm/next (3.17) Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Borntraeger @ 2014-07-31  7:59 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Alexander Graf, KVM, linux-s390, Cornelia Huck, Jens Freimann,
	Gleb Natapov, David Hildenbrand, Christian Borntraeger

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

A VCPU might never stop if it intercepts (for whatever reason) between
"fake interrupt delivery" and execution of the stop function.

Heart of the problem is that SIGP STOP is an interrupt that has to be
processed on every SIE entry until the VCPU finally executes the stop
function.

This problem was made apparent by commit 7dfc63cf977447e09b1072911c2
(KVM: s390: allow only one SIGP STOP (AND STORE STATUS) at a time).
With the old code, the guest could (incorrectly) inject SIGP STOPs
multiple times. The bug of losing a sigp stop exists in KVM before
7dfc63cf97, but it was hidden by Linux guests doing a sigp stop loop.
The new code (rightfully) returns CC=2 and does not queue a new
interrupt.

This patch is a simple fix of the problem. Longterm we are going to
rework that code - e.g. get rid of the action bits and so on.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
[some additional patch description]
---
 arch/s390/kvm/interrupt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 1be3d8d..92528a0 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -158,6 +158,9 @@ static void __reset_intercept_indicators(struct kvm_vcpu *vcpu)
 					       LCTL_CR10 | LCTL_CR11);
 		vcpu->arch.sie_block->ictl |= (ICTL_STCTL | ICTL_PINT);
 	}
+
+	if (vcpu->arch.local_int.action_bits & ACTION_STOP_ON_STOP)
+		atomic_set_mask(CPUSTAT_STOP_INT, &vcpu->arch.sie_block->cpuflags);
 }
 
 static void __set_cpuflag(struct kvm_vcpu *vcpu, u32 flag)
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [GIT PULL 0/2] KVM: s390: Fixes for kvm/next (3.17)
  2014-07-31  7:59 [GIT PULL 0/2] KVM: s390: Fixes for kvm/next (3.17) Christian Borntraeger
  2014-07-31  7:59 ` [GIT PULL 1/2] KVM: s390: Fix memory leak on busy SIGP stop Christian Borntraeger
  2014-07-31  7:59 ` [GIT PULL 2/2] KVM: s390: rework broken SIGP STOP interrupt handling Christian Borntraeger
@ 2014-07-31 14:31 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2014-07-31 14:31 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Alexander Graf, KVM, linux-s390, Cornelia Huck, Jens Freimann,
	Gleb Natapov

Il 31/07/2014 09:59, Christian Borntraeger ha scritto:
>   git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-20140730

Thanks, applying.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-31 14:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-31  7:59 [GIT PULL 0/2] KVM: s390: Fixes for kvm/next (3.17) Christian Borntraeger
2014-07-31  7:59 ` [GIT PULL 1/2] KVM: s390: Fix memory leak on busy SIGP stop Christian Borntraeger
2014-07-31  7:59 ` [GIT PULL 2/2] KVM: s390: rework broken SIGP STOP interrupt handling Christian Borntraeger
2014-07-31 14:31 ` [GIT PULL 0/2] KVM: s390: Fixes for kvm/next (3.17) Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox