Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp155216ybv; Thu, 6 Feb 2020 20:07:00 -0800 (PST) X-Google-Smtp-Source: APXvYqz7nrS/PKIU8V3Azg9YGJV2FaHQ2Ts+ajZRCc+N/mB1hqOGkua3QduHoaM+eMoRSghlLA19 X-Received: by 2002:a05:6830:13da:: with SMTP id e26mr1106508otq.97.1581048420186; Thu, 06 Feb 2020 20:07:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581048420; cv=none; d=google.com; s=arc-20160816; b=o51ViPRRXbzaYr+Hy5mocqEC8+L9uZragYlfl5wddAeTAUAgFYClWm9f2bEMZL9+2k 2E0opSA6or1Wp5JKeIDMMcYlFZSnMddv4hPcK4DbEcUlwMhgcUWQHum8rfkFAJqgcGz2 dP67NedDqGVkH5k1ZPRlZTHVM1CAq0wdZyuAIDb6NRD428WuQDybe++qpgqqao6TEeIQ cg6CGD54PHnOqC0+XmK/utcS8J6EtKkIAIgjWOn9IObj0Ss6LBGoGweGBAKH8mUmd6UZ bHLToG1f4MBJMividpNZAopBB1ewgEgcDfoGq82fzoACAx2QUt1nV4rOOsXvvsfmxgi8 UshQ== 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=cpd417pmla8xBu1RjMHRvWNYHG4LX3DmsJ9QusfXKc4=; b=jf/sxcM03vDcahor+td5uValGm6me/IWV3PpuGqXkSX3xiETJg1pfX69OzNHwgVun4 obscgaBmNWp1AOjyBirdITyTZ7nA34zWSNLgboDt2uwR7k8l3lcpiwgieS6Dc3ESC4fI eL1f+r9CmuySq5mw8zWSQec1z6ym6UZhmTrTnDBDWO8l2f0wavcoxLEZRLsUMdkM5e5S K3cvDBAS1nG5iDKGlZqbfcRc6jUJgxVokJ7Fve6W+fnWGS7dpzjUkIyMJSbzWb1nqF6E FfAb8Un5yIeNLwWmheuD/tg7+AT+DtA38NjtiLECJQI6xNqKZT/AHYPZ1Anc1zbdwxnN j3jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b="1rL8Wdo/"; 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 l11si1013855otn.189.2020.02.06.20.06.41; Thu, 06 Feb 2020 20:07:00 -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="1rL8Wdo/"; 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 S1727123AbgBGEFt (ORCPT + 99 others); Thu, 6 Feb 2020 23:05:49 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:38801 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726674AbgBGEFs (ORCPT ); Thu, 6 Feb 2020 23:05:48 -0500 Received: by mail-oi1-f194.google.com with SMTP id l9so761462oii.5 for ; Thu, 06 Feb 2020 20:05:48 -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=cpd417pmla8xBu1RjMHRvWNYHG4LX3DmsJ9QusfXKc4=; b=1rL8Wdo/5eIm7IoF28G2FUHnSYk0XpmnaHZzJWrYUvY+Tm2f0F2zJmDp8CfFxmEGjL pnzS70GtljKulQZGbhcBvJJDgkhx3+bap+isASnFzIpyrB26goh/03igzV1b6E24z7Dk dqujhitlEXnHYWPI5fuaWE7LiGvCTPzkoZGt845Ftzg09EelaKpXzZ4nClqujuskgQo2 WZ0GK7DsHBhg+7naaIoaxKbDBpbNdFo3t0Ev43wfqgtoCjH9WQ/dtf+yqn2RCkqVQ1K+ +yf8xQEAVnPTDNpdkee14SUSovbqXaDaO6mrt+ASppf/yP+pBtUai08+KOhDKtXbBTZR UD0w== 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=cpd417pmla8xBu1RjMHRvWNYHG4LX3DmsJ9QusfXKc4=; b=AVSUvMOsUVHoAi7eyL2imd4fP5LuNZEOqdQ4NtW8ctiDDmC1X//BOaHSOSMQraMYdU 3RJf3ixlkG/FW9WvyPs9XLvRM3fyHOmjTHeb+rTKpgroiGJpOTnqEl7+lMbEfDG1zAPT 3pFhEajV+ALxrD/X7vHyFDxGU9ZFoKNfIo6Cx3009RQvrF5rUG0t4vAJDihI3ojRkted 9o/s5iry93wRW1jTsA2qxIBlDcD/nIAsirtaYGnO8nSeelQ+P8q1VnZ6pfhpRtE0Cikc 9g34C7ip4gpJJlmE4RVBWU7BbIrvUZfAWiOc2if2RQklXtj0uaIzDRYhJITvMKirm/wr n7OA== X-Gm-Message-State: APjAAAVJxXO6MGL3UwETfY3EsltO62c1jTw0AOAphIAL57RKEpGOaBVE L6LstV9iMDxbSKgBBZruvSLKtYfK5zxlomtaT4JZbg== X-Received: by 2002:a05:6808:a83:: with SMTP id q3mr850210oij.0.1581048348209; Thu, 06 Feb 2020 20:05:48 -0800 (PST) MIME-Version: 1.0 References: <20200206231629.14151-1-richardw.yang@linux.intel.com> <20200206231629.14151-3-richardw.yang@linux.intel.com> <20200207031011.GR8965@MiWiFi-R3L-srv> <20200207033636.GS8965@MiWiFi-R3L-srv> In-Reply-To: <20200207033636.GS8965@MiWiFi-R3L-srv> From: Dan Williams Date: Thu, 6 Feb 2020 20:05:36 -0800 Message-ID: Subject: Re: [PATCH 2/3] mm/sparsemem: get physical address to page struct instead of virtual address to pfn To: Baoquan He Cc: Wei Yang , Andrew Morton , Oscar Salvador , Linux MM , Linux Kernel Mailing List , 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 7:36 PM Baoquan He wrote: > > On 02/06/20 at 07:21pm, Dan Williams wrote: > > On Thu, Feb 6, 2020 at 7:10 PM Baoquan He wrote: > > > > > > Hi Dan, > > > > > > On 02/06/20 at 06:19pm, Dan Williams wrote: > > > > On Thu, Feb 6, 2020 at 3:17 PM Wei Yang wrote: > > > > > 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. > > > > > > The practical effects is that the memmap for the first unaligned section will be lost > > > when destroy namespace to hot remove it. Because we encode the ->section_mem_map > > > into mem_section, and get memmap from the related mem_section to free it in > > > section_deactivate(). In fact in vmemmap, we don't need to encode the ->section_mem_map > > > with memmap. > > > > Right, but can you actually trigger that in the SPARSEMEM_VMEMMAP=n case? > > I think no, the lost memmap should only happen in vmemmap case. > > > > > > By the way, sub-section support is only valid in vmemmap case, right? > > > > Yes. > > > > > Seems yes from code, but I don't find any document to prove it. > > > > check_pfn_span() enforces this requirement. > > Thanks for your confirmation. Do you mind if I add some document > sentences somewhere make clear this? > Sure, I'd be happy to review as well.