Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5019093pxj; Wed, 26 May 2021 00:23:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznt7l2chZ4dw4U7Fc36ggX5Gsb03ulmR3g9Ew+meEMAWaPKb6W/2rnwAR4feIe7pAzA2Rc X-Received: by 2002:aa7:c485:: with SMTP id m5mr35050715edq.230.1622013821618; Wed, 26 May 2021 00:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622013821; cv=none; d=google.com; s=arc-20160816; b=FItEOUv+gVr/MGkcv6nQ3RVTuHhSK/WTJkWYzEFV5a0bMNd4DpizT2tUHdP0FD0rHX u0zTXCLRFicCugVSKphcJj2DLSNXtyugIb5flPq6vJ3PF+0OJ5vD+hlX39ivTgTWCqUS W92OwQtmh/ww3nqVJOMOEYRwzTLCBkSDXLmvPVTOVuk8MQHoyWM0TXL/db7osQEXkCOp ojXJfMM+cWi7wG6oJShn5/9HnROSQPeTpLMDmbZnxMbholvaYKgoxES7GNsQLCt8c5TB 7LacINwI4LKftV6FG+euOCSdzBsys4DIsD0lc5b7Lc+vEKQIdivC8reC7XgfA1NSSZNS Zcyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=Hu6vbJEUfSy3xVjpGxE3b+lLzlhlYDxtyQ/EIyQiosc=; b=YRtX7JWf/Sbctt1grCj7Xrav6tYCddNIIycyWsKyWwDhJR0M28ys+eH9EEQROVaBI/ yD0cd7dhEBkCXqt39gLZnZ1g07YRij9/V3N2A+ljG2qTNLguRdQsIh3t+Ac2jbWytiqh uIT3R7UT3sXCmdsdDJilwD/MmLr8cZpb5l1PBEwapK6Zr/b4/T8/k9OIwPdVtirxt/pX GSqshcspcC3BOp/SIXtY4NkOX724uORnX5h+1w4TppZ0Q+6SjOfJmQ2eFEZGPY24z/76 Aq9ypzeHQt94IchJoWjnA240qyq9JlmguE2uVUwrfigHGcOCPj1R77V89u0jKaJZxS3s XTqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=G5yhKDNp; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=9ad48l5y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t11si11732319ejs.673.2021.05.26.00.23.17; Wed, 26 May 2021 00:23:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=G5yhKDNp; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=9ad48l5y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232942AbhEZHV6 (ORCPT + 99 others); Wed, 26 May 2021 03:21:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:36980 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232869AbhEZHVy (ORCPT ); Wed, 26 May 2021 03:21:54 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622013622; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Hu6vbJEUfSy3xVjpGxE3b+lLzlhlYDxtyQ/EIyQiosc=; b=G5yhKDNp4+PYobmOwje4fpv7dLvBBCDMWYp+HvxTy6mZ7UVgUMcSSGO8vVm3DY9BZd2+8Z HEx0kEFGrGhize7XgHogHyS4f4PnNOK2AvnPrM0xPAebbh/H9zEElNCZjZ0NQHXmr/JhQa JSzjw6PtgeHkGxEtNZqqakhQprDWsVs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622013622; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Hu6vbJEUfSy3xVjpGxE3b+lLzlhlYDxtyQ/EIyQiosc=; b=9ad48l5y2ubiKXhnRbjbhg/s79jT9taB+Gy1te+fdt3OQQbBDEIgQdu3/e4u50XotLDFAo S//S+53jARk2H2Bg== Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 47DAAAD54; Wed, 26 May 2021 07:20:22 +0000 (UTC) Date: Wed, 26 May 2021 09:20:19 +0200 From: Oscar Salvador To: David Hildenbrand Cc: "Qian Cai (QUIC)" , Andrew Morton , Anshuman Khandual , Vlastimil Babka , Michal Hocko , Linux Memory Management List , Linux Kernel Mailing List Subject: Re: Arm64 crash while online/offline memory sections Message-ID: <20210526071948.GA30891@linux> References: <8e0dc9de-6834-72aa-364c-50ce1c717437@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8e0dc9de-6834-72aa-364c-50ce1c717437@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 25, 2021 at 08:12:22PM +0200, David Hildenbrand wrote: > diff --git a/drivers/base/memory.c b/drivers/base/memory.c > index b31b3af5c490..6e661d106e96 100644 > --- a/drivers/base/memory.c > +++ b/drivers/base/memory.c > @@ -218,14 +218,15 @@ static int memory_block_offline(struct memory_block *mem) > struct zone *zone; > int ret; > - zone = page_zone(pfn_to_page(start_pfn)); > - > /* > * Unaccount before offlining, such that unpopulated zone and kthreads > * can properly be torn down in offline_pages(). > */ > - if (nr_vmemmap_pages) > + if (nr_vmemmap_pages) { > + /* Hotplugged memory has no holes. */ > + zone = page_zone(pfn_to_page(start_pfn)); > adjust_present_page_count(zone, -nr_vmemmap_pages); > + } > ret = offline_pages(start_pfn + nr_vmemmap_pages, > nr_pages - nr_vmemmap_pages); > > > We must not touch pfn_to_page(start_pfn) if it might be a memory hole. > offline_pages() will make sure there are no holes, but that's too late. Yeah, definitely. I somehow didn't think about holes when writing that. Thanks for catching it David. Would you be so kind to send a patch? Thanks! -- Oscar Salvador SUSE L3