Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp123729lqb; Thu, 23 May 2024 12:43:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVtLkd+xPJFSF35cEFUDXg4S6bfoxIJTLH9mA5jlPvN8+0Xe/3GAmy4JS6fs7cnUL7ZkMMFJ0AIrIwsP+JUSmLWlHC22qJJFy/bcUvgqg== X-Google-Smtp-Source: AGHT+IHuPSJzI4IVduwM/MHblNoL1CPT06MDXhUetnJ/H7p9dJXdRAHSaKF7ivkPMeFHKatpLov7 X-Received: by 2002:a50:9541:0:b0:574:d009:cb3c with SMTP id 4fb4d7f45d1cf-57843f2c906mr2611946a12.18.1716493427410; Thu, 23 May 2024 12:43:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716493427; cv=pass; d=google.com; s=arc-20160816; b=iehacTBnsIGJhcaMXhoXD4KqmLQBk/uiUNPRFLuJKuqLt93RHYWisMc8bOeH7cpCg/ GFDFQ/pN5SWPI0gvJIYPUlX/KY7yhIkts0DTGV0XHL7SLsTmirDPStrYmlkhePj4l7w8 L9xcdKH9yct4UJB8GoW9ozi1gtinVHpVtG5vAVD/FU2PT1s4G3raJXceM7uwLJ/SVPPd Yg4/0JEOty9jNQk7H+Eue4FHHh11L59jIlzPoezSppnP/4Ihn1XDVqFHUFgg4ZBENUUX vH8gZhTH0v3esTPiBVfGbJE5SYDecOZ9J6q/C6T7bD676KPoLVvfG2B07adREa872Raf p5JQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:from:date; bh=dZxAV3CKU0bm92ylR+o5PYI9/FoEfLlfoOsqrKedEpU=; fh=5Z7fMLsn08jXTbO9EoWg7LU/UA07KOpesu5U3KcaNX4=; b=oUVnnMFA7GGKf3XkiVPifvVc2WHBCkRdHkB8VVZ5TT5GAi1IkOyXJ6iF9DPFyzJPMf oKD2S1TihGqJpQBLYUWdQNjkZbqQ7kEu51gTkb8D4aTaZrIxISoxAINmytbc7Wb2hjmE 64LIIKGDh/DzT1veE6ByRh7jGkpDBD3bJnRk/CLK40PTl8ujWlpv1wHq3QpIZaUB3wWS /Fcrr7DQm1SU1wuCOVP21ltK7qxmjP0Qvb9TdBr3lcTb2PjhJ2ugT8NnmwyVBoNmK9HC IugYpFge+4J07Rs5luq+XKtfsUFR7+1J26jWHe9fsSHEnHMMJSRKgm5ZWiUvUd1Kgsei qF5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-187937-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187937-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57852495c73si35092a12.449.2024.05.23.12.43.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 12:43:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187937-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-187937-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187937-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.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 0BB851F235F0 for ; Thu, 23 May 2024 19:43:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F4EB84A36; Thu, 23 May 2024 19:43:39 +0000 (UTC) Received: from gentwo.org (gentwo.org [62.72.0.81]) (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 C2BEF81AD0 for ; Thu, 23 May 2024 19:43:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.72.0.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716493419; cv=none; b=RDYkApDLvzHqh+Mec3QwOr+Dc3v1I83vuCmfbQ512914dpnUF3LWN1OQxm6jGplXxDpultXJe3ZOKcESTl3Qd55SkXB4GIE/WZ3xmVcueoBlUoQGqRx7E9Bsdd8r01I9xVTIA+y5DlltCj9iJPx8w93ahojONLsP3sy5zqoz47M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716493419; c=relaxed/simple; bh=hwJnow95Alh/ZOXDYGhP/XTkujibrRJUnoj+M7pyhcM=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=osBGG5kFk+ViOhXiE/IToN8C3pQzbzAkmPBl8Ll5pVA6V/psMo2t3Pdx6DcFqcy+qOXeYmXmPL5FpHLCHduHmZ2RC7aGpPvpC6Wcqmq42eiRWmbPr3iucsQ7r0Ek+YcmPcPYnxjQMDSHP59AyK4/OyuYQ3URbZ6Y5+zFgr5QS9Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.com; spf=fail smtp.mailfrom=linux.com; arc=none smtp.client-ip=62.72.0.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=linux.com Received: by gentwo.org (Postfix, from userid 1003) id D80A440251; Thu, 23 May 2024 12:43:34 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id D4F91401F3; Thu, 23 May 2024 12:43:34 -0700 (PDT) Date: Thu, 23 May 2024 12:43:34 -0700 (PDT) From: "Christoph Lameter (Ampere)" To: Catalin Marinas 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 In-Reply-To: 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; format=flowed 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. 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??? It is more likely that new atomic ops are added that require write permissions. Those will then just work. Otherwise we would need to maintain an exception table of unallocated instructions that would then have to shrink depending on new atomics added. The ultimate solution would be to change the spec so that arm processors can skip useless read faults.