Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4646399iob; Sun, 8 May 2022 20:28:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlx6CJhQWy6BInLefSkXKttdPDczj1+JiESthTxRdNLibic0/ullVwcs0bjfAU0zZV0nii X-Received: by 2002:a17:902:e38c:b0:15b:40ca:37c8 with SMTP id g12-20020a170902e38c00b0015b40ca37c8mr14499914ple.23.1652066918805; Sun, 08 May 2022 20:28:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652066918; cv=pass; d=google.com; s=arc-20160816; b=cVBp1se3kVY35ecrHc+KYzeS0pWQX9AJIlZjF8bTBlbQOjLXuHnynoSJj80XHoLrnf zRy5RKrrKzvyHq01UBMgOCOArJdett7JS78Q7zbruok2qFPyJVUCJ/GV0eD2RUMAc9Vc WreIEbzHCEzUIso5G4NhWZzdTLchnPoZsOaGyxFYo2FnuYOjGXNJocaPqBGtwy8W25rW 5dUDMsBwZDyWH8NOpn1252QEXZOG5KigHwl2c6vxjdZelbuPlhWpSDRU+iM7gCdSg7lw ygCMKiTvUixefe1RuUke3n5rRvOtbkutwxSUIzsaKr15jEmqiHnc486hTysTSrpgTrKK 5M4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=3irBkaw7MSw5EGYTgHR9KPyQK6kZCo+BSGv5T23HPDE=; b=vSYps1PuyWgBzJErsuWb1UrIGUptVNYAtqZM2WC9VPgobsxP/UbHeTEiy5zvb972LC 8Yl5uQsr1kvTYPa6OCl8RNDtRGandb0PBGU4mFPpVnmLwXxMIpyYNFvodgRDuiwwypij THoE0fbC7IcveaEmO1EQcRMtYzFDCHTxMjU7VS0qsEQctito/kSXRHpEUM1M+ByizSxO bmJC0FWBgVqStVlN1nSchUJP3vxxFl/sWXoD492he7zy/488Es27fdRnIbr9alIeZSMD RKADnUhnWpnzBp+11Rea4MMXAXi+yVbWSN2WD4lSD6kVfV2oWgAcVM05LNVD3znGi0do CMlA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=QRjjbEnl; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m23-20020a17090a7f9700b001dc240137bcsi11909626pjl.37.2022.05.08.20.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 20:28:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=QRjjbEnl; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 567FFA27C1; Sun, 8 May 2022 20:27:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378006AbiEEVmC (ORCPT + 99 others); Thu, 5 May 2022 17:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385981AbiEEVlv (ORCPT ); Thu, 5 May 2022 17:41:51 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2079.outbound.protection.outlook.com [40.107.243.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75BA326AE2; Thu, 5 May 2022 14:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kEqv6C2X9poGzvsLJ3GynIcrj0yqUzvnAYkWKrogW1wm2aBmP09wtK0/Kj/C8lALlfb8faPrev6NIxslEYwFpmR0W4nsrfy4H71UYXgvAgfOwbh3O1XN3PVToHQRD7yPeBsUMheZyANrP2Gv+aIEa03x/aWtBZC43z3dAy8ksgzpwBaTkh+yYBZLLCp0MjgN4PBqOY4n9JTLO8Lkqkvk2JIOzdRbR5PvBMERDyNvAREH/4qsRZd25gU1FCvxCy16I1kOOXkJTXWhuSufUx83s8nri+4nJLEV1vzXNRGHM4lXt1pr3Zmg7y/8isoc5OTp3hK9vdyjVlrTdOtMPgms6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3irBkaw7MSw5EGYTgHR9KPyQK6kZCo+BSGv5T23HPDE=; b=PbkDoKnpk2k389XedvcubpG0OYx73godnSJyJ0ylIgmv1uEAR8K3/Z1PwZzuPlBafyrZFxTkVx2UZnPgcOyzvEQLwSdeKo4cXXzkWI3laXsKDkAXKn+VzGxOHe/f3QB0+HGO1dW7hiKsQ8FsMUPM3HK+F4HF7yW3trnSxgNvQOjfII8c57MAO5VnUYdUnj/IayuBBC50tvyipTSnd8HzRKMg87VAAqexelpAQ2/kuarh/JZbRCYxS4uYPzW+qlDiBriHobxw58K1L3tzCx1Z/SjV1SzQQ8ZOhM47Hm7iuUA72ijM9GakZpTx/A0YJjVldlT+Da/xExaafPrD3qGUWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3irBkaw7MSw5EGYTgHR9KPyQK6kZCo+BSGv5T23HPDE=; b=QRjjbEnlOHnK1WDB9+5cfXLL7iPaMtnLvHbohKphmKfMHCeYIBcwACr7Ormb6ZzVksW20QwIhOKEhVjiDE58ffgvWhA9csrtD5rawtmPHIhvpjfZXRQAU8vReTkfZGuF22pdD7HJIVvsWEnes6YU5MebUALPdpn0cYpMaMcYFBE= Received: from SN6PR12MB2717.namprd12.prod.outlook.com (2603:10b6:805:68::29) by LV2PR12MB5991.namprd12.prod.outlook.com (2603:10b6:408:14f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.25; Thu, 5 May 2022 21:38:08 +0000 Received: from SN6PR12MB2717.namprd12.prod.outlook.com ([fe80::2c05:6d91:e76a:6e24]) by SN6PR12MB2717.namprd12.prod.outlook.com ([fe80::2c05:6d91:e76a:6e24%4]) with mapi id 15.20.5206.025; Thu, 5 May 2022 21:38:07 +0000 From: "Sierra Guiza, Alejandro (Alex)" To: "Sierra Guiza, Alejandro (Alex)" , "jgg@nvidia.com" , "apopple@nvidia.com" CC: "rcampbell@nvidia.com" , "willy@infradead.org" , "david@redhat.com" , "Kuehling, Felix" , "amd-gfx@lists.freedesktop.org" , "linux-xfs@vger.kernel.org" , "linux-mm@kvack.org" , "jglisse@redhat.com" , "dri-devel@lists.freedesktop.org" , "akpm@linux-foundation.org" , "linux-ext4@vger.kernel.org" , "hch@lst.de" Subject: RE: [PATCH v1 04/15] mm: add device coherent checker to remove migration pte Thread-Topic: [PATCH v1 04/15] mm: add device coherent checker to remove migration pte Thread-Index: AQHYYMgGjgxyHrmtGk6QLDJATlgC2K0Qzsjg Date: Thu, 5 May 2022 21:38:07 +0000 Message-ID: References: <20220505213438.25064-1-alex.sierra@amd.com> <20220505213438.25064-5-alex.sierra@amd.com> In-Reply-To: <20220505213438.25064-5-alex.sierra@amd.com> Accept-Language: en-US Content-Language: en-US X-Mentions: apopple@nvidia.com X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0c917ea8-4da3-4a26-5ae6-08da2edf8b54 x-ms-traffictypediagnostic: LV2PR12MB5991:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: e0cJaDWALjuUH+yTX6zCzyfcL5EvF35igo2w8hUZ2fUKbxKywtnlHxZFzlurlnZvyJ1sweyIjgc4lgMNIXZ7i5v0qjmmWNUmVcGRvyUXfPlLxV2zZLgLqggd6R/ihI33IzqBbViUu3r+qYcXan66A73OTIOgl3sEfukrvrWK7kWJTfxiqtOb2c+BhQrk0Tm10u11Mz/s3HG1X/594njCSKpyQUgh25i5ENcLa2s1RXRK65DABsYlPRUOO1koDv+msABu0DaGa7ytr+3LCt3pa9syRwbPRw9Y9Bnf5zo2msvyAMIRjCbnkucpNXMHkam7NYc0Qt+4y3KRU8dWWHtXnJluKSW1pdVayFqIfCYGxzh43orsz3/YKduZOdZbPxyGrCQ8y4BgYz8RaoC+2IUbBogsD8bVRQ+Kruf8cwpPdgh2+65aTRITdmXO7PVFcTSZE2iVOTDSltPesM4oQ1jrvkPAgwFJwk7f3vn5g7hvUAWv4CEKT3nzFNZBjQzgDK0oiXtjIVgj2qXqajx+El0mT/q8yGHlGENiZkGABOymUcQHbGduCZ5iYkVUd/5GIJ2xVuivW4RX2cf+SHfAUw184XIwaTza5Bz6KlurTkvzKbnVNsgeU2jI6uAkcwLvFbd4lxuObEhmT1Ovo/03NJPc2w6mnYs73ieECztlTvrfsJBIqgj4wO1v01WD/swgSZcLymWHtVz9xNKZuXpch/lRdQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2717.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(9686003)(186003)(6506007)(53546011)(33656002)(7696005)(26005)(122000001)(86362001)(38070700005)(38100700002)(55016003)(110136005)(83380400001)(508600001)(5660300002)(7416002)(54906003)(316002)(76116006)(66556008)(4326008)(8676002)(66946007)(66476007)(52536014)(8936002)(64756008)(71200400001)(66446008)(2906002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?z96eIh5ESCSV5/dOLE/VRFh4gROWsa4oSxnft0n8d6psRoFH5vnJS6pNJYew?= =?us-ascii?Q?Y1a3CSrbIXbO4zSzwQlB5TFheBOGjuFDPEEkfeNyf92PkFMMdn91LsmV2Tqj?= =?us-ascii?Q?1bjx8tWuKP4Y8Z8fQ+GlNpD3UFN55uifMd4Rssm0cTeigm8pOtwFZdttU9eQ?= =?us-ascii?Q?EpcafKdwkmifKLYR6vbnZ8NvsfhIfA1uLeAf3Nf4xx0FPU3tpcSY4SLov5Vt?= =?us-ascii?Q?S/5hEYuw2pYeuDomss1Eb7L7CoognDQo259bNIA5riweVoZqk2c7x3TDjY6b?= =?us-ascii?Q?gfYSidq9NO32mVkxOoXriqM3sxmNXKSd72l2tNAt8RcqJixfQO9dg7cA7Di6?= =?us-ascii?Q?5u3AaCnBmpxNdFBacriWVjpBhrGto5e8eyY8xncIFg5TYTfADhJ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s+1LMOWFqzU18oqF1Ekau5lHK4vLDE3lI9s?= =?us-ascii?Q?9NrFResylkyC0fGPbsAZNTLYNPr9JyA4r7s9G416KXfaJJwihTwp6112GT8k?= =?us-ascii?Q?OhyBJwgQHiwIth7z2Ho9RhueBzxqgjke5v+TwnuIEg0gIx7/yMJFUPhrmJnq?= =?us-ascii?Q?MevYjhY7fNt2fngmBEXQci68lVMVeiNVs+AzdtXWai5siOOW8wvBTvOucl8T?= =?us-ascii?Q?dB4ZDRANOztOfdHikYhpN5IpcDZJq0DB/KbpM6EcVMXb060trMQcAMIWnFiZ?= =?us-ascii?Q?bwJJY32owKeuFuosSAdRXWgApWCwlaHBLPElF1pbhRVTo9pij90pUxMjun3O?= =?us-ascii?Q?m9rk6IoonFJk5lgYdFDg0TVZsYfKxjk0hOR8+2RJKkin4T5ojtKXhIGjcwH5?= =?us-ascii?Q?tAaV2sW++VrkTU5KSD7oZGTyy95oxLMhmja7E8Umi7brLmQH?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2717.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c917ea8-4da3-4a26-5ae6-08da2edf8b54 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 May 2022 21:38:07.6023 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: nUHSTSIuR/+r3WgTV+FI6dEwxezN9wOcWVxFbKaQXRPGTdtahlkmyXLKeIv2HyiPuGbSGOh7v34bNy1jm8hQBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5991 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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-ext4@vger.kernel.org @apopple@nvidia.com Could you please check this patch? It's somehow related= to migrate_device_page() for long term device coherent pages. Regards, Alex Sierra > -----Original Message----- > From: amd-gfx On Behalf Of Alex > Sierra > Sent: Thursday, May 5, 2022 4:34 PM > To: jgg@nvidia.com > Cc: rcampbell@nvidia.com; willy@infradead.org; david@redhat.com; > Kuehling, Felix ; apopple@nvidia.com; amd- > gfx@lists.freedesktop.org; linux-xfs@vger.kernel.org; linux-mm@kvack.org; > jglisse@redhat.com; dri-devel@lists.freedesktop.org; akpm@linux- > foundation.org; linux-ext4@vger.kernel.org; hch@lst.de > Subject: [PATCH v1 04/15] mm: add device coherent checker to remove > migration pte >=20 > During remove_migration_pte(), entries for device coherent type pages tha= t > were not created through special migration ptes, ignore _PAGE_RW flag. Th= is > path can be found at migrate_device_page(), where valid vma is not > required. In this case, migrate_vma_collect_pmd() is not called and speci= al > migration ptes are not set. >=20 > Signed-off-by: Alex Sierra > --- > mm/migrate.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/mm/migrate.c b/mm/migrate.c index > 6c31ee1e1c9b..e18ddee56f37 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -206,7 +206,8 @@ static bool remove_migration_pte(struct folio *folio, > * Recheck VMA as permissions can change since migration > started > */ > entry =3D pte_to_swp_entry(*pvmw.pte); > - if (is_writable_migration_entry(entry)) > + if (is_writable_migration_entry(entry) || > + is_device_coherent_page(pfn_to_page(pvmw.pfn))) > pte =3D maybe_mkwrite(pte, vma); > else if (pte_swp_uffd_wp(*pvmw.pte)) > pte =3D pte_mkuffd_wp(pte); > -- > 2.32.0