Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4179410rdb; Mon, 11 Dec 2023 11:02:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRqhyBagzmUqJSCvnBcO4nGVdlCR3VCA1E0DDriC6DZcBIzjxrLt7E5RBVvp/yg4W7oAIA X-Received: by 2002:a05:6a20:728f:b0:18c:30:f408 with SMTP id o15-20020a056a20728f00b0018c0030f408mr7242171pzk.0.1702321352159; Mon, 11 Dec 2023 11:02:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702321352; cv=none; d=google.com; s=arc-20160816; b=po8g0Nd5/aGT4TMGn0VU7j95RzlTi9i3crxzV0YvFj+hAgFEiovKv8Y/9hOx6vr1nq iYXE+9VQM+nEBPzwJn95EiJmtgPC5D+LJsGgv7LXaJrVUCtXGGV8DO0K8uF6mWJQO5Q2 wWnjxwDVo30lRRT52riKY/JeoA4YF+DBR5vnRQZci6IfP6LglHrorm5T4E09Hks5rlet EbaTrNY51He6lB2wOmtXGk36Xv4vD/8Uv69Swcoq8LkDDWkDgjdsyOBP/PneV6eTHfff 0zYUsQGMSqHA24VPlmmDThLEr1jDZeKKQdGCPkBmkaQDZwXrtVO1xhsQC+GivutegTnP 7wAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=3KbcZPb3ouJho6Kgt8unn6XTmhQsbLYfRLMQ3Ty9aJ8=; fh=b5lel+3Y64Ln5D3P011lmqW37F7AvhB8EnLbTY3zxKE=; b=hC3sxPGKFa8dJ5GWMNJs/KOOe4fpekj/UN3CDecsi7QXF9dRiPagIQsrPHoRbcnIK/ joXqBfbOzv031Fn1FbC1FuAkOWVGNeX7yoMVU1/Ta9NDkhhhkQu1pxFYVaxCnJuEhL31 9/1mr3YXDpRDlVTO+9xr9pBwsvz5wP4EVjJL598Ftach9qBRs5Pe2coBQY3BFQvnAr/Z qumVizmoCWL8+eM6p1I061NXhfUhrw4sJkiFxYdw2FUgxjT+m1xPZywqaxTiM0088d3s R4XnOyoDxoQf2ogR0OXLFqrr+8ZR/JBHGsYvUbe4ucUWXbT5L5mzyAGbFHVxeMnhzbnH Tm2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ewBQ2+NW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id b6-20020a6541c6000000b005bdfda8e044si6164078pgq.775.2023.12.11.11.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 11:02:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ewBQ2+NW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 968EC8071066; Mon, 11 Dec 2023 11:02:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229795AbjLKTCL (ORCPT + 99 others); Mon, 11 Dec 2023 14:02:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344328AbjLKTCJ (ORCPT ); Mon, 11 Dec 2023 14:02:09 -0500 Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0935B4 for ; Mon, 11 Dec 2023 11:02:15 -0800 (PST) Received: by mail-qt1-x82d.google.com with SMTP id d75a77b69052e-425928c24easo60481cf.0 for ; Mon, 11 Dec 2023 11:02:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702321335; x=1702926135; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=3KbcZPb3ouJho6Kgt8unn6XTmhQsbLYfRLMQ3Ty9aJ8=; b=ewBQ2+NWTIjvRSqDb9QeOuePngiKNOVIAbFJqxBHlWZ2tP0J3HUpv+DEyw8TYWw64h MZ2rovbdLI8H+1ghfrIoUaJp2FOYXyjcCVesdTnJvgN7kngySUkHjacRXJEIhOKL+eld di9fWCTEynvaHXgLKukODQq/Cxk0jRhrSxs32lOpTuRlvYLv0NtMGtTeWDjvQjnnlkz7 zSiMYY/gHR3EipL2u6Le+TfaNTaO+Q8o3Q9kXPJ9JB5TOgPJNFeLXSmA4V/GZelTGvqY +AcDIFmp1elq0pz3YOEeiM2ez8jBkLMzcwTZPF47/9Rzy/0x2BvewMne4FsNCJY4DTlU izZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702321335; x=1702926135; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3KbcZPb3ouJho6Kgt8unn6XTmhQsbLYfRLMQ3Ty9aJ8=; b=LNhqphWhlC2uTt+ZR6V+5OP4vz2GDBqiHYUBVMQkZhpfHPd0OozUgkfjjad+T1l+pm YS81o5P33KLiSPlg7Avdee8s0aELh6JA/sa9utffaMGtjCQWJWxERy/NKcHeYyjtKiwO qZ2+uFFSQDjU5kIVZRef8X51XImW+ZacwH+FOj6Hn8/wFIAmpgATKpIlNONQSb3Q15tg AhyCRzKUPM+7qcIeEcFm9bMscE1l+h2rgk5qhghJEPah1J1GcGohqcQcTHTSQjo4KK0M sIms5+CeCojzdW6vt0dUaykrlkRe0L622bUzymrE8QE+qnNmr+xfSR6JYVik7Mbr7Q6b qX2Q== X-Gm-Message-State: AOJu0YxCz32RI2HsOnRG6hVgFkEKZQQJN5HKM9zVQu9kbEl0xXUDu0mc QcI5jQG7mCoY4N3EVZjq1G6SCuPdwSd59pSu4ZGS/Buw7EnMYqz2NCQ= X-Received: by 2002:a05:622a:190c:b0:423:b6a1:2088 with SMTP id w12-20020a05622a190c00b00423b6a12088mr738239qtc.5.1702321334910; Mon, 11 Dec 2023 11:02:14 -0800 (PST) MIME-Version: 1.0 References: <20231204172646.2541916-1-jthoughton@google.com> <20231204172646.2541916-3-jthoughton@google.com> <20231211184236.GB26462@willie-the-truck> In-Reply-To: <20231211184236.GB26462@willie-the-truck> From: James Houghton Date: Mon, 11 Dec 2023 11:01:38 -0800 Message-ID: Subject: Re: [PATCH 2/2] arm64: mm: Always make sw-dirty PTEs hw-dirty in pte_modify To: Will Deacon Cc: Steve Capper , Andrew Morton , Mike Kravetz , Muchun Song , Anshuman Khandual , Catalin Marinas , Ryan Roberts , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Mon, 11 Dec 2023 11:02:27 -0800 (PST) On Mon, Dec 11, 2023 at 10:42=E2=80=AFAM Will Deacon wrot= e: > > 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. Thanks for pointing that out. Looks like it came from using `--summary` in git format-patch. :/ > > > 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 =3D set_pte_bit(pte, __pgprot(PTE_DIRTY)); > > > > pte_val(pte) =3D (pte_val(pte) & ~mask) | (pgprot_val(newprot) & = mask); > > + /* > > + * If we end up clearing hw dirtiness for a sw-dirty PTE, set har= dware > > + * dirtiness again. > > + */ > > + if (pte_sw_dirty(pte)) > > + pte =3D pte_mkdirty(pte); > > return pte; > > Looks like this is a fix for Catalin to pick up (patch #1 isn't necessary > afaict). If only this patch is taken, make sure to add cc:stable and the fixes tag from patch #1. Thank you!