Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp472108ybv; Fri, 7 Feb 2020 02:53:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwCtq9hopR8oL9aDUaUEOyLT+WNd/eeLJj+u2wY+2oWiwG60rtFSyCHCk9+9FGs0iM3C3vG X-Received: by 2002:a9d:6f85:: with SMTP id h5mr2187855otq.19.1581072828216; Fri, 07 Feb 2020 02:53:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581072828; cv=none; d=google.com; s=arc-20160816; b=W1z+NMFYPL3FlvK/4bSGXbJWh5PytGDzyhLq90qJWFtQJsDWt5juRJYoQYLFB02aaT wlCxbruNRc1PWE0A1RJJVbkuU8LsGeKSP4pcJ65Jhvh2tchDOVj7ej/DySzdu+4nJE5k FbbKHWwEAAKn8aX2TIjISBM2hbuQR5NNao+Ga4/mS0p02X3VOQBP7YF7dyoOCpuoJRaA LjY/ppB4bONaqCPE6oAIxD70RiuZeCUxX7bjslbd3GjHInARQdPl46Dn8XFm7cTV5Quf WgwS/Vy4oP5tWbMlNPClinmlcIOy6ny6Fvt6FzmPLKWrWjtKs+tUpch9Q1ZNh0PQ8CKa mFzw== 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=Zc3jMaChYZfioTbBOk9kpxLi+oHkdXLRPRb4H8775Ng=; b=iuTuLN27sbWIQ1v2GzqwBBeWm3k7GQyx6ajIO2uDiH5nolpZQjV/gSvU/EP4V/qFpk U6CNwj3RwpjLQTwIz+pNU/sufYG7JJfTdrAf+ouBm24nf3MwAZNgdP68OjA7CHLsvnnT IlBkEABCGNRQm7h69xBYMhhApG53YEUD6V6HWnUbuLp7+yBZ6PBtpxzdzP/Wp7qcR17t /MB18SyBTPVKy/AlQO7BHP3Z6sYCXXqPfUeZhFog5IXYFEoIe++42yWMgIi/WF5UpI// +KOwrnX0wc3TNQzJ/ObXidlhoghq055cgRxeDEX20Aoyn4EHQjvluTbPFpujsfry/w7J 0Fog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="I/ebsK+T"; 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 n186si3640459oig.191.2020.02.07.02.53.35; Fri, 07 Feb 2020 02:53:48 -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="I/ebsK+T"; 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 S1726954AbgBGKvj (ORCPT + 99 others); Fri, 7 Feb 2020 05:51:39 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:39724 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726798AbgBGKvj (ORCPT ); Fri, 7 Feb 2020 05:51:39 -0500 Received: by mail-wr1-f66.google.com with SMTP id y11so2097978wrt.6 for ; Fri, 07 Feb 2020 02:51:37 -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=Zc3jMaChYZfioTbBOk9kpxLi+oHkdXLRPRb4H8775Ng=; b=I/ebsK+TWi7aYsC74HDQmsHiiYDR7MnGLFxe+hHyowxI6oJWDn6uiLJs3HFspDquZT Cmqxt3uF5uL5FWMe6o+KpUX3HoFTucsTgWkTbV83MTUudXADqXfmU9Z+BfAs++Any3iH TOuzamkiD79BVAVq2HXW7ZQNB+ut77pKFCo9PVUn04kGu4+MFMzQK4S97yXXZ48khPMn tc7DZBqRYMgI4JFUPD33tkdAYE87FN9Mrki+rrliR1PfKB/0ebWCfP2cXr9MQ16zItb3 J4nK9/is8w1kbgysfxj1Kw4ZgiHEIZoxdEaBMhvFP+Mrge6HzUybk4z5x+CXtzDnIR/s QXSQ== 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=Zc3jMaChYZfioTbBOk9kpxLi+oHkdXLRPRb4H8775Ng=; b=X0CupoBa78MBNVfnHR9QbiRRY8BoP/7A3FpSsiMbJXOvy2VIhY6gjZFLdZw3lgMsxm DHLb0kjSQ+mYIg3o5LTLCKApj862EW30Znp4hE+IBKffyppFTOhxb+qG4sJD0Bn8tLfj HN531LnOBv1bUP7Qr6MgPQoNoTbJucw1JKzd8pQXgkQ0H7uB5AJvg2gVzq5r5pkoUXhp ab5giva5Dw+Cnb/3xSHVF1Z+VhfJ6M4mDFVxZRauDKbv59CVyY4K5HcC+4Nay3lx/srs bai0r9h87Jnl7ZRV19MfnvMnuPj6zqwhLmGKeOOyFyF6MtDXgYcsbpw5+hgiwz4mZeRd URlg== X-Gm-Message-State: APjAAAW3ZLKVzjzgGh1IvHEjbR5C8GNVDkEKBfi9xUzCehyMu/IKXnR5 IYa4XY8F1+O+EGvpW3Qz+2c= X-Received: by 2002:adf:a35e:: with SMTP id d30mr3816542wrb.33.1581072696736; Fri, 07 Feb 2020 02:51:36 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id b16sm2761352wmj.39.2020.02.07.02.51.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2020 02:51:36 -0800 (PST) Date: Fri, 7 Feb 2020 10:51:35 +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: <20200207105135.cl2kelkrqlift273@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. To summarize: * vmemmap, ->section_mem_map is not used mostly * !vmemmap, we are sure range is section aligned Sounds we don't need to handle this? -- Wei Yang Help you, Help me