Message ID | 20241029202041.25334-1-gourry@gourry.net (mailing list archive) |
---|---|
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 ECC7FD3A696 for <linux-mm@archiver.kernel.org>; Tue, 29 Oct 2024 20:20:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C5A36B0089; Tue, 29 Oct 2024 16:20:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 775556B008A; Tue, 29 Oct 2024 16:20:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 615A36B0092; Tue, 29 Oct 2024 16:20:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 434CB6B0089 for <linux-mm@kvack.org>; Tue, 29 Oct 2024 16:20:46 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C023E160353 for <linux-mm@kvack.org>; Tue, 29 Oct 2024 20:20:45 +0000 (UTC) X-FDA: 82727756832.03.2C265F8 Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by imf20.hostedemail.com (Postfix) with ESMTP id 1B6D61C0006 for <linux-mm@kvack.org>; Tue, 29 Oct 2024 20:20:12 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=nThdVxjM; spf=pass (imf20.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.182 as permitted sender) smtp.mailfrom=gourry@gourry.net; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730233163; a=rsa-sha256; cv=none; b=YtCMX3xoPeHW1uM7EEhXQJsyThH34ZhYZRFM/EcauhBU0wdMama46cECUxgaC4+saivfld 2/Fw+Y5IB3a4u7JLK65bSYqSM0aCRk0n0DDQrGTnabbh127ABz6wg6G9uEXZutlj0fNWwM 1iDcDI5qBnfp0WEm62Bj3cWacB640BI= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=nThdVxjM; spf=pass (imf20.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.182 as permitted sender) smtp.mailfrom=gourry@gourry.net; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730233163; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=NPsMQe02LYzk6AvqbJXX4CMDFW9tZF0F106go5mNZqA=; b=poyUcsRLZn1RZ5P/bef70yl0IM4Lp15NSLxkUQqUJ3yIYaLUPWNUpJQaiQoikrtlWnGrin I1CWq31tB3PQzQPbOJDz774hdSYpeikSmot52ZUz0S6kwA74USUSHkysSjVn2d+mtr5y0q KKC5FHWOJFGUW4/LVcyUtUaGreSHgAI= Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-460c2418e37so43983911cf.0 for <linux-mm@kvack.org>; Tue, 29 Oct 2024 13:20:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1730233243; x=1730838043; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=NPsMQe02LYzk6AvqbJXX4CMDFW9tZF0F106go5mNZqA=; b=nThdVxjMnO6OxYn7DkxHZnxpIBvjbtNqHXcV4Rg2zcU/TM4KCeIO7WyaTIepaDB/Z6 2qTTGWdU3gBcRlglm97VsIegj2Q71VsQkkYJKCCcMFUv8861avuixjvCdqV5rMlzDCrv ZKsVty3nZShD42+3axOmUy2XhP6KpklpSphiMZ9rf9l0ocPtyfySykweIuQYsXHEbRZV KnypcXP4P1OcSXgUw4baMJz7g8jtzpvVXuL02vF38RWJ8LLTfGmxmriRgXcy7+lkoqpt oJr9b4vNV5QkcYDoZVMpUBx/S1y99ZMwf6oHnOMuVvtcOIjWyd/2jsMxWN3o0/z0wa00 W4UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730233243; x=1730838043; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NPsMQe02LYzk6AvqbJXX4CMDFW9tZF0F106go5mNZqA=; b=mWHJ8PJ4vbbDnuLSCCMut0xZvuhuLVYCgyc6fJeQ/wTCOVarrs/qIoWxA/xguiXEWm IzOhG5ymW9oL/jGQsoEqcNwun9CTuo2P414qcWDwO0EqKJT/5FN7GQpPWTr9d3CJ2wMV W03KailMRri6b6lSC9uSf+E28ywPj2+lcwWVmlLOe4Up2CdeXQXtJb59LBopbyrWBfbe vt7GCOjvJZQdwGI4+pvqJWDvUeezqqHBy2OhoygaB+f9ie/is0l6pp4nA3Jm+5ix0bGR /DRu0AcEAHDjtuEuUS0Jg+9/9o7R5TX6dc7Tbunx/vB/m+v4b9hB+D+4FiygvgrZ4GDt z0BQ== X-Forwarded-Encrypted: i=1; AJvYcCUVXSkB4ZSA5BPBylgkBSCIm/4uxXBv4xXMbf0UsDuVr6IXCHTll4yC8j1GkGz/h5UDFbvWLfmMlQ==@kvack.org X-Gm-Message-State: AOJu0YyenIv7YEo3BAbWnOOX47N34SouAa2hp8zr22QH7KmDAWXJMUJH fvwI9PpVRCB3Ki/Bc6iV02sxzzVAjFBZSu0uRBBH5yfSt9RhogWv2W9zAhNQPm/2hwzMboX5rC2 2 X-Google-Smtp-Source: AGHT+IHs/aqZSL7TzZKT8I7dCZ/v2av91ER/O1QkY1vmriHGsVXlOik6zNWxN4zfTbxPZu6qWBjKLw== X-Received: by 2002:a05:622a:1890:b0:460:a313:28bf with SMTP id d75a77b69052e-4613c00dc97mr182051421cf.23.1730233243008; Tue, 29 Oct 2024 13:20:43 -0700 (PDT) Received: from PC2K9PVX.TheFacebook.com (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6d1798bd8bdsm45071796d6.54.2024.10.29.13.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 13:20:42 -0700 (PDT) From: Gregory Price <gourry@gourry.net> To: x86@kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org Cc: linux-cxl@vger.kernel.org, Jonathan.Cameron@huawei.com, dan.j.williams@intel.com, rrichter@amd.com, Terry.Bowman@amd.com, dave.jiang@intel.com, ira.weiny@intel.com, alison.schofield@intel.com, gourry@gourry.net, 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, david@redhat.com, osalvador@suse.de, gregkh@linuxfoundation.org, akpm@linux-foundation.org, rppt@kernel.org Subject: [PATCH v4 0/3] memory,x86,acpi: hotplug memory alignment advisement Date: Tue, 29 Oct 2024 16:20:38 -0400 Message-ID: <20241029202041.25334-1-gourry@gourry.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: f3bbrijywx1in1iqx5uc9xgwzx3sdoth X-Rspamd-Queue-Id: 1B6D61C0006 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1730233212-696566 X-HE-Meta: U2FsdGVkX1+yZc1LqU/croyx//Tpe2EMA/kDEiGFtnDtvCH/B//OfNFJ8tv0jeRVeTAbRUib7sSAeoO0FLnL4C1jeZV17GMp1QTFBQ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/eFF7zWgHBZWO6zpDcNRMcZD3ibk+DLrty5gP/JGo0IwPyx7nz3zJy999gNO9DlEcQpE49pyDJw8vEg74ZTYDkzzq3dDLvVvmnpambabzBZv+8GH/IHv8pVtbuFq2QzRVKlgYapLdN0sBR7pBNGPmXUmMZiO90zFlL1Zy0vQ30V 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
memory,x86,acpi: hotplug memory alignment advisement
|
expand
|
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/query functions in driverse/base/memory.c to report/query architecture agnostic hotplug block 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 query actually occurs (which presently only happens on x86 and acpi logic). This is to assist debugging future users. Once probe is called the first time, it will always return the same value. Interfaces return -EBUSY and 0 respectively on systems without hotplug. v4: - nits and renames - consolidate srat logic into existing iterator - remove lock-in call from srat code Suggested-by: Ira Weiny <ira.weiny@intel.com> Suggested-by: David Hildenbrand <david@redhat.com> Suggested-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Gregory Price <gourry@gourry.net> Gregory Price (3): memory: implement memory_block_advise/probe_max_size x86: probe memory block size advisement value during mm init acpi,srat: give memory block size advice based on CFMWS alignment arch/x86/mm/init_64.c | 16 +++++++++----- drivers/acpi/numa/srat.c | 19 ++++++++++++++-- drivers/base/memory.c | 48 ++++++++++++++++++++++++++++++++++++++++ include/linux/memory.h | 10 +++++++++ 4 files changed, 85 insertions(+), 8 deletions(-)