Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6537471ybl; Mon, 23 Dec 2019 07:28:36 -0800 (PST) X-Google-Smtp-Source: APXvYqzw8khMJkqmwvdd5XgGMV7CIlWgzmDsJX44QWEzmRnnJBJSWMRh3G0tt4HzlCOVdGIHlIUF X-Received: by 2002:a9d:6b03:: with SMTP id g3mr33070824otp.200.1577114916505; Mon, 23 Dec 2019 07:28:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577114916; cv=none; d=google.com; s=arc-20160816; b=huuWiK5wPP+2bISmEg4DZi5dSBw6QezAMcETU48ghdkIE3hmqRaTGi7haiaXVw8U/D +3nZPIzsHahWr1yxC0Q43D2pRV/zERBj/3CHgajvPbqXCrv7fa+cQxqrDC6T32ZOwP6p EEvZGnSsS4tJr7WUiPhQQjV2UsAb1/703A+BInLwuhmRk7vJl+HoO2MhpT4RQvp5SKfH HcdV5qAGMPGtsPFT0daV9pU9l2D7dKXYAoQfAEcFf+Rg0/mjI0NW1BVG1SfEvbbcm9Fp ht9DAax4D7cw0Wa5ld+aLEnzN+E3ygxyPFBIe1Msr+1Kj2HFY96uR5ONINWovw5+wot/ iJfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=Vs9zjyHpxKTdwXBLQb1H8vLAKdY1DAGFCl+K3eW5KCc=; b=NOvIGCTU9Qy+VCIs0HlQXhCiJmeXoBg5aeHauIPJFD4MQVyJ+OpBoBTt0FeNS0d4fE 8Udo1dJkkViXXRXvppJIOYr+D5GVK68ClC1AMADtMGqdr4FlmcidibzpCv7vYAPGFVN0 XBsMOvhVXDdi9d9djEwhZ15fhkQu0hf3cOMBCp2noLCIUUl9Wm76lRXXFJLhur1dFzqV e4hsv0t27f9skamoLstp46RWqE5no25xjXRJp1TiOX/Ov8SEy8kt+y3SeCydgIMc8Swq /n9jHkw7IJruwSW2Giz7vlr/Z9+wUds4gsqQ7X8rtD4rE/Qsy2xpd/oeAceGhxri50k8 6Uxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=jMZ3BDZQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r25si4713156otp.280.2019.12.23.07.28.24; Mon, 23 Dec 2019 07:28:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=jMZ3BDZQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726981AbfLWP0R (ORCPT + 99 others); Mon, 23 Dec 2019 10:26:17 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:9145 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726903AbfLWP0Q (ORCPT ); Mon, 23 Dec 2019 10:26:16 -0500 Received: from localhost (mailhub1-ext [192.168.12.233]) by localhost (Postfix) with ESMTP id 47hNV86wSzz9vJys; Mon, 23 Dec 2019 16:26:08 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=jMZ3BDZQ; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id DzIVaFvOzGtT; Mon, 23 Dec 2019 16:26:08 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 47hNV85lqhz9vJyn; Mon, 23 Dec 2019 16:26:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1577114768; bh=Vs9zjyHpxKTdwXBLQb1H8vLAKdY1DAGFCl+K3eW5KCc=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=jMZ3BDZQ2POyf/DzvY1rkIh0tDIyl+lODJ+vYuM9UFIxWlz9sXrvI7kkoar7Xsbso eKw4xhkcT/r/NC6008pgZPU8D7RvS2Y1ozuEBx62DC6AHOCl6ycSJigNuJg3BtiqY0 aU1XSElvyLz+1rkqPgR0J44v1i3hrM0S2nTbDJ48= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id F101C8B7AB; Mon, 23 Dec 2019 16:26:13 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id wVCD1s8Om32N; Mon, 23 Dec 2019 16:26:13 +0100 (CET) Received: from po16098vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.100]) by messagerie.si.c-s.fr (Postfix) with ESMTP id CE0318B7A1; Mon, 23 Dec 2019 16:26:13 +0100 (CET) Received: by po16098vm.idsi0.si.c-s.fr (Postfix, from userid 0) id D7252637D8; Mon, 23 Dec 2019 15:26:13 +0000 (UTC) Message-Id: <9bd99cf0e97fd62e63c4a14247dee060c8f743e1.1577114567.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [RFC PATCH 3/8] powerpc/irq: don't use current_stack_pointer() in do_IRQ() To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 23 Dec 2019 15:26:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Before commit 7306e83ccf5c ("powerpc: Don't use CURRENT_THREAD_INFO to find the stack"), the current stack base address was obtained by calling current_thread_info(). That inline function was simply masking out the value of r1. In that commit, it was changed to using current_stack_pointer(), which is an heavier function as it is an outline assembly function which cannot be inlined and which reads the content of the stack at 0(r1) Create stack_pointer() function which returns the value of r1 and use it instead. Signed-off-by: Christophe Leroy Fixes: 7306e83ccf5c ("powerpc: Don't use CURRENT_THREAD_INFO to find the stack") --- arch/powerpc/include/asm/reg.h | 8 ++++++++ arch/powerpc/kernel/irq.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index 1aa46dff0957..bc14fca9b13b 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h @@ -1466,6 +1466,14 @@ static inline void update_power8_hid0(unsigned long hid0) */ asm volatile("sync; mtspr %0,%1; isync":: "i"(SPRN_HID0), "r"(hid0)); } + +static __always_inline unsigned long stack_pointer(void) +{ + register unsigned long r1 asm("r1"); + + return r1; +} + #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_REG_H */ diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 4690e5270806..410accba865d 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -680,7 +680,7 @@ void do_IRQ(struct pt_regs *regs) void *cursp, *irqsp, *sirqsp; /* Switch to the irq stack to handle this */ - cursp = (void *)(current_stack_pointer() & ~(THREAD_SIZE - 1)); + cursp = (void *)(stack_pointer() & ~(THREAD_SIZE - 1)); irqsp = hardirq_ctx[raw_smp_processor_id()]; sirqsp = softirq_ctx[raw_smp_processor_id()]; -- 2.13.3