Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp32537rdb; Thu, 16 Nov 2023 11:04:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHYL8Jq6g3Sji8WL8LQATZrpDzPgguY1riMOKpfiSAk+kA0bEoZE3PqDfmCCkCcLaGA+e11 X-Received: by 2002:a05:6830:1288:b0:6d6:4c25:5a56 with SMTP id z8-20020a056830128800b006d64c255a56mr9981948otp.12.1700161469679; Thu, 16 Nov 2023 11:04:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700161469; cv=none; d=google.com; s=arc-20160816; b=COu9NobHIHomMHR6DiS2Nmwi7SQGTgbc0X244yqjo8ngcKh2cCMrUPx2DQzsDTRmFq CcTKEkzA64u3oK4BtKisP2AdambjSpd4/6viil2t6JMTlo4gLkUno2WcWUzT9YaReXWC unInH4t6cGTJ5UCMljbeKwOibm+XKnpLa7TSp9QeCad5ia1pMn5UsuoHHa/55sOLy9UD GwgIIePTmT7Swbc6KJdZWpF2nEkUEGFXPYI/IbczXrLb7mDwHc3/vX4ozEd1dqWyg6Bf vYAOuR6LzvipHiLKLyJ8CXrE0Bu6cnJqGszEzc2duCHdkZlVR/7Ny/pGZOypUjiZ5rOD N2YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:autocrypt:from:references:cc:to:content-language :subject:user-agent:mime-version:date:message-id:dkim-signature; bh=noFtgqazCBC+/n+W0RzmjdI1W4IMXkcCumNBFAtwhRo=; fh=3egS9YKmRGJdJV9BmXCaae31O2G/7W1QKg9vhvE3J88=; b=FiA/o9Pd5NHqc9PoiDJn+FFfbblD5UYQQ/lNqetYjQKxqyUAuV3OPrOhWMCMJWLTX5 +kw0jXppbluLibQtar2eXYZAgisks/ZY66CkHN2L4onGpObc/ox9pxdSdg1GeaPT6kGO 6jNEWSkTPAv455aFPdfVn+fC4zOGugDAGo9PsgYcJbu5NLoejh+yIgyDroYQzYea8xyU hX/4EtWmKWD7KFkK7pLaNNwiZ0u0dNwzfoQs9UzZD3Nw7BShqSOm5q4rPZF1G5vSJ9JI HGVwxlcI8DKWf7eYddEjYgeEoeGwJ7CWrKoIGV57YC/sIywVYAPoIZNERTVtUv3Q6NVK ZTfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ddZEkOKd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id m9-20020a9d73c9000000b006c8f5827d43si4768124otk.343.2023.11.16.11.04.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 11:04:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ddZEkOKd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 4245580F8F43; Thu, 16 Nov 2023 11:04:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345465AbjKPTEF (ORCPT + 99 others); Thu, 16 Nov 2023 14:04:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbjKPTEE (ORCPT ); Thu, 16 Nov 2023 14:04:04 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47F57182 for ; Thu, 16 Nov 2023 11:04:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700161440; 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=noFtgqazCBC+/n+W0RzmjdI1W4IMXkcCumNBFAtwhRo=; b=ddZEkOKdzrtBOqsewMMsez5vI4DDWj/o1StXze29UcKV/05LSLXOpTZS5bdRxLMXVpQM6f gIngwMGLymhJrxAjeNFP4tv9JmKIeGhqOQpajT55qmVU2zyj9ZzdAvjC0cryKQ6OauLc5r vf4XXsafIgHuJnQHJwuzj83Csz1nr3c= 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-26-e2YbIfriOqaVSOq3OeJ7fQ-1; Thu, 16 Nov 2023 14:03:57 -0500 X-MC-Unique: e2YbIfriOqaVSOq3OeJ7fQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4084e263ec4so7664005e9.2 for ; Thu, 16 Nov 2023 11:03:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700161436; x=1700766236; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=noFtgqazCBC+/n+W0RzmjdI1W4IMXkcCumNBFAtwhRo=; b=I7iL37Vsi3HlyqrU6zETpPzwIaVJth6KQv/w3Qq0WRe+BAUAihTdTwhYGXQndLT6PJ Pja0GSa7v11y1IUsPOGjw79/V9CjkpS6Yj+MC+GkVvouvFD8G0i1BCUTiyaoYiBhCyj6 bGg2kX8MwCPblwMZtB5NAhwshokPSU4Jo9HUqWMUDHJg7Qgb39xnoB9Hau9AzAzWFC2E XacC32oyXAD4o1OHD+E4zsX0btpQ/N+xcyODNc+JtxLnUNrbiTBLiwT5NtKcMQn9zyzW 8Yv+Psv49MLGACiaKioySrJoskywjZowmpTugSQCgpY1UGGLa8ktWlsG0Q8zvwiWWQZB r4RQ== X-Gm-Message-State: AOJu0YwNGsXH4OgZuLg+6caHqIIUN+lZsQUmzS1T3ZtOOy5r8eVCSvAr D+CTuG7kFRyEtIxXcpduqYp17QJBx3S9LSgnVCj9kp5kPN9ko/qgGnlAzGPfwYY33SHBGoHvFZs qnjBu856fHriB5+pkwIAoWwLS X-Received: by 2002:adf:f9cf:0:b0:32d:14c5:643d with SMTP id w15-20020adff9cf000000b0032d14c5643dmr11981622wrr.5.1700161435786; Thu, 16 Nov 2023 11:03:55 -0800 (PST) X-Received: by 2002:adf:f9cf:0:b0:32d:14c5:643d with SMTP id w15-20020adff9cf000000b0032d14c5643dmr11981594wrr.5.1700161435301; Thu, 16 Nov 2023 11:03:55 -0800 (PST) Received: from ?IPV6:2003:cb:c714:e000:d929:2324:97c7:112c? (p200300cbc714e000d929232497c7112c.dip0.t-ipconnect.de. [2003:cb:c714:e000:d929:2324:97c7:112c]) by smtp.gmail.com with ESMTPSA id j10-20020adfff8a000000b00326f0ca3566sm162043wrr.50.2023.11.16.11.03.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Nov 2023 11:03:54 -0800 (PST) Message-ID: Date: Thu, 16 Nov 2023 20:03:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 4/8] mm/memory_hotplug: introduce MEM_PHYS_ONLINE/OFFLINE memory notifiers Content-Language: en-US To: Sumanth Korikkar Cc: linux-mm , Andrew Morton , Oscar Salvador , Michal Hocko , "Aneesh Kumar K.V" , Anshuman Khandual , Gerald Schaefer , Alexander Gordeev , Heiko Carstens , Vasily Gorbik , linux-s390 , LKML References: <20231114180238.1522782-1-sumanthk@linux.ibm.com> <20231114180238.1522782-5-sumanthk@linux.ibm.com> <7c85bd39-8b34-4b09-b503-b0a2f2e58b88@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 WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEE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7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 16 Nov 2023 11:04:18 -0800 (PST) On 15.11.23 15:23, Sumanth Korikkar wrote: > On Tue, Nov 14, 2023 at 07:27:35PM +0100, David Hildenbrand wrote: >> On 14.11.23 19:02, Sumanth Korikkar wrote: >>> Add new memory notifiers to mimic the dynamic ACPI event triggered logic >>> for memory hotplug on platforms that do not generate such events. This >>> will be used to implement "memmap on memory" feature for s390 in a later >>> patch. >>> >>> Platforms such as x86 can support physical memory hotplug via ACPI. When >>> there is physical memory hotplug, ACPI event leads to the memory >>> addition with the following callchain: >>> acpi_memory_device_add() >>> -> acpi_memory_enable_device() >>> -> __add_memory() >>> >>> After this, the hotplugged memory is physically accessible, and altmap >>> support prepared, before the "memmap on memory" initialization in >>> memory_block_online() is called. >>> >>> On s390, memory hotplug works in a different way. The available hotplug >>> memory has to be defined upfront in the hypervisor, but it is made >>> physically accessible only when the user sets it online via sysfs, >>> currently in the MEM_GOING_ONLINE notifier. This requires calling >>> add_memory() during early memory detection, in order to get the sysfs >>> representation, but we cannot use "memmap on memory" altmap support at >>> this stage, w/o having it physically accessible. >>> >>> Since no ACPI or similar events are generated, there is no way to set up >>> altmap support, or even make the memory physically accessible at all, >>> before the "memmap on memory" initialization in memory_block_online(). >>> >>> The new MEM_PHYS_ONLINE notifier allows to work around this, by >>> providing a hook to make the memory physically accessible, and also call >>> __add_pages() with altmap support, early in memory_block_online(). >>> Similarly, the MEM_PHYS_OFFLINE notifier allows to make the memory >>> inaccessible and call __remove_pages(), at the end of >>> memory_block_offline(). >>> >>> Calling __add/remove_pages() requires mem_hotplug_lock, so move >>> mem_hotplug_begin/done() to include the new notifiers. >>> >>> All architectures ignore unknown memory notifiers, so this patch should >>> not introduce any functional changes. >> >> Sorry to say, no. No hacks please, and this is a hack for memory that has >> already been added to the system. >> >> If you want memory without an altmap to suddenly not have an altmap anymore, >> then look into removing and readding that memory, or some way to convert >> offline memory. > > Sorry, I couldnt get the context. Could you please give me more details? See my reply to Gerald. In an ideal world, there would not be any new callbacks, we would get rid of them, and just let the architecture properly hotplug memory to the system when requested by the user. -- Cheers, David / dhildenb