From patchwork Mon Aug 31 21:22:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralph Campbell X-Patchwork-Id: 11747059 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE538109B for ; Mon, 31 Aug 2020 21:22:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9B96320866 for ; Mon, 31 Aug 2020 21:22:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="ZzXUvi0p" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B96320866 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 811196B0055; Mon, 31 Aug 2020 17:22:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 76F386B005A; Mon, 31 Aug 2020 17:22:33 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 570196B005C; Mon, 31 Aug 2020 17:22:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0022.hostedemail.com [216.40.44.22]) by kanga.kvack.org (Postfix) with ESMTP id 2AD4E6B0055 for ; Mon, 31 Aug 2020 17:22:33 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E92AE2497 for ; Mon, 31 Aug 2020 21:22:32 +0000 (UTC) X-FDA: 77212137744.01.hand84_44083f227092 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id A896F1004BA70 for ; Mon, 31 Aug 2020 21:22:32 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,rcampbell@nvidia.com,,RULES_HIT:30012:30054:30064,0,RBL:216.228.121.143:@nvidia.com:.lbl8.mailshell.net-64.10.201.10 62.18.0.100;04y8451ejuf91zz9moynz5rwj6zquypbeg78mwqy3c7hcqjsouikjfx39ex39fn.m6zcqqtq7bfw6cozaimyppomrpsbt7ht8jr66gtrskzc7efk6h76baikkx6poop.a-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: hand84_44083f227092 X-Filterd-Recvd-Size: 3648 Received: from hqnvemgate24.nvidia.com (hqnvemgate24.nvidia.com [216.228.121.143]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Mon, 31 Aug 2020 21:22:31 +0000 (UTC) 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 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== X-Rspamd-Queue-Id: A896F1004BA70 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Christoph Hellwig --- 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, struct vm_area_struct *vma, if (unlikely(is_device_private_page(new))) { entry = make_device_private_entry(new, pte_write(pte)); pte = swp_entry_to_pte(entry); + if (pte_swp_soft_dirty(*pvmw.pte)) + pte = pte_swp_mksoft_dirty(pte); if (pte_swp_uffd_wp(*pvmw.pte)) pte = pte_swp_mkuffd_wp(pte); }