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=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 CF77FC35250 for ; Sun, 9 Feb 2020 14:27:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 74F9520715 for ; Sun, 9 Feb 2020 14:27:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ThKJiHos" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74F9520715 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0572F6B0003; Sun, 9 Feb 2020 09:27:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 009C66B0006; Sun, 9 Feb 2020 09:27:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5F716B0007; Sun, 9 Feb 2020 09:27:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0101.hostedemail.com [216.40.44.101]) by kanga.kvack.org (Postfix) with ESMTP id CF5796B0003 for ; Sun, 9 Feb 2020 09:27:26 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6B7DF8248047 for ; Sun, 9 Feb 2020 14:27:26 +0000 (UTC) X-FDA: 76470816492.15.root59_6218a2dbc8429 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 3D465180A703E for ; Sun, 9 Feb 2020 14:14:35 +0000 (UTC) X-HE-Tag: root59_6218a2dbc8429 X-Filterd-Recvd-Size: 6457 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Sun, 9 Feb 2020 14:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581257673; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4hBqjd/FAVjHir+ITJ6hd97Lc17HSSkZXXKYu6Uyubs=; b=ThKJiHosYyF6zWB38y+JtIqSo1mFj7hZJm6qftdy0W34uKyB4lldlJ+ROv+jd6YRfVAuGN thBoyuQLo9yN+aD7YwxqnCJz68l9IkS3j3KkNjWIlV2RJ5pbCRQsZ01mtx1iqHE8Wu5No9 MQSYVFYsXBPW+fo2EqjyzfEmJSiV1+Y= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-87-R_VWHwSgPWydHahw3C1Erw-1; Sun, 09 Feb 2020 09:14:31 -0500 Received: by mail-wr1-f71.google.com with SMTP id w17so3249905wrr.9 for ; Sun, 09 Feb 2020 06:14:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=813s76S6mX/ZPXrvvTupXYay1h8zH1+OICdcpr86wfM=; b=ALeF7mp9MR4d3sADSr9Tv6ynXwgX9PzXN87nkXPgxlQXGMRZRcjCccwyrgq117+npu lU8IvXI10rDQqsIJkcrsDAeG8LQSJbQl5hYwRYx5eysoP65TgEtHKoks2yWDwMMjgyeT kYLMBtQmQQ0M0l88CXZKPeZoVgVASGzzU+Ehx2lDg1rJFyDt/2c/RwwaPVy7VHB7vEoH tCAIK/y1GD+48PIka5FvyUwETEAsndtlZkjWRKNas/+Ueum/WODDyh8B3DyWVxS19s41 +Ger7l4xHCBjDGdm/L4wYbi/jjBCME5vfPUS6EzicIqpOuUoFE8FQ7OD7DKvHSs1app0 BYOg== X-Gm-Message-State: APjAAAXSrHYk6jziUUPpBJsUfZvywKdTmJCsg7eKODTMYJRQ7XDvj0pu CYRId819bmHC77SoUnvkcLEDqs2lBY3Y0zQhV1qMc8MngUY8H2qIVWpVPE1NNkGDUcgjZsZQimg Wf164hUZgcrc= X-Received: by 2002:a7b:cb49:: with SMTP id v9mr10208420wmj.160.1581257670899; Sun, 09 Feb 2020 06:14:30 -0800 (PST) X-Google-Smtp-Source: APXvYqywWLeCJMBRdhe4PAzltDrfZmYBKWl+x+93v2t0WrtYuOGkM04/aaempW6pNrI0HoPra/JtKA== X-Received: by 2002:a7b:cb49:: with SMTP id v9mr10208397wmj.160.1581257670604; Sun, 09 Feb 2020 06:14:30 -0800 (PST) Received: from [192.168.178.65] (p4FE0FDD8.dip0.t-ipconnect.de. [79.224.253.216]) by smtp.gmail.com with ESMTPSA id d22sm11721121wmd.39.2020.02.09.06.14.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Feb 2020 06:14:30 -0800 (PST) From: David Hildenbrand Mime-Version: 1.0 (1.0) Subject: Re: [PATCH 2/3] mm/sparsemem: get physical address to page struct instead of virtual address to pfn Date: Sun, 9 Feb 2020 15:14:28 +0100 Message-Id: References: <20200209135015.GX8965@MiWiFi-R3L-srv> Cc: Wei Yang , Dan Williams , Wei Yang , Andrew Morton , Oscar Salvador , Linux MM , Linux Kernel Mailing List , David Hildenbrand In-Reply-To: <20200209135015.GX8965@MiWiFi-R3L-srv> To: Baoquan He X-Mailer: iPhone Mail (17C54) X-MC-Unique: R_VWHwSgPWydHahw3C1Erw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: > Am 09.02.2020 um 14:50 schrieb Baoquan He : >=20 > =EF=BB=BFOn 02/07/20 at 11:26am, Wei Yang wrote: >>> 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: >>>>=20 >>>> memmap should be the physical address to page struct instead of virtua= l >>>> address to pfn. >>>>=20 >>>> Since we call this only for SPARSEMEM_VMEMMAP, pfn_to_page() is valid = at >>>> this point. >>>>=20 >>>> 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(-) >>>>=20 >>>> 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) !=3D start_pfn) >>>> - memmap =3D pfn_to_kaddr(section_nr_to_pfn(section_nr))= ; >>>> + memmap =3D pfn_to_page(section_nr_to_pfn(section_nr)); >>>=20 >>> 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. >>=20 >> I took another look into the code. Looks there is no practical effect af= ter >> this. Because in the vmemmap case, we don't need ->section_mem_map to re= trieve >> the real memmap. >>=20 >> But leave a inconsistent data in section_mem_map is not a good practice. >=20 > Yeah, it does has no pratical effect. I tried to create sub-section > alighed namespace, then trigger crash, makedumpfile isn't impacted. > Because pmem memory is only added, but not onlined. We don't report it > to kdump, makedumpfile will ignore it. >=20 > I think it's worth fixing it to encode a correct memmap address. We > don't know if in the future this will break anything. We can have system memory and devmem overlap within a section (which is sti= ll buggy and to be fixed in other regard - e.g., pfn_to_online_page() does = not work correctly). E.g., 64 mb of (boot) system memory in a section. Then you can hot-add devm= em that spans the remaining 64 mb of that section. So some of that memory will be kdumped - and should be fixed if broken. Cheers >=20 > Thanks > Baoquan