Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp175005lqb; Thu, 23 May 2024 14:34:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX553zrTyol+ijEB90InqcAY5gyVl9sXYhlRZegsEv4FRgEAMWCUV/p3vDP6HNj3jMaJuQDU74qtqHOVy/sewvcXWX36izSFVRS2VbpVw== X-Google-Smtp-Source: AGHT+IER+x2Pna+dg0YnNjs3aRMpqddeKsj78GDw3CVywx8Dom9f39OPnEg1RSvLgX0Ch/3fXEm6 X-Received: by 2002:a17:906:df02:b0:a59:b4e8:d925 with SMTP id a640c23a62f3a-a62645d76f0mr26938466b.34.1716500087093; Thu, 23 May 2024 14:34:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716500087; cv=pass; d=google.com; s=arc-20160816; b=HfB7wbjkpttzBlDZ/QS3rIbT1Zi3RlMckWkQTIVRyp4Lmf1AaVsXjX51wKEJZMnVG6 s4HW1w4lXoWI6LGzuI63br2fsqFdfIAcvfAWbCD3d2omZX5gMvQV7tIRNxC9QQVu6hZI mHnOQwd/2umfpp+mIh5WORM9xRW9pb4pl6IAV7WqCQ8ikwyzy1nQHBcf/OKr5/HDmv57 01bDHf440XIq1SaiCjrc93jZXuAOeCNl7zGfhQMgBFNQ4zqu13nA9SYJZFrVuR3prppx 85WlIG9i6o2fE0UKVamDSYb5XPSWn8SCT9uy+uhI0w5ktMMNTB2049pcPUZK0GqCqzG1 MTcQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=th7OZDr5IN4nKqWaRq+81X6t4k8Q4Lkw9G2HPMhnmps=; fh=jvWE2d5nYeXzNQepbKcOl2J/uueorsUOKTuELtRn5B4=; b=jMCisJty5Rtv9yCxQEXa0l5h56DOQ8HbO+hZoIXD+C0MVkcBE3KI6dcd6Ahu6KI+sT 2JmDfu1F5M66ZfUdsrL+8+0wX+tBqMuZ2Au+C9q6xhC++V1dr0zA8byK3JdTPR8e3Zb2 6KJ5RVNSpXZor29DxS+enVY6nvFlbnIgHRCi3CWKKomdcWDTjbyvH/If6duy/xrJKzSJ ffnph9O1AE0bG7FdaKmxY86clsFAfvUj7YDsASDTH1ERY1dFL9AJo83oSLuOUkiW4CFt cnRTldKMCl8wEs11ZYWOvCzgEVZ9BBEEaOtKjqPIYEJJsIuD2KH/ILJgqGGiCJOJASBV 4yDA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-188042-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188042-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a626c8016b1si8843466b.96.2024.05.23.14.34.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 14:34:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188042-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-188042-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188042-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AA5D71F24E21 for ; Thu, 23 May 2024 21:34:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 179FB127E04; Thu, 23 May 2024 21:34:40 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90488811FF for ; Thu, 23 May 2024 21:34:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716500079; cv=none; b=Whb0oHWL8Gyiz7hEV8uVZUnjgR0+nuLPNT9NCeGwJJXZgbPTwRuws3TJO9JlnxShWmXAMYGebhS37Tlq2Cy7PVMi9x/Gi1v0tfQ+B9VqSsw0BsQ0xzsY4kBDp7d7154CsxmQPAET/MytZJtURD7tf6dB3eh8yTWdx0Oi+JdLlpc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716500079; c=relaxed/simple; bh=K7OioervpsduQtFyeU96++HOAKnvbyCclRoqOWrO4Kc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aup2+1Gdl76x2ovRGv959hQGWJSUVoOw+m5Lp05vPKIs0ggKs3+wsoLTIQxQMZXlzVP0QiNLvLttU1I43uvzZOpado6toNGO3AJAvAPu3Y1G4SGSCMB/zLtTIUDwF4KK+7GGG2Bjl4UvOOZI6vTI4TnybA8bW0/keKFP3jo73hg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1C89C2BD10; Thu, 23 May 2024 21:34:37 +0000 (UTC) Date: Thu, 23 May 2024 22:34:35 +0100 From: Catalin Marinas To: "Christoph Lameter (Ampere)" Cc: Yang Shi , will@kernel.org, anshuman.khandual@arm.com, scott@os.amperecomputing.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [v2 PATCH] arm64: mm: force write fault for atomic RMW instructions Message-ID: References: <20240520165636.802268-1-yang@os.amperecomputing.com> <640f8606-2757-4e82-721f-9625d48ded65@gentwo.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, May 23, 2024 at 12:43:34PM -0700, Christoph Lameter (Ampere) wrote: > On Thu, 23 May 2024, Catalin Marinas wrote: > > > > While this class includes all atomics that currently require write > > > > permission, there's some unallocated space in this range and we don't > > > > know what future architecture versions may introduce. Unfortunately we > > > > need to check each individual atomic op in this class (not sure what the > > > > overhead will be). > > > > > > Can you tell us which bits or pattern is not allocated? Maybe we can exclude > > > that from the pattern. > > > > Yes, it may be easier to exclude those patterns. See the Arm ARM K.a > > section C4.1.94.29 (page 791). > > Hmmm. We could consult an exception table once the pattern matches to reduce > the overhead. Yeah, check the atomic class first and then go into the finer-grained details. I think this would reduce the overhead for non-atomic instructions. > However, the harm done I think is acceptable even if we leave things as is. > In the worst case we create unnecesssary write fault processing for an > "atomic op" that does not need write access. Also: Why would it need to be > atomic if it does not write??? I'm thinking of some conditional instruction that states no write if condition fails. But it could be even worse if the architects decide to reuse that unallocated space for some instructions that have nothing to do with the atomic accesses. It's something we need to clarify with them but I'm about to go on holiday for a week, so I won't be able to check. > The ultimate solution would be to change the spec so that arm processors can > skip useless read faults. I raised this already, waiting for feedback from the architects. -- Catalin