Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1484330rwl; Wed, 29 Mar 2023 19:18:21 -0700 (PDT) X-Google-Smtp-Source: AK7set+elyH8dQ3rxf27RYjAMNg/wW3ZyZkIdXHG5haNHODUIiq47+pfjrsrQqbJ1ywP6x/HVhoe X-Received: by 2002:a05:6a20:1dc:b0:dd:df53:4355 with SMTP id 28-20020a056a2001dc00b000dddf534355mr17169000pzz.53.1680142701041; Wed, 29 Mar 2023 19:18:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680142701; cv=none; d=google.com; s=arc-20160816; b=SfHdS39ePY0ty8EW5meJB1XQ6mNlEPEa3VUOkB6PSxKKmkQHt/1okif5NxweCD8G6Z ICKZc7QkbAN6/ZMkMsQFJtppI2qL8MPQSFRaQdIbblRAMYwWPBkkQCaJPPq7ZAJLv9xw DIGvo5vCIJBfBjH7pmMbG+ZeHkxokq/jFgM7oJwt1RUT60n7K6ZU7iIx5K2lZie5P/H/ n5pIWQERptStgI6C3aL2wRtUS9NG9HfKMTIOMsdeckmvM155qK+ooifdhHH2PgD1Xb6Q WZkGbbnbjWRUpBWwtPT+Qb/XngzhLarWlUGH5aKiC0nAZgiFsKUqKQ9rxMiREFnojwZO AdpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Ov8U3ndBqOjbpRCBCKAiYsQl8BCeUHPouIEgMmuAUEM=; b=eUi72+C7WrXUez8LPeDzJYOk+/sBRQUISJncFn+yKu43ncoxFKhfzonG6mIht7YGVI V2zY4MgIKpNMI5aF2OFb1600EdMcLVilc/jJ0J4LXg4DIR+LEtDL244vUwdzLtbwxx/k c3try8CbKqiXGeihfZ3a5I38XkUoWFeuSP2qlFkraB9NeHjLDjWEB3hveP701E6445xZ tFtx9LYFRUZ8x9wjweoKQMI8tXsbxH46LyMnOBW1F/+A+gRrfbS/W8RDk+F+OO5Y8kCQ Icf/ichIt6JMJ7ImrYeDiOnz+GS39wW4GkMVumUSlrGJqxJ59BaQ1i1EHKqgWAc5GBpw eMEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bzqbj0XX; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d130-20020a621d88000000b0062ae6345c6esi13269035pfd.393.2023.03.29.19.18.08; Wed, 29 Mar 2023 19:18:21 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=bzqbj0XX; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229834AbjC3CFO (ORCPT + 99 others); Wed, 29 Mar 2023 22:05:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjC3CFL (ORCPT ); Wed, 29 Mar 2023 22:05:11 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17BCF1BC; Wed, 29 Mar 2023 19:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680141911; x=1711677911; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=zDLHnp7f6/gRaeT/OTofMpHjg3g6plw+5DJPulgggY4=; b=bzqbj0XXO0I+qiE1xWttr1xWMmFCEEmfXQi0cLQ2Xn6xX++S9nSeHOut jc1bfldzeuUdsKA4057ji8iGdZyKBTWtV5u6Sqt2XejSfynWHIFGaZpQP 4Pyzu0IQTb8TlRVVRpYO7kQEMaeBSRMuwh5aETnqCM3gr2hVn9aguV/My XF0npGWKLOOHPl9WNU94mtup496qIy/+SRfGfR6lGqHKlNOQKlhWJYdV7 GzGhtp4x7987CSB7WbNFdPs1+2bYmbJmUUJ2nVFoluloII3q2/RJP3SAu Hqi3B/WKbPEBf4TkZA9xi1pxC2BuZSLj+5wcWEJSOEky5V9NhXcHhQHOT A==; X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="368825508" X-IronPort-AV: E=Sophos;i="5.98,301,1673942400"; d="scan'208";a="368825508" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2023 19:05:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="828125258" X-IronPort-AV: E=Sophos;i="5.98,301,1673942400"; d="scan'208";a="828125258" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2023 19:05:10 -0700 Date: Wed, 29 Mar 2023 19:15:54 -0700 From: Ricardo Neri To: "Rafael J. Wysocki" Cc: "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" Subject: Re: [PATCH v3 13/24] thermal: intel: hfi: Store per-CPU IPCC scores Message-ID: <20230330021554.GC26315@ranerica-svr.sc.intel.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 02:08:30PM +0200, Rafael J. Wysocki wrote: > 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). I thought so. Thank you for clarifying.