summaryrefslogtreecommitdiff
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2015-06-22 17:14:14 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2015-07-22 09:58:03 +0200
commitdcd2a9aaa0e0331ba0c4d7a64830788f22f26aa4 (patch)
tree49711292e4ef4cd27bc12f326c12f7194c1b293e /arch/s390/kernel
parentd05377c12ae2ac88e747a28ae1e23f556d549592 (diff)
s390/kvm: fix interrupt race with HANDLE_SIE_INTERCEPT
The HANDLE_SIE_INTERCEPT macro is used in the interrupt handlers and the program check handler to undo a few changes done by sie64a. Among them are guest vs host LPP, the gmap ASCE vs kernel ASCE and the bit that indicates that SIE is currently running on the CPU. There is a race of a voluntary SIE exit vs asynchronous interrupts. If the CPU completed the SIE instruction and the TM instruction of the LPP macro at the time it receives an interrupt, the interrupt handler will run while the LPP, the ASCE and the SIE bit are still set up for guest execution. This might result in wrong sampling data, but it will not cause data corruption or lockups. The critical section in sie64a needs to be enlarged to include all instructions that undo the changes required for guest execution. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/entry.S14
1 files changed, 4 insertions, 10 deletions
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 05ea485156ee..391db6412b85 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -90,14 +90,7 @@ _PIF_WORK = (_PIF_PER_TRAP)
lgr \scratch,%r9
slg \scratch,BASED(.Lsie_critical)
clg \scratch,BASED(.Lsie_critical_length)
- .if \reason==1
- # Some program interrupts are suppressing (e.g. protection).
- # We must also check the instruction after SIE in that case.
- # do_protection_exception will rewind to .Lrewind_pad
- jh .+42
- .else
jhe .+42
- .endif
lg %r14,__SF_EMPTY(%r15) # get control block pointer
LPP __SF_EMPTY+16(%r15) # set host id
ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE
@@ -1308,15 +1301,16 @@ ENTRY(sie64a)
lg %r14,__SF_EMPTY(%r15) # get control block pointer
oi __SIE_PROG0C+3(%r14),1 # we are going into SIE now
tm __SIE_PROG20+3(%r14),3 # last exit...
- jnz .Lsie_done
+ jnz .Lsie_skip
tm __LC_CPU_FLAGS+7,_CIF_FPU
- jo .Lsie_done # exit if fp/vx regs changed
+ jo .Lsie_skip # exit if fp/vx regs changed
LPP __SF_EMPTY(%r15) # set guest id
sie 0(%r14)
-.Lsie_done:
LPP __SF_EMPTY+16(%r15) # set host id
+.Lsie_skip:
ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE
lctlg %c1,%c1,__LC_USER_ASCE # load primary asce
+.Lsie_done:
# some program checks are suppressing. C code (e.g. do_protection_exception)
# will rewind the PSW by the ILC, which is 4 bytes in case of SIE. Other
# instructions between sie64a and .Lsie_done should not cause program