KVM: s390: trace and count all skey intercepts
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Tue, 10 May 2016 07:40:09 +0000 (09:40 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Fri, 10 Jun 2016 10:07:31 +0000 (12:07 +0200)
Let's trace and count all skey handling operations, even if lazy skey
handling was already activated. Also, don't enable lazy skey handling if
anything went wrong while enabling skey handling for the SIE.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/priv.c
arch/s390/kvm/trace.h

index b8327b8fdb8f9da7be04828acbc44e9b953aa436..6745c2a602c343e83f4f44e8d9d326503a2df684 100644 (file)
@@ -152,24 +152,27 @@ static int handle_store_cpu_address(struct kvm_vcpu *vcpu)
 static int __skey_check_enable(struct kvm_vcpu *vcpu)
 {
        int rc = 0;
+
+       trace_kvm_s390_skey_related_inst(vcpu);
        if (!(vcpu->arch.sie_block->ictl & (ICTL_ISKE | ICTL_SSKE | ICTL_RRBE)))
                return rc;
 
        rc = s390_enable_skey();
-       VCPU_EVENT(vcpu, 3, "%s", "enabling storage keys for guest");
-       trace_kvm_s390_skey_related_inst(vcpu);
-       vcpu->arch.sie_block->ictl &= ~(ICTL_ISKE | ICTL_SSKE | ICTL_RRBE);
+       VCPU_EVENT(vcpu, 3, "enabling storage keys for guest: %d", rc);
+       if (!rc)
+               vcpu->arch.sie_block->ictl &= ~(ICTL_ISKE | ICTL_SSKE | ICTL_RRBE);
        return rc;
 }
 
 
 static int handle_skey(struct kvm_vcpu *vcpu)
 {
-       int rc = __skey_check_enable(vcpu);
+       int rc;
 
+       vcpu->stat.instruction_storage_key++;
+       rc = __skey_check_enable(vcpu);
        if (rc)
                return rc;
-       vcpu->stat.instruction_storage_key++;
 
        if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
                return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
index 1c4586b367a44364dd30f15da145f28d91c8af8a..4fc9d4e5be89c69aaf9465d45e2409b41b4a1ab6 100644 (file)
@@ -41,7 +41,7 @@ TRACE_EVENT(kvm_s390_skey_related_inst,
            TP_fast_assign(
                    VCPU_ASSIGN_COMMON
                    ),
-           VCPU_TP_PRINTK("%s", "first instruction related to skeys on vcpu")
+           VCPU_TP_PRINTK("%s", "storage key related instruction")
        );
 
 TRACE_EVENT(kvm_s390_major_guest_pfault,