summaryrefslogtreecommitdiffstats
path: root/arch/s390/mm/fault.c
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2017-10-05 08:44:26 +0200
committerHeiko Carstens <heiko.carstens@de.ibm.com>2017-11-14 11:01:43 +0100
commitc771320e9357c9b85634002daedfe5c8988f27a6 (patch)
treebf405eb39a9cb33d352fddaf2edf3eeacf4eb74f /arch/s390/mm/fault.c
parentcefbeb5df56e1daf0adda8ca5eecee03c5084af6 (diff)
downloadlinux-c771320e9357c9b85634002daedfe5c8988f27a6.tar.bz2
s390/mm,kvm: improve detection of KVM guest faults
The identification of guest fault currently relies on the PF_VCPU flag. This is set in guest_entry_irqoff and cleared in guest_exit_irqoff. Both functions are called by __vcpu_run, the PF_VCPU flag is set for quite a lot of kernel code outside of the guest execution. Replace the PF_VCPU scheme with the PIF_GUEST_FAULT in the pt_regs and make the program check handler code in entry.S set the bit only for exception that occurred between the .Lsie_gmap and .Lsie_done labels. Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'arch/s390/mm/fault.c')
-rw-r--r--arch/s390/mm/fault.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 242b78c0a9ec..be974b3eb7e4 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -117,7 +117,7 @@ static inline int user_space_fault(struct pt_regs *regs)
return 1;
if (trans_exc_code == 2) /* secondary space -> set_fs */
return current->thread.mm_segment.ar4;
- if (current->flags & PF_VCPU)
+ if (test_pt_regs_flag(regs, PIF_GUEST_FAULT))
return 1;
return 0;
}
@@ -209,7 +209,7 @@ static void dump_fault_info(struct pt_regs *regs)
pr_cont("kernel ");
}
#ifdef CONFIG_PGSTE
- else if ((current->flags & PF_VCPU) && S390_lowcore.gmap) {
+ else if (test_pt_regs_flag(regs, PIF_GUEST_FAULT)) {
struct gmap *gmap = (struct gmap *)S390_lowcore.gmap;
asce = gmap->asce;
pr_cont("gmap ");
@@ -438,7 +438,7 @@ static inline int do_exception(struct pt_regs *regs, int access)
down_read(&mm->mmap_sem);
#ifdef CONFIG_PGSTE
- gmap = (current->flags & PF_VCPU) ?
+ gmap = test_pt_regs_flag(regs, PIF_GUEST_FAULT) ?
(struct gmap *) S390_lowcore.gmap : NULL;
if (gmap) {
current->thread.gmap_addr = address;