Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp710107ybi; Fri, 14 Jun 2019 02:00:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXrSU808MFMmlUwdmjQ59LL/u2/RUpYykisCDlQ8FnIIE9qRIWPSk5ES+g+78gse/7cZB3 X-Received: by 2002:a62:1a93:: with SMTP id a141mr98301311pfa.72.1560502849113; Fri, 14 Jun 2019 02:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560502849; cv=none; d=google.com; s=arc-20160816; b=GF5VK1AVXJmrcDLT3cJ37tk5AB6BoHka2HwaupP8x/3NurWyJJiFwpFHX90/gewxIo UWxEEpbng819zpeNGm6Lqk0/mXBikE+j34BiVogDF5NIvMn4DSJnM+8UWYRUW46OnyGE CjVZ8EvaDpCbVTLBuR4yOkf4j3EwhaPsuML0We46cwZ6t5B+vIr7s7eV0n7H72DKQG6h JYKG8rLmZEKJr8Q1pwsEgmJMUWjLba7rzRURpLNLFL2+AmVWErojj93Sr3Q9Xol155I/ Adkzb5Mf5vkUr+tUoxpPVm9vrx6Bb5DeEBKl6ooQIrbV9mbzKY9WIBc6NDNzpM14VgSr F4HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:mime-version:date:references :in-reply-to:subject:cc:to:from; bh=3cY7snI7yW30fqydwfpeO2RnX8hO+FC+i7/Ga9P8IUw=; b=P9USzuspwxN9r6vQoLy7wt9F/1CmCcyTtZPuAyVYnLT1MWjrA6OAYTNhuy8A8X8D+i WXT8iJ/V4KdLU1EOIfX+sTkrVm42a1dy4vhZBuNwNEoCcKpPFN9RiLWtfLIvEv+5EcQh +gOw8NfuUDczuNLyB0wkkvH2KykgChBGd/qWF9PbZfMHZnIpWt4DgIQf+quQTbFswgED k7kdkgnUj3Wmv+DAp4rQrHVH9A7uUCuJyXTUtDrXUZUMqN3IDfr965dPNboKjlgPL/Bm e7Jf24MoKbyTKrhRsvoDsrhkLtu04VcPkQhWIinvXE6taJT1BJlQbDBNgTNXt/I4ULw6 xb6A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si1853937pfn.188.2019.06.14.02.00.32; Fri, 14 Jun 2019 02:00:49 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726750AbfFNI6v (ORCPT + 99 others); Fri, 14 Jun 2019 04:58:51 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:41996 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725812AbfFNI6u (ORCPT ); Fri, 14 Jun 2019 04:58:50 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5E8vwe7058808 for ; Fri, 14 Jun 2019 04:58:49 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2t48cyrbt8-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 14 Jun 2019 04:58:49 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 14 Jun 2019 09:58:47 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 14 Jun 2019 09:58:45 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5E8wjxc45285512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Jun 2019 08:58:45 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E5803AE053; Fri, 14 Jun 2019 08:58:44 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B175AE051; Fri, 14 Jun 2019 08:58:43 +0000 (GMT) Received: from skywalker.linux.ibm.com (unknown [9.199.60.77]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 14 Jun 2019 08:58:43 +0000 (GMT) X-Mailer: emacs 26.2 (via feedmail 11-beta-1 I) From: "Aneesh Kumar K.V" To: Qian Cai , Dan Williams Cc: Andrew Morton , Oscar Salvador , Linux MM , Linux Kernel Mailing List Subject: Re: [PATCH -next] mm/hotplug: skip bad PFNs from pfn_to_online_page() In-Reply-To: <1560376072.5154.6.camel@lca.pw> References: <1560366952-10660-1-git-send-email-cai@lca.pw> <1560376072.5154.6.camel@lca.pw> Date: Fri, 14 Jun 2019 14:28:40 +0530 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 x-cbid: 19061408-0008-0000-0000-000002F3B1CA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061408-0009-0000-0000-00002260BB0E Message-Id: <87lfy4ilvj.fsf@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-06-14_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=27 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906140074 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Qian Cai writes: > 1) offline is busted [1]. It looks like test_pages_in_a_zone() missed the same > pfn_section_valid() check. > > 2) powerpc booting is generating endless warnings [2]. In vmemmap_populated() at > arch/powerpc/mm/init_64.c, I tried to change PAGES_PER_SECTION to > PAGES_PER_SUBSECTION, but it alone seems not enough. > 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; + ms = __nr_to_section(pfn_to_section_nr(pfn)); + if (valid_section(ms)) + return true; + } + return false; } /*