Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755966AbbGTIex (ORCPT ); Mon, 20 Jul 2015 04:34:53 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:34951 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755522AbbGTIew (ORCPT ); Mon, 20 Jul 2015 04:34:52 -0400 Date: Mon, 20 Jul 2015 10:34:47 +0200 From: Ingo Molnar To: Heiko Carstens Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Thomas Gleixner , "H. Peter Anvin" , Andy Lutomirski , Dave Hansen , Andrew Morton , Oleg Nesterov , Martin Schwidefsky , Peter Zijlstra Subject: Re: [PATCH] s390, sched: Fix thread_struct move fallout to __switch_to() Message-ID: <20150720083447.GA15398@gmail.com> References: <20150718031810.GA19818@gmail.com> <20150720072037.GA3607@osiris> <20150720082004.GB12468@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150720082004.GB12468@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3736 Lines: 84 * Ingo Molnar wrote: > I also looked at fixing pgm_check_handler(), but my s390-fu gave up completely > on that one: task_struct is in 'r14', but this is a hardware entry function it > appears. So to fix it we'd have to pick a temporary register, put thread_struct > pointer into it, and fix up these offsets: > > arch/s390/kernel/asm-offsets.c: DEFINE(__THREAD_per_address, offsetof(struct task_struct, thread.per_event.address)); > arch/s390/kernel/asm-offsets.c: DEFINE(__THREAD_per_paid, offsetof(struct task_struct, thread.per_event.paid)); > arch/s390/kernel/asm-offsets.c: DEFINE(__THREAD_trap_tdb, offsetof(struct task_struct, thread.trap_tdb)); > > to be thread_struct relative. Here's a stab at that: we can move 'r14' from 'current' to 'current->thread' and back relatively cheaply I think. If I got the mnemonics right. Thanks, Ingo ===============================> arch/s390/kernel/asm-offsets.c | 9 +++++---- arch/s390/kernel/entry.S | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c index 2b422297660f..26edbc4b5078 100644 --- a/arch/s390/kernel/asm-offsets.c +++ b/arch/s390/kernel/asm-offsets.c @@ -24,13 +24,14 @@ int main(void) { DEFINE(__TASK_thread_info, offsetof(struct task_struct, stack)); + DEFINE(__TASK_thread_struct, offsetof(struct task_struct, thread)); DEFINE(__THREAD_ksp, offsetof(struct thread_struct, ksp)); BLANK(); DEFINE(__TASK_pid, offsetof(struct task_struct, pid)); BLANK(); - DEFINE(__THREAD_per_cause, offsetof(struct task_struct, thread.per_event.cause)); - DEFINE(__THREAD_per_address, offsetof(struct task_struct, thread.per_event.address)); - DEFINE(__THREAD_per_paid, offsetof(struct task_struct, thread.per_event.paid)); + DEFINE(__THREAD_per_cause, offsetof(struct thread_struct, per_event.cause)); + DEFINE(__THREAD_per_address, offsetof(struct thread_struct, per_event.address)); + DEFINE(__THREAD_per_paid, offsetof(struct thread_struct, per_event.paid)); BLANK(); DEFINE(__TI_task, offsetof(struct thread_info, task)); DEFINE(__TI_flags, offsetof(struct thread_info, flags)); @@ -175,7 +176,7 @@ int main(void) DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data)); DEFINE(__LC_GMAP, offsetof(struct _lowcore, gmap)); DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb)); - DEFINE(__THREAD_trap_tdb, offsetof(struct task_struct, thread.trap_tdb)); + DEFINE(__THREAD_trap_tdb, offsetof(struct thread_struct, trap_tdb)); DEFINE(__GMAP_ASCE, offsetof(struct gmap, asce)); DEFINE(__SIE_PROG0C, offsetof(struct kvm_s390_sie_block, prog0c)); DEFINE(__SIE_PROG20, offsetof(struct kvm_s390_sie_block, prog20)); diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index c2fcb9e7ad25..9806b2f94985 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S @@ -421,6 +421,7 @@ ENTRY(pgm_check_handler) LAST_BREAK %r14 lg %r15,__LC_KERNEL_STACK lg %r14,__TI_task(%r12) + ahi %r14,__TASK_thread_struct # r14 now points to 'current->thread' lghi %r13,__LC_PGM_TDB tm __LC_PGM_ILC+2,0x02 # check for transaction abort jz 2f @@ -448,6 +449,7 @@ ENTRY(pgm_check_handler) nill %r10,0x007f sll %r10,2 je .Lsysc_return + ahi %r14,-__TASK_thread_struct # r14 now points to 'current' lgf %r1,0(%r10,%r1) # load address of handler routine lgr %r2,%r11 # pass pointer to pt_regs basr %r14,%r1 # branch to interrupt-handler -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/