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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79857D0E6D8 for ; Mon, 21 Oct 2024 09:51:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9176C6B007B; Mon, 21 Oct 2024 05:51:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C6D56B0082; Mon, 21 Oct 2024 05:51:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78DDB6B0083; Mon, 21 Oct 2024 05:51:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 59C8D6B007B for ; Mon, 21 Oct 2024 05:51:48 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E19AD816ED for ; Mon, 21 Oct 2024 09:51:34 +0000 (UTC) X-FDA: 82697141982.01.2EFAEBC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 28FFE40014 for ; Mon, 21 Oct 2024 09:51:24 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Z9YnZye/"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729504269; a=rsa-sha256; cv=none; b=JhsLSlhiQfaPN94h3cCb5CRDiJeJJj2Tix7z3LJxZigdOCKVcwHhnX1wNn3kyuy5PYub2a GST/1P7A/o4yKNdA0X4/hNP66Qe/UaJTueuucwdSWlQi21wQv7pfKT6Oe26XXdXgosYrKa 3Orl/Q6sXD0weSRxmKTGNDdpXsepV1Q= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Z9YnZye/"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729504269; h=from:from:sender: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:dkim-signature; bh=4nn/+beuGSyT6IppBG0CXPg7AYEwhH2O7vh6xIs2kpA=; b=LgRHNFHfI/bFaFwO4ZV7axxNW7u8x2Mvv7x8rz8Hfge3RuWbyAM7czlgQZuZpL1LlluOQP hJexqctAuYUtsRbCHKZ+rwdx3EAP/fRAYzNL5G3Fb2JEbHHoUoLFKru8xFMBdql030mkeO 275QIt/n9W4x2rytwHWwsIO2VxwbHW8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729504303; 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=4nn/+beuGSyT6IppBG0CXPg7AYEwhH2O7vh6xIs2kpA=; b=Z9YnZye/v5QYw4VtqJsioWzb4SFK9alwANdGp78vwaogme9YDm0zEUMJkIBCKcqVhBgeyN SkJHJZ+nq5sjccks9wZ6TUC+PM9TLEsHvSO6GHH1yJ3VMGPbpxJv9oByb3Bg3YoeiZo+JO tdl+QD3fQEDMIm5ks3hgbaJN6OcvdEk= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-4a03GBTYOfClbCkbu75WLQ-1; Mon, 21 Oct 2024 05:51:42 -0400 X-MC-Unique: 4a03GBTYOfClbCkbu75WLQ-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-431673032e6so16784925e9.0 for ; Mon, 21 Oct 2024 02:51:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729504301; x=1730109101; h=content-transfer-encoding:in-reply-to: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=4nn/+beuGSyT6IppBG0CXPg7AYEwhH2O7vh6xIs2kpA=; b=fc5Vj2fACwAzkxfH4oT9I4IuAIOyMgMf+o/Lq2pGLHZrKaUD/XXKtmAY4rv9QgsyRv 38PvAEAcuAbiUs4wOvm4uvUMkXmrRe5niJxJ/ixgby8FMZI9wtTlvqoBvT0moPiEC7yA bivHlwtvR6+0uhZ+jJecUzNkWx70ZMka2y1vkcrFr1VrRhHew63iaGjQT/P8bpefUA5z DgodHW++iRIeXcSW9Jq/g1qKv/zvcHKdrF9nsu2suVRKJiiIgpyBVjQD/EtgBF11wPXv OKn/HKp+Z4oEVS1MuLftiSFBDwczu9wWbmztaAXM6edQxFls3jrJkv3Y6+1T88OqCi76 TXeQ== X-Forwarded-Encrypted: i=1; AJvYcCW0TwN0lp3vRuVcH26gg+R33ZBGf66BZpniVyHzBYUSF9OEpgR1I9yBK1ORN6f7vkUOhp2TwyZrzg==@kvack.org X-Gm-Message-State: AOJu0YyYudHGbge7s/dwIdBSbbwMtxU2SITBiMpzb7nbUvO1Ps57ruu8 8pjzt1Z23IhnAQfH8fTPlPbha7PR/hRS+x19OO8dNKfwoEEXhDT0SBL787tS5Q5AVFsR2leqfxb QGWG8ZqfITH4arBZRxv5tUmiS+770GbRT3OollP1lMlnx1D+P X-Received: by 2002:a05:600c:1d1a:b0:431:6153:a258 with SMTP id 5b1f17b1804b1-43161641cdfmr87276505e9.13.1729504301192; Mon, 21 Oct 2024 02:51:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGL1nqu+VttUCQ0203kNMq9H/NLS7ZxrRhe0hPz/aN+ndMq9UmgQAQTp//+Oz8jWOZFaykk3g== X-Received: by 2002:a05:600c:1d1a:b0:431:6153:a258 with SMTP id 5b1f17b1804b1-43161641cdfmr87276245e9.13.1729504300815; Mon, 21 Oct 2024 02:51:40 -0700 (PDT) Received: from ?IPV6:2a09:80c0:192:0:36d3:2b96:a142:a05b? ([2a09:80c0:192:0:36d3:2b96:a142:a05b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37ee0a477d9sm3898910f8f.26.2024.10.21.02.51.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Oct 2024 02:51:40 -0700 (PDT) Message-ID: Date: Mon, 21 Oct 2024 11:51:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 0/3] mm/memblock,x86,acpi: hotplug memory alignment advisement To: Gregory Price , x86@kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org Cc: dan.j.williams@intel.com, ira.weiny@intel.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, rafael@kernel.org, lenb@kernel.org, rppt@kernel.org, akpm@linux-foundation.org, alison.schofield@intel.com, Jonathan.Cameron@huawei.com, rrichter@amd.com, ytcoode@gmail.com, haibo1.xu@intel.com, dave.jiang@intel.com References: <20241016192445.3118-1-gourry@gourry.net> From: David Hildenbrand In-Reply-To: <20241016192445.3118-1-gourry@gourry.net> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspam-User: X-Stat-Signature: htdkjtet7snceitei9m93pxida7jo5ow X-Rspamd-Queue-Id: 28FFE40014 X-Rspamd-Server: rspam02 X-HE-Tag: 1729504284-189426 X-HE-Meta: U2FsdGVkX18Mwy0sTVP8cCuUJcG7wQdaUXkr6ddutl0WIQYwmMoi8cjzhBeOlRHmZlZ+IYDSZmYDfSMeqmDnLrmRjT0O4DdRnsErLg/7lHr0NNjALkWjGPPVIniFwxQ6rYintIZSgcIBbWhDKa3pBaE2vUYvNdGRPgwTtwww2CR8qmWcQ3vQrH/2Rc8DQimzhbDiyGZ5HqtiD1EndDBMEUZyF0plDiWxykYUzXQu6gtvoOWAGh2S0bxCOTwO2Tf1nXPMrzokQFzE5RLQbWIKeSF+eavUu6bSdQjea0fAAFQMe4iupnbrux2zd15Q6XMM4VWXbcxNh8Zyuo59d9zZQ7voa82FDUx/bEQyMtI/xtDOawm1WV2snFzyv7jP2zW42GQmnOQBjGZPkEGvEbc5rOyheShwgZA0PQIu2Qy6TeyEbSfjKaD3H96Iuan2JsYdT8EdAGihM5RniMPwuzkGSGz5nkFS5OmiTJT84oYDAOmgWj/3Mk3q0wdLIa9n5rISInI4ARCx/W+HrCs3PCfVq5QTahQ9OO8FrOaM/KopElKcJpK8QB8F2QCDq955TtxT9mb9/MFQmim2Ja1NtgjQQaYlHVyuSEv04HYmBWooOHw+VVMgibtj4QgFizDJsvCLywYHxnCSaZqbAPN3lsL51n5R1kVELnqsIpXbukl/MeTyu7Hz6wWNprrnbvK/uvdBKpp9djtSXssYt617ZPj/8AZlHlkxEF+C6k9JlVEsiG7Ex/qtgRjCUv56rWaSRBfGfH79zakPLWvouuuUyXte4z2KEoAGHuvFHi4RpN+Rm2PzsamDKTlxDS1cmv6Rdzq1JFwfaVYf25aprdQU7w8gDPcxPMxWkOf/Nv3P1HWxQQqEG20l+FNMT3rIkacY/Ime8X9MyFZYEMnlA1+nmCSBlefrccP1rffPEWzvS32lLQJSJUfTmrCHAPEFhuc8Cp+dguartGK6HyDjU3L1fL6 35eUBgNV qzGFVA9dwyAJAOz2TNLdbjxg3DqGJuB/0zJclCj+8H7IVyURLbGdjfC3htSthBEELg33wM7sMemWVeg+GFOYA20hQGt3VIhPwNEXOIjiXN3IGDokoe1bUIulh8f4L5FXwhTTowAqfY+ak5+RXVLIvve/gcVR1VWqIYUgGsWVY7slwGqHiKR0Y5ctY+rhnsBOB9ga6+tK+N2Qblj8XiSfreDWKlP7Y/sAWZePhuyQEHpCud7Xdd+MCa5J1twDH1O2GsOayInct0vUiJ8vq5qqhwvsoaVe5HW5+lQBgDEr6YCl41cHLevhW0itkdCRMP9Ln5nRSrc8C9osWYDOn/DnnGuIcC6KtTn7mWz+YInnPQwXNUAqzVOiob8dKqwFPVoNl47Gw2wGCHvug55Pc76mwNAQXJUaF/3185qtyEr2jaFNOEGIcuXV6HmoNfa1C8VawKUTZVHW5iJ/mYm8IKc+5gi7cysjCl6kR/epYwxEaxN5R+YE= 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: List-Subscribe: List-Unsubscribe: Am 16.10.24 um 21:24 schrieb Gregory Price: > When physical address regions are not aligned to memory block size, > the misaligned portion is lost (stranded capacity). > > Block size (min/max/selected) is architecture defined. Most architectures > tend to use the minimum block size or some simplistic heurist. On x86, > memory block size increases up to 2GB, and is otherwise fitted to the > alignment of non-hotplug (special purpose memory). > > CXL exposes its memory for management through the ACPI CEDT (CXL Early > Detection Table) in a field called the CXL Fixed Memory Window. Per > the CXL specification, this memory must be aligned to at least 256MB. > > When a CFMW aligns on a size less than the block size, this causes a > loss of up to 2GB per CFMW on x86. It is not uncommon for CFMW to be > allocated per-device - though this behavior is BIOS defined. > > This patch set provides 3 things: > 1) implement advise/probe functions in mm/memblock.c to report/probe > architecture agnostic hotplug memory alignment advice. > 2) update x86 memblock size logic to consider the hotplug advice > 3) add code in acpi/numa/srat.c to report CFMW alignment advice > > The advisement interfaces are design to be called during arch_init > code prior to allocator and smp_init. start_kernel will call these > through setup_arch() (via acpi and mm/init_64.c on x86), which occurs > prior to mm_core_init and smp_init - so no need for atomics. > > There's an attempt to signal callers to advise() that probe has already > occurred, but this is predicated on the notion that probe() actually > occurs (which presently only happens on x86). This is to assist debugging > future users who may mistakenly call this after allocator or smp init. > > Likewise, if probe() occurs more than once, we return -EBUSY to prevent > inconsistent values from being reported - i.e. this interaction should > happen exactly once, and all other behavior is an error / the probed > value should be acquired via memory_block_size_bytes() instead. > > Suggested-by: Ira Weiny > Suggested-by: David Hildenbrand > Suggested-by: Dan Williams > Signed-off-by: Gregory Price Just as a side note, a while ago there was a discussion about variable-sized memory blocks -- essentially removing memory_block_size_bytes(). The main issue is that this would change /sys/devices/system/memory/ in ways it could break existing user space. I believe there are other corner cases that are a bit nasty to handle (e.g., removing parts of a larger memory block), but likely it could be handled. -- Cheers, David / dhildenb