Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11502276rwl; Mon, 2 Jan 2023 23:31:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXsrcSuyqoEuEpmuLQJzXxTf2ch2G7zPlw9oGWz/VY5P/leMW8YpSrgvXSCn4+62eMA/v1GK X-Received: by 2002:a17:906:33d7:b0:842:cd68:4956 with SMTP id w23-20020a17090633d700b00842cd684956mr33790664eja.52.1672731092414; Mon, 02 Jan 2023 23:31:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672731092; cv=none; d=google.com; s=arc-20160816; b=ZLrlcMFfMI3TS/AQlIGlaO9SR7OycHQogYYvafaaHTIi4JgBeWOvJZstgVHGpYSPxD N8i/a+mM/e7YbYPD6XYGDMg9Z/7amEiqcqKfcqEj0GWql+jPS3UWr83uqziUxmHkWcds 7hEVMmk5xkvYCxk4IK9rtjZaE4vfR5FO74jdfdaOo3Xybis/cFXMNb9PUt/GSkHnj5DC VqSwHT19mpzxbKxJ9yzXySS6bd4Pur4BTRMZyx9sBjh6VuAf+UwnyPfhI2wJDxm2EIId aetIHxSgc5eMRaLdV+psM8RWvJ/H63x0w8LjPYqMGvp7lDFR0gZAXi9cKx+ImQFcfTx/ 3PCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MYKrmSOx2pt3469lia8FKNW80E8qGEbATC3jLzux/4g=; b=GXbyZLNd4LIOSSCa3gBaIkEPT6FkRJFvbMJ+BXXawt9fo7DpqCZgJNBOedHANxlLXn V/0OZjdH9r6X9U19f81qt9KOxWbeXeBOFrq7xU296OrFMvWfifhxB06MJVlMS6ozLviF kEGlSBLP1YMOF94K08W51cCmIGtIyHN7i2xnPvnawpEmCHdff4zDVODEIicT7CWB3Y1F 5R3OnoGXnWBjSWwJ0UMoCISt5APZDZnJ79Q9U2DyEzm2UAh7qxXWqMPR3ukhkJvDLRv9 HMMl1AJZwoQhXwbltLYjSHIX9E1lv6QHLRmxgfbQN73KUNRhcK7phh6DRqEwvGuMfD3j jyTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=SSxZ1bYY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds11-20020a170907724b00b007ba49ec6d3bsi28130424ejc.390.2023.01.02.23.31.17; Mon, 02 Jan 2023 23:31:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=SSxZ1bYY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236855AbjACGyU (ORCPT + 62 others); Tue, 3 Jan 2023 01:54:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236798AbjACGyQ (ORCPT ); Tue, 3 Jan 2023 01:54:16 -0500 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13F7FB48 for ; Mon, 2 Jan 2023 22:54:14 -0800 (PST) Received: by mail-ed1-x533.google.com with SMTP id u18so41199550eda.9 for ; Mon, 02 Jan 2023 22:54:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MYKrmSOx2pt3469lia8FKNW80E8qGEbATC3jLzux/4g=; b=SSxZ1bYYpZK8rXkVsCOw5nzTeGVkoJYmeKeFwWPJv3fj2uIFovL0NSLtWF2O+SJwsf 8tF4sJXRBtbmNt67kAYtyXTuDXLLWoyOt4kbP7jxAgASa9srvQotdlRfrZWNm/6Q3DAU buNZZjGu+rTKqwebaXmiTOHafRcQ+OGK17esT1uFHKiWfgoO3fm6W5Kq8uGkLd9mOc7k JaBbKuVP4wO/R9tSGQ9WC+tL6TnSaEVUDF7zRJt06rLoGJWkdr47nesKxIqfA03L/GKf KKZFmPEv46EKWhkFyddQXxPjgYjQnOexVICxpzi2c+JvQlf6Jt7+m6nkLewV0L/DZWFp 2Cbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MYKrmSOx2pt3469lia8FKNW80E8qGEbATC3jLzux/4g=; b=DhiscGAeIY7EzZOoVI1fDjHt60GiS8z5KZI01S2VEkU8P4S284xY3LtN6t1V2G4EyJ mAVT2FXj2NCoPKTlzqYEgxTyBjFHScc14g5IV4qcxoz47s1ykoAgm0ldDVBGVC0xh2Vx tQsDKQsLYpuV4Wxs6t79ZYz2AnnhUduuJf3zV1Ujpm6df9dNS5jLwiyeGh1V5qXShSL0 4yhs07KvO6EaJuHgJ0MzBr5RzN9Egt42rqWeotIeiUTXGH2Wxgn3dU49luFxwPuexCVq Et59Cb+Q4pOKbZUNzMXVBS/c2xkIpsDZmi3yrYa673eAG+zOi0p/PlxSAGiSlG6x2cng Zm1w== X-Gm-Message-State: AFqh2kpzcB5n0z841zV8Wfv2/HfuY+jhMvKLHgLkwcsBBSasQqOdKfxb MGebNL9qyaXx2xuBCb7nHcOkPA== X-Received: by 2002:a05:6402:22ad:b0:488:6003:24b6 with SMTP id cx13-20020a05640222ad00b00488600324b6mr8981767edb.40.1672728852621; Mon, 02 Jan 2023 22:54:12 -0800 (PST) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id cf30-20020a0564020b9e00b0048db3e85cdcsm2400559edb.85.2023.01.02.22.54.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jan 2023 22:54:12 -0800 (PST) Date: Tue, 3 Jan 2023 07:54:11 +0100 From: Andrew Jones To: Ley Foon Tan Cc: Palmer Dabbelt , Paul Walmsley , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Ley Foon Tan Subject: Re: [PATCH] riscv: Move call to init_cpu_topology() to later initialization stage Message-ID: <20230103065411.2l7k6r57v4phrnos@orel> References: <20230103035316.3841303-1-leyfoon.tan@starfivetech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230103035316.3841303-1-leyfoon.tan@starfivetech.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 03, 2023 at 11:53:16AM +0800, Ley Foon Tan wrote: > topology_parse_cpu_capacity() is failed to allocate memory with kcalloc() > after read "capacity-dmips-mhz" DT parameter in CPU DT nodes. This > topology_parse_cpu_capacity() is called from init_cpu_topology(), move > call to init_cpu_topology() to later initialization stage (after memory > allocation is available). > > Note, this refers to ARM64 implementation, call init_cpu_topology() in > smp_prepare_cpus(). > > Tested on Qemu platform. Hi Ley, Can you provide the topologies (command lines) tested? > > Signed-off-by: Ley Foon Tan Fixes tag? > > --- > > In drivers/base/arch_topology.c: topology_parse_cpu_capacity(): > > ret = of_property_read_u32(cpu_node, "capacity-dmips-mhz", > &cpu_capacity); > if (!ret) { > if (!raw_capacity) { > raw_capacity = kcalloc(num_possible_cpus(), > sizeof(*raw_capacity), > GFP_KERNEL); > if (!raw_capacity) { > cap_parsing_failed = true; > return false; > } > --- > arch/riscv/kernel/smpboot.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c > index 3373df413c88..ddb2afba6d25 100644 > --- a/arch/riscv/kernel/smpboot.c > +++ b/arch/riscv/kernel/smpboot.c > @@ -39,7 +39,6 @@ static DECLARE_COMPLETION(cpu_running); > > void __init smp_prepare_boot_cpu(void) > { > - init_cpu_topology(); > } > > void __init smp_prepare_cpus(unsigned int max_cpus) > @@ -48,6 +47,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus) > int ret; > unsigned int curr_cpuid; > > + init_cpu_topology(); > + > curr_cpuid = smp_processor_id(); > store_cpu_topology(curr_cpuid); > numa_store_cpu_info(curr_cpuid); > -- > 2.25.1 > Otherwise, Reviewed-by: Andrew Jones Thanks, drew