Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp370282pxb; Thu, 19 Aug 2021 01:15:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcFJst2cjZep8s3tF1rXenhsZE84y2ZH+wW+78XYH6h7e0YiUlrcEYk2YL55HoxTw/n+m3 X-Received: by 2002:aa7:df03:: with SMTP id c3mr14873530edy.348.1629360903225; Thu, 19 Aug 2021 01:15:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629360903; cv=none; d=google.com; s=arc-20160816; b=pAeXkoiu6WCX+298OMQdl9aZ+Dl59rbv7tmH6jgnrK+EXywuYIfpEd30jtq1khYGh5 NQ0jFbX63o5iqIUcCBcC6pR8qIRhUVg3cecw5xpgyiW8EWzOtF4M6tMsScuodAcWYg7z i4U20LVG+fA04NZGyaIQ6ly2jp9YcG5pE7qN1LTAt9Hp2080NNIf+15o10KkZPK9ejpe r5g9NBZP9bY3psBl9rApJKdoT2HcAMZGJl52on2Q967hxtfELRSz/4CFFFsWzhtnQLCQ DhbKBa/Z2GC9Vnjoaplu+aYzHufJM5ImHUYmcuhe8IH3Gi6CNv8gdXVCAGu1H7KLEjkL TclQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=On4FWGGM+8YbPuLjgSEYOqUALY1mzp22fPj/UXSrDGA=; b=d4a4Y4tzOLFJ+cOl3Arb2zRrisA8eQ/cUzi0k7XawfD4kk57yjAIfOtsKeVGkjTAbQ xmVEENFRBBQ3Sk/aH+3n6SGsUOfkcQPdyDDugv26Y1JMZq4vk4s3rbe7EAvocmAcmvWt fmVeKJpApax6bcYZ00UGTOQhYxa7nEJk5gJbbgGzrG9sUBPcViWNI3QG+oujtobr883t T9/mnNt75bpoCQNdvIRSLwk5YR50xU7G35buIuC6vROuQFCPgXrixnK4FTWKImC7lBLT M8jvBBzmo/n86xAMK+80UKt978CCTkStwkhNShh81o1xWdfpaW7Yub8QyTBY0qZoytZR 4ksg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qk18si2642584ejc.690.2021.08.19.01.14.35; Thu, 19 Aug 2021 01:15:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236766AbhHSINn (ORCPT + 99 others); Thu, 19 Aug 2021 04:13:43 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:8883 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232545AbhHSINm (ORCPT ); Thu, 19 Aug 2021 04:13:42 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Gqy8Y2ktlz8sdd; Thu, 19 Aug 2021 16:09:01 +0800 (CST) Received: from dggpemm500023.china.huawei.com (7.185.36.83) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 19 Aug 2021 16:13:04 +0800 Received: from DESKTOP-TMVL5KK.china.huawei.com (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_GCM_SHA256) id 15.1.2176.2; Thu, 19 Aug 2021 16:13:04 +0800 From: Yanan Wang To: CC: Mark Brown , Lorenzo Pieralisi , Catalin Marinas , Sudeep Holla , Subject: [Question] Make the DT cpu-map parser be aware of socket nodes Date: Thu, 19 Aug 2021 16:13:03 +0800 Message-ID: <20210819081303.188008-1-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500023.china.huawei.com (7.185.36.83) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, It seems that there is some discrepancy between the kernel documentation (Documentation/devicetree/bindings/cpu/cpu-topology.txt) and the actual implementation of DT topology parser for ARM64 (function parse_dt_topology() in drivers/base/arch_topology.c). The Doc implies that we can define a cpu-map for the ARM64 multi-socket system like: (1) cpu-map socket0 cluster0 core0 core1 cluster1 core0 core1 socket1 cluster0 core0 core1 cluster1 core0 core1 or a cpu-map for 32-bit system like: (2) cpu-map cluster0 cluster0 core0 core1 cluster1 core0 core1 cluster1 cluster0 core0 core1 cluster1 core0 core1 But current parser only assumes that there are nested clusters within cpu-map and is unaware of socket, the parser also ignore any information about the nesting of clusters and present the scheduler with a flat list of them. So based on current parser, we will get "4 packages, 2 cores per package, 1 threads per core" from (2), but can not generate a valid topology from (1). There are two questions that I'm not sure. 1) Why are we using leaf cluster nodes as packages ? To be more consistent with the concept of package (or sockets), maybe we should use the top-level cluster nodes as packages, or just make one single socket ? 2) Now it's documented that a cpu-map with socket nodes can be defined for ARM64, then do we have any plan to make the parser be aware of sockets too ? Like, we will make each socket nodes as a package instead of the leaf clusters if there are socket nodes found in the DT. So we will get "2 packages, 4 cores per package, 1 thread per core" from cpu-map (1). In virtualization, I hope to describe the user-defined (from QEMU) topology information (e.g. sockets=2,cores=8,threads=2) through DT, so that the guest kernel can get the topology. But I'm not sure whether to build the DT in format "cpu-map/socket%d/core%d/thread%d" or "cpu-map/cluster%d/core%d/thread%d". Honestly, I think the first one is consistent with the Doc. Looking forward to some reply, thanks! Yanan .