Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4168918rdb; Mon, 11 Dec 2023 10:42:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/yLAhhWXHnxeCF9dkdHuu4d2Np9J7W4vjbQUWUDx7/B2gqwPysITF0+afmy2iTX9k13SV X-Received: by 2002:a05:6a00:a85:b0:6ce:2731:c23e with SMTP id b5-20020a056a000a8500b006ce2731c23emr2587300pfl.45.1702320172737; Mon, 11 Dec 2023 10:42:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702320172; cv=none; d=google.com; s=arc-20160816; b=bLnteWwipMPTB/9swAEMZgzjFK0fewynqsZFqU/7VEFeNyj9I0FjsG11uVMcGNeMnh /yChGwP3Y2+c4d+XQI6hccBEeu44vQPfXOh5MLPYnVC6VG/isXkKFqJAjBam922LGU7n pwwMlOxTxgGh96tNHyOrzQhXA3aBibNNqepSgl6v8nsDXftdE6qBFyG77q717ZAy/R6O 9w8eVvaBZemtWn4DdXEWHX/dI725rhipsReE9W2C68rYduWWH3Sa1DhzEkLJyJuhdt+8 qWzB0ZP5EUZN7AOsNMy70LMhyptiK6I7EEWqBHusxP4/R9veqpbdF0+pa8Z8z5JNR34e FoJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=3I/XmUfU8WZXVTEhaLOVLbopU64w5bIbkMvwyI6D4TI=; fh=7aaq5/4jXvNcQ2F5JVjaDGMyqpm1fgM+IqoCkbIdFHg=; b=Zu8s/PFUYQ5WulCi+9/jxar6tDgDPd8tKyRP9uKYLzntUh/cxwgai0ZmOr4qbXXrUN ShL90L67+rA8xUpwegWsjhA7j2Ib9ITBv8vU+1JkjvcuMaR/y1C7x0U3VYORROlyZuK+ QsGFAevv2uU2J7LDWiPl0pkyE5QoNlsTd33aEQb8r1t0IqXlyz9gcrsKTspmj+AKJyee ld/ZRIjT2LzBxrP4y9QXeK8Xl4dUJOcUxWGPvDumdq84dC0xRUNCMaNehHuqddMUKKRD poEfcOSrYf0p1MWi2XUmzGP7Kj4wtR5TpZk15HsqscsAIMe7LHcmyE/uRekKhjIoSdsZ vwCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S0fbAglu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id s16-20020a056a00195000b006ce96e33eb8si6379138pfk.112.2023.12.11.10.42.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 10:42:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S0fbAglu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 59CF080B3B6E; Mon, 11 Dec 2023 10:42:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345363AbjLKSmg (ORCPT + 99 others); Mon, 11 Dec 2023 13:42:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345340AbjLKSmf (ORCPT ); Mon, 11 Dec 2023 13:42:35 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CC0FB4 for ; Mon, 11 Dec 2023 10:42:42 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 232D0C433C7; Mon, 11 Dec 2023 18:42:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702320162; bh=La1SkaK7aEdY1LxNkNO5JyzTxPGR7qbV9MxCEFKaG3c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=S0fbAglu5jBzJzxh07T39fVM/s7FoQQSuOhDZqlRkIy91TQy6IekTeoIlifpvVwhU PN264G8HQGPp9TJP7Q5MnF3aAIS7+3ikvtayafsup1uH7XFTvI6QOQl8gSes/6/YF9 nmyUZCZb9nmtc9v0yaf4T1nkJpx0SQu4WCXqivdjTbkj+/islL16+lokwCbggKM8I/ U9BbayDdfuz+VHhDGDk2HIW7kqOBhhswSowciT5cLlC2E88xWqonx9Qdseyo7+ObiE bSa1NcTqx/+TNV1EGySODFGcKNk1ysriAJAjSjIL2tMSi/b4Pw230zFkjYBxosUiWe UiRxINs+8/2XA== Date: Mon, 11 Dec 2023 18:42:36 +0000 From: Will Deacon To: James Houghton Cc: Steve Capper , Andrew Morton , Mike Kravetz , Muchun Song , Anshuman Khandual , Catalin Marinas , Ryan Roberts , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] arm64: mm: Always make sw-dirty PTEs hw-dirty in pte_modify Message-ID: <20231211184236.GB26462@willie-the-truck> References: <20231204172646.2541916-1-jthoughton@google.com> <20231204172646.2541916-3-jthoughton@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231204172646.2541916-3-jthoughton@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 11 Dec 2023 10:42:50 -0800 (PST) On Mon, Dec 04, 2023 at 05:26:46PM +0000, James Houghton wrote: > Make it impossible to create a sw-dirty, hw-clean PTE with pte_modify. > Such a PTE should be impossible to create, and there may be places that > assume that pte_dirty() implies pte_hw_dirty(). > > Signed-off-by: James Houghton I'm not sure how, but you seem to be missing the '---' separator and the diffstat here, so I suspect this might confuse tools such as b4 which try to apply the patch directly. > diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h > index b19a8aee684c..79ce70fbb751 100644 > --- a/arch/arm64/include/asm/pgtable.h > +++ b/arch/arm64/include/asm/pgtable.h > @@ -834,6 +834,12 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) > pte = set_pte_bit(pte, __pgprot(PTE_DIRTY)); > > pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); > + /* > + * If we end up clearing hw dirtiness for a sw-dirty PTE, set hardware > + * dirtiness again. > + */ > + if (pte_sw_dirty(pte)) > + pte = pte_mkdirty(pte); > return pte; Looks like this is a fix for Catalin to pick up (patch #1 isn't necessary afaict). Will