Received: by 2002:a19:e348:0:0:0:0:0 with SMTP id c8csp550126lfk; Wed, 13 Apr 2022 19:27:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJIb5JcbV09C2aW5g2QmhFnJu0VKi0+rxhsdZQnlOhM7bN0CBFzzeubTQwfTx/qd+HEj2x X-Received: by 2002:a37:a5c5:0:b0:69a:e04:cae2 with SMTP id o188-20020a37a5c5000000b0069a0e04cae2mr411630qke.138.1649903264562; Wed, 13 Apr 2022 19:27:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649903264; cv=none; d=google.com; s=arc-20160816; b=N3fH2+bG31cqKcVKPACUBk9ft+FF20kx/B4E/v/5mioqbBJiM+4pfnpD4WVspnAjBg z5A61hiDxhchhHqD1SnxENmreaMUaJ9ffx3nrdGeT7E4tThqfhiwcWiAgsQj9QYdFBvA Efiol2LVRnc0dgkQwl44Zi1jAAjKED4twv/EuFfDhz9+/z/5y4VSi/oUb6sgxT6tN7p2 yiMnZvduifSmR+pxhd/2zIZICW5+tO5MdKdqV2/e1fQdiCyVwqlzo+psPRPPdThuqPc2 8ikUyjVtrM1B0AbapY9+pz6f8xKvpX5oQAXdkZ04ocSW554tPMvnWtCFviNt9HinoFN2 2eRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=from:reply-to:sender:errors-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject; bh=iFVzAOX76COQ4kZGljdoLnxcpd9L16TlUFij6CDG8Ps=; b=TgGJ5wXsOkRJB7JYB4/QfX3IBS3zJUNJjCLxGwLnxoUAWiCL1bP6gnIZYUbOhvXVU/ 2jyb8zVl3YqNJnc2l3yESAE41XkC4xJ3u6dme9ZuErSKHoIg7BZp2BRgBRAHMkkN0lQa MoqMUPvzRDcpeAcgt4nN4ZoVkfz7ySS/E1SX2l0pzRvhzQtarwp9doTTNflt/ZnPO9p4 PKgITcDryvyQ4yzyEvDbU9iGC9BV3bOuSZlhd4MNh3gqWEHJIFgsAQpOUj2znmfN+o4m /f4xbP9xylKFDjUSn72nBj1Ys9R/RI1VzDTzV/B/f8QC56pfKu39ziFO/4fXXXdvk3yw trxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id hr10-20020a05621423ca00b00443f251fa56si8215108qvb.244.2022.04.13.19.27.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Apr 2022 19:27:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nongnu.org Received: from localhost ([::1]:53070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nepCy-0002aV-38 for alex.bennee@linaro.org; Wed, 13 Apr 2022 22:27:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nepCo-0002a8-M0; Wed, 13 Apr 2022 22:27:34 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:5144) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nepCl-0000q5-9q; Wed, 13 Apr 2022 22:27:34 -0400 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Kf3Fm66t0zFptm; Thu, 14 Apr 2022 10:25:00 +0800 (CST) Received: from [10.174.187.128] (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.24; Thu, 14 Apr 2022 10:27:25 +0800 Subject: Re: [PATCH v5 1/4] qapi/machine.json: Add cluster-id To: Gavin Shan , CC: , , , , , , , =?UTF-8?Q?Daniel_P=2e_Berrang=c3=a9?= , Markus Armbruster References: <20220403145953.10522-1-gshan@redhat.com> <20220403145953.10522-2-gshan@redhat.com> <6e27668c-0895-fcc8-165e-673aded5ba47@redhat.com> Message-ID: Date: Thu, 14 Apr 2022 10:27:25 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <6e27668c-0895-fcc8-165e-673aded5ba47@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggeme701-chm.china.huawei.com (10.1.199.97) To dggpemm500023.china.huawei.com (7.185.36.83) X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.188; envelope-from=wangyanan55@huawei.com; helo=szxga02-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" Reply-to: "wangyanan (Y)" From: "wangyanan (Y)" via X-TUID: Shso4OHB6OjH Hi Gavin, Cc: Daniel and Markus On 2022/4/14 8:06, Gavin Shan wrote: > Hi Yanan, > > On 4/13/22 7:49 PM, wangyanan (Y) wrote: >> On 2022/4/3 22:59, Gavin Shan wrote: >>> This adds cluster-id in CPU instance properties, which will be used >>> by arm/virt machine. Besides, the cluster-id is also verified or >>> dumped in various spots: >>> >>>    * hw/core/machine.c::machine_set_cpu_numa_node() to associate >>>      CPU with its NUMA node. >>> >>>    * hw/core/machine.c::machine_numa_finish_cpu_init() to associate >>>      CPU with NUMA node when no default association isn't provided. >>> >>>    * hw/core/machine-hmp-cmds.c::hmp_hotpluggable_cpus() to dump >>>      cluster-id. >>> >>> Signed-off-by: Gavin Shan >>> --- >>>   hw/core/machine-hmp-cmds.c |  4 ++++ >>>   hw/core/machine.c          | 16 ++++++++++++++++ >>>   qapi/machine.json          |  6 ++++-- >>>   3 files changed, 24 insertions(+), 2 deletions(-) >>> >>> diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c >>> index 4e2f319aeb..5cb5eecbfc 100644 >>> --- a/hw/core/machine-hmp-cmds.c >>> +++ b/hw/core/machine-hmp-cmds.c >>> @@ -77,6 +77,10 @@ void hmp_hotpluggable_cpus(Monitor *mon, const >>> QDict *qdict) >>>           if (c->has_die_id) { >>>               monitor_printf(mon, "    die-id: \"%" PRIu64 "\"\n", >>> c->die_id); >>>           } >>> +        if (c->has_cluster_id) { >>> +            monitor_printf(mon, "    cluster-id: \"%" PRIu64 "\"\n", >>> +                           c->cluster_id); >>> +        } >>>           if (c->has_core_id) { >>>               monitor_printf(mon, "    core-id: \"%" PRIu64 "\"\n", >>> c->core_id); >>>           } >>> diff --git a/hw/core/machine.c b/hw/core/machine.c >>> index d856485cb4..8748b64657 100644 >>> --- a/hw/core/machine.c >>> +++ b/hw/core/machine.c >>> @@ -677,6 +677,11 @@ void machine_set_cpu_numa_node(MachineState >>> *machine, >>>               return; >>>           } >>> +        if (props->has_cluster_id && !slot->props.has_cluster_id) { >>> +            error_setg(errp, "cluster-id is not supported"); >>> +            return; >>> +        } >>> + >>>           if (props->has_socket_id && !slot->props.has_socket_id) { >>>               error_setg(errp, "socket-id is not supported"); >>>               return; >>> @@ -696,6 +701,11 @@ void machine_set_cpu_numa_node(MachineState >>> *machine, >>>                   continue; >>>           } >>> +        if (props->has_cluster_id && >>> +            props->cluster_id != slot->props.cluster_id) { >>> +                continue; >>> +        } >>> + >>>           if (props->has_die_id && props->die_id != >>> slot->props.die_id) { >>>                   continue; >>>           } >>> @@ -990,6 +1000,12 @@ static char *cpu_slot_to_string(const >>> CPUArchId *cpu) >>>           } >>>           g_string_append_printf(s, "die-id: %"PRId64, >>> cpu->props.die_id); >>>       } >>> +    if (cpu->props.has_cluster_id) { >>> +        if (s->len) { >>> +            g_string_append_printf(s, ", "); >>> +        } >>> +        g_string_append_printf(s, "cluster-id: %"PRId64, >>> cpu->props.cluster_id); >>> +    } >>>       if (cpu->props.has_core_id) { >>>           if (s->len) { >>>               g_string_append_printf(s, ", "); >>> diff --git a/qapi/machine.json b/qapi/machine.json >>> index 9c460ec450..ea22b574b0 100644 >>> --- a/qapi/machine.json >>> +++ b/qapi/machine.json >>> @@ -868,10 +868,11 @@ >>>   # @node-id: NUMA node ID the CPU belongs to >>>   # @socket-id: socket number within node/board the CPU belongs to >>>   # @die-id: die number within socket the CPU belongs to (since 4.1) >>> -# @core-id: core number within die the CPU belongs to >>> +# @cluster-id: cluster number within die the CPU belongs to We also need a "(since 7.1)" tag for cluster-id. >> I remember this should be "cluster number within socket..." >> according to Igor's comments in v3 ? > > Igor had suggestion to correct the description for 'core-id' like > below, but he didn't suggest anything for 'cluster-id'. The question > is clusters are sub-components of die, instead of socket, if die > is supported? You may want to me change it like below and please > confirm. > >   @cluster-id: cluster number within die/socket the CPU belongs to > > suggestion from Ignor in v3: > >    > +# @core-id: core number within cluster the CPU belongs to > >    s:cluster:cluster/die: > We want "within cluster/die" description for core-id because we support both "cores in cluster" for ARM and "cores in die" for X86. Base on this routine, we only need "within socket" for cluster-id because we currently only support "clusters in socket". Does this make sense? Alternatively, the plainest documentation for the IDs is to simply range **-id only to its next level topo like below. This may avoid increasing complexity when more topo-ids are inserted middle. But whether this way is acceptable is up to the Maintainers. :) # @socket-id: socket number within node/board the CPU belongs to # @die-id: die number within socket the CPU belongs to (since 4.1) # @cluster-id: cluster number within die the CPU belongs to (since 7.1) # @core-id: core number within cluster the CPU belongs to # @thread-id: thread number within core the CPU belongs to Thanks, Yanan > >>> +# @core-id: core number within cluster/die the CPU belongs to >>>   # @thread-id: thread number within core the CPU belongs to >>>   # >>> -# Note: currently there are 5 properties that could be present >>> +# Note: currently there are 6 properties that could be present >>>   #       but management should be prepared to pass through other >>>   #       properties with device_add command to allow for future >>>   #       interface extension. This also requires the filed names to >>> be kept in >>> @@ -883,6 +884,7 @@ >>>     'data': { '*node-id': 'int', >>>               '*socket-id': 'int', >>>               '*die-id': 'int', >>> +            '*cluster-id': 'int', >>>               '*core-id': 'int', >>>               '*thread-id': 'int' >>>     } >> Otherwise, looks good to me: >> Reviewed-by: Yanan Wang >> >> Please also keep the involved Maintainers on Cc list in next version, >> an Ack from them is best. :) >> > > Thanks again for your time to review. Sure, I will do in next posting. > > Thanks, > Gavin > > .