Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4711292pxj; Tue, 25 May 2021 14:39:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5Gs+6I2jsZcW043MAJYrsw9mCvEDueCgXO/oWM0uP32vkCQ8AVirqRz23ZBqwexZYkn7s X-Received: by 2002:a05:6402:684:: with SMTP id f4mr35090876edy.25.1621978742393; Tue, 25 May 2021 14:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621978742; cv=none; d=google.com; s=arc-20160816; b=YrXSkRRfYlN0wZdLERmUrrTD9T1gqaQDmQb7ZsYSSaNGcGG1/g6ba86xShe6q9ci24 ArN1dA3LFHKwgz0uKAT+d4oA6RLsbZ5rfShcgLDfwVvxeFcMGCOovyI4Kk3LTOQIp68n X2e0T4IMp/5K9O92zrTHzIpjx31W5M/VxZBc7EoaTjYy8dOjMDgmF7bIVP5zmEbxAhAD VPbCdFNvxXlwPukb8zevyetHXvXPKRBE2EV8/DSGlLJDXcEOXxA/sF9GLBrF589lHSAJ NGsZGHtkmj535d3g04jjxeRdqAfPnJ7cl7N5v5q2HqgZrCVUaM2A6/zrRtN9fl7dAMGK jaRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=1WHkrjtXA494SlCEhN3Bx7hSUV7AdTJw4XPOhexNR20=; b=kbNice3fHO/+sIRBceVSsk4RScyqInfgD5fe2VV630xELJt5Ua7sbJ6EBdZQncR8/X D5Tjmdl/+UZ2KGtyjTQJTULMHwRXxWtHPvISNJarkqrWpbSqC0yb4YzuoZ2yfDzJV4vH f7ty3aJfLZfMvdkoIfKf4vojQq8HQS8FCBJxs4Tth/APQabcAMqbofq2sCV+SLzvuUR2 y6l9qhKFvz69giNXF2kghpdHlSxc417ptRyrn84eD03AohaIBLGwbjm4Sfp65jciVQx5 lWJhEn4NPKD5DnHT1EBUuEPk6qSKiGtvM9pbE4P5r8FLU8SnoOFYA6/jgxLk1sloKhnu +kAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NZpQK03H; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si15276240edw.467.2021.05.25.14.38.39; Tue, 25 May 2021 14:39:02 -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=@redhat.com header.s=mimecast20190719 header.b=NZpQK03H; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231190AbhEYSN6 (ORCPT + 99 others); Tue, 25 May 2021 14:13:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31359 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229819AbhEYSN5 (ORCPT ); Tue, 25 May 2021 14:13:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621966347; 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=1WHkrjtXA494SlCEhN3Bx7hSUV7AdTJw4XPOhexNR20=; b=NZpQK03HNZkGegEdeH5P8r1ftu/JSE5wZG3ejlwCrw/BEQVljF7/CtSA1eTViJcgLCccdN Yn0Q+Jg7TtwPJnvv7mTZZbjf+jTxwBN/1avHmDkN8dehS4JIU3jaykakSFHpZQKL685XVG FIYJsqoXflBfCMjnI7MOQxZEVyngjSU= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-Awb3jrR6O7u0aWCI59JC6Q-1; Tue, 25 May 2021 14:12:25 -0400 X-MC-Unique: Awb3jrR6O7u0aWCI59JC6Q-1 Received: by mail-wm1-f69.google.com with SMTP id z62-20020a1c65410000b0290179bd585ef9so3857573wmb.7 for ; Tue, 25 May 2021 11:12:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=1WHkrjtXA494SlCEhN3Bx7hSUV7AdTJw4XPOhexNR20=; b=kjxphca50aL35QBOfjIcqdbfs75S+e7O7IAaobhPH0eLFcgyoukZTqCLVHig7Ywioe U857/+kFiakxQDy5f3VkkEdylRcUr+OWnyUZ90FX1yB48h6f6HLw5e0ZYVTaxQY9YwXk vmIellVjMVtkAKkKC0U7sgFYeE/9NT/zutiesf9gDS85mj/wu4guIysiqH8jr+GZ+ZGk S0ZazrbrM/Qtj3eUXQtGGN0rZCL+QPou+DkIC7vHpyiRbDLDNNTJSuEq8xmZO7AyAEmp 7sSS+ofZeXvvcNe49fe6fDv+ufrOahjNGxlUF47AtJ5F+fnPi9AQoi6xPnIHm35GjPZA dQ+g== X-Gm-Message-State: AOAM531ckuQrBHhKqvVVG/as+prm7H9xg9GeUXdtzG7XI5z8F/bLmtLS 4Jq/NTgKYxAxNUoIzVyNb1a/KAMLLx4tPI1Yra1PP3LJx2IP5NvemCCC5XjwPPqjzr8ZCYSbVh1 0rX9ekeMhhHISE/IMAdkRu7LHV7QRs2cc20plo7bBnF5EW/lDn+3NerDSjKVAHbK4ZQuZbvbM X-Received: by 2002:adf:f0ca:: with SMTP id x10mr29536281wro.40.1621966344173; Tue, 25 May 2021 11:12:24 -0700 (PDT) X-Received: by 2002:adf:f0ca:: with SMTP id x10mr29536250wro.40.1621966343819; Tue, 25 May 2021 11:12:23 -0700 (PDT) Received: from ?IPv6:2003:d8:2f38:2400:62f4:c5fa:ba13:ac32? (p200300d82f38240062f4c5faba13ac32.dip0.t-ipconnect.de. [2003:d8:2f38:2400:62f4:c5fa:ba13:ac32]) by smtp.gmail.com with ESMTPSA id f202sm14010365wmf.14.2021.05.25.11.12.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 May 2021 11:12:23 -0700 (PDT) Subject: Re: Arm64 crash while online/offline memory sections To: Oscar Salvador , "Qian Cai (QUIC)" Cc: Andrew Morton , Anshuman Khandual , Vlastimil Babka , Michal Hocko , Linux Memory Management List , Linux Kernel Mailing List References: From: David Hildenbrand Organization: Red Hat Message-ID: <8e0dc9de-6834-72aa-364c-50ce1c717437@redhat.com> Date: Tue, 25 May 2021 20:12:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25.05.21 20:00, Oscar Salvador wrote: > On Tue, May 25, 2021 at 05:57:34PM +0000, Qian Cai (QUIC) wrote: >>> Do we know which patch in particular is problematic? >> >> Okay, the winner is "mm,memory_hotplug: Allocate memmap from the added memory range". >> >> https://lore.kernel.org/linux-mm/20210421102701.25051-5-osalvador@suse.de/ > > Ok, which means that is irrelevant to having it enabled, as the latter > patch of that series actualy enables it for arm64. > Can you work out where exactly the crash happens? > > I will have a look into it tomorrow. > > Thanks for reporting. > I assume the following will work: 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. -- Thanks, David / dhildenb