Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp189892rdb; Mon, 22 Jan 2024 00:28:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGPtDzO1azpxMsPmniP5Y71173A4kl8D8FGgxIaLqzGlSxNNoUuSMbZfP6QnyUfKMzNxLh7 X-Received: by 2002:a05:6a00:10c5:b0:6d9:b0a8:8fb5 with SMTP id d5-20020a056a0010c500b006d9b0a88fb5mr1444994pfu.17.1705912110058; Mon, 22 Jan 2024 00:28:30 -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 n24-20020a63f818000000b005ce05e5d57asi7663345pgh.660.2024.01.22.00.28.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 00:28:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32515-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=7mfFYS4v; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-32515-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32515-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 AA77F28480B for ; Mon, 22 Jan 2024 08:28:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9D5B20DF4; Mon, 22 Jan 2024 08:28:22 +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="7mfFYS4v" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2121.outbound.protection.outlook.com [40.107.243.121]) (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 43C9F20DE8; Mon, 22 Jan 2024 08:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.121 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705912101; cv=fail; b=rgKTXT6DGWuN5tyXIaPpcQN+hrFWvBCuD3mCcE3Fb702TYivRGaVcB+5sOTU7M7jEYIynAVukrxZn3oGhSYmqjBteNn6UAfT8f8PbAPS3EFalQVSFj6wvlL2cEok/VsfaQIgbERgQ4e1JZu5GZiiGbvhZTrhxur6ip1C/cSDAQo= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705912101; c=relaxed/simple; bh=o8Uq65Ox6ozp5oWnqPVw1CApiu7FKGwyf98JgWGl11U=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=RUU+dqFXn5FKihvdoVhk5wN3oYdohU5Fms0QcQMBsEcekVum/zG8sUqA0JsGWDEHj2jJH/gC8wVFuygPkwymPI+V3TPWNvppaKw2R+RpdeuB6e5mGhIH4o5Ox9iMxJW82ZEM1QDL6MOER6qELTBWwCWZkHEH9bqPicRJ14eetrg= 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=7mfFYS4v reason="key not found in DNS"; arc=fail smtp.client-ip=40.107.243.121 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=L6oFlIolLKcOmVUMQpJBuPuHExbJ6x11YoEnOnxe6fCf0mecbrnNGQA+OqdHjVC9C366EG9JkfJ8xI/p23ht62CY99L2+K41gpBw/8xsOSFSxK4q+czc51BLiKzRZ/+vmfsTaN6+QrmOkeoGQY9udyLzgpp2SEbcEz3kq5kqnMnxblDi6EYiO/ZKD+rCE3ChvqE3kGZkOQgaiR5rvTAcwOOLaMCF44uEG4ATJVbQ3z9Uu3+fmyZBVAgvulLqiG4WC+FG37XSBQLBNN5tYtxktRdEEymJw8OB8nQk8j5Q7AiRtukZdZWHO7+zM4ZlRdP+T1yW5ak7zK0v8fQuwzOmYw== 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=N/OQsH/h9MEYqYgFJAmdJ32/zkiLhRbhU/7SYMCvYx8=; b=a4BvI3cfpiXkBIIyoPgJWEzzQ0z5S37T+J2shbAToZcsWcW5PZiwk932n7HUZY2AlhjuLoIkL8ZTidOEM2v2yIvx6HoxAQhzPQRGVsT8LWKzU4x0btse6w5QL5sfXJbbdP190vCVg+gEpwas6im0ZYY5cvVj8j19o51OGkguSZRTMtRBw2OLJEDtcCunAO/T5+m5EHEMVlFUaNwDABP+IDmNdWWUD5gHLP0yOHtfKTTGybGUSqg8zfHHBnFNvtZk1Gflw5D6EnXEUcanTXUj6R78Q85cpTGhWsAvc6au418PJYRXzNiuvYPim8Hm2peZnBRkB2OhmPWkdXsDcejuTw== 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=N/OQsH/h9MEYqYgFJAmdJ32/zkiLhRbhU/7SYMCvYx8=; b=7mfFYS4vCdZySb/13z1Ugz9r6RLFJ5wDO+n5xyo2MkmyfwkkCi4oZH2R0JjVsv4mHgUtFXIpHfqvTEPItcL5PHtUX3S3zYPkT+/LF+Sjc530SDBY7hbr73AntzQSJBdowAFEvp6MyYEjA3HpH3mTuwnX/WfzsH9QMBhgIBniLbc= 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 PH0PR01MB6603.prod.exchangelabs.com (2603:10b6:510:75::9) 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 08:28:14 +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 08:28:14 +0000 Message-ID: <9d9b39fc-82db-4320-9935-f760ee723064@amperemail.onmicrosoft.com> Date: Mon, 22 Jan 2024 16:27:58 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id To: Mike Rapoport Cc: Yury Norov , 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: CH5P221CA0016.NAMP221.PROD.OUTLOOK.COM (2603:10b6:610:1f2::12) 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_|PH0PR01MB6603:EE_ X-MS-Office365-Filtering-Correlation-Id: 4636f5cc-2fc9-458f-b000-08dc1b2413cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aNoFEUdLf58HF5Rzmwsj7WqwWnSkxnmxN5o3/B464Qn/mauxEGfzibbVchI+RAkH7lt3dv7HaL15nj/En1kFHKveWy+o5i/qvZPGXs8EwEeGCqlzRM70L5m+2V6EanhQebcXBY9I1pS9A/I7k42szI+nDm44Q6Ai9Im76u0rl0g0ghFadVame7n+Y01sLg7SD+WNtomyYx615TIgDHD6L4qfQV3WDF5rylpwAnH48E+DGR+sCM14YDYYbqRjGN/SiSgTIUbf6rW4DqwhCTmo9P8hX7zyyHzopgPQE+GW+mgKlyR1argQKi1CDziDR4T8c7Az3pgjkVeXHeHIpSjCF8jZ3pY3SzgTELq9QBfb8+1OuNKZQcoeixCcjYzhprgAZtA1fiTdDKLxrXJGsNxLN2Z7H8Q5QAdFlYVXdKaaSDD8zDpcb4ZeYEh6DITe54te4wJQz4dHhInQUsmKs8NPkEp8K/ctPsm+gMswSfm0V1ummuRg7gw3DO9qaH65XOZi1jYouiXtliazTXnL+GXVMCH4NtVqIgpLw6m+pZxQ/8TJqwP7GFBsTxb9NUBp8CdwpQn2pdeuCJn+259z5S3qnUZDha5Ya1pWm4J53OOmen3NKUFZ6VJc5g6IwGelCdOE 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)(396003)(39840400004)(136003)(376002)(346002)(366004)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(26005)(2616005)(107886003)(42882007)(478600001)(6666004)(6512007)(6506007)(6486002)(41300700001)(2906002)(8676002)(31686004)(8936002)(4326008)(54906003)(66946007)(66556008)(66476007)(316002)(6916009)(5660300002)(38100700002)(7416002)(4744005)(31696002)(83170400001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SEw0UjFlZUVFVTh3OUFHVjZGK0docW1WelhrY2RXTXhPZUR5U2xnL0NadUo5?= =?utf-8?B?dkJsMGJ5QWVvdXYxRXNxb3F0V2FJaVNhSVRjejdtTWJSckNVblM5TnNvSG0y?= =?utf-8?B?Q2liKzhOQ05GNE9ySEY3VFFDdmZtR2V0VXhYeFJWQXNrWGkrWTEzeElCelZr?= =?utf-8?B?NnNTeEt2U200R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YzQVhrSDJLMGRa?= =?utf-8?B?T3VNcDd0bjR4VlVsSm94UlVEb05QTkQwYlBnV2Rzb2RkZUR1cDREalZlZ2wz?= =?utf-8?B?bFFBQ0FGNjM4bVM0UytCbEUrZ1hkNTRMN09QMGJQa3JBZEFiN3F1UURoNHpv?= =?utf-8?B?Q2RObHlNQWN1WE02ZGIrR25LMVpUcCtNZWtGanIweHhxbktGbDhkc08yOE9M?= =?utf-8?Q?75qimKA5MLosMzfaujCi8JE=3D?= X-OriginatorOrg: amperemail.onmicrosoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4636f5cc-2fc9-458f-b000-08dc1b2413cd X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7975.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 08:28:14.6559 (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: Mns27POmZo2tUMhwRvOVd5bbbz4iztUoNj1TqB9I7OLAgLJ3z8x3KYm4LaF9U4BDX0R/3C5I4coNgEZIbZtIpDCTNwvYUm9qY6gPCM//DH0RH/oby4N+7+uWd/+M/BLJ X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6603 在 2024/1/22 15:41, Mike Rapoport 写道: > On Fri, Jan 19, 2024 at 04:50:53PM +0800, Shijie Huang wrote: >> 在 2024/1/19 16:42, Mike Rapoport 写道: >>> 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. > My question was why we need early_cpu_to_node() at all and why can't we use > cpu_to_node() early on arches that do have it As you see, some ARCHs use cpu_to_node() all the time, such as SPARC,mips and S390. They do not use early_cpu_to_node() at all. In some ARCHs(arm64, powerpc riscv), the cpu_to_node() is ready at:     start_kernel --> arch_call_rest_init() --> rest_init()                            --> kernel_init() --> kernel_init_freeable()                            --> smp_prepare_cpus() The cpu_to_node() is initialized too late. I am not sure if we can move "cpu_to_node initialization" to an early place. Move "cpu_to_node() initization" to an early place is more complicated, I guess. Thanks Huang Shijie