Skip to content

Commit 9d634c4

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 fix from Martin Schwidefsky: "Fast path fix for the thread_struct breakage" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390: adapt entry.S to the move of thread_struct
2 parents d7f430d + 3827ec3 commit 9d634c4

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

arch/s390/kernel/asm-offsets.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323

2424
int main(void)
2525
{
26-
DEFINE(__THREAD_info, offsetof(struct task_struct, stack));
27-
DEFINE(__THREAD_ksp, offsetof(struct task_struct, thread.ksp));
28-
DEFINE(__THREAD_mm_segment, offsetof(struct task_struct, thread.mm_segment));
29-
BLANK();
26+
DEFINE(__TASK_thread_info, offsetof(struct task_struct, stack));
27+
DEFINE(__TASK_thread, offsetof(struct task_struct, thread));
3028
DEFINE(__TASK_pid, offsetof(struct task_struct, pid));
3129
BLANK();
32-
DEFINE(__THREAD_per_cause, offsetof(struct task_struct, thread.per_event.cause));
33-
DEFINE(__THREAD_per_address, offsetof(struct task_struct, thread.per_event.address));
34-
DEFINE(__THREAD_per_paid, offsetof(struct task_struct, thread.per_event.paid));
30+
DEFINE(__THREAD_ksp, offsetof(struct thread_struct, ksp));
31+
DEFINE(__THREAD_per_cause, offsetof(struct thread_struct, per_event.cause));
32+
DEFINE(__THREAD_per_address, offsetof(struct thread_struct, per_event.address));
33+
DEFINE(__THREAD_per_paid, offsetof(struct thread_struct, per_event.paid));
34+
DEFINE(__THREAD_trap_tdb, offsetof(struct thread_struct, trap_tdb));
3535
BLANK();
3636
DEFINE(__TI_task, offsetof(struct thread_info, task));
3737
DEFINE(__TI_flags, offsetof(struct thread_info, flags));
@@ -176,7 +176,6 @@ int main(void)
176176
DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data));
177177
DEFINE(__LC_GMAP, offsetof(struct _lowcore, gmap));
178178
DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb));
179-
DEFINE(__THREAD_trap_tdb, offsetof(struct task_struct, thread.trap_tdb));
180179
DEFINE(__GMAP_ASCE, offsetof(struct gmap, asce));
181180
DEFINE(__SIE_PROG0C, offsetof(struct kvm_s390_sie_block, prog0c));
182181
DEFINE(__SIE_PROG20, offsetof(struct kvm_s390_sie_block, prog20));

arch/s390/kernel/entry.S

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,17 +178,21 @@ _PIF_WORK = (_PIF_PER_TRAP)
178178
*/
179179
ENTRY(__switch_to)
180180
stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task
181-
stg %r15,__THREAD_ksp(%r2) # store kernel stack of prev
182-
lg %r4,__THREAD_info(%r2) # get thread_info of prev
183-
lg %r5,__THREAD_info(%r3) # get thread_info of next
181+
lgr %r1,%r2
182+
aghi %r1,__TASK_thread # thread_struct of prev task
183+
lg %r4,__TASK_thread_info(%r2) # get thread_info of prev
184+
lg %r5,__TASK_thread_info(%r3) # get thread_info of next
185+
stg %r15,__THREAD_ksp(%r1) # store kernel stack of prev
186+
lgr %r1,%r3
187+
aghi %r1,__TASK_thread # thread_struct of next task
184188
lgr %r15,%r5
185189
aghi %r15,STACK_INIT # end of kernel stack of next
186190
stg %r3,__LC_CURRENT # store task struct of next
187191
stg %r5,__LC_THREAD_INFO # store thread info of next
188192
stg %r15,__LC_KERNEL_STACK # store end of kernel stack
193+
lg %r15,__THREAD_ksp(%r1) # load kernel stack of next
189194
lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4
190195
mvc __LC_CURRENT_PID+4(4,%r0),__TASK_pid(%r3) # store pid of next
191-
lg %r15,__THREAD_ksp(%r3) # load kernel stack of next
192196
lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
193197
br %r14
194198

@@ -417,6 +421,7 @@ ENTRY(pgm_check_handler)
417421
LAST_BREAK %r14
418422
lg %r15,__LC_KERNEL_STACK
419423
lg %r14,__TI_task(%r12)
424+
aghi %r14,__TASK_thread # pointer to thread_struct
420425
lghi %r13,__LC_PGM_TDB
421426
tm __LC_PGM_ILC+2,0x02 # check for transaction abort
422427
jz 2f

arch/s390/kernel/traps.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ void vector_exception(struct pt_regs *regs)
259259
}
260260

261261
/* get vector interrupt code from fpc */
262-
asm volatile("stfpc %0" : "=m" (current->thread.fp_regs.fpc));
262+
asm volatile("stfpc %0" : "=Q" (current->thread.fp_regs.fpc));
263263
vic = (current->thread.fp_regs.fpc & 0xf00) >> 8;
264264
switch (vic) {
265265
case 1: /* invalid vector operation */
@@ -297,7 +297,7 @@ void data_exception(struct pt_regs *regs)
297297

298298
location = get_trap_ip(regs);
299299

300-
asm volatile("stfpc %0" : "=m" (current->thread.fp_regs.fpc));
300+
asm volatile("stfpc %0" : "=Q" (current->thread.fp_regs.fpc));
301301
/* Check for vector register enablement */
302302
if (MACHINE_HAS_VX && !current->thread.vxrs &&
303303
(current->thread.fp_regs.fpc & FPC_DXC_MASK) == 0xfe00) {

0 commit comments

Comments
 (0)