Message ID | 20231114091643.59530-1-shijie@os.amperecomputing.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1740093vqg; Tue, 14 Nov 2023 01:18:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IFBaNJaqnKHzPFMKfPLqDIij2BiL3vJAWXZx5joX3CaY3eTOhxOVEGBagc+JVnN5CI7SW5a X-Received: by 2002:a05:6870:7b47:b0:1e9:f220:ac3b with SMTP id ji7-20020a0568707b4700b001e9f220ac3bmr10546273oab.32.1699953504219; Tue, 14 Nov 2023 01:18:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699953504; cv=pass; d=google.com; s=arc-20160816; b=RH8ufLhWRkucJIFvDsXp+NQI17DqU2/NIhkNlfhJptkHkO+yfby+wo41miVbEIoWGY 91jAcmRIe7ZbMyVe+2KocWi8eYOqwthcxf7DVLIdqqHS4uFA5kE/fKQ7mj56dRs6KI6J qEszVy9OlHZE8dSk8Q21vGtyuWV1z5/HPE9WNh7MsnWng48CWYbQ/6qtSOhHPlGxiRw2 WB/M76utaW7GOkfg91sRfevJF0czShyQfrT3+ZhCpQP3J8mkDXNYmMAA2CYtnPCR/Eml 9GPnGYlKXrl1l3Nd2Vxb0gVAg42hKEX6N8dhNATpwX7sgYZSwJbiEY8Lq37CvldhMOX3 uX5w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=zCTfLweAjmMubihY6xBAwiJ+HbPDBA38ZcHvNO04dMc=; fh=FpWUK1Dqq9usdIlHjzlZ1b0bmIVNDsz6Rd1cKPgoizk=; b=hjJfn/OtGCyv5KU9XRfKANypLM4Vd9yCST2p6Tp3Z3FsLzb4BxQ+6IgKaSaVLSY1Oq m/+/LaKCkskIo0QGvl5SMveoW4f5ty6So7LRPCD1mKUZH40wr5hz24BoktRngSV1Ht0t tt6AQ9OQmljQ/KBkxPZ7CTaOFaZwLlhnXiUqd/bubMdpmLySZvBAF75V1/Yv2cB7MG0E 7F98JiHYUtzxhHdvCMgmsv0ZlI32xhMTw1kGfq3hsXBiKQ1idsP8K4JR8q9pVzCsAWWe 4WyRhmJNlfjOv671jlwawLI3gCljvtViEMxM0MlLEWrTG4mwNSIY/XrS/WUODJAcKLCv AZbw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=j4I9ExqK; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id l15-20020a056a00140f00b00690bc2ac50asi7683850pfu.246.2023.11.14.01.18.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 01:18:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=j4I9ExqK; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id E589980417D8; Tue, 14 Nov 2023 01:18:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232456AbjKNJSC (ORCPT <rfc822;lhua1029@gmail.com> + 30 others); Tue, 14 Nov 2023 04:18:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232466AbjKNJSA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 14 Nov 2023 04:18:00 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2126.outbound.protection.outlook.com [40.107.100.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D57D019F; Tue, 14 Nov 2023 01:17:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c8XJKTiJHC8SqtnUAwwbYPZvmzdI1PQ1t3wCjo49KCGehZahiTViysGIzcD6mXYnhRkYGYMkqEAvIaNlERIDExD7s+R6VGn+DBRCJFk9fm1IutjEWe9mA3q6z4WyDeeNLIJvm2LIQxAHbvMSdcVIHCYLQgKtoD2Db8RgVfz4bKilACoHyId4U6g0kl6y0Bu9ZGQUOioHkWe9s9D7r04sl4ydpjMotwQbR8YIJoTDvpVSZbnVwZwhhWXPzqdEzv3WVDHRiE/nNIBnq40Icnmko3yYFNCPk8+LsbZrGH0WjNgSJscXbcCvjdP0FFieX1ybqcRZLyBEW/9OEzUFW/m52Q== 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=zCTfLweAjmMubihY6xBAwiJ+HbPDBA38ZcHvNO04dMc=; b=csPT7I6l0c1UhOKvzttTS716DMNpNc4vqPVfAfmG4cIRwYglfqSR2okXPfpIX0JS1JTjLGRER56xByDUGQ7IU6+ks7Dp6hD1h2WGA5Z2BsNtF6jgwe67CeSPn//PAwAuqHJLaTnzQjrI717YKUMsWbUf2Fa6CcbtS5ctgMApgGaCI/e2u3nDEGOVE8gRlVHNjPKRtF9uQ67BdAueTWxStaznvIuaQMuPP5aTHFAWE0jWCqkNRbw606HTiOFvd/IV9Nvq0bD9pyk2uwa2q82vRDyx7g9F5Kuq8k+BIx5XJ/n7PnsCGRi1WVaosJPAjYMPzDrN8B4swkq4+A1jm1cdfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zCTfLweAjmMubihY6xBAwiJ+HbPDBA38ZcHvNO04dMc=; b=j4I9ExqK8onfDsmEVZwfw4DV+FIWEBdWwuOuEk4SY5Uft0SLSNfHEwsCpD4KC0l43UiTodYkagn7/3CdxCybdyZeswoRbBobRuKxuOlLhi9X0wd5/UkO2f8CGWykttr8SKWaK8tILajwv/71ahn1MbQdjirlcvgJtPTRAd2A3s8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH0PR01MB7975.prod.exchangelabs.com (2603:10b6:510:26d::15) by BL3PR01MB7196.prod.exchangelabs.com (2603:10b6:208:347::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 09:17:50 +0000 Received: from PH0PR01MB7975.prod.exchangelabs.com ([fe80::3f45:6905:e017:3b77]) by PH0PR01MB7975.prod.exchangelabs.com ([fe80::3f45:6905:e017:3b77%7]) with mapi id 15.20.6977.028; Tue, 14 Nov 2023 09:17:49 +0000 From: Huang Shijie <shijie@os.amperecomputing.com> To: catalin.marinas@arm.com Cc: will@kernel.org, gregkh@linuxfoundation.org, rafael@kernel.org, arnd@arndb.de, mark.rutland@arm.com, broonie@kernel.org, keescook@chromium.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, patches@amperecomputing.com, Huang Shijie <shijie@os.amperecomputing.com> Subject: [PATCH] arm64: irq: set the correct node for VMAP stack Date: Tue, 14 Nov 2023 17:16:43 +0800 Message-Id: <20231114091643.59530-1-shijie@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: CH0PR03CA0264.namprd03.prod.outlook.com (2603:10b6:610:e5::29) To PH0PR01MB7975.prod.exchangelabs.com (2603:10b6:510:26d::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR01MB7975:EE_|BL3PR01MB7196:EE_ X-MS-Office365-Filtering-Correlation-Id: fb359013-e710-4a3d-205f-08dbe4f2923a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ifcpzH0LgExv3zxsy24q+LnIwsGZbxY1snmOSABxosOZuMJBbW6WVOGt34nKd8wag8UXDXLPyZf06LJW1ll75Lb9mjMzZZ/9hOW1hFdo7KJ4rtew1D3JeuHXlUL1AZwm1eWdj/IntG90u53vCnoylggLWhbCo1RJFWkGFDeAU1ExfBWPjn8OAvcThNGKEcJOqPvYXiey97p+r/W3RP5d/qbay1xeteec3rZLHtf/nOK8BriPe3VM9HVSOT1NHUrBztQLUs/CwIvV7+utYEzffidql6ybOnoxSbwIsVonu+Zn8noeSPioZWTkODldXzpG98jKM4RtwQIisdYLE2O5Wfh+hNJIq98YNl96W7MClB4X2RRb322EYfQZiHeJXRD4grwMb/57tMEZwnd2dbIP8RYBQnj0HEUoNw/m//s8FZhtPygXMqRJ4qyDodJNddugc+ZJE7s4mnHbm3MBHEhxrPIz0HOIAHalBWqt216EkL5te6dtHrNVBktrfPqMY7OzXG/WeeWdSHa6UQeAeEYxS2HMeSU394YokmOyqQBxw26mVAs8infuzNX7liRO4zehCSdEuNOrnE6djVJ2Rjr0IiLwQwAfmS46bIHtgZJxBl4/qVlor1fV0aCLctEw2qsF 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)(366004)(376002)(346002)(39850400004)(136003)(230922051799003)(451199024)(186009)(64100799003)(1800799009)(38350700005)(86362001)(83380400001)(26005)(6666004)(6486002)(478600001)(1076003)(6512007)(2616005)(107886003)(38100700002)(52116002)(6506007)(41300700001)(2906002)(6916009)(5660300002)(7416002)(66556008)(8936002)(4326008)(66476007)(8676002)(316002)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jzpe3EHoDwXf8k8btOens2RUmCiX7k5iH+w+JG0Lsh3KxqgWysuOls13vkQ26kMjCUK0olLQ0VYdixsN1kG10P/q83q5WKKpokkTYFQ+hrgIZ5mljRYMydpT8eU98M6CYXWNhSScmEALVBtdP+YnaIzOnZPjz6WDUHvgWayj4PDlB9PG+n+7psoEq+6pIsork7TTjqSuUNRNkV53EuMAYeerJmTHeAQVbewOQx/xGjVwRCgmSJR0tCr6xHUHzN8UExgOAizLKFtc8uaHgrc51LV0pXW9L4v1dbxXJOJEDUnEwnwbMRRxQUdeIxo+eON9q2SnlcK2MQZe0kMQyjbMNG5n0W6isEOsz8Vylx43ylxcYxuo+yckwl1EDZ+XpYUsq1pnD8ZSOSD0NJhYySOQvZhq19KRJ8pBM1YQ/rtN4mIf2PeO2YCPxlwQaHTcues77U0HyHNxBWSRKQCu9e7ua8aUsr1H1qqpFqq6H3CE7vhK8hVYqArhhpwB9z/xmOKa6ufix0nQhLfioawKBHsSTebosZ9FFDzsLTBIJGKV+SDX4HqNvabUpZpuK1IKXZOffaV5tS5942kL8C5LhHTufibW0eEMp1F7idYnUOAigorxBgXUvZ8DfYhZXJxrJjkroC3eKuv9Yfx0qMClDpajmLLAi4l7Lt/tRJBwY6GziQgsVzE1Ekzv45SED/Y0gt9/zKdEa49uVDPSumCMBHPK/NIK7yXVlYq4Fxgley3UpShpAY275WuyFIM4Ekps38+JNUBcIseG9CDc2DyGRkxnlHDSdy+DmNeNqVx/B9rx1NEIORIOk0v5LuaqBsrfYe7Iijc2mBRMy9S1BXYxads5ExCY8ceSGmHmd4PLTpA0wbi7hsa7IbJtq2IMrKf116Q29dGbR4b5FeTzwiEtwcJ6Sl13dGnOIzHOvMBW6VQrjj/WE9o64Hb4awBBSvDZxAD3uN8f3jShxVXttOwI3cDS8VCA7ZUVEmCxJPzvmIVEqAprnln+fj4TXa2jJTzhuagrvpXptqPWNsim+Ggq7XcY0JBxeQYD09hU1Z2qeftPM0gC6QNit5eQVma0i8TD9LrQOZzmf+UjXk8WD2avnxQBWCC44FUfHolE5RBdIf4gQqAvAwFrBjYPU23d3aymWhi0twl9/SZyFiqrgPznOdvfoPlCuaIutomer2X2tlnJe7Gi0Ehu1vErF6fmpR/pWz6ypp65znT5lKA2lRMTNVw8Ck+YaRlfyvgcyZlUJxnd8kJYwEViE09OHSJgTpem7VBHFYDTzRtQr8K1Ys0JmT0NTaJpdbtfl/EBHbBFuPF110XTm0n8KKePuG6FpXZXnS7cOWEOnZIhvbjsFalF5YAxF9wJPco39myk7MAHgPalu+UEFxn/wU4k6+vDRKChtFCW9y5eQ1M24Vt9s9I6lJXUtyUpUoxh25t2DXMSkZxKwWz1KzTuuzme1mQh/jrehU6JbAkFoqx04B3SLej4flsPN1p4a3L3nCDvt+4wT7RvH/H+E1aebHjxyImwD1ihN4kd9mtyQyYkKGsICrsJj8rfb0UYD7uDta31qGNYhgXhpq7Z3jG00h2Df8P+YmsoCnI6QbzXTWv5CjMi3zqIWrcOkg== X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb359013-e710-4a3d-205f-08dbe4f2923a X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7975.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 09:17:49.3210 (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: YmiaUWSXIDcmMrhKJNuPWahtSFT/vHVKhrJ9y471Y2oj0hQL88sUcLJn1dgy0KAvsNMnH08gEqciA+qI3MUnpdeYfLFbwK+QmrOmKMqQPBK3fiZmMgI+e6AobPE2upIK X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR01MB7196 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 14 Nov 2023 01:18:22 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782530445321680936 X-GMAIL-MSGID: 1782530445321680936 |
Series |
arm64: irq: set the correct node for VMAP stack
|
|
Commit Message
Huang Shijie
Nov. 14, 2023, 9:16 a.m. UTC
In current code, init_irq_stacks() will call cpu_to_node().
The cpu_to_node() depends on percpu "numa_node" which is initialized in:
arch_call_rest_init() --> rest_init() -- kernel_init()
--> kernel_init_freeable() --> smp_prepare_cpus()
But init_irq_stacks() is called in init_IRQ() which is before
arch_call_rest_init().
So in init_irq_stacks(), the cpu_to_node() does not work, it
always return 0. In NUMA, it makes the node 1 cpu accesses the IRQ stack which
is in the node 0.
This patch fixes it by exporting the early_cpu_to_node(), and use it
in the init_irq_stacks().
Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
---
arch/arm64/kernel/irq.c | 2 +-
drivers/base/arch_numa.c | 2 +-
include/asm-generic/numa.h | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
Comments
Hi Huang, kernel test robot noticed the following build errors: [auto build test ERROR on arm64/for-next/core] [also build test ERROR on driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus arnd-asm-generic/master linus/master v6.7-rc1 next-20231115] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Huang-Shijie/arm64-irq-set-the-correct-node-for-VMAP-stack/20231114-171932 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core patch link: https://lore.kernel.org/r/20231114091643.59530-1-shijie%40os.amperecomputing.com patch subject: [PATCH] arm64: irq: set the correct node for VMAP stack config: arm64-randconfig-001-20231115 (https://download.01.org/0day-ci/archive/20231115/202311152250.ozO781vZ-lkp@intel.com/config) compiler: aarch64-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231115/202311152250.ozO781vZ-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202311152250.ozO781vZ-lkp@intel.com/ All errors (new ones prefixed by >>): arch/arm64/kernel/irq.c: In function 'init_irq_stacks': >> arch/arm64/kernel/irq.c:60:59: error: implicit declaration of function 'early_cpu_to_node'; did you mean 'early_pfn_to_nid'? [-Werror=implicit-function-declaration] 60 | p = arch_alloc_vmap_stack(IRQ_STACK_SIZE, early_cpu_to_node(cpu)); | ^~~~~~~~~~~~~~~~~ | early_pfn_to_nid cc1: some warnings being treated as errors vim +60 arch/arm64/kernel/irq.c 52 53 #ifdef CONFIG_VMAP_STACK 54 static void init_irq_stacks(void) 55 { 56 int cpu; 57 unsigned long *p; 58 59 for_each_possible_cpu(cpu) { > 60 p = arch_alloc_vmap_stack(IRQ_STACK_SIZE, early_cpu_to_node(cpu)); 61 per_cpu(irq_stack_ptr, cpu) = p; 62 } 63 } 64 #else 65 /* irq stack only needs to be 16 byte aligned - not IRQ_STACK_SIZE aligned. */ 66 DEFINE_PER_CPU_ALIGNED(unsigned long [IRQ_STACK_SIZE/sizeof(long)], irq_stack); 67
On Tue, Nov 14, 2023 at 05:16:43PM +0800, Huang Shijie wrote: > diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c > index 6ad5c6ef5329..e62d3cb3f74c 100644 > --- a/arch/arm64/kernel/irq.c > +++ b/arch/arm64/kernel/irq.c > @@ -57,7 +57,7 @@ static void init_irq_stacks(void) > unsigned long *p; > > for_each_possible_cpu(cpu) { > - p = arch_alloc_vmap_stack(IRQ_STACK_SIZE, cpu_to_node(cpu)); > + p = arch_alloc_vmap_stack(IRQ_STACK_SIZE, early_cpu_to_node(cpu)); > per_cpu(irq_stack_ptr, cpu) = p; > } > } This looks alright to me, I don't have a better suggestion. The generic code already has the cpu_to_node_map[] array populated by early_map_cpu_to_node(), so let's reuse it. > diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c > index eaa31e567d1e..90519d981471 100644 > --- a/drivers/base/arch_numa.c > +++ b/drivers/base/arch_numa.c > @@ -144,7 +144,7 @@ void __init early_map_cpu_to_node(unsigned int cpu, int nid) > unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; > EXPORT_SYMBOL(__per_cpu_offset); > > -static int __init early_cpu_to_node(int cpu) > +int early_cpu_to_node(int cpu) > { > return cpu_to_node_map[cpu]; > } > diff --git a/include/asm-generic/numa.h b/include/asm-generic/numa.h > index 1a3ad6d29833..fc8a9bd6a444 100644 > --- a/include/asm-generic/numa.h > +++ b/include/asm-generic/numa.h > @@ -38,6 +38,7 @@ void __init early_map_cpu_to_node(unsigned int cpu, int nid); > void numa_store_cpu_info(unsigned int cpu); > void numa_add_cpu(unsigned int cpu); > void numa_remove_cpu(unsigned int cpu); > +int early_cpu_to_node(int cpu); Here I'd move this just below early_map_cpu_to_node() and, for completeness, also add the dummy static inline for the !NUMA case.
Hi Catalin, 在 2023/11/17 1:18, Catalin Marinas 写道: > On Tue, Nov 14, 2023 at 05:16:43PM +0800, Huang Shijie wrote: >> diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c >> index 6ad5c6ef5329..e62d3cb3f74c 100644 >> --- a/arch/arm64/kernel/irq.c >> +++ b/arch/arm64/kernel/irq.c >> @@ -57,7 +57,7 @@ static void init_irq_stacks(void) >> unsigned long *p; >> >> for_each_possible_cpu(cpu) { >> - p = arch_alloc_vmap_stack(IRQ_STACK_SIZE, cpu_to_node(cpu)); >> + p = arch_alloc_vmap_stack(IRQ_STACK_SIZE, early_cpu_to_node(cpu)); >> per_cpu(irq_stack_ptr, cpu) = p; >> } >> } > This looks alright to me, I don't have a better suggestion. The generic > code already has the cpu_to_node_map[] array populated by > early_map_cpu_to_node(), so let's reuse it. > >> diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c >> index eaa31e567d1e..90519d981471 100644 >> --- a/drivers/base/arch_numa.c >> +++ b/drivers/base/arch_numa.c >> @@ -144,7 +144,7 @@ void __init early_map_cpu_to_node(unsigned int cpu, int nid) >> unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; >> EXPORT_SYMBOL(__per_cpu_offset); >> >> -static int __init early_cpu_to_node(int cpu) >> +int early_cpu_to_node(int cpu) >> { >> return cpu_to_node_map[cpu]; >> } >> diff --git a/include/asm-generic/numa.h b/include/asm-generic/numa.h >> index 1a3ad6d29833..fc8a9bd6a444 100644 >> --- a/include/asm-generic/numa.h >> +++ b/include/asm-generic/numa.h >> @@ -38,6 +38,7 @@ void __init early_map_cpu_to_node(unsigned int cpu, int nid); >> void numa_store_cpu_info(unsigned int cpu); >> void numa_add_cpu(unsigned int cpu); >> void numa_remove_cpu(unsigned int cpu); >> +int early_cpu_to_node(int cpu); > Here I'd move this just below early_map_cpu_to_node() and, for > completeness, also add the dummy static inline for the !NUMA case. Thanks a lot. It seems there is no need for me to send the V2 for this. Thanks Huang Shijie
diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c index 6ad5c6ef5329..e62d3cb3f74c 100644 --- a/arch/arm64/kernel/irq.c +++ b/arch/arm64/kernel/irq.c @@ -57,7 +57,7 @@ static void init_irq_stacks(void) unsigned long *p; for_each_possible_cpu(cpu) { - p = arch_alloc_vmap_stack(IRQ_STACK_SIZE, cpu_to_node(cpu)); + p = arch_alloc_vmap_stack(IRQ_STACK_SIZE, early_cpu_to_node(cpu)); per_cpu(irq_stack_ptr, cpu) = p; } } diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c index eaa31e567d1e..90519d981471 100644 --- a/drivers/base/arch_numa.c +++ b/drivers/base/arch_numa.c @@ -144,7 +144,7 @@ void __init early_map_cpu_to_node(unsigned int cpu, int nid) unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; EXPORT_SYMBOL(__per_cpu_offset); -static int __init early_cpu_to_node(int cpu) +int early_cpu_to_node(int cpu) { return cpu_to_node_map[cpu]; } diff --git a/include/asm-generic/numa.h b/include/asm-generic/numa.h index 1a3ad6d29833..fc8a9bd6a444 100644 --- a/include/asm-generic/numa.h +++ b/include/asm-generic/numa.h @@ -38,6 +38,7 @@ void __init early_map_cpu_to_node(unsigned int cpu, int nid); void numa_store_cpu_info(unsigned int cpu); void numa_add_cpu(unsigned int cpu); void numa_remove_cpu(unsigned int cpu); +int early_cpu_to_node(int cpu); #else /* CONFIG_NUMA */