Message ID | 20241101134706.1185-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 CFD4EE6B278 for <linux-mm@archiver.kernel.org>; Fri, 1 Nov 2024 13:47:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 553CB6B0089; Fri, 1 Nov 2024 09:47:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5043E6B008C; Fri, 1 Nov 2024 09:47:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3CBA76B0093; Fri, 1 Nov 2024 09:47:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1EFF96B0089 for <linux-mm@kvack.org>; Fri, 1 Nov 2024 09:47:14 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B8B75C04C9 for <linux-mm@kvack.org>; Fri, 1 Nov 2024 13:47:13 +0000 (UTC) X-FDA: 82737651486.08.8BFC29A Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by imf02.hostedemail.com (Postfix) with ESMTP id 6D61F80002 for <linux-mm@kvack.org>; Fri, 1 Nov 2024 13:46:18 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=qERz9Lxv; dmarc=none; spf=pass (imf02.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.179 as permitted sender) smtp.mailfrom=gourry@gourry.net ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730468775; a=rsa-sha256; cv=none; b=7FR68sLROI2/hAJZ1p3Aedw0hs2fGVEIBIe6NWETZ0MaP7oSTfa4TNGxZ4wRQH21+98/n+ 1+C/HdLuXQQJnD64VE5b8lnHLSY8qRy5PXt38/XrCy+7a8qGXrZ5pL+HXNBJjEQHXdWYIF 2Xgyfjd2ZOg4CRPCKKsuOOHDlv0tWKc= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=qERz9Lxv; dmarc=none; spf=pass (imf02.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.179 as permitted sender) smtp.mailfrom=gourry@gourry.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730468775; 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=pgZpdUoTAWBGW8HPZFX/sXBtOGTucTxkHn+L83ATAH8=; b=d5/d0UuzQdLa7qny0OYiFGQbGBGHhAka/7mURFvdaaCXGF/uCs5SCp1yYT2s0urBVHFW12 J0CaHBUl80SLC4mnzsH3ZSepLBHJoaxuzDPQcKiKGGmEkT+16TlguYR5Uk1NIynI4Pb8M1 NKktUfHS2nTotZsqBVx3bEK2/6T4QZ8= Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-460c0f9c13eso17482091cf.0 for <linux-mm@kvack.org>; Fri, 01 Nov 2024 06:47:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1730468831; x=1731073631; 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=pgZpdUoTAWBGW8HPZFX/sXBtOGTucTxkHn+L83ATAH8=; b=qERz9LxvSRFGWgc2sjR6Xyaa8Pua88LzlmWTDp2ZhEnKGLAWvWQgdCsPbAj9xmm+Pq Axmr0skfxIAZJ8DCh8cmv7183w3FDLafD8p7JTsChLGSHqD/5ThjNRExEeDtZw1nm/SH OQaK4hofa/9oZhkIfosDCYH8E3QKqgm7AzRA8CcgZegv1oS7L1Y5oCnNto+jNFgWn484 Rx97e8dAYHuQcb5yvvOmDF1c1AfVrBysn7mtEVPrQFXegtW1PZqUqlJqp9ppEK89ipHA A7nS1xzl7Ixc0Q2fN4be65J2yqan80sIf/Ry+FF+AkftjoQD0E9JTVrUBUOpZYx4q1MK HqOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730468831; x=1731073631; 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=pgZpdUoTAWBGW8HPZFX/sXBtOGTucTxkHn+L83ATAH8=; b=wzQBZ/ZpH+Qt43TjLYPinr3fE1nSn8XJ4T8x24Ega5JcXPBRVu3wI9IQLTq1lgwYo/ Xb234UguBHTiB9tgdLBSm5KQVL0CIuNwYMOk81+3lquMUq18hJEg74NwcnFiTPUPO7A3 fzhpSAGNtqK/LqJbN3SlE2Ju5Fi01YDsaXrKcbxvCOrrhkKhxjIbW8dfhBruXBs5jvAN GTS0xhTsep/VCY7U7rhx+J3KkQDkC4dR9OlYlDv0yW5m6yVr+9+WZ6APHcV33ZRJUjv7 OOePN2zbp0FTdXwj7UuDTItPPtzGnwOiPZyOLL/pa8myPkKHl5kB/ZxSarHHjXe44bTH ZBjw== X-Forwarded-Encrypted: i=1; AJvYcCXNnod5NCXXxL9ZIMojAf7GJrzlKed0/otBhmgQX+A5Y0ColtsQvf+2xJCvrY/x1lCUMITZWfLMXQ==@kvack.org X-Gm-Message-State: AOJu0YzSlEiM3wh0sOxyrUACCQ29x1V9FRdBe/vzD8VoQbmiWabfwqGj v5sAuAwSvTVzl7h8F3UWLlPxVqBc2UkV3LBEBQ/+F32mGCDk7mHK1eFuCSVCMfA= X-Google-Smtp-Source: AGHT+IFO7TPVt3YP/4LUm5QV2ItbjgKfbOmnapBUP+AyArR90OJPmLDKIteJ7SrM/lUFaW2ItVhwSQ== X-Received: by 2002:a05:622a:1a97:b0:45d:ace1:a44a with SMTP id d75a77b69052e-462b6ebae38mr51618591cf.30.1730468831023; Fri, 01 Nov 2024 06:47:11 -0700 (PDT) Received: from PC2K9PVX.TheFacebook.com ([50.193.156.113]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-462ad0cac07sm18840631cf.48.2024.11.01.06.47.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 06:47:10 -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 v5 0/3] memory,x86,acpi: hotplug memory alignment advisement Date: Fri, 1 Nov 2024 09:47:02 -0400 Message-ID: <20241101134706.1185-1-gourry@gourry.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Queue-Id: 6D61F80002 X-Rspamd-Server: rspam11 X-Stat-Signature: 8mtn7utmh46si9d3kdc3w88ebbkxwx9e X-HE-Tag: 1730468778-187613 X-HE-Meta: U2FsdGVkX19+8g3GKIb0LS5jSqzcBO9htYkCaiyIARGSKV9F9HnYsQF577oSX+Wt+uvArrYchmBTmfzUTVE3/eAi6DMXY1h7wvS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owCq7AY9BCfGcNGXdEkQ8Ewq3jYfmRIZ8thDeUpoZb7Mt49bLGRu4qobj5Xc/hOD4bL4dzgD1z8Z/VhAcjZn8zOKtH229Mx8KB6iB0iuHLcA19FcbEzWXmFGzFsDjFVe1G8F/qvPSB8wbGp//V/hFYOwoO+4JsEL/s/Ze5/4pB8CdAfJPeCC 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 (i.e. not 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 query has already occurred, but this is predicated on the notion that query actually occurs (which presently only happens on the x86 arch). This is to assist debugging future users. Otherwise, the advise() call has been marked __init to help static discovery of bad call times. Once query is called the first time, it will always return the same value. Interfaces return -EBUSY and 0 respectively on systems without hotplug. v5: - nits and renames - kdoc warning - change to everything `unsigned long` instead of size_t - memory_block_advise_max_size marked __init - both cannot be __init because the query is called from non-init - simplified alignment code in cfmws iterator 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 | 15 ++++++++---- drivers/acpi/numa/srat.c | 12 ++++++++- drivers/base/memory.c | 53 ++++++++++++++++++++++++++++++++++++++++ include/linux/memory.h | 10 ++++++++ 4 files changed, 84 insertions(+), 6 deletions(-)