Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp511170rwl; Wed, 29 Mar 2023 05:14:55 -0700 (PDT) X-Google-Smtp-Source: AKy350baOA61Q1hh8oScN5gB8VpYA86owDWUqI189L2aSde8ws9nfSbdvAImt8zpBOtDrNkATnY7 X-Received: by 2002:aa7:c68b:0:b0:4fb:78a0:eabf with SMTP id n11-20020aa7c68b000000b004fb78a0eabfmr20106552edq.29.1680092095001; Wed, 29 Mar 2023 05:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680092094; cv=none; d=google.com; s=arc-20160816; b=eJ3Fdv4BZN8zf0ikWcb0LJr4LElrf2YOCFPLNakGSPsKt4j36sFrEEU3pcn3w08CF+ QUO4rrz6XPMGt1XjigOrfn5XiRsYF/yrMXPE/XJw1zbBKpEdWNDT2ewOde7O01sz1WzC zcby0ZFR1nMKrE4RDSt3mzAp4g0GWEdEuZe4JG+l141uCuQnWT+LcMG6EwZhltBKI4NB et7R5wJH28jQbe8byVuUqZ2HYb82ZevekgZ7Q+3ynVB8d3kvaNpRH5pkWUXdn+QdQ9+i Jrs5Ht/i7Vl4k2jag5Tv3k3TiaZeFasnnvG66iL0dnoOg2uupEdV35N7ohB1V9QWWqK4 SsuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=apGshqMTw9fgWX7nlqpH4KBWFo87LDQXz5ljeOYqv/4=; b=IBtH+UPEbumMGYTQxeBT6e2SiDbEdixuzsSWmtrCwAevzSfYa/UUf0AJWkfyDNptSM CALikI7Dghi6BrR15N9C7arDVn1xjTFT9iWLrhLmcb1IO4Yd7b5qdyYrcA7BrKlSdEkd pg/iDxh4ePLQLvC5e4vbafPJ2mNhOm2BElFVVdBJZGDPvZzmNfdLEvpn851a2HBeCRob hsub3H4kiLlNvjUKjnZ7qcX9c/YIErs9IKubga6uh9pSvLb1AdAilAdU9sfYkmndROgn 6cFRe/t41z3z/7KkMe3B8s3rkIbjcwj1kxxEqBMlfuDsgGDcLMfI8v61FTqk60500u1r ZpcA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020aa7de0e000000b005024d6d6d5bsi4743198edv.532.2023.03.29.05.14.30; Wed, 29 Mar 2023 05:14:54 -0700 (PDT) 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; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229590AbjC2MIu convert rfc822-to-8bit (ORCPT + 99 others); Wed, 29 Mar 2023 08:08:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbjC2MIq (ORCPT ); Wed, 29 Mar 2023 08:08:46 -0400 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3749619A6; Wed, 29 Mar 2023 05:08:43 -0700 (PDT) Received: by mail-ed1-f41.google.com with SMTP id eh3so62215730edb.11; Wed, 29 Mar 2023 05:08:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680091721; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QWzS8o2cDqs6eUyJBwx+5Ajp/UM3cNcMfK4e9vgW6Yc=; b=0WaDg57zfFrniRueSiMvPO5iIVXzetbTAgrhpMGVA7MClmHcoCTZ+UtsyChujrWQ/X W6KQspW+cHaq8jIZtqbj7YLpk+tNuyoI++SJrBOGt++Ckj/cYH4i5LoRTwjfOH5NtOTx GUsqjjRUyY0naeNDAnsxesUVMeQS2ijkQBToKXimrJaW7THshhdDfgmpoLv7wiFvcy+M g9RhApDs11ucN6dm/pX4E/ohSNz4HTIS397rKKqBy6Ht3173Ka02Vqqi0BVqaBd/t018 1DyZ3uA6f87hPkQmKODMsGW7tuxkc/nrdrQeHZi0V21RyxYNu8l6G4REQ9dSudt0T65h A2hg== X-Gm-Message-State: AAQBX9dxNW7/bV4VTRhqQTkg5oE5rBa0M8N6zGgMrO3t6lW1aJq9KG+O fklfYTSvsiA82hXXeI+f9Hwg6L2PIvwzukvz/GQ= X-Received: by 2002:a17:907:d48d:b0:93e:c1ab:ae67 with SMTP id vj13-20020a170907d48d00b0093ec1abae67mr8662109ejc.2.1680091721743; Wed, 29 Mar 2023 05:08:41 -0700 (PDT) MIME-Version: 1.0 References: <20230207051105.11575-1-ricardo.neri-calderon@linux.intel.com> <20230207051105.11575-14-ricardo.neri-calderon@linux.intel.com> <20230328234315.GD8958@ranerica-svr.sc.intel.com> In-Reply-To: <20230328234315.GD8958@ranerica-svr.sc.intel.com> From: "Rafael J. Wysocki" Date: Wed, 29 Mar 2023 14:08:30 +0200 Message-ID: Subject: Re: [PATCH v3 13/24] thermal: intel: hfi: Store per-CPU IPCC scores To: Ricardo Neri Cc: "Rafael J. Wysocki" , "Peter Zijlstra (Intel)" , Juri Lelli , Vincent Guittot , Ricardo Neri , "Ravi V. Shankar" , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Len Brown , Mel Gorman , "Rafael J. Wysocki" , Srinivas Pandruvada , Steven Rostedt , Tim Chen , Valentin Schneider , Lukasz Luba , Ionela Voinescu , x86@kernel.org, "Joel Fernandes (Google)" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, "Tim C . Chen" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Wed, Mar 29, 2023 at 1:32 AM Ricardo Neri wrote: > > On Mon, Mar 27, 2023 at 06:37:32PM +0200, Rafael J. Wysocki wrote: > > On Tue, Feb 7, 2023 at 6:02 AM Ricardo Neri > > wrote: > > > > > > The scheduler reads the IPCC scores when balancing load. These reads can > > > be quite frequent. Hardware can also update the HFI table frequently. > > > Concurrent access may cause a lot of lock contention. It gets worse as the > > > number of CPUs increases. > > > > > > Instead, create separate per-CPU IPCC scores that the scheduler can read > > > without the HFI table lock. > > > > > > Cc: Ben Segall > > > Cc: Daniel Bristot de Oliveira > > > Cc: Dietmar Eggemann > > > Cc: Ionela Voinescu > > > Cc: Joel Fernandes (Google) > > > Cc: Len Brown > > > Cc: Lukasz Luba > > > Cc: Mel Gorman > > > Cc: Rafael J. Wysocki > > > Cc: Srinivas Pandruvada > > > Cc: Steven Rostedt > > > Cc: Tim C. Chen > > > Cc: Valentin Schneider > > > Cc: x86@kernel.org > > > Cc: linux-pm@vger.kernel.org > > > Cc: linux-kernel@vger.kernel.org > > > Suggested-by: Peter Zijlstra (Intel) > > > Signed-off-by: Ricardo Neri > > > --- > > > Changes since v2: > > > * Only create these per-CPU variables when Intel Thread Director is > > > supported. > > > > > > Changes since v1: > > > * Added this patch. > > > --- > > > drivers/thermal/intel/intel_hfi.c | 46 +++++++++++++++++++++++++++++++ > > > 1 file changed, 46 insertions(+) > > > > > > diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c > > > index 2527ae3836c7..b06021828892 100644 > > > --- a/drivers/thermal/intel/intel_hfi.c > > > +++ b/drivers/thermal/intel/intel_hfi.c > > > @@ -29,6 +29,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -170,6 +171,43 @@ static struct workqueue_struct *hfi_updates_wq; > > > #define HFI_UPDATE_INTERVAL HZ > > > #define HFI_MAX_THERM_NOTIFY_COUNT 16 > > > > > > +#ifdef CONFIG_IPC_CLASSES > > > > It would be good to provide a (concise) description of this variable. > > > > > +static int __percpu *hfi_ipcc_scores; > > Do you mean hfi_ipcc_scores or CONFIG_IPC_CLASSES? hfi_ipcc_scores (as the latter is not a variable).