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=-12.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 24779C4707F for ; Tue, 25 May 2021 18:12:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AECE76140F for ; Tue, 25 May 2021 18:12:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AECE76140F 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 2F52B6B006E; Tue, 25 May 2021 14:12:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2CB436B0070; Tue, 25 May 2021 14:12:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 16D586B0072; Tue, 25 May 2021 14:12:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0080.hostedemail.com [216.40.44.80]) by kanga.kvack.org (Postfix) with ESMTP id D7B866B006E for ; Tue, 25 May 2021 14:12:29 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7623FA2D4 for ; Tue, 25 May 2021 18:12:29 +0000 (UTC) X-FDA: 78180548418.34.46732CC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf28.hostedemail.com (Postfix) with ESMTP id EEBDD20007E0 for ; Tue, 25 May 2021 18:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621966348; 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=I1nx14Wuyy1Ai1BHKOsZ2QDyxVtLCkZQzNkXCOdAaK3OkwbAY92RgVMM8qiiNg9wR9R6Cb LMpnxHGGnpib3/EL+V81YZXoML1YvXbat725d7Olnh8cgPAq+F3AA9Sq8oz6R8lminlrKP TM53F/vYrraWvAxiSCaxtOI4IiljsKU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-gdcJvMo9OAq1S95w91ZYew-1; Tue, 25 May 2021 14:12:25 -0400 X-MC-Unique: gdcJvMo9OAq1S95w91ZYew-1 Received: by mail-wm1-f71.google.com with SMTP id v2-20020a7bcb420000b0290146b609814dso4899102wmj.0 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=LuQeNcprJULXA0AXbdfZo+/Y4/ZMwDV+X1h5b/wLvkER9WLwELRVNv/FIoQDKCQYCX +1ZjBkeyZaCgsiYkNfPVMEM+oHbU/dde4EvBHKeR3Cz1mQbWnra3WhnGJf0h3MDDnO1k BCCiNuac6wMlHxV1fzjPdn9xv8BPIQysvsN6H94aDMJGCfT6d+QxQGVIZ2Qouj2NZDyu CUm59APBNn4nNIeVStQWvnn5MBpQzoUg+LKY5VSpCiDQrzfP1STFm8DPfNB6clp85LdO TTfwdGWdZs1uQzucMW/oHJn0fYhSd4oYWzwZ7HUoONgbtSb7CNMWKcJzvnmBNqDS8PFt cG0w== X-Gm-Message-State: AOAM532zLCvuh5lwvlk90rI4SpnxQyigSIHYHDNF3/WFr+y/7d99EkKD mvEJhKQaTJgiBXwqISquQu8q/JQC2dyGuZg1U/6T34G0V7VhWXytUVNEKGC/zKa2RIyRue8Ko42 N9dqgGzfulvc= X-Received: by 2002:adf:f0ca:: with SMTP id x10mr29536270wro.40.1621966344087; Tue, 25 May 2021 11:12:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9ckYsGK9u1fIRGrc+rrkX67qXdkR20wX+K7gS2Y5J8OlQ2XUrwnKhFphQS75FbiRmSluSsQ== 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: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=I1nx14Wu; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf28.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=david@redhat.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: EEBDD20007E0 X-Stat-Signature: ceiwwm4ei9hc7sk9fepkfwt761fbegme X-HE-Tag: 1621966342-469429 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: 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