Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp172600rdb; Sun, 21 Jan 2024 23:42:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpJLkryHvM+AjMDIECoHGHO/WloRkew06Whs5CU98SKcfnSajF5Lda76dH5Mx0fTvRQYf0 X-Received: by 2002:aa7:c511:0:b0:55c:f5:2523 with SMTP id o17-20020aa7c511000000b0055c00f52523mr2845155edq.6.1705909336529; Sun, 21 Jan 2024 23:42:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705909336; cv=pass; d=google.com; s=arc-20160816; b=kNEEATInkZfMBDyPp4BBkzUcUPz4Bq2nyg9mmlf8V9jc2x0F1QmqeaycQ7e8LBzpS3 mAm4a6kpVa9JbUyegb6BtprC53gHSotNUuuDHRSrJOSjjGD5a1yety1ZqBhmqE1zI6L3 ZOM9mmKb+moXoixFpBUi1Vs7NGrekiNJ36fS1mVDZ1Ad6tVqEit9zZ9clAM9hfMc6UG+ of/Mk4wECL8bhZ/UQAQuLtXQhqGAjcRiGWK9N5PXsvRIqFg6BeHC0SzYEhMCIBMWvJRc oxfLOdGN4LkceFw/bPN/W89eWB/FwWg8PfpaPnA7kjPPnRjYT19Pt0DFesWVuw29jHsx /U/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Cka4HLgO3d4RCq8q683D1eHnHjuwgScNHj2BHJ0nnF0=; fh=wrI0x4h8Zmupv13w/8NqwHAK0fpUi9R3eXxefJuA5AI=; b=AXbR0dmrVu5k7n3cyiUIj+m9z3Afss+NHHDW7yOZNVfZvRhNb6HSYXoKJIpOy8feNO Onh2MoTcSjMqrFshHud1Dse0JrMddCpIUVCI69SUperajlbxcmCCGrP+kot+vOmarUd2 HqmkSBtEG8IE020RQcR0tIR6hOYzXNc9nnQPzgJyuVmOB6wqG+2sIwnkQ0rhG6JOniRg oPtguG7s3qgkuX9HX+1wSUAZ/xPBWASupOya//KCO4MXK0xq5sJyyK+9t/pRPTycwUzi SoTgACrNbFkvxDrlMksE2op1Mh1PLmzgI4TtUmXtdCyhQ53fIYmEzhdx7Ppb5j/mg2Ps fvYg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jOnqDMRd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-32447-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32447-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w22-20020a50d796000000b0055c15d66d35si1462094edi.524.2024.01.21.23.42.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 23:42:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32447-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jOnqDMRd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-32447-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32447-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 2BD731F223BE for ; Mon, 22 Jan 2024 07:42:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 211BF16435; Mon, 22 Jan 2024 07:42:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jOnqDMRd" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 496DB14F6C; Mon, 22 Jan 2024 07:42:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705909327; cv=none; b=t5Sfz5HNorVcrktsf8AlMjo0QV76sae2q72AvDQY+2LWEPkH6XcOzAR4lvPiGHMxF5ciJUasLer3bsYa/Y1UfpKEj456seFhhaVlj6ZN/SkXcrZLR2w43oiv3BK/c/LLpS1QxaXnOs2xVSe6JjhyQ70mcoFhnbE14Ya3LCUYQW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705909327; c=relaxed/simple; bh=6q+Ae298LK6Fwx9w1Hxqg+/TcqF4+MMHBmWb7Tw8+hU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uQ1aSF46tk2aWy4OvE+gENAnpX36Khxre6ANhFgF3WpMnv5uKJSZ47FGArOukW+tj67uEYW0EXe+8fLu6W5OyCbdkmDJOn2fEO+cFlBc53a0sRUOZ//MKboctanu6k7iHoyCWR5lCgKo4Orm+cjwVGy3y2/E2vKVotdSGqSzwcE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jOnqDMRd; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B284C43394; Mon, 22 Jan 2024 07:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705909326; bh=6q+Ae298LK6Fwx9w1Hxqg+/TcqF4+MMHBmWb7Tw8+hU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jOnqDMRdvXuWTje7hxQN2dCLE7PzYUq8rAYWennGmg2eWAJlF8wYxF7WITOD93XyX kOi7HC3t/JBdyraClA4q5IQ6eCe0QP9DQEOOLu5rJzGGtUakerutvskNDSebyStAJZ z+mnBJqfh9Fcq+5rh+Kc2KPiYn9xLCRpmCpxOFhvwp4xLOdS0I9/a1r1ZusQ+JEtay eerJbS9dnoFfr2YnDqeIifjrZ8RFwgs3XLP/I8Wfw7PBHR0aHCQTC5FxayDUKgCqE/ I+Nux9qFYloyZL8LPJSk6tchB/m6C22f9IUgs1mhO9obbBZ8/pniLuN0IIT85I3k0j 4+4RMm18KCn0Q== Date: Mon, 22 Jan 2024 09:41:40 +0200 From: Mike Rapoport To: Shijie Huang 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 Subject: Re: [PATCH] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id Message-ID: References: <20240119033227.14113-1-shijie@os.amperecomputing.com> <1cd078fd-c345-4d85-a92f-04c806c20efa@amperemail.onmicrosoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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. > Thanks > > Huang Shijie > > > 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. > > > > > > Please see the alloc_pages_node(). > > > > > > > > > Thanks > > > > > > Huang Shijie > > > -- Sincerely yours, Mike.