Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp902556pxb; Wed, 29 Sep 2021 12:06:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmSeUs+RD1gJCHMwc96buA3KHYKlYCJkALgkBi8IOy6PhtOQxqgeSbjCGawVKKI0YKrpYw X-Received: by 2002:a17:907:7f16:: with SMTP id qf22mr1617038ejc.1.1632942406556; Wed, 29 Sep 2021 12:06:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632942406; cv=none; d=google.com; s=arc-20160816; b=wHZ+Xe+rdSLXYXnknXFrngr/T7RAeu081mDOf8uer+2aoT3ufxOkcVsEfln1BSFMZf 2+C+wOWAZ24HSGvGsjlAR+o39AxYsWYNCKZeFBxvYPCfGKXs3ynR/SeJ9XE8Dbvj56zA dLuGlRB1FiQ8NR2XkAEpDtWWuiaHua/GNwLo0Dm6gOq7I6/wV3xz0m2l3hiR/gWCaiXF I+PIZtaqjzL29XqR8pvDXLaKqvqU6qqGzIe3iIS/wtues7XMJRwYEAKfxNAU6w5gb23I ajQuoOb5Hj5cnxAQZrk7OXRPZly/LphzYo+S0kkHZEpKAM1H/AGe5Qb34x086gF94YOF lqxA== 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:subject :organization:from:references:cc:to:dkim-signature; bh=wz7/LCBNzU2qEx/p5MvqtYMtlnh6TSWHAxM6fGc3vyI=; b=Uwim8RDsJTcBdeFbURutJ0Iq+U8c4cTF34H3fhjACh+uoMReHjw7k0FbmVa/smB4Jt ApknAVM0j6GG7gQxZLdHaZeaC4y3pZi1fcIZBpJcGGBGIrvhcyaV4r35ik8/oIndA1H6 eESXwuQJhP6TYmFy3B1CsU1Alfj4VAIoubtPam8mcTQK72BRQ7RomYJ2REmqyjJjmhan jwZvmrUDNEz0KGP84FNWkMMFv+uMHTasla1fBH0dmQ+LHDNmHj/qL78WOWdqHkJOIjPM FYpXPkJEGY+5TzC/bwCg/mxFeNNrYeWSgKYp+PUjAGW8bKte/h3n8aaZ0pI/VYzZACpY yOdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="AZI0/QgF"; 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 i10si858547edb.111.2021.09.29.12.05.57; Wed, 29 Sep 2021 12:06:46 -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="AZI0/QgF"; 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 S1343931AbhI2Qzu (ORCPT + 99 others); Wed, 29 Sep 2021 12:55:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23793 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245180AbhI2Qzt (ORCPT ); Wed, 29 Sep 2021 12:55:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632934448; 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=wz7/LCBNzU2qEx/p5MvqtYMtlnh6TSWHAxM6fGc3vyI=; b=AZI0/QgFD2B5O6XPH6sEgh7RXjoFSpaESNqU0i6Mib7FolWxBW4P9xqfLct23zR3aZ1pFS H7FfQckMsvb0LRmacL8ZNaVH/HddSA2CYjjQaB5gfn1dx2tAbxb4t58oH09xBtpikyWNMB qJlZi6GqnkxEeTRX/y+eKfH70hbNVD4= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-490-IXz4ke1JNqa8C9WC8138GQ-1; Wed, 29 Sep 2021 12:54:05 -0400 X-MC-Unique: IXz4ke1JNqa8C9WC8138GQ-1 Received: by mail-wm1-f70.google.com with SMTP id m2-20020a05600c3b0200b0030cd1310631so1052786wms.7 for ; Wed, 29 Sep 2021 09:54:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:to:cc:references:from:organization:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=wz7/LCBNzU2qEx/p5MvqtYMtlnh6TSWHAxM6fGc3vyI=; b=3cApjoHPZelox7c3X6HX8SbVWJKgODz+vXEm/Ed9JyBr8QqNo3vNdvXzbpKTAuNzi0 l0ESe35MxPZ+2mNVeqXTPGrfkqx1vulpNju5UMcxuSZmhTY/BAS1I5wcMQEQDHX0Wu8C TDGHYFT8q1daxeBR16FXKJx5/JVtm+KPvLKMW8lKiR9O/TM8NZ5JXKBzLdxUQp2/eKkk 3GicfRVqYI/QON24wr8xGS6ZmMObruJjkw7ngX4wafz1y/9Hf0JaeOyxg5ofOOZNa0Dy 8AfT8lejdUVqPAQ+kvgntVMytZ/5/SRoyhAWL9lUhezlz+/LGDTHIyW/yY0LUtheX0dv +WIA== X-Gm-Message-State: AOAM531rBlSxLfMVD9vEQoP0CxOKfYozBcFwX59nojX637HXilQowGLl kKiH3aAplTcrQVGqmI8ppjO3e2xF/S9QKd6p66SHB/u87iHcIJQIxFvCxc7jgRnkIhV0HefGLED qO3FrKTbcLeqQT0pxB1rPYK+b X-Received: by 2002:adf:de86:: with SMTP id w6mr1061895wrl.287.1632934443883; Wed, 29 Sep 2021 09:54:03 -0700 (PDT) X-Received: by 2002:adf:de86:: with SMTP id w6mr1061866wrl.287.1632934443713; Wed, 29 Sep 2021 09:54:03 -0700 (PDT) Received: from [192.168.3.132] (p4ff23c3b.dip0.t-ipconnect.de. [79.242.60.59]) by smtp.gmail.com with ESMTPSA id m4sm465862wrx.81.2021.09.29.09.54.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Sep 2021 09:54:03 -0700 (PDT) To: Mike Rapoport Cc: linux-kernel@vger.kernel.org, Andrew Morton , Michal Hocko , Oscar Salvador , Jianyong Wu , "Aneesh Kumar K . V" , Vineet Gupta , Geert Uytterhoeven , Huacai Chen , Jiaxun Yang , Thomas Bogendoerfer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Eric Biederman , Arnd Bergmann , linux-snps-arc@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-s390@vger.kernel.org, linux-mm@kvack.org, kexec@lists.infradead.org References: <20210927150518.8607-1-david@redhat.com> <20210927150518.8607-4-david@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v1 3/4] memblock: add MEMBLOCK_DRIVER_MANAGED to mimic IORESOURCE_SYSRAM_DRIVER_MANAGED Message-ID: <830c1670-378b-0fb6-bd5e-208e545fa126@redhat.com> Date: Wed, 29 Sep 2021 18:54:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29.09.21 18:39, Mike Rapoport wrote: > Hi, > > On Mon, Sep 27, 2021 at 05:05:17PM +0200, David Hildenbrand wrote: >> Let's add a flag that corresponds to IORESOURCE_SYSRAM_DRIVER_MANAGED. >> Similar to MEMBLOCK_HOTPLUG, most infrastructure has to treat such memory >> like ordinary MEMBLOCK_NONE memory -- for example, when selecting memory >> regions to add to the vmcore for dumping in the crashkernel via >> for_each_mem_range(). > > Can you please elaborate on the difference in semantics of MEMBLOCK_HOTPLUG > and MEMBLOCK_DRIVER_MANAGED? > Unless I'm missing something they both mark memory that can be unplugged > anytime and so it should not be used in certain cases. Why is there a need > for a new flag? In the cover letter I have "Alternative B: Reuse MEMBLOCK_HOTPLUG. MEMBLOCK_HOTPLUG serves a different purpose, though.", but looking into the details it won't work as is. MEMBLOCK_HOTPLUG is used to mark memory early during boot that can later get hotunplugged again and should be placed into ZONE_MOVABLE if the "movable_node" kernel parameter is set. The confusing part is that we talk about "hotpluggable" but really mean "hotunpluggable": the reason is that HW flags DIMM slots that can later be hotplugged as "hotpluggable" even though there is already something hotplugged. For example, ranges in the ACPI SRAT that are marked as ACPI_SRAT_MEM_HOT_PLUGGABLE will be marked MEMBLOCK_HOTPLUG early during boot (drivers/acpi/numa/srat.c:acpi_numa_memory_affinity_init()). Later, we use that information to size ZONE_MOVABLE (mm/page_alloc.c:find_zone_movable_pfns_for_nodes()). This will make sure that these "hotpluggable" DIMMs can later get hotunplugged. Also, see should_skip_region() how this relates to the "movable_node" kernel parameter: /* skip hotpluggable memory regions if needed */ if (movable_node_is_enabled() && memblock_is_hotpluggable(m) && (flags & MEMBLOCK_HOTPLUG)) return true; Long story short: MEMBLOCK_HOTPLUG has different semantics and is a special case for "movable_node". -- Thanks, David / dhildenb