Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1307988pxk; Mon, 31 Aug 2020 15:58:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTpUAXckYDW6HhmEbW47vEtkwbxV3XWL/omtbV5P16lkvX0UglK9dAgXXt5ifPOXrp4EmH X-Received: by 2002:a50:ec89:: with SMTP id e9mr3370097edr.32.1598914730971; Mon, 31 Aug 2020 15:58:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598914730; cv=none; d=google.com; s=arc-20160816; b=gHpcToEDzTOCitCFD82thgrQ0xdY4Zo3X22xS6HqfihtJUzLBaAF678d6gqlIrRsuR jeK6nvH0Ac1F2k60nstDbJ5AuC8n4Vis92cxgdwYXUx1uH/WaVdpMg7E39E0s+E1pWeY YUZFKnmrWi7YthwcXHxo9fRXIEmFidpcSxMgMNw5p83OqGM9QDFjO55TblHtVad7vTZ4 cOmBfpPWbX2IsLwN7TeXTxA1GbY6/wivJfTQmTXC1KkTd8JgHMQAwCzn36/2Wr/eQCZE GCBtXjjQsf2ctzQr3QTkxKqkA32lrKTOD1frb02axzFFNzqxhKF0ObD8+GM0H0pZ4oSJ C0wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=/ipjpHkkeivZ87Vlc2yYb0Vba/A4X8d8GxlfEZWUxR0=; b=I+eYO+8Vxqmg3T+6pIbOlC3B4u3Ap/eVc4Lk32DyZbM3UxwFNNYwVfKajDYzAiJNFo 2XwYwy+hnK02KjIzAG9CsSEcnrfvusYqY+K7PYmIKzD3I6lPquexujF9qnrfEWAiiLlm DDGsqapVnCPJHM5U/xwbgqMafmU9yJPLO71wmQENbIfNLhhMhPPFEDNTyV0tFF6jWAq5 SddVvvq0Z6QapLCZ0qtZIt2yHdvEAUu1sb4qzyVZK7p2B0tduNn6DS4AKlezvosqzxUI fcThQ0qTv0/zi2MKBCZwDlEViq1qvIbKysFrHZuLRWouEmYuk1Epud9CYmyfxfOnvqdE NVlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=ZzXUvi0p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k17si6537722eds.353.2020.08.31.15.58.28; Mon, 31 Aug 2020 15:58:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=ZzXUvi0p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730255AbgHaVWf (ORCPT + 99 others); Mon, 31 Aug 2020 17:22:35 -0400 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:11379 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728458AbgHaVWb (ORCPT ); Mon, 31 Aug 2020 17:22:31 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 31 Aug 2020 14:20:24 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 31 Aug 2020 14:22:30 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 31 Aug 2020 14:22:30 -0700 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 31 Aug 2020 21:22:30 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 31 Aug 2020 21:22:30 +0000 Received: from rcampbell-dev.nvidia.com (Not Verified[10.110.48.66]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 31 Aug 2020 14:22:29 -0700 From: Ralph Campbell To: , CC: Jerome Glisse , Alistair Popple , Christoph Hellwig , Jason Gunthorpe , Bharata B Rao , Andrew Morton , Ralph Campbell Subject: [PATCH 2/2] mm/migrate: preserve soft dirty in remove_migration_pte() Date: Mon, 31 Aug 2020 14:22:22 -0700 Message-ID: <20200831212222.22409-3-rcampbell@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200831212222.22409-1-rcampbell@nvidia.com> References: <20200831212222.22409-1-rcampbell@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: quoted-printable Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1598908824; bh=/ipjpHkkeivZ87Vlc2yYb0Vba/A4X8d8GxlfEZWUxR0=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:X-NVConfidentiality: Content-Transfer-Encoding:Content-Type; b=ZzXUvi0px/bTG0EVGP2xyCKwESunCzWASuxsvDpudVMigdzLlKaTlJZs5JHmzz0aB jyXi1u44c9KoM2W7SmcyDofzVrhN3jkFmxVc6gvXHkT+malP6swX/k9haqrisgdcwh HMfmBvCqWbWl/QYLPbKbJcc6gotJX2fRbO31yUE43PXRc8rjID84khaMLCtZG9f20a Sbj8gKC1sArfB/DBZkB8k0lXkeqBGRjjKMrTPbJMPaxZfBvO3MmVsOisWNk+YUcdr1 1W4xmUS1P05smOPgsPhQT0VkxxrglfA7NCcMXAjZvLdEYCV9ZGg3DHgaW7Qx/zEI2t x9BNk7o+QUfhQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The code to remove a migration PTE and replace it with a device private PTE was not copying the soft dirty bit from the migration entry. This could lead to page contents not being marked dirty when faulting the page back from device private memory. Signed-off-by: Ralph Campbell --- mm/migrate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/migrate.c b/mm/migrate.c index fe339a847328..4f89360d9e77 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -249,6 +249,8 @@ static bool remove_migration_pte(struct page *page, str= uct vm_area_struct *vma, if (unlikely(is_device_private_page(new))) { entry =3D make_device_private_entry(new, pte_write(pte)); pte =3D swp_entry_to_pte(entry); + if (pte_swp_soft_dirty(*pvmw.pte)) + pte =3D pte_swp_mksoft_dirty(pte); if (pte_swp_uffd_wp(*pvmw.pte)) pte =3D pte_swp_mkuffd_wp(pte); } --=20 2.20.1