From patchwork Mon Jul 20 07:20:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ingo Molnar X-Patchwork-Id: 6825261 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 095C2C05AC for ; Mon, 20 Jul 2015 07:23:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 215542062C for ; Mon, 20 Jul 2015 07:23:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 387A8205BE for ; Mon, 20 Jul 2015 07:23:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZH5Ny-0001CW-Jg; Mon, 20 Jul 2015 07:21:14 +0000 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZH5Nu-00014b-RN for linux-arm-kernel@lists.infradead.org; Mon, 20 Jul 2015 07:21:11 +0000 Received: by wibud3 with SMTP id ud3so88389435wib.0 for ; Mon, 20 Jul 2015 00:20:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=VfSbmkdKyfNilc5HE+O6DIY+ajZGptg2MRlLDyBnz2Y=; b=0aid/rVpPRTm+pnHAiQnSf8oUCvaO/cB6xBXU6CMxCexjMaBTqbPz+o27aXLi7TqK3 3D1q7kujeKg8dRPovIfEiUqKoWibXgsEylFHzXigU5rNtiB50fm+eW3kMZk2U/1DIWLF 6nYpONHwcpYYvYMizJrJBQquEXkqKmZRTzFHlsXuVTZAFJrl98wF7KI3k+GwztRQb6bv 94a05SX0LJcAvZwxopDkKFu9xLbq3uHLK8W8zU9v8nTNapT2Tpk3sYZOJnLrfxUeAOXa XHOPq2lOOrhR74td8gkzH5+7GzO3OVKbtKgt0/B8w647WupzEBRC9RoG9LoK2uQeweTg +j/g== X-Received: by 10.180.82.230 with SMTP id l6mr18149590wiy.61.1437376848850; Mon, 20 Jul 2015 00:20:48 -0700 (PDT) Received: from gmail.com (54033495.catv.pool.telekom.hu. [84.3.52.149]) by smtp.gmail.com with ESMTPSA id x6sm10374688wiy.6.2015.07.20.00.20.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jul 2015 00:20:46 -0700 (PDT) Date: Mon, 20 Jul 2015 09:20:44 +0200 From: Ingo Molnar To: Guenter Subject: [PATCH] sched, arm64: Fix the fallout of increasing the offset of 'thread_struct' within 'task_struct' Message-ID: <20150720072043.GA7696@gmail.com> References: <20150718232717.GA3235@groeck-UX31A> <20150718233455.GA3273@groeck-UX31A> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150718233455.GA3273@groeck-UX31A> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150720_002111_039667_59F61D66 X-CRM114-Status: GOOD ( 20.93 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390@vger.kernel.org, Stephen Rothwell , Catalin Marinas , Dave Hansen , linux-kernel@vger.kernel.org, Martin Schwidefsky , linux390@de.ibm.com, Linus Torvalds , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, FSL_HELO_FAKE,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP * Guenter wrote: > On Sat, Jul 18, 2015 at 04:27:17PM -0700, Guenter wrote: > > Hi, > > > > Commit 0c8c0f03e3a2 ("x86/fpu, sched: Dynamically allocate 'struct fpu'") > > causes s390 builds in mainline to fail as follows. > > > > arch/s390/kernel/traps.c: Assembler messages: > > arch/s390/kernel/traps.c:262: Error: operand out of range > > (0x00000000000023e8 is not between 0x0000000000000000 and 0x0000000000000fff) > > arch/s390/kernel/traps.c:300: Error: operand out of range > > (0x00000000000023e8 is not between 0x0000000000000000 and 0x0000000000000fff) > > > > Also: > > arm64:allmodconfig: > > arch/arm64/kernel/entry.S: Assembler messages: > arch/arm64/kernel/entry.S:588: Error: immediate out of range > arch/arm64/kernel/entry.S:597: Error: immediate out of range > make[1]: *** [arch/arm64/kernel/entry.o] Error 1 > > I didn't bisect that one, but it looks like the cause is the same. Hm, it looks like the new, increased offset of 'thread_struct' within 'task_struct' goes over a limit that these instructions are able to support on arm64: arch/arm64/kernel/asm-offsets.c: DEFINE(THREAD_CPU_CONTEXT, offsetof(struct task_struct, thread.cpu_context)); arch/arm64/kernel/entry.S: add x8, x0, #THREAD_CPU_CONTEXT arch/arm64/kernel/entry.S: add x8, x1, #THREAD_CPU_CONTEXT If there's no instruction that can support such offset sizes then I suspect the straightforward fix would be to pass in thread_struct instead - like the patch below. That's a tiny bit cleaner for type encapsulation anyway. Warning: it's not even build tested, but in case it works: Signed-off-by: Ingo Molnar Thanks, Ingo ================ arch/arm64/include/asm/processor.h | 4 ++-- arch/arm64/kernel/asm-offsets.c | 2 +- arch/arm64/kernel/process.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index e4c893e54f01..890f84bb3b8c 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -152,8 +152,8 @@ static inline void cpu_relax(void) #define cpu_relax_lowlatency() cpu_relax() /* Thread switching */ -extern struct task_struct *cpu_switch_to(struct task_struct *prev, - struct task_struct *next); +extern struct task_struct *cpu_switch_to(struct thread_struct *prev, + struct thread_struct *next); #define task_pt_regs(p) \ ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1) diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c index c99701a34d7b..3785373c2369 100644 --- a/arch/arm64/kernel/asm-offsets.c +++ b/arch/arm64/kernel/asm-offsets.c @@ -39,7 +39,7 @@ int main(void) DEFINE(TI_TASK, offsetof(struct thread_info, task)); DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); BLANK(); - DEFINE(THREAD_CPU_CONTEXT, offsetof(struct task_struct, thread.cpu_context)); + DEFINE(THREAD_CPU_CONTEXT, offsetof(struct thread_struct, cpu_context)); BLANK(); DEFINE(S_X0, offsetof(struct pt_regs, regs[0])); DEFINE(S_X1, offsetof(struct pt_regs, regs[1])); diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 223b093c9440..436e95bda1b2 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -325,7 +325,7 @@ struct task_struct *__switch_to(struct task_struct *prev, dsb(ish); /* the actual thread switch */ - last = cpu_switch_to(prev, next); + last = cpu_switch_to(&prev.thread, &next.thread); return last; }