Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp169582rdb; Sun, 21 Jan 2024 23:33:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IGG6SmKpL7tfGPo2VyvxjV0eUVotKM9gKiJM2bDEKhGtb7FqMGbxYv73H36aUROMDSjhqgT X-Received: by 2002:a17:902:7444:b0:1d0:6ffd:835b with SMTP id e4-20020a170902744400b001d06ffd835bmr1385066plt.102.1705908780330; Sun, 21 Jan 2024 23:33:00 -0800 (PST) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n1-20020a170902d2c100b001d729af3e6dsi4372227plc.174.2024.01.21.23.33.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 23:33:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32426-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@amperemail.onmicrosoft.com header.s=selector1-amperemail-onmicrosoft-com header.b=mbYCrIvT; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-32426-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32426-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E80E42841AD for ; Mon, 22 Jan 2024 07:32:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9504F179BA; Mon, 22 Jan 2024 07:32:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=amperemail.onmicrosoft.com header.i=@amperemail.onmicrosoft.com header.b="mbYCrIvT" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2125.outbound.protection.outlook.com [40.107.244.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD30F168C2; Mon, 22 Jan 2024 07:32:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.125 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705908771; cv=fail; b=M4puJym6f87SgzV2aS5AbCr2aPQ3Tr7vIbjMTIj3qt/byeNknm7VJFF4GZwmd9Q/u5GRk/lh0k1ILhUG8om5ZcTs18jSve0DK2ppn+qzhp9X2KWP+DYeTccK97aRpUasBQuVjDPAu8IHkx5kfntpK7rJSHLiF8EVU8E0I8YToAE= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705908771; c=relaxed/simple; bh=OFxAgdjkyz44++nL5o4ToOgbq+gyzIfjluT+a7Y5EN8=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=WBeZLcfXLq+dmquo9JtHHp6UZ8TTfRTAt6l/A4hSp+1uHPYjTlUKdMeOs/eLWF4Xgh5dB0GISnECAliiM/5SwwVlWy+C51LC7eeXZdBZGXqPJ018sGuZ/N5o3893h1ibfBudZ9XOXibYqmjMIx8+HKmW4/sG07UYKSmwVQ/PBy0= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=amperemail.onmicrosoft.com; spf=pass smtp.mailfrom=os.amperecomputing.com; dkim=fail (0-bit key) header.d=amperemail.onmicrosoft.com header.i=@amperemail.onmicrosoft.com header.b=mbYCrIvT reason="key not found in DNS"; arc=fail smtp.client-ip=40.107.244.125 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=amperemail.onmicrosoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=os.amperecomputing.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oDI9kMHVrQxhGhNYjuBAzDFVSobDEnvSuF/b/hUDkFB3KCYxE+0ISeLUwlkNDLcXwl+gdVxl4rzGTlsUstsbtnSYGD4X/kQmjmOmoJsTn8WXm53KQtMBOVHbQyQ+qcssxbyQAiv6hNAW89ZcZ2t7pNyzc0HasC1vIzu9Qt1fdtmeckeH9y/9otV4WNoXpzHXEd7kj/NKZ6Kff+Fl4clE7Jw8jYx7VW+mpyN5GQQvtl2lvzZSm/8YX/jWMvtczTjZXldQ5Qp4n8ch5XyEM4HEpmjbPi8d0pUhdvBzO0NCt5GdriKxxxWhCgUvqzArqoHzMQHVUo4kZvlPfVQrUABUTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OMmLoXFnauY9KkDUcUs7kn/KAWO9NChcXWBew8e/yJ0=; b=buBERJQ2PScCsyFI/7X0bkt23HZtTb1MDVmEDe0iElE/PeWtcCCG4zoXsDWA2FhRnfvEHCMKY370fAQPZ1NVvAHZykkokwe+uFeJ0xeUbUuScnwChE79FC6PugT1tdvNLO0UU7qHlXsRlPHUgmLehLvarsmrqwB57nB9IrG0iDTuZ2aP1TFNhZX5IG+QberAlNnaQ+vYeBw89jydpj52vERVA1hDldXwC/gXC+P2EePLd+2a47olrR3tfklJOe8LZL6+5YWfR+3XkYCYROxqAZsI7qi1eaWHI9sZeVdp63y4F4z5QeFjN5f0SCfUSAibWgf9xVOKB8Nk/7r0aL1cOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=amperemail.onmicrosoft.com; dkim=pass header.d=amperemail.onmicrosoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amperemail.onmicrosoft.com; s=selector1-amperemail-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OMmLoXFnauY9KkDUcUs7kn/KAWO9NChcXWBew8e/yJ0=; b=mbYCrIvTyPZ2RQ/2Nb99ZRClxgU5pxGb2W1ERiWxmMpwwEbnuefC+LSr6YHa5buqHjO6lj/qxSOBghuPveiovSGzdpOShskFXScbArNSqW2uJSLEB7BdJUfbi8zIdmABJ1z9SI8rs2BRz5ACLqVrkQF+IpbUYAgis7x6GU7B41E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amperemail.onmicrosoft.com; Received: from PH0PR01MB7975.prod.exchangelabs.com (2603:10b6:510:26d::15) by SA0PR01MB6379.prod.exchangelabs.com (2603:10b6:806:e1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32; Mon, 22 Jan 2024 07:32:46 +0000 Received: from PH0PR01MB7975.prod.exchangelabs.com ([fe80::91c:92f:45a5:e68a]) by PH0PR01MB7975.prod.exchangelabs.com ([fe80::91c:92f:45a5:e68a%6]) with mapi id 15.20.7202.026; Mon, 22 Jan 2024 07:32:46 +0000 Message-ID: <1e39190e-3cb9-41f5-bd60-1f1124823e4a@amperemail.onmicrosoft.com> Date: Mon, 22 Jan 2024 15:32:27 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id To: Yury Norov Cc: Mike Rapoport , Huang Shijie , gregkh@linuxfoundation.org, patches@amperecomputing.com, rafael@kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, kuba@kernel.org, vschneid@redhat.com, mingo@kernel.org, akpm@linux-foundation.org, vbabka@suse.cz, tglx@linutronix.de, jpoimboe@kernel.org, ndesaulniers@google.com, mikelley@microsoft.com, mhiramat@kernel.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, chenhuacai@kernel.org, jiaxun.yang@flygoat.com, linux-mips@vger.kernel.org, cl@os.amperecomputing.com References: <20240119033227.14113-1-shijie@os.amperecomputing.com> <1cd078fd-c345-4d85-a92f-04c806c20efa@amperemail.onmicrosoft.com> From: Shijie Huang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: CH0PR03CA0032.namprd03.prod.outlook.com (2603:10b6:610:b3::7) To PH0PR01MB7975.prod.exchangelabs.com (2603:10b6:510:26d::15) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR01MB7975:EE_|SA0PR01MB6379:EE_ X-MS-Office365-Filtering-Correlation-Id: a7a667ef-ee11-48b9-55bf-08dc1b1c53b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6TdZwVbXaJ2LXfN776XoNhi70w3d0IgW4wLwbVPcgj0PtJC0RbmhbLSII8NbY8+dPPkqhgRPB1v6wg96BG70Xc/W32bE714d/5JW7SOU+62xuWAPZDKwVLdu4nM2+u8LycBPf04hvtUKo9fVIrXGmBFX8RwHIQhWwvbkT1/s0lZF1JLZiiR6gjeNuCjKYAQ1hEOpWxZJfYAJcgsasSW/nixSqW18oHWoXKEHGGXB7doBx0v5fLpriSWkoWNPmYv4k+DGq8WsUQlvMXvuS/6HWuko5lkMKH41XpXs0xqiUeSQXHT7Gv1/LxmZ6GxEplO1Z1OlHm6ZUMR99hcVzMsfNEEht10zYufhtXWwtGAa99SYccnpGmKPdGOybP71Fp03ZY9Hpxv8fQQXRmcARY+XZdOJya+12Awgfgt18LTiIKrrnR0hGZV8WCDq4fgfbPrJ2K4no1l5cuai7tPf4ZROUnZxJh2Ks2A7Ru8yfttUTIYGy6bAsxw9LiGrP2M1hOqHYPtxOq14gxY0YSMYiZ9RmaccxQeDyv3ZG+ko75G7gtmQ0e5SW7zHO6xgroJGMZpFdNId0sErmq8pEgTE1PMqGa4ZVKOODUhesBhR76PDDRMYMJBScoDXJncLrrGWnhxmTHve5/jN6NjSko82QHeJlegLQ6Dmzlo4cSnsMPiiOjI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR01MB7975.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(136003)(346002)(39850400004)(396003)(366004)(230273577357003)(230173577357003)(230922051799003)(186009)(1800799012)(451199024)(64100799003)(31686004)(6666004)(8936002)(4326008)(8676002)(478600001)(42882007)(6506007)(83380400001)(83170400001)(38100700002)(6512007)(26005)(107886003)(2616005)(6486002)(66556008)(66946007)(54906003)(31696002)(66476007)(316002)(6916009)(2906002)(7416002)(5660300002)(41300700001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Szg2WHgxMEhZNlRuWkprK3F0R3hZRVZ2cUVsRjVFbCtoZjNkUGFtcW5tTjlP?= =?utf-8?B?RmxKNWp2V0NKVWRMcDRLNkFmVXUrQndNWHlSaXF5V1prUVIxYWF5WVlzbmI3?= =?utf-8?B?VTkzVFhyd3kvd0t6dDNmei9yN285U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utf-8?B?YVJxMXRrNEl4VDJ6dCtDcWNSQWtKRlQrd2Q4MERla1dnd2NmVnRlY3grZjR2?= =?utf-8?B?c29hdDk4RFVKQ0ZIcm44OHc3Wmg1OTRmdVRFdXNyZEhoRGJyM1BGbGc2cEQr?= =?utf-8?B?bm5jUGtuOTNzekxFUkw2UTRZdlNkS2Nid1IvbXZKTG1aUXRyQUh1ZE1UZ2Vm?= =?utf-8?B?WGtRZ0RUcU1HUHhTc0lEUkRPSit0RVloeldNUTJqWTdUZ1J1RTkvS3Bpam90?= =?utf-8?Q?tV1q2wkOVhEQOZeaxCPZvhU=3D?= X-OriginatorOrg: amperemail.onmicrosoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7a667ef-ee11-48b9-55bf-08dc1b1c53b8 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7975.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 07:32:45.9517 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dykvp/O6lEy3ZHWlYAkZ8e+2942Vu8eXdL2D3VVBxgB38l+igSj2xwZ3G8Mvyr6UzlfokbKnIipxJd9nezsFrh6PvLtt5ExW5zyiduWDR7r8iMf0oiQP09cQ0KykMjJ0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR01MB6379 在 2024/1/20 2:02, Yury Norov 写道: > [EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please be mindful of safe email handling and proprietary information protection practices.] > > > On Fri, Jan 19, 2024 at 04:50:53PM +0800, Shijie Huang wrote: >> 在 2024/1/19 16:42, Mike Rapoport 写道: >>> On Fri, Jan 19, 2024 at 02:46:16PM +0800, Shijie Huang wrote: >>>> 在 2024/1/19 12:42, Yury Norov 写道: >>>>> This adds another level of indirection, I think. Currently cpu_to_node >>>>> is a simple inliner. After the patch it would be a real function with >>>>> all the associate overhead. Can you share a bloat-o-meter output here? >>>> #./scripts/bloat-o-meter vmlinux vmlinux.new >>>> add/remove: 6/1 grow/shrink: 61/51 up/down: 1168/-588 (580) >>>> Function old new delta >>>> numa_update_cpu 148 244 +96 >>>> >>>> ...................................................................................................................................(to many to skip) >>>> >>>> Total: Before=32990130, After=32990710, chg +0.00% >>> It's not only about text size, the indirect call also hurts performance >> The cpu_to_node() is called at very low frequency, most of the times is in >> the kernel booting time. > That doesn't matter. This function is a simple inliner that dereferences > a pointer, and I believe all of us want to keep it simple. Yes. I agree. I also want to keep it simple too. >>>>> Regardless, I don't think that the approach is correct. As per your >>>>> description, some initialization functions erroneously call >>>>> cpu_to_node() instead of early_cpu_to_node() which exists specifically >>>>> for that case. >>>>> >>>>> If the above correct, it's clearly a caller problem, and the fix is to >>>>> simply switch all those callers to use early version. >>>> It is easy to change to early_cpu_to_node() for sched_init(), >>>> init_sched_fair_class() >>>> >>>> and workqueue_init_early(). These three places call the cpu_to_node() in the >>>> __init function. >>>> >>>> >>>> But it is a little hard to change the early_trace_init(), since it calls >>>> cpu_to_node in the deep >>>> >>>> function stack: >>>> >>>> early_trace_init() --> ring_buffer_alloc() -->rb_allocate_cpu_buffer() >>>> >>>> >>>> For early_trace_init(), we need to change more code. >>>> >>>> >>>> Anyway, If we think it is not a good idea to change the common code, I am >>>> oaky too. >>> Is there a fundamental reason to have early_cpu_to_node() at all? >> The early_cpu_to_node does not work on some ARCHs (which support the NUMA), >> such >> >> as SPARC, MIPS and S390. > So, your approach wouldn't work either, right? I think you've got a > testing bot report on it already... IMHO, my patch works fine for them. They have their own cpu_to_node. The x86 reported an compiling error, because the x86 does not compile the driver/base/arch_numa.c. I have fixed it by moving the cpu_to_node from      driver/base/arch_numa.c to driver/base/node.c The driver/base/node.c is  built-in for all the NUMA ARCHs. > You can make it like this: > > #ifdef CONFIG_ARCH_NO_EARLY_CPU_TO_NODE > #define early_cpu_to_node cpu_to_node > #endif Thanks. Add this make it more complicated.. >>> It seems that all the mappings are known by the end of setup_arch() and the >>> initialization of numa_node can be moved earlier. >>>>> I would also initialize the numa_node with NUMA_NO_NODE at declaration, >>>>> so that if someone calls cpu_to_node() before the variable is properly >>>>> initialized at runtime, he'll get NO_NODE, which is obviously an error. >>>> Even we set the numa_node with NUMA_NO_NODE, it does not always produce >>>> error. > You can print this error yourself: > > #ifndef cpu_to_node > static inline int cpu_to_node(int cpu) > { > int node = per_cpu(numa_node, cpu); > > #ifdef CONFIG_DEBUG_PER_CPU_MAPS > if (node == NUMA_NO_NODE) > pr_err(...); > #endif > > return node; > } > #endif Thanks.  I had a samiliar private to detect it. After my patch, there is no need to detect the error again. Thanks Huang Shijie