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 3583FC433F5 for ; Wed, 6 Oct 2021 10:51:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16C4961039 for ; Wed, 6 Oct 2021 10:51:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238147AbhJFKwl (ORCPT ); Wed, 6 Oct 2021 06:52:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238157AbhJFKwk (ORCPT ); Wed, 6 Oct 2021 06:52:40 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E05F3C061755; Wed, 6 Oct 2021 03:50:47 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id v18so8128785edc.11; Wed, 06 Oct 2021 03:50:47 -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=/RnP//V6796HoXyW5g91DrP6v6JppXFbXNsT/OGvyG8=; b=qImZXBHHeRk0lUf6RDWqAGl5sjDtD9AeVQdko0eV+76rBlnqrSrvFl4eTYXPcOYLXb 4HeNnlBR17kx8AMvZqVkR8LHooVlXcAQnT5ZEnUIyWaYpXOr4FxYwjRo8rgc+8DPwoCu CIqeNQEu6KJjCkuM20ygR8puiEeAVh0XiDzvGlK/ejb/7Uqz7RcTCcqofdrUFRR3/Mmc gvnMNkNTQf+iHGrNEF049FSpa9YXPUAs9F/hro+AzyS5AxtLPL6W2xg/qagAVqj9hfvo /5bKSDDqxluO5XrOOa+UyRSAAG6U6PTdSGd0NS/4rWq19n7Yr8UNwJt82JeRCGUvOf78 rVNQ== 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=/RnP//V6796HoXyW5g91DrP6v6JppXFbXNsT/OGvyG8=; b=sLIxSkKuy7VholT9XSOqgxKr59Cvooe+MCUPtDc5RSuOHeRofXmEOoCHhk89Lnbdf2 l2fDiRYSAMvANE3Ldsl1AIgKWBohj8CYAF/Z3bZ8bPzRVeJIBVGyFor1ct2/H5q+lb00 7uhCeznQQlKoZlBlE1iLvC5OzvZNWfK4BtOm+pjZ81t5kpxee6oCrc5E2C9CRXIb7deD XBN7bgX1/7E2gRp6hKFtFzIiWHLRxKUCKXewxLLa8iMaWfrqYSHdLPqVPzK4khW66jww 7jMI9xzGbNugF2SZ/4Vb5v9r4Frxt7b+wqfCxKL1v40U9piZJaRHqbdiNUT2icbZqB1v ObSw== X-Gm-Message-State: AOAM533Z3zdQQ9eamLlDt0fkkoT3Mc79Z/Lt+7V1gKaBB+QCVTdiAjTB MdRGH66yuGfDYrQkXjsCWE28bxneF+V/rL+CbNY= X-Google-Smtp-Source: ABdhPJw75xV19FmERlZGZH9B0wc18Fupm3yUyEd9K8GKVfiJR8Cw7kDe/8ziN/hJHKheeXgJWUlFrfxi1VS71DUg3H4= X-Received: by 2002:aa7:dd16:: with SMTP id i22mr33372235edv.167.1633517446492; Wed, 06 Oct 2021 03:50:46 -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: From: Barry Song <21cnbao@gmail.com> Date: Wed, 6 Oct 2021 23:50:35 +1300 Message-ID: Subject: Re: [PATCH RESEND 1/3] topology: Represent clusters of CPUs within a die To: Valentin Schneider , Peter Zijlstra Cc: Dietmar Eggemann , LKML , Ingo Molnar , 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 9:43 AM Barry Song <21cnbao@gmail.com> wrote: > > 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); > } > Hi Peter, Would you like to change this line in your tree? Or do you want me to send a new patchset with this small change? > 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