Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp503256ybv; Fri, 7 Feb 2020 03:28:35 -0800 (PST) X-Google-Smtp-Source: APXvYqz2f3bnrARskI3LmnKsifY05wiigacTL+4tVRn3xWAXU9j+vAFTIj6xABlOO2WDjKw6tRFq X-Received: by 2002:aca:534f:: with SMTP id h76mr1725494oib.23.1581074914888; Fri, 07 Feb 2020 03:28:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581074914; cv=none; d=google.com; s=arc-20160816; b=li1GgoN051jmhTgPpzKYal2DmUG24FqyKEaappsO4YlE6Wfri5BdHWZsHRxgNzvDaX E/zFinGLDwCUO/4v+DdU6vetaQTemjozNH3vHdGdgsGWPaOihh7utO5dbV+OusQStm92 5v7kWhKTSCoNyIqqbkHsGv+2rCS+DReCrwFiHzUGLqqroS0tSyMr2UTr2xCchszOFZ74 O4BbpNxqaoKpaO4UOebaXd0FHW1y3DxZvFVxPO6fFqG4KHS/BXyynOFFJAQULDBfPHn0 YLYdbApBKVjT6wMQzDP61l0TsO+/HVb4jPpLHiY24JiWQDGaBWPL5MxMxvxaXk02pY7m mBoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=SMZrIsF6ztKLhnhRtzZ68+A39XQYu+eA8LHmISXlFc4=; b=m6rosej8AEUH7Ag0ctJeArImUBEnefOVDRfDraZgVb6XQ4m5cB9RYNnF0xJXAUSO4q ob7CQsHMW2w8ubGiStcbi+1q+EfEbqwJqWf+lO9rQ+lGeg+6H7X6s4XBheTmmWWUdOVl etvTvkhISqWS7mSBY6B6IO9zGkBPbYnef310l/fTiYKTBEnCo2H2pGrqLd1TTvF9QTKN 5+6F2LNftKBB/aB/DWFf5pLG6S8E4hRDmBtmX5FaACJIkx5uEzWfAXqNGJxbnS/6YVd0 1ldcEwFJ0N7pYgbwdT/3wm2ohFhRffapAxqDCTVwS5i2xqOKB8kxf7Khp8DEGMEl9YfS Dv7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IP5MZFON; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u132si3716542oie.250.2020.02.07.03.28.23; Fri, 07 Feb 2020 03:28:34 -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=@gmail.com header.s=20161025 header.b=IP5MZFON; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726974AbgBGL0g (ORCPT + 99 others); Fri, 7 Feb 2020 06:26:36 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36726 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726798AbgBGL0f (ORCPT ); Fri, 7 Feb 2020 06:26:35 -0500 Received: by mail-wm1-f66.google.com with SMTP id p17so2364943wma.1 for ; Fri, 07 Feb 2020 03:26:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=SMZrIsF6ztKLhnhRtzZ68+A39XQYu+eA8LHmISXlFc4=; b=IP5MZFONMBrbwfIgvl9IwOOPxC8oklm3zpsWll8sVbpP5n1tJZID0WfNhYy3cKk2zW aCFCVlhKruDaJa4g9yk5T4Sdc02DGfbXAlx+RhKiquVng2PaemoVYHgsh0r1/Hfaq1yS 2fPmOU35xZHtze7Ko6Y/gWeRAKi/+m3UdWQ89na0i2gnn3qZbYfkfitNIFw2k5ZJeowm 6aOnGPEhVhVjjsto/yrjXzRjMrJw1rkJz4EvafhiFNxSl7s+52AmL1E9peo/wVkZrQOD f1EwjXyzyjqv1tec/FDuTrt7T3HMBRlgTLdIivveBpG0AOBWweBt8n6hjESCQEUfnBL3 F8DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=SMZrIsF6ztKLhnhRtzZ68+A39XQYu+eA8LHmISXlFc4=; b=Ao4FVyQledP7YjDHk9b2Xq/UF1gXVT+U+QOJ/KDgRaUfBugz9koJ8i+Y2ZVjFwCsSr 8sFJ3BlVSQ5nARyQO8iHun8htukXxfBjbWkgkw9N0xqqBP1fFjs2Bj7MyCzh1L75ZTE1 zmjtBa7ps6niQsK+cT8gaxkSzmZVMlfu8qxFX/CRvwxk+UuDk521OXDyFVdhqEXZ3IM8 GrBcGAO8rFjeVZ28O9r8SLt2HKgOondMf1nVot1PP+I+0JQAyIvqCdwSvj9l68FKWwm+ XlkOoDu4GYuiEGAD8Vb32na+a2xoFXnLzc8p9l2epGFgkPNllzc8neoljJmLemckgWcC sh5Q== X-Gm-Message-State: APjAAAUbFYEXlw+qxKlPdT4r1r1AAjnpcNJ/hW6aVlaaFaMB1EM+ZQjg ey25sr7S6RR7PAA/EK+ToyY= X-Received: by 2002:a1c:a514:: with SMTP id o20mr3931782wme.179.1581074793758; Fri, 07 Feb 2020 03:26:33 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id v14sm3109117wrm.28.2020.02.07.03.26.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2020 03:26:33 -0800 (PST) Date: Fri, 7 Feb 2020 11:26:32 +0000 From: Wei Yang To: Dan Williams Cc: Wei Yang , Andrew Morton , Oscar Salvador , Linux MM , Linux Kernel Mailing List , Baoquan He , David Hildenbrand Subject: Re: [PATCH 2/3] mm/sparsemem: get physical address to page struct instead of virtual address to pfn Message-ID: <20200207112632.5inklkwyiewhrd75@master> Reply-To: Wei Yang References: <20200206231629.14151-1-richardw.yang@linux.intel.com> <20200206231629.14151-3-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 06, 2020 at 06:19:46PM -0800, Dan Williams wrote: >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. I took another look into the code. Looks there is no practical effect after this. Because in the vmemmap case, we don't need ->section_mem_map to retrieve the real memmap. But leave a inconsistent data in section_mem_map is not a good practice. -- Wei Yang Help you, Help me