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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CABFCC27C52 for ; Wed, 5 Jun 2024 08:23:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4h5fubZZwgstSVHegel/chwSdBL/aui2zrG0q6OOyDk=; b=vy3Kg/9oXnnmZ2 You8HIpODprirXaCxHj1stEFaegSygxQ/tC91Q1Ivg4DFU8+fTvIqIwjeri9hnm41J9FkiXmP2gLX rJD6xUWnWFsxc4ddC3wI9Y8oJJ7fjDKBwQfmLqimkgzgB+ZqnHPcCrH++Qrz6toGTdsAt7nE9+vd0 Id3uRShzd93HNx6MBcpzu/lDKG7oMaTxJVJ2oGApMVw3iFqw92YsdBTURUGI+RxY0Gj84nZM1ar+T oex6QMev0JuRfPho4hRmOhI+ldL+dxDgzuIbDDCnBIVnn+mfoU0qp/qc8b+oPnRFaUBMOL+MJAdmh Tg0ss7mgRcUzCKOWATYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sElvq-00000005Bcj-2YMP; Wed, 05 Jun 2024 08:23:42 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sElvn-00000005BaX-1xqN for linux-arm-kernel@lists.infradead.org; Wed, 05 Jun 2024 08:23:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717575818; 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:autocrypt:autocrypt; bh=FrXRJSl24pMWxTSTUa5BAvS/aN3UcspqvTrML27gFfI=; b=d3sIqqJQdIrF7Mqt0nLm6RMwxUkfFAJlIhFTFC6k/Nxm0kBsGaLwTGDxL9WSDjmvvvw5nA C2oSxujAKF+wYDYtaBlQDlyzp1XBnoI2DJ1keiMd8IFCVAPv2BLzhWFs4QwvxqJhs0n4Hc /RIWRTLT5kBvOyXZTZzqkyVsEwXlDCA= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-v451r2l1Nua_qxnLwCfGJQ-1; Wed, 05 Jun 2024 04:23:37 -0400 X-MC-Unique: v451r2l1Nua_qxnLwCfGJQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4212bf90891so13492545e9.1 for ; Wed, 05 Jun 2024 01:23:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717575816; x=1718180616; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=FrXRJSl24pMWxTSTUa5BAvS/aN3UcspqvTrML27gFfI=; b=Vy8oQF9IRcKmRoYWA0n/wAKrS/3u4DAzwJp/WJBkcK21uDEGFZA2oLpaTtU7JTTVhG KyPZAqXmRtv177Tf20lSa6RJaALpNUMQk9BRo773mAvu2qFZ5RpJyNBZfrXkQAVjAO0r D62XNiiE9j+AStf7h6AdWp+Wmpn2U+S4FcWMvzVQDAFcEIhHNAlgL0ZMpQ6puPsMJWSu eXLWqNyKnfaqgnRleqzeT2iMONQ3sw++EaCbHrggMeaSK40H+VZ5q95/TeceTfkeZHUz jdeVT2uYc4YzJsFDbFBarWDjOo06fIZldsYfqoZoHDJBJj+EFQgG7ntGpkDgVSLjMS+r zvvQ== X-Forwarded-Encrypted: i=1; AJvYcCXzH5uoU9UBrIsdDATkY4LtQ+seCokWLNlVA+YyvR8rUJf1oqOQGYh5l7perO1MJ0pmZtnIjktt3iOxg6zD6M/rNOfeS/LBN1u9coI+7/FMkqMeZI0= X-Gm-Message-State: AOJu0YzY3RxSnDo3LlA8DkRCWOtiwRYFhgSTTFpk/W9B+kd1zv7pZ15h HxZ/afjD89vSuq90D7kiAgbwzKTbGdQ3N1u15F//mr3JxDFVfB/9BiVovqR3mChL4RNrbmbz05Z J0QvYSZFiLLyxv5MDqz59WjmqeCeRaiI0AomdatsQYL2GzGbxpa6QWsWEI3nVOx9M3kJZK5mu X-Received: by 2002:a5d:5f8f:0:b0:354:f7f3:5e68 with SMTP id ffacd0b85a97d-35e8ef86ca1mr1729240f8f.43.1717575816001; Wed, 05 Jun 2024 01:23:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUm8r8YIaH0IadkJhkR+rTF3BoaMFsjrFZeC20i2LbK1E/8UZX1p7PoCk8VCAl4/oUMJfZcw== X-Received: by 2002:a5d:5f8f:0:b0:354:f7f3:5e68 with SMTP id ffacd0b85a97d-35e8ef86ca1mr1729214f8f.43.1717575815568; Wed, 05 Jun 2024 01:23:35 -0700 (PDT) Received: from ?IPV6:2003:cb:c706:3100:19a8:d898:8e69:6aff? (p200300cbc706310019a8d8988e696aff.dip0.t-ipconnect.de. [2003:cb:c706:3100:19a8:d898:8e69:6aff]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35dd062eda6sm13725694f8f.86.2024.06.05.01.23.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Jun 2024 01:23:35 -0700 (PDT) Message-ID: <785a8370-e40a-4a86-8534-c25503678318@redhat.com> Date: Wed, 5 Jun 2024 10:23:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 8/8] HACK: mm: memory_hotplug: Drop memblock_phys_free() call in try_remove_memory() To: Mike Rapoport Cc: Jonathan Cameron , Dan Williams , linux-cxl@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sudeep Holla , Andrew Morton , Will Deacon , Jia He , Mike Rapoport , linuxarm@huawei.com, catalin.marinas@arm.com, Anshuman.Khandual@arm.com, Yuquan Wang , Oscar Salvador , Lorenzo Pieralisi , James Morse References: <20240529171236.32002-1-Jonathan.Cameron@huawei.com> <20240529171236.32002-9-Jonathan.Cameron@huawei.com> <92ea53c6-a93b-4ab8-8aec-7f88300576eb@redhat.com> <900bd9b6-a788-4c71-9b43-aff4855ba234@redhat.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB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T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240605_012339_703552_97452FAE X-CRM114-Status: GOOD ( 26.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 05.06.24 10:00, Mike Rapoport wrote: > On Tue, Jun 04, 2024 at 11:39:27AM +0200, David Hildenbrand wrote: >> On 04.06.24 11:35, Mike Rapoport wrote: >>> On Mon, Jun 03, 2024 at 10:53:03PM +0200, David Hildenbrand wrote: >>>> On 03.06.24 12:43, Mike Rapoport wrote: >>>>> On Mon, Jun 03, 2024 at 11:14:00AM +0200, David Hildenbrand wrote: >>>> >>>>> The commit that added memblock_free() at the first place (f9126ab9241f >>>>> ("memory-hotplug: fix wrong edge when hot add a new node")) does not really >>>>> describe why that was required :( >>>>> >>>>> But at a quick glance it looks completely spurious. >>>> >>>> There are more details [1] but I also did not figure out why the >>>> memblock_free() was really required to resolve that issue. >>>> >>>> [1] https://marc.info/?l=linux-kernel&m=142961156129456&w=2 >>> The tinkering with memblock there and in f9126ab9241f seem bogus in the >>> context of memory hotplug on x86. >>> >>> I believe that dropping that memblock_phys_free() is right thing to do >>> regardless of this series. There's no corresponding memblock_alloc() and it >>> was added as part of a fix for hotunplug on x86 that anyway had memblock >>> discarded at that point. >> >> So when we re-add that memory, we might have still ranges as "reserved". > > I don't see how anything can become reserved on the hotplug path unless > hotplug is possible before mm_core_init(). > There are no memblock_reserve() calls in memory_hotplug.c, no memblock > allocations possible after mm is inited, and even if memblock_add() will > need to allocate memory that will be done via slab. I had the following in mind: (1) DIMM is part of boot mem and some boot allocation ended up on it (2) That boot allocation got freed after the buddy is already up (memblock.reserved not updated) (3) We succeed in offlining the memory and unplugging the DIMM Now we have some "reserved" leftover from memory that is no longer physically around. (4) We re-plug a DIMM at that position, possibly with a different NUMA assignment. On bare metal, this is unlikely to happen. With current QEMU, it won't happen because (hotunpluggable) DIMMs are usually not part of bootmem; that is, e820 and friends only indicate it as "hotpluggable but not present memory" range. It could be possible after kexec (for example, we add that memory to the e820 of the new kernel), but that's rather a corner case. (3) is already unlikely to happen, so removing that memblock_phys_free() probably won't change anything in practice. > >> It does sound weird, but you're the boss :) > > Nah, it's mm/memory_hotplug.c, so you are :) > Well yes :) but it's your decision whether we want to use memblock.reserved memory to store this persistent NUMA node assignment for the fixed memory windows. Essentially another user of memblock.reserved we should then document ;) Removing the memblock_phys_free() call sounds like being a requirement for that (although it might make sense independently) use case. I'm not sure whether memblock.reserved is the right datastructure for this purpose, but if you think it is, Jonathan would have green light on the general approach in this RFC. -- Cheers, David / dhildenb _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel