From patchwork Wed Nov 6 15:58:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Price X-Patchwork-Id: 13865124 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 EC347D59F48 for ; Wed, 6 Nov 2024 15:59:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC10A6B00AF; Wed, 6 Nov 2024 10:59:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AAB416B00B0; Wed, 6 Nov 2024 10:59:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 924FA6B00B1; Wed, 6 Nov 2024 10:59:09 -0500 (EST) 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 6E62E6B00AF for ; Wed, 6 Nov 2024 10:59:09 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2B68C16191E for ; Wed, 6 Nov 2024 15:59:09 +0000 (UTC) X-FDA: 82756128546.04.D1F8E48 Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) by imf03.hostedemail.com (Postfix) with ESMTP id 658AA20016 for ; Wed, 6 Nov 2024 15:58:51 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=sScpLB0n; spf=pass (imf03.hostedemail.com: domain of gourry@gourry.net designates 209.85.222.171 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=1730908523; 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=dE7GBdO27UpsSNU1CxN3p2/3T9xO+pcffcnhhBLFfkk=; b=CgHlGL3v4wm3lb46nTxDKKoquT9jMynQf84xc65tmK/wmCXdm5BXWmdjwpsm/VrOjlniIC HG0VAlcpm7LOSj7nbKn/BUmyD8Nzbg77w7O+UXBiBKnrN10nynYD0sd1Od2krmk/0AFJQq 6RpD/55Fv5IZ513XvzxiZySOKZ2UYGA= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=sScpLB0n; spf=pass (imf03.hostedemail.com: domain of gourry@gourry.net designates 209.85.222.171 as permitted sender) smtp.mailfrom=gourry@gourry.net; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730908523; a=rsa-sha256; cv=none; b=YfQPwNJ+nNqQ0OkXhKlabb2d8Tu5Sz1/TPenBU/BLHmOwo8hRPGyC+S14Amaq6ql7a/vkY 6EEE4FynBKN/m0aHTx/RvT430B/LRTCXdAN1/3e6CrAcj/LjyCLPzUxdmHPm6n/1lgsgi4 jpFGXeU55dGn+GzB2kQJn2/bFgYEN/c= Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-7b1507c42faso82704785a.0 for ; Wed, 06 Nov 2024 07:59:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1730908746; x=1731513546; 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=dE7GBdO27UpsSNU1CxN3p2/3T9xO+pcffcnhhBLFfkk=; b=sScpLB0n6rrf8jQA0ORtPUZ+kEPTcmRPNpLWm6kIobPjGoxq1NeNeY31TWMlW4X1XU tdauV4MWaBG9RWCUgJJav7zrtsWVRwAhp4DJrb1RIOaquyv2ysZj7XlYt5lAvJ4MfqWJ OZOHDnPJMmvUjdCrOv51serWjsnhcO6xIrBIxZ8LGtq2rLrsTSmX1XlcvavcDqf5cHch 3d/ieVTQBNy1xXyRD5OgxBFEse3SmvFzk1ImVW7h7vJrqSs8M3X53ffkSfX4BXMT96kr sKniwu8Dx+l6EXfOXb0DRWW7alTAyU35uW6Qb9QO2gBU3hWSxbidRbRs2SSkT3+PigfX Y5Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730908746; x=1731513546; 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=dE7GBdO27UpsSNU1CxN3p2/3T9xO+pcffcnhhBLFfkk=; b=JfTxc1dLNSi3Vby2KKjpheFRUSMmK7V6P8grPWK7hl5uqpb8yt4nS4QmWSavvHXGdO irJc9sPaJxzCrIuvG2pUdYTKvMQqHtZiIjvpKEYVm7FIyuTn36kd+CsWxV2i536C5QyG 7FKcqv9LY4IYJfzjD7UBma7NX/gLJsbDNe+4Wxhm50tGFJjreZi30LNtB0Hfbxp9rZ7D WaOoTNC4M03G5KrXIQ+XZUMXpSW4gbLHV5XLgtLKAA6/yk0LYGaqGmBM1ZL3y/kbkMFT TKvKA71DgncM8BBLnCCXxSh4uyOhNdxHvI+kocK6p9aVIz09YHwfZ7nZLWJ4bGgJYr8j ydkQ== X-Forwarded-Encrypted: i=1; AJvYcCXNbmbDvdpkqqBYo0r80tzlN27w6Nd8MfnzLo+BlKyKrvCDer9kMBSM8jcf6qFZxgAR7J3GJeVaKw==@kvack.org X-Gm-Message-State: AOJu0Ywk+I4MjC3pjegP6vhOSO1Gvy7FkpD82XLJwgGJNFebzlX/lAN6 e6T5uXidSekW9QIHNg9wyzBdJbhD32cvBKhCDYb/ZeUH/gavOwZUkoQIijMmvsM= X-Google-Smtp-Source: AGHT+IEUkctiVyqefq/YK8UzVAb3G1JlrVxWuRVPIwvQYFeNj0t51VLwtemS/L2Zn+W2U6AWN8z3Tg== X-Received: by 2002:a05:620a:bc4:b0:7b1:3c19:a665 with SMTP id af79cd13be357-7b3217fd138mr445393985a.19.1730908746378; Wed, 06 Nov 2024 07:59:06 -0800 (PST) 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 af79cd13be357-7b2f39f7b85sm641377285a.31.2024.11.06.07.59.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2024 07:59:06 -0800 (PST) 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, kernel-team@meta.com, 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 v6 3/3] acpi,srat: give memory block size advice based on CFMWS alignment Date: Wed, 6 Nov 2024 10:58:47 -0500 Message-ID: <20241106155847.7985-4-gourry@gourry.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241106155847.7985-1-gourry@gourry.net> References: <20241106155847.7985-1-gourry@gourry.net> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 658AA20016 X-Stat-Signature: gi67ns8789aoodaz6kyim9gr1pfizrzn X-Rspam-User: X-HE-Tag: 1730908731-724528 X-HE-Meta: U2FsdGVkX183VKxnUnkDiSiM+aXWBlnAfm3a+hl5rA30RJ8dldeT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HwPhKnAcLu7MhVSPJcvquRp3Gw4FD6uhy4TCZf0UIviZ968HUi2QYIqke9TFmb57F1NpUqGvr6GtV+GIH5JF2aIltODPQzjreh/MahIP0plrwaK5o4JHXbyLbBKoqg8e/EN9YoVRhxB7ErJm0Tpancp99ZQ0jCAllxl80ph7oJmfTTuYZn+J2XEczZKX5aCqMS5aoqzbzjJrswOQA01ngSWo6/wCI8KzUC1NsxbqP4swSLuOiV7qQw== 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 Acked-by: Mike Rapoport (Microsoft) Acked-by: David Hildenbrand --- drivers/acpi/numa/srat.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index 44f91f2c6c5d..34b6993e7d6c 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,13 +339,22 @@ 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; int node; cfmws = (struct acpi_cedt_cfmws *)header; start = cfmws->base_hpa; end = cfmws->base_hpa + cfmws->window_size; + /* Align memblock size to CFMW regions if possible */ + align = 1UL << __ffs(start | end); + 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, * or a portion of, this CFMWS HPA range. Extend the memblks