Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1099686ybi; Fri, 14 Jun 2019 08:37:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSP45+MgrmBaRjMQy1ItZ0zaPU8fcvsDSmEPJdmptUg1CvyVfFXJg+2rFE5TZt2ulPvrIK X-Received: by 2002:a17:902:4124:: with SMTP id e33mr56350713pld.135.1560526625885; Fri, 14 Jun 2019 08:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560526625; cv=none; d=google.com; s=arc-20160816; b=sgNTPHQgvSwPZ+wNCxYa557Us/cCQUP6H2PtMz4vPRDLeuIGAGTDE+YPVb6uk2f/AV 1fmdBsssVWnRF8p0PYVKIjsShuRLFabgwop6s64wDXjnDIMr2ASoq070Sbw7DurxM5fx 3XhjIxqeIW7tcfGxVv8fw+aiFL0m4rFTk3h+y1i2y1ADIGfEiykK/n2o+lK6xqk74W1S Bmv8W5wTzJo4GPjXPmhNJR40fCb0Tx8WpWnSXAlnlwzwwkukqbGuUGWUioj7mwH9fR9r wMPTzYMvTuzng3zwcIvPLd0aL/th1P6xclxZtzsVUV+ES7sKNZB88tJxQc3DcZdO1+UF JmJQ== 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:message-id:subject:cc :to:from:date; bh=iitiSONiOt/KeScHjUeGXfdj2CqUz1GvYKXpCZFQaww=; b=ce1dPNwq9xECPGcJCIKtxt/CfYfWhqbtVFT8a76NGSHB3ezo8PaVt6oCZWlS0f2VIJ NM0xDEzGpwvgSVgivbY8b9SrZWBI8NsL6E+a/9nIhPrHOYp623LNicAIiNYehhOeIRkm UC3pHf1AnsULtqfYum04YGmEUhu+SbLFAdzMgqvqSk3BL6Uea/UI89TWI+Tlj/RKJ063 9HRiJwC4l/GUlFod1/jIQZPNx/nLmTcFsnJE7bvdY/wXDUQoTgk62EBJN1P0wLaQ76oq ctUAt577Bpo0eQ0SpbJB5pzPALujAS1hLc6adbz9MLk0nabiWP5hnV4o8AHF2p4eI1Ug IcNw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m6si2899955pgr.40.2019.06.14.08.36.50; Fri, 14 Jun 2019 08:37:05 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726758AbfFNPfo (ORCPT + 99 others); Fri, 14 Jun 2019 11:35:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:56128 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725780AbfFNPfn (ORCPT ); Fri, 14 Jun 2019 11:35:43 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E91E2ACAC; Fri, 14 Jun 2019 15:35:41 +0000 (UTC) Date: Fri, 14 Jun 2019 17:35:39 +0200 From: Oscar Salvador To: "Aneesh Kumar K.V" Cc: Qian Cai , Dan Williams , Andrew Morton , Linux MM , Linux Kernel Mailing List Subject: Re: [PATCH -next] mm/hotplug: skip bad PFNs from pfn_to_online_page() Message-ID: <20190614153535.GA9900@linux> References: <1560366952-10660-1-git-send-email-cai@lca.pw> <1560376072.5154.6.camel@lca.pw> <87lfy4ilvj.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87lfy4ilvj.fsf@linux.ibm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 14, 2019 at 02:28:40PM +0530, Aneesh Kumar K.V wrote: > Can you check with this change on ppc64. I haven't reviewed this series yet. > I did limited testing with change . Before merging this I need to go > through the full series again. The vmemmap poplulate on ppc64 needs to > handle two translation mode (hash and radix). With respect to vmemap > hash doesn't setup a translation in the linux page table. Hence we need > to make sure we don't try to setup a mapping for a range which is > arleady convered by an existing mapping. > > diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c > index a4e17a979e45..15c342f0a543 100644 > --- a/arch/powerpc/mm/init_64.c > +++ b/arch/powerpc/mm/init_64.c > @@ -88,16 +88,23 @@ static unsigned long __meminit vmemmap_section_start(unsigned long page) > * which overlaps this vmemmap page is initialised then this page is > * initialised already. > */ > -static int __meminit vmemmap_populated(unsigned long start, int page_size) > +static bool __meminit vmemmap_populated(unsigned long start, int page_size) > { > unsigned long end = start + page_size; > start = (unsigned long)(pfn_to_page(vmemmap_section_start(start))); > > - for (; start < end; start += (PAGES_PER_SECTION * sizeof(struct page))) > - if (pfn_valid(page_to_pfn((struct page *)start))) > - return 1; > + for (; start < end; start += (PAGES_PER_SECTION * sizeof(struct page))) { > > - return 0; > + struct mem_section *ms; > + unsigned long pfn = page_to_pfn((struct page *)start); > + > + if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) > + return 0; I might be missing something, but is this right? Having a section_nr above NR_MEM_SECTIONS is invalid, but if we return 0 here, vmemmap_populate will go on and populate it. -- Oscar Salvador SUSE L3