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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25703EB64DD for ; Fri, 21 Jul 2023 18:23:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229451AbjGUSXv (ORCPT ); Fri, 21 Jul 2023 14:23:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230339AbjGUSXs (ORCPT ); Fri, 21 Jul 2023 14:23:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA2A13A85 for ; Fri, 21 Jul 2023 11:23:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 40F9961D70 for ; Fri, 21 Jul 2023 18:23:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FFABC433C7; Fri, 21 Jul 2023 18:23:38 +0000 (UTC) Date: Fri, 21 Jul 2023 11:23:37 -0700 From: Catalin Marinas To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, david@redhat.com, Will Deacon , Mark Rutland , linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64/mm: Set only the PTE_DIRTY bit while preserving the HW dirty state Message-ID: References: <20230713071518.628440-1-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230713071518.628440-1-anshuman.khandual@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 13, 2023 at 12:45:18PM +0530, Anshuman Khandual wrote: > pte_mkdirty() creates dirty states both in SW and HW bits, which is really > not required, either in pte_wrprotect() or pte_modify() for preserving the > HW dirty state. Because pte_mkdirty() sets PTE_DIRTY and clears PTE_RDONLY > as pte_write() always evaluates to be true - otherwise pte_hw_dirty() will > not test out in the first place. Clearing PTE_RDONLY again is not required > here because the pte is already in pte_hw_dirty() but might soon loose its > dirty state thus requiring preservation in SW dirty bit i.e PTE_DIRTY. > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Mark Rutland > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual Acked-by: Catalin Marinas