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 73811ECAAA1 for ; Fri, 9 Sep 2022 23:07:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232042AbiIIXH4 (ORCPT ); Fri, 9 Sep 2022 19:07:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231493AbiIIXGs (ORCPT ); Fri, 9 Sep 2022 19:06:48 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8323E115CC6 for ; Fri, 9 Sep 2022 16:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662764798; x=1694300798; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=epYtVjcbLviWKnJTVHgtRgUsqwNMxXWwwx/cQDLQkHc=; b=TERmdQdd/25me7JzWUbtqiiIR4Mo41t1VHOdh8AYTvLO9XLytZ21rbnR zfFLKQkb2bR6Iv95YgBeXRZPInGrDb0RJwppkj+gSoDVTlfSxTKTqOscU HdeqMDO7aIZGZy4Q53JGHt3RhjvEiQ40+E9d6pgp1Uaaihzz9UnffeGgV WEgBUVIxDUvk5zd3oA7uEO6HwZgBVW7moGXOEJj2Rr3VPex1tGGc2EYV0 oPgwYyyEUKgFw9ZedOUa9DTc+fGSAjOkP5cppJrc0cHHcR/99isz6Trme 3833aDgJOqPAIJTx3Edv0GqyplO5hyc/a3qpKJB5LfaqYAGVdig6OXd1E g==; X-IronPort-AV: E=McAfee;i="6500,9779,10465"; a="298386920" X-IronPort-AV: E=Sophos;i="5.93,304,1654585200"; d="scan'208";a="298386920" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2022 16:06:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,304,1654585200"; d="scan'208";a="677355029" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga008.fm.intel.com with ESMTP; 09 Sep 2022 16:06:35 -0700 From: Ricardo Neri To: "Peter Zijlstra (Intel)" , Juri Lelli , Vincent Guittot Cc: 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 , x86@kernel.org, linux-kernel@vger.kernel.org, Ricardo Neri , "Tim C . Chen" Subject: [RFC PATCH 16/23] thermal: intel: hfi: Define a default classification for unclassified tasks Date: Fri, 9 Sep 2022 16:11:58 -0700 Message-Id: <20220909231205.14009-17-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220909231205.14009-1-ricardo.neri-calderon@linux.intel.com> References: <20220909231205.14009-1-ricardo.neri-calderon@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tasks may be unclassified if they have been recently created, spend most of its lifetime sleeping, or hardware has not provided a classification. Most tasks will be eventually classified as 0. This class corresponds to the capabilities in the legacy, classless, Hardware Feedback Interface table. Class 0 is a reasonable choice until hardware provides an actual classification. Meanwhile, the scheduler will place tasks of higher- performance classes on higher-performance CPUs. Cc: Ben Segall Cc: Daniel Bristot de Oliveira Cc: Dietmar Eggemann Cc: Len Brown 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-kernel@vger.kernel.org Signed-off-by: Ricardo Neri --- drivers/thermal/intel/intel_hfi.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c index 1b6072c828ff..967899d2c01f 100644 --- a/drivers/thermal/intel/intel_hfi.c +++ b/drivers/thermal/intel/intel_hfi.c @@ -184,6 +184,20 @@ static struct workqueue_struct *hfi_updates_wq; #define HFI_MAX_THERM_NOTIFY_COUNT 16 #ifdef CONFIG_INTEL_THREAD_DIRECTOR + +/* + * Tasks may be unclassified if they have been recently created, spend most + * of its lifetime sleeping, or hardware has not provided a classification. + * + * Most tasks will be classified as 0 eventually. Meanwhile, the scheduler + * will place tasks of higher per-class performance on higher-performance + * CPUs. + * + * Class 0 is a reasonable choice. It matches the performance capability + * of the legacy, classless, Hardware Feedback Interface table. + */ +#define UNCLASSIFIED_TASK_DEFAULT 0 + int intel_hfi_has_task_classes(void) { return cpu_feature_enabled(X86_FEATURE_ITD); @@ -222,14 +236,14 @@ int intel_hfi_get_task_class_score(int class, int cpu) struct hfi_cpu_info *info = &per_cpu(hfi_cpu_info, cpu); struct hfi_instance *instance; struct hfi_cpu_data caps; + int cap, _class = class; unsigned long flags; - int cap; if (cpu < 0 || cpu >= nr_cpu_ids) return -EINVAL; if (class == TASK_CLASS_UNCLASSIFIED) - return -EINVAL; + _class = UNCLASSIFIED_TASK_DEFAULT; if (class >= (int)hfi_features.nr_classes) return -EINVAL; @@ -239,7 +253,7 @@ int intel_hfi_get_task_class_score(int class, int cpu) return -ENOENT; raw_spin_lock_irqsave(&instance->table_lock, flags); - get_one_hfi_cap(instance, info->index, &caps, class); + get_one_hfi_cap(instance, info->index, &caps, _class); cap = caps.perf_cap; raw_spin_unlock_irqrestore(&instance->table_lock, flags); -- 2.25.1