From patchwork Wed May 29 07:39:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13677975 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 8533BC25B75 for ; Wed, 29 May 2024 07:39:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1FB616B009A; Wed, 29 May 2024 03:39:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1AA406B009B; Wed, 29 May 2024 03:39:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04A656B009C; Wed, 29 May 2024 03:39:15 -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 D72306B009A for ; Wed, 29 May 2024 03:39:15 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 90BEE40889 for ; Wed, 29 May 2024 07:39:15 +0000 (UTC) X-FDA: 82170632670.17.6118152 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by imf26.hostedemail.com (Postfix) with ESMTP id 8692D140008 for ; Wed, 29 May 2024 07:39:13 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=YEY7KXZr; spf=pass (imf26.hostedemail.com: domain of jbeulich@suse.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=jbeulich@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716968353; a=rsa-sha256; cv=none; b=nUf6DV4NMOhS5kvPK5Qn3APKy/kCeD4mUvwjZZv0uPuG2pEayuHf5mJ0I17TRFAotyf11Z Bea8U6qBrKhUQvgQOoEXdLvkSBuxRp7UKP9WKlc+xV47F22kA99qciW+GcuolsuhkTPZpa GwGu06RFAhUWGkm3ZSG0CRkGiFgdqSM= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=YEY7KXZr; spf=pass (imf26.hostedemail.com: domain of jbeulich@suse.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=jbeulich@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716968353; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=CTERH0I9AKg9NwfwmsgE4RQTrbvFKKDYSyON0OrLaYE=; b=SUZx8U3pvc90KiJC15vsarxUjSSpvNbhkNz9UC6v/fly+YPRYyF05ESFm4y+SLzMYjsEww dzeDOiLeQ3CRl/rqccphfWNNG/NllTEWitEPQOHo2MybRMihQwbliRpNoNo6j2H+OEtmxl YwlO2+f9wrfDbLO/oBLYkJYas76j4R4= Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a634e03339dso188983666b.3 for ; Wed, 29 May 2024 00:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1716968352; x=1717573152; darn=kvack.org; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=CTERH0I9AKg9NwfwmsgE4RQTrbvFKKDYSyON0OrLaYE=; b=YEY7KXZrK8avcUIECsuMkOX9L8lNALVbWi5tpslbfoK4ukWUevvhasKdNZ4gf4o/X6 KUB4Us1TMVfKiDswhDc0HkXGyBlyk2z0mejp52bZKgF5t4zt+9RFTR0OA6AssU7pfrLL miiZheLxdniyT2AfJLvrePDC8hCAaC3QtQ/V+AhVNmbaF0SyZ16YBD1utz73hF0yppUJ +VFsOG0B8nxcQM7ehQBj8FqJA7NLcRfDP35DCWrzYPZCcXWnCZ27vwblbO35eUo0ocju fGHLuh+h9F3US6k2AEa+vEuS0Zbz62wKaBz2b81vIZQdJxie2ORKuMv6tj6Ce+g/pbuO rIQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716968352; x=1717573152; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CTERH0I9AKg9NwfwmsgE4RQTrbvFKKDYSyON0OrLaYE=; b=Sq86edQyc05q11l1k3PO97CTkmCjWHJossLPF1e/OEcB3xisDHtHGdMgzEp+e873xM UnbKYYid8utHFAI/+5ViK23Z2P7FYOn/ZGWb8QMkMwlFFsQRgss5DczrbHEuyyaog0a5 KltwE4+alZqHjyolvCkwh9WjVXgm3J8KddxDfrdM4BljUIvAqZhMQP6YKKfD6+S6ftQ0 O5zHbj+GQQQHhLGOJakV1jNlpLTF0NgN68nR8oZqYRo9NjRnh24RmMu4ISuAe3SiiW7e G3TmRnFmtn+uni1BMbm9lmXXHPNkyEcrOgyxAX4NC84OnyCo/+xYzPUaMWGu+phVGmI6 nTKg== X-Gm-Message-State: AOJu0YzzOTS4ns65hywo2XRJ9O9Xy7c8Y4cHBJ0ra3GjTBHJV0/A7vjs E1buAg8hQo1JXLByKYB2nEcfDHJjz9jk86UhKpYagqFd0Qiow3Uxq/FZnFj3/0CUP/iKY5Dv5UY = X-Google-Smtp-Source: AGHT+IHuyBc0KLPpX77ajcObmq98Qe0+nO+coTREaSr6bj8hxMGUHsN/2t4/U27UeVIG5dzYbHXrkQ== X-Received: by 2002:a17:906:2b82:b0:a62:2cae:c10 with SMTP id a640c23a62f3a-a6264f1600dmr1017783166b.47.1716968351855; Wed, 29 May 2024 00:39:11 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6590d02e53sm6035666b.119.2024.05.29.00.39.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 May 2024 00:39:11 -0700 (PDT) Message-ID: <1c8a058c-5365-4f27-a9f1-3aeb7fb3e7b2@suse.com> Date: Wed, 29 May 2024 09:39:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "linux-mm@kvack.org" Cc: Mike Rapoport From: Jan Beulich Subject: [PATCH] memblock: make memblock_set_node() also warn about use of MAX_NUMNODES Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY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cdCe0jfrS7/gL9TmMmuWtyit+PzdE/Ua8eFx7d/grNbyZRr4i9caKc7liCKu51uG7AHOMkTLy9aEpy/u51wCOPF61PRlzZvcoUv6Ypue3eJU/IY1VuuXSSIpXCk3FqBTBoxjooTWPgVw3GlMl5BI98J6JpZ35ufsef5gBrLrJFzAVnJ9+u6xwhV420UA3AnW6y+VUuCiq50qJuU3CppbrP6frOT5/fj4vyAccztMGr7NwyO65PIk/rj2O2ER56ymYmKSQCDF2TFosMvx7mD3QhpvK7XTa9Q79VS87gvFy2zzVh04zw/60+38JQ3qrIuG/d74YfSyKJVZKBHW7y8IU+AqEvT3V89kGoDDg07FGTbg88ZPrf/V8jUqUMGFVbf+kZgOpPiw7ed2LIx7PXTgpWptHNYUgHYUSJr2AGFAZcxJO4norDUkDVbhRQUeN+6H8nzUepSwg2rFRDvlgjUo01SoppV3ecuSWo/Y= 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: On an (old) x86 system with SRAT just covering space above 4Gb: ACPI: SRAT: Node 0 PXM 0 [mem 0x100000000-0xfffffffff] hotplug the commit referenced below leads to this NUMA configuration no longer being refused by a CONFIG_NUMA=y kernel (previously NUMA: nodes only cover 6144MB of your 8185MB e820 RAM. Not used. No NUMA configuration found Faking a node at [mem 0x0000000000000000-0x000000027fffffff] was seen in the log directly after the message quoted above), because of memblock_validate_numa_coverage() checking for NUMA_NO_NODE (only). This in turn led to memblock_alloc_range_nid()'s warning about MAX_NUMNODES triggering, followed by a NULL deref in memmap_init() when trying to access node 64's (NODE_SHIFT=6) node data. To compensate said change, make memblock_set_node() warn on and adjust a passed in value of MAX_NUMNODES, just like various other functions already do. Fixes: ff6c3d81f2e8 ("NUMA: optimize detection of memory with no node id assigned by firmware") Signed-off-by: Jan Beulich Cc: stable@vger.kernel.org --- This still leaves MAX_NUMNODES uses in various other places. Interestingly https://lore.kernel.org/lkml/20170309034415.GA16588@WeideMacBook-Pro.local/T/#t was a more complete patch which, for an unclear reason, looks to never have made it anywhere. IOW the two memblock_set_node() invocations from x86'es numa_init() likely also want adjusting, among others. --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1339,6 +1339,10 @@ int __init_memblock memblock_set_node(ph int start_rgn, end_rgn; int i, ret; + if (WARN_ONCE(nid == MAX_NUMNODES, + "Usage of MAX_NUMNODES is deprecated. Use NUMA_NO_NODE instead\n")) + nid = NUMA_NO_NODE; + ret = memblock_isolate_range(type, base, size, &start_rgn, &end_rgn); if (ret) return ret;