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 42E08C352A3 for ; Fri, 7 Feb 2020 11:26:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D656B2082E for ; Fri, 7 Feb 2020 11:26:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IP5MZFON" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D656B2082E 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 3ACA56B0007; Fri, 7 Feb 2020 06:26:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 336E46B0008; Fri, 7 Feb 2020 06:26:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D7786B000A; Fri, 7 Feb 2020 06:26:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0024.hostedemail.com [216.40.44.24]) by kanga.kvack.org (Postfix) with ESMTP id F367A6B0007 for ; Fri, 7 Feb 2020 06:26:35 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A844D8248D51 for ; Fri, 7 Feb 2020 11:26:35 +0000 (UTC) X-FDA: 76463103150.13.move67_73b415d50f64c X-HE-Tag: move67_73b415d50f64c X-Filterd-Recvd-Size: 5163 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Fri, 7 Feb 2020 11:26:34 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id f129so2352077wmf.2 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=WB47xks8wDXLX4EO4Pk0gq6RTnIFCroKmWTba8L8PzOBTLLgjLy4cTmw4DtgqokYCD w2j3Z/kTLFPIvyEdBuSyLo3Qn0MJhTAhK36B40bP2lQaVbQfjm9h3GuqWl+R4JIbPPpu J0Th2qQ9XCoyXqPyUsVU6wvN1bVDKhIPueDBpwyXbqZLpryTLBpyHivfAOEVwyujF/7F gejtBK6DsXI+YNdOiMpoXSGDYnL8iVqdIyjn1fqCiRi/J0DincXVl8i7mEw05r0r5Z0i PR/YlOIGonnRfhTNemZXi3U/tH/J8DvPwznKxM3uGpTeyEuO8qwqSRT14TzW6smAfiFA WUtw== X-Gm-Message-State: APjAAAVzoaXWJoL7n41OyRCxZduYzhkVODFcFWWS5uWIB3SQNd0yfuuU 6hh/Yy2MVz/xM3Sm+8Ycld8= X-Google-Smtp-Source: APXvYqxJqroZC3Qzk4Lf0L75oKPWEeUk2uiGdOd5OzZCjXGAaCKpQz7Hnfv6CFEcIKqG3lNleRP3UQ== 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) 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. 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