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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12355C74A5B for ; Thu, 30 Mar 2023 02:05:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229847AbjC3CFO (ORCPT ); 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) 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.