From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00337C352A4 for ; Fri, 7 Feb 2020 10:51:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BA72320838 for ; Fri, 7 Feb 2020 10:51:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I/ebsK+T" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA72320838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 48DEA6B0003; Fri, 7 Feb 2020 05:51:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 446D56B0005; Fri, 7 Feb 2020 05:51:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 302E86B0007; Fri, 7 Feb 2020 05:51:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0156.hostedemail.com [216.40.44.156]) by kanga.kvack.org (Postfix) with ESMTP id 116636B0003 for ; Fri, 7 Feb 2020 05:51:40 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id ED71F181AEF1A for ; Fri, 7 Feb 2020 10:51:38 +0000 (UTC) X-FDA: 76463015076.19.birds02_65a3e8efa5244 X-HE-Tag: birds02_65a3e8efa5244 X-Filterd-Recvd-Size: 5068 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 7 Feb 2020 10:51:37 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id y17so2100176wrh.5 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=R8W8CAneyv7yIwhOjm9ftCZLlSVjfy/MzogEKO40tOv7VzHrRd3/imJn15F/3cKuKR oO66sHDWhFEmK/P/5UIH0Rbgo24dba37RfrG8qSS1G9zgE4TS8cdeb8MP+E5c2fhfKZs eSuy+FjT4f6YKplEwY+OyrpjgjUPBgMOtIDVbmkK6aHSleGXUXr4I/ry3rPTrCEzsKF5 SFYB22bGOHaNf0b1ear9Q64zYAMVBI6jwqpqk7E0xXwl2Qaz4WiBPhHymuvjQW9b95Fo ZtJdfxpiNrIi2emvu7Hb3FZDfW66m9O4LuXwyLwYGxmzujPqyFvsaHAuXzK+CrHmL4Dt FifA== X-Gm-Message-State: APjAAAU+cdZTiC4+cKO50T+mEC8/Q0SFv+wntb1/2EGNXiOcabDAcZ6y nyNF20suH3hj3ChxI5fznTk= X-Google-Smtp-Source: APXvYqwIKeDyNV4qkwYvgz0z2/KKIj/hgwRYUaTQDF9bezEOpITlkV5MUtAMke/EvdVbGGJ6jQh9ag== 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) 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: 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