Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp76166ybv; Thu, 6 Feb 2020 18:21:27 -0800 (PST) X-Google-Smtp-Source: APXvYqwru+4O2H5Hz+rR4Tn+6dDRKeLo0SAxVc4MxmOsyOR/O9xdBndLdE0r9JugvWn2hwdPfgz4 X-Received: by 2002:aca:3d7:: with SMTP id 206mr605128oid.98.1581042087597; Thu, 06 Feb 2020 18:21:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581042087; cv=none; d=google.com; s=arc-20160816; b=GPebUNQjSlPYypmzij0WFlGxNQ03mkBPsYt4d1BlpMbbbjdl3IcQuDWdJ0M7z6IBGx Qx0eSWCalSKTo3baVzq7fQWYPRCDT8khXP//NrVi+Vv3df6ZsDXUBBl+58kF3AamatxJ lgQgmVOhDObPUNUjsVGlpgP2LwIMrJp6XMRMCpt6QJWXOIm3GGn60vtwtQ4+rawt0zrK 6rO5WLyuVbsNdcWfDqQgHOAeVqVhHCZzVPcujoG4LIXmPtPviV2hStSeYCa6vzGT0RLg 9yfFLusvvnemLgr/rX4d7jJM/bE2MCVMksAxDmoMtr6U+nnv3JXu0kHW5cCw5XN05IYf UEiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4bNX4611c68uTPwlDqh0AwoeptlDyMNJDpCMpisti+U=; b=d5U1YXkIz+bQAUacGu09p583wAMg59+iUApLXwmSXD04wEsX0L0WIq7gGabjDKzKa+ urcHU4gDEtnHf2dC1Xe4pE4xFDG5YnjxTfm1/IIag4PWIhVAa2PNYymXERFrsWyfWXPK zG7P2IHgcFBfgESY/30/hkasZEzDT01TMxnGiHm1/vsp/oL4QhO02ddFtPueX5w4/6ip tT3CP04vg0SU/RJ8IkbYfhnn+z281Th5Y1+pwB5Da7Uc0n0MpkOhRHc/wiRW8ndEnWsz XbhKEa2i5H0eXWeQTBK5GLnBYbrsGJB8q/8stAjKKD7+LcyHA+yl22Q+tRw/ooTw4RO4 OK5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=repA3BNU; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p25si858495oto.191.2020.02.06.18.21.13; Thu, 06 Feb 2020 18:21:27 -0800 (PST) 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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=repA3BNU; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727303AbgBGCT7 (ORCPT + 99 others); Thu, 6 Feb 2020 21:19:59 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:45179 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726597AbgBGCT6 (ORCPT ); Thu, 6 Feb 2020 21:19:58 -0500 Received: by mail-ot1-f67.google.com with SMTP id 59so675644otp.12 for ; Thu, 06 Feb 2020 18:19:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4bNX4611c68uTPwlDqh0AwoeptlDyMNJDpCMpisti+U=; b=repA3BNU8ntMmnv8TjrpEXQJYxL5dZe64rkBCGIJiTUOpJ30PucDwFrQHjkbWbbVlh kqj6hAN1Lr47QyPyFDBvom55wVefzJhj3bqFR88zHyhMbXA8o+7Ea2swJ3cRaHyyvWtu GRqE5Xo2lNjzlVFpVsEfSuJz1hJ191Yi6GjOwxCjb7VS2gz4y0L9G3EjLZsyQRuJNdOJ 2ItaiJQ0m/06GVvsSbh88b/NL8TVu2WC5WGBEnpqY+UR7Ao3RpDX/yVcntNwTKnLFd1n 8UJjUT8W3xFhVWHiutMllEoPZA6f992LvEcG8CBWTBch6lTqsbxHf4OivobD8SG9sKfU 72zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4bNX4611c68uTPwlDqh0AwoeptlDyMNJDpCMpisti+U=; b=aTxtWjZxp9So/lHYeS4Kw/Cwj/S6YO0w2v00L9LR9wFX08iivovRccvj1T9wthzKS8 PEkkZW6nEKAcis0LjXuFA1uBX7PJIg/SbBRibF3CEKoNkg+iThiMKkoh4Kl1wQV/6fbp KGB0dYeTuw3+poQv1CfVYrM5MVqODKs8thwZVAikYzT8yR+Me+DHnjKboxhIaWK9Bd52 qXKeunrqb9iy3UnONnKlGHrTTKR++vTnpCj8nec6e21LEovppOqtf5NpLGbTQIORkDkY +J23rozGbjDcD6gjKAHXavbNdEQYTGWmOn1rBhbimtiFqAoeeyrPZYs1EEcix6zmIKXs 1tig== X-Gm-Message-State: APjAAAWpkGFU7OQTuiBzcVz4lVz2kRwzG7gIxMvBABnVdYiXWiLy9E5S xyftexuf3wsICeK+qCW2URtcm/P/BFl0enmSxEZhIw== X-Received: by 2002:a9d:64d8:: with SMTP id n24mr865991otl.71.1581041997813; Thu, 06 Feb 2020 18:19:57 -0800 (PST) MIME-Version: 1.0 References: <20200206231629.14151-1-richardw.yang@linux.intel.com> <20200206231629.14151-3-richardw.yang@linux.intel.com> In-Reply-To: <20200206231629.14151-3-richardw.yang@linux.intel.com> From: Dan Williams Date: Thu, 6 Feb 2020 18:19:46 -0800 Message-ID: Subject: Re: [PATCH 2/3] mm/sparsemem: get physical address to page struct instead of virtual address to pfn To: Wei Yang Cc: Andrew Morton , Oscar Salvador , Linux MM , Linux Kernel Mailing List , Baoquan He , David Hildenbrand Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 6, 2020 at 3:17 PM Wei Yang wrote: > > memmap should be the physical address to page struct instead of virtual > address to pfn. > > Since we call this only for SPARSEMEM_VMEMMAP, pfn_to_page() is valid at > this point. > > Fixes: ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug") > Signed-off-by: Wei Yang > CC: Dan Williams > --- > mm/sparse.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/sparse.c b/mm/sparse.c > index b5da121bdd6e..56816f653588 100644 > --- a/mm/sparse.c > +++ b/mm/sparse.c > @@ -888,7 +888,7 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn, > /* Align memmap to section boundary in the subsection case */ > if (IS_ENABLED(CONFIG_SPARSEMEM_VMEMMAP) && > section_nr_to_pfn(section_nr) != start_pfn) > - memmap = pfn_to_kaddr(section_nr_to_pfn(section_nr)); > + memmap = pfn_to_page(section_nr_to_pfn(section_nr)); Yes, this looks obviously correct. This might be tripping up makedumpfile. Do you see any practical effects of this bug? The kernel mostly avoids ->section_mem_map in the vmemmap case and in the !vmemmap case section_nr_to_pfn(section_nr) should always equal start_pfn.