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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 40022EB64DD for ; Thu, 13 Jul 2023 11:21:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=b+un2OwZRwJkBAx6k6tSlYmm53L5EFJoa8f2y3WmX4g=; b=HuYB/ol9l/ykdk j93jN6tDTGh8QkVNBGJHEUOxg+rliunXNzbqTfJ9J72G+pcCOfibi4HWYxL2P0L+XuP5icS6+nOHS k1B7IU196rGaq0vU6bviAlqJLL16foJIdX237TC5BHKau/f5dye8kZpr4sQOKamfIbFQ/2M7vbDLx Atxr5V9m+AecgINIweVRYtsGLL7Xk2u2QyOEa+EmNavZMNwdBgPObhHxOMInss4gsYbpdBG8wO9EV /BpxHSI5pU5AFfzuw3AkYVDCgnawq+hhNNsf6ONzcGIP0YnC+y9zUj3zVMxGUQrHZH8d1jdjFC1Eq FgOY5pzjsVbFiQP5loTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qJuNB-00349y-0t; Thu, 13 Jul 2023 11:20:37 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qJuN7-00348b-1p for linux-arm-kernel@lists.infradead.org; Thu, 13 Jul 2023 11:20:35 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F3E1A1570; Thu, 13 Jul 2023 04:21:10 -0700 (PDT) Received: from FVFF77S0Q05N.cambridge.arm.com (unknown [10.37.36.116]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 954BC3F740; Thu, 13 Jul 2023 04:20:26 -0700 (PDT) Date: Thu, 13 Jul 2023 12:20:19 +0100 From: Mark Rutland To: "Aiqun(Maria) Yu" Cc: Will Deacon , corbet@lwn.net, catalin.marinas@arm.com, maz@kernel.org, quic_pkondeti@quicinc.com, quic_kaushalk@quicinc.com, quic_satyap@quicinc.com, quic_shashim@quicinc.com, quic_songxue@quicinc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] arm64: Add the arm64.nolse_atomics command line option Message-ID: References: <20230710055955.36551-1-quic_aiquny@quicinc.com> <20230710093751.GC32673@willie-the-truck> <5cf15f85-0397-96f7-4110-13494551b53b@quicinc.com> <20230711082226.GA1554@willie-the-truck> <84f0994a-26de-c20a-a32f-ec8fe41df3a3@quicinc.com> <20230711102510.GA1809@willie-the-truck> <67c2621f-4cad-2495-9785-7737246d3e90@quicinc.com> <604ac52d-4336-744f-2ab8-44d1c93fbaa8@quicinc.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <604ac52d-4336-744f-2ab8-44d1c93fbaa8@quicinc.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230713_042033_718564_FAFD5AAB X-CRM114-Status: GOOD ( 43.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Thu, Jul 13, 2023 at 10:24:24AM +0800, Aiqun(Maria) Yu wrote: > On 7/12/2023 3:36 PM, Mark Rutland wrote: > > On Wed, Jul 12, 2023 at 11:09:10AM +0800, Aiqun(Maria) Yu wrote: > > > On 7/11/2023 6:25 PM, Will Deacon wrote: > > > > On Tue, Jul 11, 2023 at 06:15:49PM +0800, Aiqun(Maria) Yu wrote: > > > > > On 7/11/2023 4:22 PM, Will Deacon wrote: > > > > > > On Tue, Jul 11, 2023 at 12:02:22PM +0800, Aiqun(Maria) Yu wrote: > > > > > > > On 7/10/2023 5:37 PM, Will Deacon wrote: > > > > > > > > On Mon, Jul 10, 2023 at 01:59:55PM +0800, Maria Yu wrote: > > > > > > > > > In order to be able to disable lse_atomic even if cpu > > > > > > > > > support it, most likely because of memory controller > > > > > > > > > cannot deal with the lse atomic instructions, use a > > > > > > > > > new idreg override to deal with it. > > > > > > > > > > > > > > > > This should not be a problem for cacheable memory though, right? > > > > > > > > > > > > > > > > Given that Linux does not issue atomic operations to non-cacheable mappings, > > > > > > > > I'm struggling to see why there's a problem here. > > > > > > > > > > > > > > The lse atomic operation can be issued on non-cacheable mappings as well. > > > > > > > Even if it is cached data, with different CPUECTLR_EL1 setting, it can also > > > > > > > do far lse atomic operations. > > > > > > > > > > > > Please can you point me to the place in the kernel sources where this > > > > > > happens? The architecture doesn't guarantee that atomics to non-cacheable > > > > > > mappings will work, see "B2.2.6 Possible implementation restrictions on > > > > > > using atomic instructions". Linux, therefore, doesn't issue atomics > > > > > > to non-cacheable memory. > > > > > > > > > > We encounter the issue on third party kernel modules and third party apps > > > > > instead of linux kernel itself. > > > > > > > > Great, so there's nothing to do in the kernel then! > > > > > > > > The third party code needs to be modified not to use atomic instructions > > > > with non-cacheable mappings. No need to involve us with that. > > > > > > > > This is a tradeoff of performance and stability. Per my understanding, > > > > > options can be used to enable the lse_atomic to have the most performance > > > > > cared system, and disable the lse_atomic by stability cared most system. > > > > > > > > Where do livelock and starvation fit in with "stability"? Disabling LSE > > > > atomics for things like qspinlock and the scheduler just because of some > > > > badly written third-party code isn't much of a tradeoff. > > > > > We also have requirement to have cpus/system fully support lse atomic and > > > cpus/system not fully support lse atomic with a generic kernel image. > > > > Who *specifically* has this requirement (i.e. what does 'we' mean here)? The > > I can use other word to describe the requirement instead of "we". > > There is requirements like android google gki. It request different cpu arch > system to use same generic kernel Image. GKI requires the system to use the generic kernel image; GKI does not require supporting atomics to non-cacheable mappings. What I am asking is: who has the requirement to perform atomics to non-cacheable mappings? > > upstream kernel does not require that atomics work on non-cacheable memory, and > > The same issue the system can be down of lse atomic not supported for > cachable memory when there need far atomic. Are you saying that LSE atomics to *cacheable* mappings do not work on your system? Specifically, when using a Normal Inner-Shareable Inner-Writeback Outer-Writeback mapping, do the LSE atomics work or not work? > > saying "The company I work for want this" doesn't change that. > > > > AFAICT the system here is architecturally compliant, and what you're relying > > upon something that the architecture doesn't guarantee, and Linux doesn't > > guarantee. > > It is not also only our company's problem: > To support the atomic instructions added in the Armv8.1 architecture, CHI-B > provides Atomic Transactions. while Atomic Transactions support is also > *optional* from CHI-B. > > So far atomic cannot fully supported by ARMv8.1 cpu + CHI-B system as well. > > from: > https://developer.arm.com/documentation/102407/0100/Atomic-operations?lang=en > > So only cpu support atomic cannot garantee the system support lse atomic > > > > > Same kernel module wanted to be used by lse atomic fully support cpu and not > > > fully support cpu/system as well. > > > > Which kernel modules *specifically* need to do atomics to non-cacheable memory? > The driver want to always do far atomic(no speculatively) and allow a > read-modify-write non-interruptible sequence in a single instruction. That doesn't answer my question (you haven't told me what "the driver" is). That doesn't explain why you need to use non-cachable memory for this. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel