Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp281262rwo; Fri, 21 Jul 2023 11:45:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlHDENvJA5/PQ2PiWkU5OxzibLj3W3YYEoyZDg+spV57Uv7+EnBuyiD7GA0IyzOARkChUa3Y X-Received: by 2002:a17:906:3042:b0:98e:16b7:e038 with SMTP id d2-20020a170906304200b0098e16b7e038mr2189892ejd.23.1689965131697; Fri, 21 Jul 2023 11:45:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689965131; cv=none; d=google.com; s=arc-20160816; b=eNIr/dx1LPlNtM98I3aGBEkmxKQnhYgaxQy/0ApZbeDP/aC6LRY4bEE2lpUqutEGez no6eHH1JvMqMj+dSPeJyKT0WXDasPAGw105jlo5QSfqtWAx7K45c0ilcDLzAA21La8q8 HHSx9mh4FRIr0dZJKl1A2M8tFZbeBG288LGM1h65q/SYLFqBxcbJELKnU1I+JLDgAIsW yLJDzZXLNMsLX/xR8Kyf6I/T7tHGGhscMDWwsGJGzamn2CLmPPIWMCKMpZ+FU7g37CEa UU44fid2A9skXr0wVyUruGKR875MKF5TZyZYct0wAAIulORY2ZKlzYgc7BX2peOQl3kA xmfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=rMCclMtjHCIeyuZndva4aB6jhtDs9ZZUCIH3+FM8h6g=; fh=T1vA5rvMQnmHYEFAFbWKGfvcJL8fTxqxkK7OWHBgMIk=; b=CX1/Lvt+E0cqLBkDBICHr4MKZ5ojcJbEMOLIH/O2p8gKtkClsiejjz/I6sORQ008c0 5hqqnBhjy7rb9nYnxX8OcYbg6S1rB6uFJp/PX8UypN6mqhy0vggbiBo3TsMbaebJuzOm EBvq6S+sx3zWSkMbCH/G7b1SEjVJHI/fcbj98tShCVuaxW57VU8dVEgFXx7MuuIFL1La 6FSwRLjaaPXWbWvdo9gbBKf22/ng4BVvWkvmKa819z2+X75qfog9kreJJuizQd7eCs4V Ttsr9r0zv5NK2GQWWO7z9/urnK0CH2i98qcwN0DjaJy2SYYVMcAOBL6pLe19IuVErIn1 ekZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rl19-20020a170907217300b00993b3881ed2si2378725ejb.686.2023.07.21.11.45.06; Fri, 21 Jul 2023 11:45:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230340AbjGUSXu (ORCPT + 99 others); Fri, 21 Jul 2023 14:23:50 -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> X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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