Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3259877pxb; Mon, 9 Nov 2020 06:48:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJw38VwSSxpL5/zfNR3TUyEprcG/UG5/3sVnMGUcKQvb/1RKF8PxWX8VuDHh9AuJLaYjK70P X-Received: by 2002:a50:e181:: with SMTP id k1mr10887369edl.284.1604933301723; Mon, 09 Nov 2020 06:48:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604933301; cv=none; d=google.com; s=arc-20160816; b=pCwCG9unw6pjlDKCFq9XBMKUqpetL26Pj0nJHUobxmGzwEjD+yFCakz5/q51eRPIUC h4TclPyqzngwfGqc95xxdxpnMP+e9KSj6mAPoyzv5ipvMKTM14su4MlyVhVRciyjJzw3 lar3TTWPbtaBrngbGADk3t/UdLJ94NvtjcQioah1Q4zuKEMZldCwajbrCDS8ImIivSct w+wMVpg+xHdbBPM7E365tl9iFZE09fn1Ep3nx1j9ysYMbLmriXZRIkE2j1TDLVdTDPIv /tACqkrvhaBX2inJtnDu7ZB9jjUalfZ7QL6CwkoyP9UaP7ATQRdEXDv28YcLzrxUIOLg dtIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=mST6JO7Q+zl0zTn/3+jhbb9F17N/x8yRU+XaQiXqC+I=; b=PpccGTFVdy2bvoObs75CrH8a4HMZH0+hq2AWg/l68M6HJFaeCai1ei/fjWdWmB9tTD FnS0/2eUy5llCuGfBipF4LjQh3VUsoU2NnBxKnhvTP9obqTm4s9QxObui4aV7vUFyYFU cfFMnp/gSMpR3xev8NQp9CBDLbv8tC/sjP3SyumVHrqTDTRvVTQiSmfg/kSW8eO+BRFQ KG8N321G/1N1sikkPDuWIAo/zK2C8wGRQg7IL2A02IgIylaEuiKhMzHDY4aIgnrITm1U H4D3umikaVQ4bXley6Urbe39JGlb7hKCNEBDUifzwEELoOV80GCZ6GGx+FoeH2xP+RrA EX3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e13si6844495eja.305.2020.11.09.06.47.58; Mon, 09 Nov 2020 06:48:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731756AbgKIOqL (ORCPT + 99 others); Mon, 9 Nov 2020 09:46:11 -0500 Received: from muru.com ([72.249.23.125]:47530 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730649AbgKIOqL (ORCPT ); Mon, 9 Nov 2020 09:46:11 -0500 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 9223E80CD; Mon, 9 Nov 2020 14:46:13 +0000 (UTC) Date: Mon, 9 Nov 2020 16:45:49 +0200 From: Tony Lindgren To: Arnd Bergmann Cc: Russell King - ARM Linux admin , 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 Subject: Re: [PATCH 2/3] arm: introduce IRQ stacks Message-ID: <20201109144549.GA26857@atomide.com> 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> <20201021125740.GM1551@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Arnd Bergmann [201021 16:07]: > On Wed, Oct 21, 2020 at 2:57 PM Russell King - ARM Linux admin > wrote: > > On Wed, Oct 21, 2020 at 01:45:42PM +0100, Russell King - ARM Linux admin wrote: > > > > > - 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 > > Right, I had missed the fallback path using asm-generic/percpu.h > that is used with CONFIG_SMP && CONFIG_CPU_V6 > Almost everything either uses fixed percpu data (on UP builds) > or TPIDRPRW when building a v7-only or v6k/v7 kernel without > v6 support. > > > 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." > > As discussed on IRC, I think it can still be done in one of these > ways, though admittedly none of them are perfect: > > a) add runtime patching for __my_cpu_offset() when > CONFIG_SMP_ON_UP is set. This adds complexity but avoids the > fallback for for SMP&&CPU_V6. It possibly also speeds up > running on single-cpu systems if the TPIDRPRW access adds > any measurable runtime overhead compared to patching it out. Out of these options a) sounds best to me. > b) If irq stacks are left as a compile-time option, that could be > made conditional on "!(SMP&&CPU_V6)". Presumably very > few people still run kernels built that way any more. The only > supported platforms are i.MX3, OMAP2 and Realview-eb, all of > which are fairly uncommon these days and would usually > run v6-only non-SMP kernels. This has been working just fine for years though. In general, removing the conditional compile ifdefferey has made things quite a bit easier for us, so let's continue on that. > c) If we decide that we no longer care about that configuration > at all, we could decide to just make SMP depend on !CPU_V6, > and possibly kill off the entire SMP_ON_UP patching logic. > I suspect we still want to keep SMP_ON_UP for performance > reasons, but I don't know how significant they are to start with. And this too has been working just fine for years :) Regards, Tony