From patchwork Tue Oct 29 20:20:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Price X-Patchwork-Id: 13855355 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 0ACB6D3A697 for ; Tue, 29 Oct 2024 20:20:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B4D26B009A; Tue, 29 Oct 2024 16:20:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 30B6F6B0099; Tue, 29 Oct 2024 16:20:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C1296B009A; Tue, 29 Oct 2024 16:20:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D72266B0096 for ; Tue, 29 Oct 2024 16:20:50 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7110FA057F for ; Tue, 29 Oct 2024 20:20:50 +0000 (UTC) X-FDA: 82727756580.20.1C85489 Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) by imf29.hostedemail.com (Postfix) with ESMTP id 0871012001C for ; Tue, 29 Oct 2024 20:20:14 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=rBilL826; spf=pass (imf29.hostedemail.com: domain of gourry@gourry.net designates 209.85.219.50 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=1730233088; 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:in-reply-to:references:references:dkim-signature; bh=Oy7XVkWRraFdetQ8jpQD3fWOiMh3kGBraLt2py6f48c=; b=Tphg5ShEuF7u47dWL0PCDCXx1RpssDuENXyBxCSfBRfEiPPwz2auUqZOZ2huCM6rBP8/Uj pNxZ9UND8JMEKYtTLKYWjdODuugZYUTeVWhao1pmjL07NLEot7rF5O4g6jZ110FNV0SiA/ ngTEMPe42y19VAI51sBXmNWn8Bco5WA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730233089; a=rsa-sha256; cv=none; b=etaRlLmobEWMqApTvJsCyvQN+G1UjPsarz/jfCvpemCQciDWGIRcWafB7iRnxKohJzlZSg cdDHD6MfmNxpHFsvfNWENkX3eyYv8FNAgA2YkUfhRfTMQElLCFoKy/RM5jiYORXL52S9V5 d/KxDsLGdz6nNuR4etIdffR6pbWvNSc= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=rBilL826; spf=pass (imf29.hostedemail.com: domain of gourry@gourry.net designates 209.85.219.50 as permitted sender) smtp.mailfrom=gourry@gourry.net; dmarc=none Received: by mail-qv1-f50.google.com with SMTP id 6a1803df08f44-6cc1b20ce54so47602776d6.0 for ; Tue, 29 Oct 2024 13:20:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1730233248; x=1730838048; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Oy7XVkWRraFdetQ8jpQD3fWOiMh3kGBraLt2py6f48c=; b=rBilL826n2JS3Hd4AWknLgUwSeWO9tCyhog6lwqm00IpEytqJ1QR5+Oi5t/wfZsSSb MIVHoTbj9YXAL864X5hoe9HJrHP8uywNXprS4hT7lx8pLAptD/pPnVEqSwghfQslH4vW QmsCC5q6dlycx9evbo7Gm/fOt4YJy6gHZNdbc+SpLgHEjZRVBb56wTK1cWBHfWwtHka3 Tcfw3Q7Jfw06wB4uZF03SNSPDWSLq81/jtuLC1YMZtb3ISeEQChNyUYW7QKK66Bx9XbR P3e7fMhc7ZYTxMJMm5RTdfM5M8JX9V+l5I3EvO5zcCERbwwgINTDjGkTkTh0TXzhtSr7 pe+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730233248; x=1730838048; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Oy7XVkWRraFdetQ8jpQD3fWOiMh3kGBraLt2py6f48c=; b=PmV68yAUT89kW7LUyyR/bcz+eWZQZ/vF4B2tFQlLJAbO30FmUx4WJL6OWcWIyl2q6B 6+6pEWjF6SN36reJeVoY1rriI73n90RvkwX9sp3/exfsg2Kyu36AONVHi/JUulo/FWg9 aXnjrG7ISGgGOo5t+zhIbgdfDETmAP3a5cA8rMe7/3oU3aGCW4eBCT+EypxrB+VUE4Yt zsbBPdtWAMhZ4Qybc/g2fVoq6Z9qG/QN8rYz26k4bXKm62kxBjUpKbjRIoe9KLQqhmuV xiNHSsr6D0c2g/YSlrCiSqXlBhCyVoJiyBNHaaUUnyFqWErYjUfHB2lJhDMdxBHGMgIi CwUw== X-Forwarded-Encrypted: i=1; AJvYcCU7LuSsrSFyBr3y0RmkY+v6JYM5WTdcqT+tNK1NOItH3vnrEtGknhcDZVN6PB2eruv3nuYjVv+XBg==@kvack.org X-Gm-Message-State: AOJu0Ywcf9w9mKXbZwCem5LAT50p4bSj8gxX3puMcHIbzca4g7q5e/O3 2kHBEybsL3znxkxIROTi0k7W7JU2F9wFgkEGTKTnUTeVxbZ2+7RrdHuSB99lsgo= X-Google-Smtp-Source: AGHT+IG8wR2VNJGr8w4nEF8K7TLnCCm88h4+MvvrazJR7tXK1WVS/iZtDKaRFV9lJM5ZTXQsS64Xjw== X-Received: by 2002:a0c:f40c:0:b0:6d1:7434:55a4 with SMTP id 6a1803df08f44-6d1856c7483mr158035446d6.19.1730233247766; Tue, 29 Oct 2024 13:20:47 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 13:20:47 -0700 (PDT) From: Gregory Price 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 3/3] acpi,srat: give memory block size advice based on CFMWS alignment Date: Tue, 29 Oct 2024 16:20:41 -0400 Message-ID: <20241029202041.25334-4-gourry@gourry.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241029202041.25334-1-gourry@gourry.net> References: <20241029202041.25334-1-gourry@gourry.net> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0871012001C X-Stat-Signature: inx8388yopab3shtuskp3m8i4s7xm98p X-HE-Tag: 1730233214-139049 X-HE-Meta: U2FsdGVkX18i4Ls3T+XCFPp4bnVCAM3Bmyo1W0Gk6iIxvIHd+9HRDsXoiqtYKoN+9KOrXD0x9e8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Din9M6uKZUlgQScWMKxMW2xzy9RGSP03KXX99IUBbIwAMsHh5sfCfcUWNfFcPR1aYTXmXaAyzwrUMd7zdKSSfP1qe58KKnwwem9txvS5kdx9WQQMRGqf2u/A766ZJxYMDbdIvFktK5iWzLP4m0cG9VIHSRwUh9sEGMaqhE0ygE+fpNxYuR34= 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: Capacity is stranded when CFMWS regions are not aligned to block size. On x86, block size increases with capacity (2G blocks @ 64G capacity). Use CFMWS base/size to report memory block size alignment advice. Suggested-by: Dan Williams Signed-off-by: Gregory Price --- drivers/acpi/numa/srat.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index 44f91f2c6c5d..a24aff38c465 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -338,12 +339,26 @@ static int __init acpi_parse_cfmws(union acpi_subtable_headers *header, { struct acpi_cedt_cfmws *cfmws; int *fake_pxm = arg; - u64 start, end; + u64 start, end, align, size; int node; cfmws = (struct acpi_cedt_cfmws *)header; start = cfmws->base_hpa; - end = cfmws->base_hpa + cfmws->window_size; + size = cfmws->window_size; + end = cfmws->base_hpa + size; + + /* Align memblock size to CFMW regions if possible */ + for (align = SZ_64T; align >= SZ_256M; align >>= 1) { + if (IS_ALIGNED(start, align) && IS_ALIGNED(size, align)) + break; + } + + if (align >= SZ_256M) { + if (memory_block_advise_max_size(align) < 0) + pr_warn("CFMWS: memblock size advise failed\n"); + } else { + pr_err("CFMWS: [BIOS BUG] base/size alignment violates spec\n"); + } /* * The SRAT may have already described NUMA details for all,