From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4C49C561F8 for ; Wed, 21 Oct 2020 12:59:11 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24F4222249 for ; Wed, 21 Oct 2020 12:59:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2VWyanhL"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="y78jstFC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 24F4222249 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/pYV50+Y7FjOVcwLh5K9Z3OqRBIThRoHM9+kjcS5GkQ=; b=2VWyanhLuBfHXiiTDpyntxb/N oxqWHEc/mVYtv7aepx6OfqvQhMK0buYWN9z5aGnM1TIOwh1IN+SV2Jxt41nKOIN/n2V/uu7U/UU5A /txn1IC5r/4f9xl1wyUu3iHLg6zFQ62p0C7EGlb6wKJpLOgXAJyEKsRRkAzwLdLv4UVDpQqTZUda1 gO7WxeSL6gmpo6z1UnFHmdvny14HsAtFfy72krpnay5xDVl9pMCMMi9BS9a+6Zw/XNiF+A+5mE/uD 3uk7/1SwNABDeo3xYInCFQGggiM8AozVjFJ08+tjBEY9RbaSyEGLXZ+FtJYAvO3s1d0kgx7QUc6Wk qsnJlNaGQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVDgf-0001jV-99; Wed, 21 Oct 2020 12:57:53 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVDgc-0001im-Fy for linux-arm-kernel@lists.infradead.org; Wed, 21 Oct 2020 12:57:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2guoGSLtHOa0nTM7D1+lgjYVtsEuXac+T3GLacIF1mg=; b=y78jstFCx8mCbIM5K6v+eQ+mu AhGm2FxHNI+92IzJArQE5oZS+WltS4w9ASWH5GSlSdMtfuuxObcpTXgWNZ1Or89k/RHL9YvGv0qlN weODQgpXxgNWGzdaeU43FB0iVlCtBm8bZKLkycy6z5VXekcjqR0zRpOsfgL4y8CrEDn2u25mOBZGS kTaJMrIVOnUHTCAuBPPhIcwwrhDgiCyrGur1DKPSCpQUqib6544KM37/LQkQ8Nkog2PPruNfNZU9K kxVbl3nn8hCXN88zG27ISaAH6rG7tKRCKWhLvVbs30duo5SKv+Xd8NFWlK8yigyeDd80D/FLZretT 8e3o6JR4Q==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:49106) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVDgT-0000ZV-OY; Wed, 21 Oct 2020 13:57:41 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1kVDgS-0006P1-7u; Wed, 21 Oct 2020 13:57:40 +0100 Date: Wed, 21 Oct 2020 13:57:40 +0100 From: Russell King - ARM Linux admin To: Arnd Bergmann Subject: Re: [PATCH 2/3] arm: introduce IRQ stacks Message-ID: <20201021125740.GM1551@shell.armlinux.org.uk> References: <1602141333-17822-1-git-send-email-maninder1.s@samsung.com> <1602141333-17822-3-git-send-email-maninder1.s@samsung.com> <20201021124542.GL1551@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201021124542.GL1551@shell.armlinux.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201021_085750_537301_508AEDB9 X-CRM114-Status: GOOD ( 25.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: v.narang@samsung.com, a.sahrawat@samsung.com, Marc Zyngier , Sebastian Andrzej Siewior , Vincent Whitchurch , Nick Desaulniers , "linux-kernel@vger.kernel.org" , Nathan Huckleberry , Jian Cai , Thomas Gleixner , Dmitry Safonov <0x7f454c46@gmail.com>, Maninder Singh , Andrew Morton , Will Deacon , Valentin Schneider , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 21, 2020 at 01:45:42PM +0100, Russell King - ARM Linux admin wrote: > On Wed, Oct 21, 2020 at 02:42:48PM +0200, Arnd Bergmann wrote: > > (also resending this reply from @kernel.org) > > > > On Fri, Oct 16, 2020 at 12:19 PM Arnd Bergmann wrote: > > > On Thu, Oct 8, 2020 at 9:20 AM Maninder Singh wrote: > > > > > > > > This patch adds code for switching to IRQ stack. > > > > IRQ stack and Kernel SVC stack have below design. > > > > > > > > IRQ STACK:- > > > > ------------ IRQ stack top > > > > | | > > > > ------------ > > > > . . > > > > . . > > > > . . > > > > ------------ > > > > | sp | <- irq_stack_base + 0x8 > > > > ------------ > > > > | fp | <- irq_stack_base + 0x4 > > > > ------------ > > > > |tinfo_ptr | /* pointer to thread info */ > > > > irq_stack_ptr --> ------------ IRQ stack base > > > > > > > > Kernel SVC stack:- > > > > ------------ Kernel stack top > > > > | | > > > > ------------ > > > > . . > > > > . . > > > > . . > > > > ------------ > > > > | | > > > > | | > > > > ------------ > > > > |tinfo_ptr | /* pointer to thread info */ > > > > ------------ Kernel stack base > > > > > > The extra indirection doesn't look great, and I don't see any of the > > > other architectures need that. Since we can access percpu data > > > without going through thread_info, maybe doing the same as > > > x86 would work here: > > > > > > - define 'current' as 'this_cpu_read_stable(current_task);' > > > - convert to CONFIG_THREAD_INFO_IN_TASK > > That means we need to also code that up in assembly - remember, we > need to access thread_info from assembly code. Note also that there is a circular dependency involved. If you make thread_info accessible via per-cpu, then: #ifndef __my_cpu_offset #define __my_cpu_offset per_cpu_offset(raw_smp_processor_id()) #endif #ifdef CONFIG_DEBUG_PREEMPT #define my_cpu_offset per_cpu_offset(smp_processor_id()) #else #define my_cpu_offset __my_cpu_offset #endif smp_processor_id() ultimately ends up as raw_smp_processor_id() which is: #define raw_smp_processor_id() (current_thread_info()->cpu) and if current_thread_info() itself involves reading from per-cpu data, we end up recursing... infinitely. This is why I said in the other thread: "We don't do it because we don't have a separate register to be able to store the thread_info pointer, and copying that lump between the SVC and IRQ stack will add massively to IRQ latency, especially for older machines." -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel