From patchwork Tue Dec 10 22:05:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Price X-Patchwork-Id: 13902357 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 A22BAE77180 for ; Tue, 10 Dec 2024 22:05:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B7B9B8D0021; Tue, 10 Dec 2024 17:05:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B29DD8D0017; Tue, 10 Dec 2024 17:05:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B9FD8D0021; Tue, 10 Dec 2024 17:05:53 -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 6A8458D0017 for ; Tue, 10 Dec 2024 17:05:53 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1E1E54293C for ; Tue, 10 Dec 2024 22:05:53 +0000 (UTC) X-FDA: 82880431704.06.6A232AE Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) by imf11.hostedemail.com (Postfix) with ESMTP id BE0C840003 for ; Tue, 10 Dec 2024 22:05:30 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=sBRgcb0S; spf=pass (imf11.hostedemail.com: domain of gourry@gourry.net designates 209.85.219.46 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=1733868328; 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=EAbRT3t6URREoSf/WrSmqWIQoci4Yw7h23phPh/fk7k=; b=aSXoZ2OpIx2VajGAs3Dn0oniYmnzCMr4BJCuP5j63NpBhudGgBeDvxavqakwzNIB7rY2PZ JOmavlQLNCw6mt5fkn00aroB1VRlgPyBo2fGREn9WBhwrQKeUHGE2Rneb3NBVMfY1iA3eq +eLXZYOA/aYZMBCvlOqih9qJ1poaGEs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733868328; a=rsa-sha256; cv=none; b=i5oOFOi2PJSrbHc9KGgnAJ+MBE4GJUKIV6ASyflfhzMIyFP2bZ7O/0B1/0uQD2kQPFRw3Z Cr4b383TvliWtC4oZvjPqtS1jvQqxmdWmN7IWpNgRMfXqiUrm+QvcXXHmFd4OouUac/2rT sB/BQB3fR8vmI0bse7umFREXpi6IMj4= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=sBRgcb0S; spf=pass (imf11.hostedemail.com: domain of gourry@gourry.net designates 209.85.219.46 as permitted sender) smtp.mailfrom=gourry@gourry.net; dmarc=none Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-6d89a727a19so905736d6.0 for ; Tue, 10 Dec 2024 14:05:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1733868350; x=1734473150; 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=EAbRT3t6URREoSf/WrSmqWIQoci4Yw7h23phPh/fk7k=; b=sBRgcb0SVplwpgA2DkgFCEi1fq+xJBdl67854S6LIn+ZFVwJh/9liiMgeCKJt4YE74 JPehmjjqvwsmM7ppavTZPGBY9mY8ANXhdQB2f3rNVd5QcsUVY4xoufGpjejpk/qgspO5 j6omf1Oh+LX1wYMTHaBugsY8AUp/ngOBLfoTabCiied+xOWcSSbBExdfVPyjzrkr8dU2 ABPNXHex55RK5qBpfreOThzr5fauWzQmI+d4Rhwsdfw4adkrVjyRt8FuacI0JOWvMmyu /CrtZSDtrmCfaKT0CAhQeXu9qQHun3K5JhQZMXH/ruE8jblKiYYrFXX1wMbSEM6Sg4nP oE1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733868350; x=1734473150; 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=EAbRT3t6URREoSf/WrSmqWIQoci4Yw7h23phPh/fk7k=; b=X4O8YcYoqfM/PY7oMPCylEEcLGoiIw751Avj2yi2niH5jJsmesioaaPu/Qs962k2kF 6pzpBF7Oc7RcKUZ7LFzFaa8zFRKJPNWN+7QBmaciFY2HUv0eJ8SXryEc6sEgNppf3ol3 nLcoCxp3nbiEP+ymfV5SBRWRkdu171S1C1oG9gAy8RbhSMkPvrBinpq+yh716Ys+fTEs nU6EHDeqS/3Ss1ljC0XeHp/1hjaIU9slGDVBvMh+3a9ECd0ntIksForsKJFF/c/0rQ7H k2bgN614dbTofXJRjgVgw6lKvw3RnFyY63/NGQ4Rkg26q7Oz26VZRz6DcN3EPsrLdWnI TCow== X-Forwarded-Encrypted: i=1; AJvYcCWinmgklHdE25Jqa1ghAjh4bejcjbzT8K5hD1cGwNqP/iVupke+o3Dt+4SMMnOqCid41jWHbnc8jg==@kvack.org X-Gm-Message-State: AOJu0YydftyKNdRBJe9PLVaqomWOeeZU9ZRSnyOiSwKmUL5uNox+BPBf NPBaVw6zzAB/NSlwRTRpGM+dGjKNh8zHTuix2KF7X7U3DT9yYIf9MRpOjwFGa3g= X-Gm-Gg: ASbGncv1wAsx1XJnBEtg1m7+BK/Uaw34FTAWsnMfJzWKtcG1eYrv+GbMq3/dX4AxWOs U9teOHvMACNAl+cc6CYHACZD8Gp11aUpB9CK4MGAv9DNjCWg7kFcXNpQE4+D5s9eh+Yuny7DbZZ GQhcwELuNGu1fgyRClIVtZPE2HZYhQD/Ya6WPhKvtIVDxU/mQaYFb7A6WIYoA1gtFuMRUO+244K 3VeLRKb8AWpgR1M9+2Fcdzt3nmN5CyBvdOG1iBTB/MGJZATZpAus57F0jCvrCX+8Da2oUEQaY3E Koxq657k7gN0WJl8UHBDGlB/QKVGQrAXZFAVnOg= X-Google-Smtp-Source: AGHT+IFa401/2CB5gCylFx+OUusnw00jP99YqBV6GuTzUiOFDtq2M92ekuKX3e9+dJid45ADWSbIGg== X-Received: by 2002:a05:6214:260f:b0:6d8:98a0:23b6 with SMTP id 6a1803df08f44-6d9351fb640mr8120916d6.4.1733868350323; Tue, 10 Dec 2024 14:05:50 -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 6a1803df08f44-6d8eeb132e1sm49707756d6.35.2024.12.10.14.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 14:05:50 -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, dan.j.williams@intel.com, ira.weiny@intel.com, gourry@gourry.net, dave.hansen@linux.intel.com, david@redhat.com, rppt@kernel.org, akpm@linux-foundation.org, luto@kernel.org, peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, rafael@kernel.org, lenb@kernel.org, osalvador@suse.de, Fan Ni Subject: [PATCH v7 3/3] acpi,srat: give memory block size advice based on CFMWS alignment Date: Tue, 10 Dec 2024 17:05:17 -0500 Message-ID: <20241210220517.3744-4-gourry@gourry.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210220517.3744-1-gourry@gourry.net> References: <20241210220517.3744-1-gourry@gourry.net> MIME-Version: 1.0 X-Rspamd-Queue-Id: BE0C840003 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: icn6tx5dqntse86sqi94gzbs864dbdi7 X-HE-Tag: 1733868330-335323 X-HE-Meta: U2FsdGVkX1/vhP1wtPYjnF4oQI5b9WIdYBjged2V/b7DVC7ls8F6zPYbjOAbvKZOeonKnfTzxXxr2RkmITOck/KTYrVtkutALvjWbH0ML5QKjJEDWlfFDY6DTzllzpT43oylOB4BgpPWK2tjo7gCwe0iB4puLgcsgy6tJO6fA+6As7PENYxGWnPyorgEl0c6NTCMhEWPAsFSxgrEOt7NP8K37QJ9EmRTJOUQV9b9V6GbMLY3aaT4hGKrULFVTDWs9cQBdzY0V66oHTmmaDzkBoAQovouEofQvQItiqk5m1+DRjwbFbYFlsx+BH4Nwj6kDOIuqyx1bqUDCVZlarr/gHue/BoXOT+7RvpxjVLtMphMsEgEW0Feod8ZA3YjvnllSZa1DYMWtHZLQtjPTOIM4jZW1AuDRGOI1FhfVG1B6ZB3kjgYg8KEx/4UKdzWp9gY3UuOZP6Pktb6Ex7TQY1sal1Eg/YMu+f/BNWPJ4h1rFe8tHc+LkSD5N2stFFZHEGk3iTtEaQ4KZQ6CRC7H79nUseXztk13RrH5SdEdWXrgxtVas+09S+xce8hMHEjMJ+UkTXTlrpZZ9DnVhpQp38rjEi9/YT/aLExW6b8Ig7o4NivG3lGz8omboMEH6OfRum54tCuxPqo/vT0XeM2ebfNsGPts4RIFuX1zeHIduX8xJ/DfAqAoQ0VnhURuzE1vEAigvKF1lOAeV7ZrgRcefa/I3qjuTKvgD4WTIADab0nsL3rLLne7bNIZyYZEjDUL4y+41R9oN4ixT8xG13GGnvcuvn/2hUmhEvqzP0Z9OPuZwlGLlnvY04qrXX+JYeEoptxPrXGENKQjr/aOgw7rJlLmOyzFCdapF3joQYe/TvmXUN8f49HfXo4JlnexKFTVsezHtCcnsRSFib206dCa+S4zbSsw5gyorlBLQXivRLDg4Obimks1hPxvqC+q7/h/N8jSeJr7zz9DVanq22BlYJ aVHeNyCk dhIsF07B47g2HzpIEAlHOS6sH02f/hZJ4NUVPO1hniNBvXh8smz0I2L/1xMeT+O6NEEwqb3yPwWXbnAeGURFbQNQqfTkJE2T3idgDKfi6ZfAV+dLtPpObYhiBIFRXEC7ONwl+GS9mhfIyUUcHblBrOYsx2XumAfY7wrJ3OdjReLqDZaZ25tqcd9N0csgRv37TDwPmBEOreD3R9lM6uFvtw2Ra4JcTk+1NiTdWPEJGcFX/a4UG+cziq2OeWINTlqbQ4czupdAetsLS21vTopwj8sraDjKwTT9tUOKnMisxHVN7Qh17fEYHDCsEkypB84TNoLNCoLinMWpTXtEuwcu7duA4yMXFtsLKoXCURS/kbX68Y8u2Uejxi/13xIMzmhYbDG43p9A7k+urDUKoFTEqs6Brcw== 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 Acked-by: Dan Williams Tested-by: Fan Ni --- 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 bec0dcd1f9c3..af7d51222933 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -339,13 +340,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