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 ACC1EC2BD09 for ; Tue, 9 Jul 2024 18:35:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id: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-Owner; bh=zbeJ+A3ZU9dt4npRA6eS1skvygCDevsy07BW1cuo6K4=; b=TtxH6Ehc7Qzirp+Wp7HPwivBeh Y6VRp3z9MGNEqAS4s+OG/QEb9UdTR6G9BHM5pZikPkUlg+Uevq3jNXNQ1lS5Dm1ngJ1yaqkBwL2aT Uzr4Qe+cKtYx7PNZuteAUwYgHEU6yb2L3Yhcz7H4nLiVbsYusu8Ah0TwG2OXvpOKbae5nGDnjjV03 AXEUG3ynXMGI9IM/7yiuhni4MykOev0xLAyY2W/aGQ4Rm1ASEuWFS3XV/CvYiGGdUrwVX0yWY6fqL kHWvjkzP5OyGa2ebd78eIwO0JH29im2V+d762/kzF+xh+Fc8ALJLcAN8AaMZqOSF+NRk19TgWlC0a 9pyC2k8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRFgc-00000008J5W-1G1O; Tue, 09 Jul 2024 18:35:34 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRFgM-00000008J2A-0Fdq for linux-arm-kernel@lists.infradead.org; Tue, 09 Jul 2024 18:35:19 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6F47F614B2; Tue, 9 Jul 2024 18:35:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82F4DC3277B; Tue, 9 Jul 2024 18:35:15 +0000 (UTC) Date: Tue, 9 Jul 2024 19:35:13 +0100 From: Catalin Marinas To: Yang Shi Cc: "Christoph Lameter (Ampere)" , will@kernel.org, anshuman.khandual@arm.com, david@redhat.com, scott@os.amperecomputing.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [v5 PATCH] arm64: mm: force write fault for atomic RMW instructions Message-ID: References: <20240626191830.3819324-1-yang@os.amperecomputing.com> <773c8be7-eb73-010c-acea-1c2fefd65b84@gentwo.org> <200c5d06-c551-4847-adaf-287750e6aac4@os.amperecomputing.com> <1689cd26-514a-4d72-a1bd-b67357aab3e0@os.amperecomputing.com> <35f70ba6-5305-4268-b7ba-81545cacd83f@os.amperecomputing.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <35f70ba6-5305-4268-b7ba-81545cacd83f@os.amperecomputing.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240709_113518_163897_7EF654CD X-CRM114-Status: GOOD ( 17.52 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jul 09, 2024 at 10:56:55AM -0700, Yang Shi wrote: > On 7/4/24 3:03 AM, Catalin Marinas wrote: > > I haven't figured out what the +24% case is in there, it seems pretty > > large. > > I think I ran the test much more iterations and I didn't see such outlier > anymore. That's good, thanks for confirming. > > What you haven't benchmarked (I think) is the case where the instruction > > is in an exec-only mapping. The subsequent instruction read will fault > > and it adds to the overhead. Currently exec-only mappings are not > > widespread but I heard some people planning to move in this direction as > > a default build configuration. > > I tested exec-only on QEMU tcg, but I don't have a hardware supported EPAN. > I don't think performance benchmark on QEMU tcg makes sense since it is > quite slow, such small overhead is unlikely measurable on it. Yeah, benchmarking under qemu is pointless. I think you can remove some of the ARM64_HAS_EPAN checks (or replaced them with ARM64_HAS_PAN) just for testing. For security reason, we removed this behaviour in commit 24cecc377463 ("arm64: Revert support for execute-only user mappings") but it's good enough for testing. This should give you PROT_EXEC-only mappings on your hardware. -- Catalin