Skip to contentSkip to conversation

KVM: s390: Fix pfmf and conditional skey emulation

PATCH David Hildenbrand 1 participant 1 message Aug 29, 2018 1 message not in the archive s390

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 49 lines · Janosch Frank
Quoted 6 lines · David Hildenbrand
Quoted 5 lines · Janosch Frank

We should not return with a lock.
We also have to increase the address when we do page clearing.

Fixes bd096f644319 ("KVM: s390: Add skey emulation fault handling")
Fixes 0230cae75df6 ("KVM: s390: Replace clear_user with kvm_clear_guest")

These will will be removed, KVM: s390: Add skey emulation fault handling is only in rc1.

Quoted 32 lines
Quoted 10 lines
---
 arch/s390/kvm/priv.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/s390/kvm/priv.c +0 -0
index d68f10441a16..7d61dccfd034 100644

arch/s390/kvm/priv.c static int handle_sske(struct kvm_vcpu *vcpu) · line 396

Quoted 8 lines
arch/s390/kvm/priv.c +1 -1
@@ -390,10 +390,10 @@ static int handle_sske(struct kvm_vcpu *vcpu)
 					      FAULT_FLAG_WRITE, &unlocked);
 			rc = !rc ? -EAGAIN : rc;
 		}
+		up_read(&current->mm->mmap_sem);
 		if (rc == -EFAULT)
 			return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 
-		up_read(&current->mm->mmap_sem);

Indeed.

arch/s390/kvm/priv.c static int handle_pfmf(struct kvm_vcpu *vcpu) · line 1005

Quoted 8 lines
arch/s390/kvm/priv.c +1 -0
 		if (rc >= 0)
 			start += PAGE_SIZE;
 	}
@@ -1002,13 +1002,14 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
 						      FAULT_FLAG_WRITE, &unlocked);
 				rc = !rc ? -EAGAIN : rc;
 			}
+			up_read(&current->mm->mmap_sem);

that's certainly correct

Quoted 5 lines

arch/s390/kvm/priv.c static int handle_pfmf(struct kvm_vcpu *vcpu) · line 1008

Quoted 3 lines
arch/s390/kvm/priv.c +1 -0
 			if (rc == -EFAULT)
 				return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
+			if (rc == -EAGAIN)

I would prefer "rc < 0" instead I guess.

Quoted 4 lines

No, I do not want to continue on any other rc.
But we could add this afterwards:
if (rc < 0)

	return rc;

Makes sense. (otherwise it could smell like an endless loop)

Signature · 3 lines
Thanks,

David / dhildenb