Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp189133ybi; Tue, 16 Jul 2019 18:51:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYDkjxDoKKb14LTJVJniZTz46kTRxwccJ+IrnGcT5aikuXLyiaqEqLN5hVinSPJcjXM6h0 X-Received: by 2002:a17:90a:17a6:: with SMTP id q35mr40561190pja.118.1563328309482; Tue, 16 Jul 2019 18:51:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563328309; cv=none; d=google.com; s=arc-20160816; b=mCUVjnWig2sMqPz0XKOV/OghhtJx2A/IEPch2rSYHes2L/mL85n/Tu5ydgn61QblXN Zl/YqiseArbLr9CLkjcMz0JuUhEY1yyGADTg6k37IzZzX1k5ul8JnJ01ubAhvC7nFmzm fvFxkKg4dHE6EAVDzAnsWywv1N++F0PQJy60sZ2zEs664HofZqWP58bLC9/exJhzYFQC O3VWFLutslWhPtxp4Abr0wqjtESCFBgjaBcZlpoMYIHUE1alVKT4uz861mOlWkF60zHy BW20KtveEyBW0B9kF5qqRPbKuJvlJ9nYYb/JBQjNY9VQBNfqH4YLFBH0R++pmI3ob7K0 UkAQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=1dmjq+OnPGvrHvEejwkg5+2298h2fZxzldWUuZPTtbI=; b=zu+yuGT9gAuaoA2SGGaV8AWMu4SFX3eDn+vYlBklkXvzmJPgeDlGaEFxfzc4lKd+cl VIqUKzZPYreWkEO5sPsAJZEjbu9EaeiM0Ao5lEaM+IRL2P+xBPrWlSpqMpzsMKQN3ugl BWNbJl4+MCaF9ZW8tqVdl7I4P4SOS0lPx9CBVN2Ho1o37YCExEYBAxDWlI70ELtxuJ3C 0aVUXti14CiGZEt74wWUkNknSGrfGIN/uuYOqATzdEYF6HRoU22jA9JKn5I9l6DYz1qU LGkCNDbkc+xRK+ngSjBeHbSRFXgkInUCS/ex7t1/sBhDjyQzkeW22Qr2c8Hss+FgBH/s 79hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="AIh90U/C"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id k189si15258832pgd.408.2019.07.16.18.51.33; Tue, 16 Jul 2019 18:51:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="AIh90U/C"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726094AbfGQBvP (ORCPT + 99 others); Tue, 16 Jul 2019 21:51:15 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:15200 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725856AbfGQBvO (ORCPT ); Tue, 16 Jul 2019 21:51:14 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 16 Jul 2019 18:51:19 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 16 Jul 2019 18:51:13 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 16 Jul 2019 18:51:13 -0700 Received: from [10.110.48.28] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 17 Jul 2019 01:51:11 +0000 Subject: Re: [PATCH 3/3] mm/hmm: Fix bad subpage pointer in try_to_unmap_one To: Ralph Campbell , CC: , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , "Kirill A. Shutemov" , Mike Kravetz , Christoph Hellwig , Jason Gunthorpe , , Andrew Morton References: <20190717001446.12351-1-rcampbell@nvidia.com> <20190717001446.12351-4-rcampbell@nvidia.com> From: John Hubbard X-Nvconfidentiality: public Message-ID: <67107cc6-cc8a-c072-a323-b5c417fb45c6@nvidia.com> Date: Tue, 16 Jul 2019 18:51:11 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190717001446.12351-4-rcampbell@nvidia.com> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL106.nvidia.com (172.18.146.12) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1563328279; bh=1dmjq+OnPGvrHvEejwkg5+2298h2fZxzldWUuZPTtbI=; h=X-PGP-Universal:Subject:To:CC:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=AIh90U/Cm54D0y3Ou8lNAM1j8ozgoxqDzEIxoGg959X3ZDt/Gxbu0DLmQZjTpiPT3 k0E4lrszsGcs4DXpbafUoCk0Tvr1JFCUh3CZ9+tmc1Pe9C7eW3+7L6m3TnM6zAoOOO uEW7HREvelwp9GSn7pMHEEYUvqSF5SL6ERgDBFqfOL5pI5l6ukeW8cmk2EOojUvVyW 8HQDwvUHMa7xudjZMCkqEhRWCYTYCfWG1qPhlloRFCHHYVkNTRwrsQFxObgdrwQj01 p9dtBgaPXQTk98EdNnY0m2+msq9M+krIEk6rKhqu9u/2MdjgnvwvxMKLi30pjZ3JBp kklI/IdXiI2ug== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/16/19 5:14 PM, Ralph Campbell wrote: > When migrating an anonymous private page to a ZONE_DEVICE private page, > the source page->mapping and page->index fields are copied to the > destination ZONE_DEVICE struct page and the page_mapcount() is increased. > This is so rmap_walk() can be used to unmap and migrate the page back to > system memory. However, try_to_unmap_one() computes the subpage pointer > from a swap pte which computes an invalid page pointer and a kernel panic > results such as: >=20 > BUG: unable to handle page fault for address: ffffea1fffffffc8 >=20 > Currently, only single pages can be migrated to device private memory so > no subpage computation is needed and it can be set to "page". >=20 > Fixes: a5430dda8a3a1c ("mm/migrate: support un-addressable ZONE_DEVICE pa= ge in migration") > Signed-off-by: Ralph Campbell > Cc: "J=C3=A9r=C3=B4me Glisse" > Cc: "Kirill A. Shutemov" > Cc: Mike Kravetz > Cc: Christoph Hellwig > Cc: Jason Gunthorpe > Cc: > Signed-off-by: Andrew Morton > --- > mm/rmap.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/mm/rmap.c b/mm/rmap.c > index e5dfe2ae6b0d..ec1af8b60423 100644 > --- a/mm/rmap.c > +++ b/mm/rmap.c > @@ -1476,6 +1476,7 @@ static bool try_to_unmap_one(struct page *page, str= uct vm_area_struct *vma, > * No need to invalidate here it will synchronize on > * against the special swap migration pte. > */ > + subpage =3D page; > goto discard; > } The problem is clear, but the solution still leaves the code ever so slight= ly more confusing, and it was already pretty difficult to begin with. I still hold out hope for some comment documentation at least, and maybe even just removing the subpage variable (as Jerome mentioned, offline) as well. Jerome? thanks, --=20 John Hubbard NVIDIA