From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18012C433F5 for ; Tue, 5 Oct 2021 20:43:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E950161181 for ; Tue, 5 Oct 2021 20:43:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236282AbhJEUp1 (ORCPT ); Tue, 5 Oct 2021 16:45:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235949AbhJEUp0 (ORCPT ); Tue, 5 Oct 2021 16:45:26 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04AA2C061753; Tue, 5 Oct 2021 13:43:35 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id f9so1525576edx.4; Tue, 05 Oct 2021 13:43:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Og2M5waf4fA2uPXVR7x75f+2DQk+Er2YOKkUnKX3nZk=; b=ap2vC8X6KAv1QHqhkz2q8YofK57fi+puC8XosK5Nz10ZYlMruG5LLHwPvClyBQpMWm 8berVuZXF7txYIkit8yuznvzVaI7C5Ow7olHViNWKOyjE1GPlrb/sEujo/OeYcpMl0yW MGc36PE5YBgGXJINGW+BwkKb5gAXA54fzGFdXkIYFvAG+LRXz6brZlhNz6Onv6ydLvPA M1TbBxjrpifn65fpmH8mxNkDUY/1J/M2fyK2AKDW0b1wpD9gYXodLEHKlntCWBUDgknL yl+rJICcXGUvjFf6Cs7+U754p4ffpaW1FLQULNv0meKZUU91HvWYgH0yiQIxMZeBSLcY EZ8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Og2M5waf4fA2uPXVR7x75f+2DQk+Er2YOKkUnKX3nZk=; b=rhumTp6UJyJII+Nocf6isD35feiC6s4nGHv4PU40qDPV3BWOdt1hMNioCMh0BvIK4q ixEnopPyHd7Po4majZPrOfYDXbLXyU4q20LWP5wgTLZGFUmlaTGgWXydmJAjz6u0g94q zf+6FxhqannxHHP37A2atp1O5XVJYoFYeB0KJe1qRW4gYCFboKyvftwuZ7vDpKSs9asT 8DtoX0BDDN8xT21woXWQ7xgpWLJeE/JeDjak3QqPtAbzPwGRgSm228boIGjksmbtujPN Cy/6vRMWxZISb2lMnGDODveoFHa6A0/7uQrzzgYm8HPcJr60w67O3sMmC9bMZkSk2g/H /yfQ== X-Gm-Message-State: AOAM531LRHTj/4q96TC8unNBQJOSfdKKKQagFoTMs4ajcpYkSxmgeeqk pOvHi1TkwJxobJJhO6vbfcS/EQ1l62OcZCrmc6U= X-Google-Smtp-Source: ABdhPJwy6b5QSPhwn9KbIlfOEPHwI/1HnWTI9L+Y+T7NDIRuCf954BxzRKe+Af1JsOXVAXjVYwbdF768KuUur7Usvb8= X-Received: by 2002:a17:906:280f:: with SMTP id r15mr26029552ejc.559.1633466613592; Tue, 05 Oct 2021 13:43:33 -0700 (PDT) MIME-Version: 1.0 References: <20210924085104.44806-1-21cnbao@gmail.com> <20210924085104.44806-2-21cnbao@gmail.com> <87o883l9c8.mognet@arm.com> In-Reply-To: <87o883l9c8.mognet@arm.com> From: Barry Song <21cnbao@gmail.com> Date: Wed, 6 Oct 2021 09:43:22 +1300 Message-ID: Subject: Re: [PATCH RESEND 1/3] topology: Represent clusters of CPUs within a die To: Valentin Schneider Cc: Dietmar Eggemann , LKML , Ingo Molnar , Peter Zijlstra , Vincent Guittot , Aubrey Li , Borislav Petkov , Daniel Bristot de Oliveira , Ben Segall , Catalin Marinas , Greg Kroah-Hartman , Guodong Xu , "H. Peter Anvin" , Jonathan Cameron , Juri Lelli , "Cc: Len Brown" , ACPI Devel Maling List , LAK , Linuxarm , Mark Rutland , Mel Gorman , msys.mizuma@gmail.com, "Zengtao (B)" , "Rafael J. Wysocki" , Steven Rostedt , Barry Song , Sudeep Holla , Thomas Gleixner , "Rafael J. Wysocki" , Tim Chen , Will Deacon , x86 , yangyicong , Tian Tao Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 6, 2021 at 5:34 AM Valentin Schneider wrote: > > On 24/09/21 20:51, Barry Song wrote: > > void update_siblings_masks(unsigned int cpuid) > > { > > struct cpu_topology *cpu_topo, *cpuid_topo = &cpu_topology[cpuid]; > > @@ -617,6 +622,11 @@ void update_siblings_masks(unsigned int cpuid) > > if (cpuid_topo->package_id != cpu_topo->package_id) > > continue; > > > > + if (cpuid_topo->cluster_id == cpu_topo->cluster_id) { > > + cpumask_set_cpu(cpu, &cpuid_topo->cluster_sibling); > > + cpumask_set_cpu(cpuid, &cpu_topo->cluster_sibling); > > + } > > + > > Hm so without cluster information (e.g. DT system), we have > ->cluster_id=-1, we'll essentially copy the package mask into the cluster > mask. > > The exposed cluster mask is still <= package mask which is sensible. Are we > fine with that, or do we need/want the mask to be empty in the -1 case? I'm > guessing userspace tools should check for either id!=-1 or if the exclusive > disjucntion of cluster vs package masks is non-empty. Hi Valentin, Yep, this is a very good question. I'd like change the code to: diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 7cb31d959f33..fc0836f460fb 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -622,7 +622,8 @@ void update_siblings_masks(unsigned int cpuid) if (cpuid_topo->package_id != cpu_topo->package_id) continue; - if (cpuid_topo->cluster_id == cpu_topo->cluster_id) { + if (cpuid_topo->cluster_id == cpu_topo->cluster_id && + cpuid_topo->cluster_id != -1) { cpumask_set_cpu(cpu, &cpuid_topo->cluster_sibling); cpumask_set_cpu(cpuid, &cpu_topo->cluster_sibling); } This should be consistent with Tim's patch3/3 for x86 in case id is BAD_APICID: static bool match_l2c(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) { ... /* Do not match if we do not have a valid APICID for cpu: */ if (per_cpu(cpu_l2c_id, cpu1) == BAD_APICID) return false; ... } Thanks Barry