From patchwork Mon Nov 28 13:20:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Neri X-Patchwork-Id: 26769 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5659930wrr; Mon, 28 Nov 2022 05:18:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf6xjQrQ3EUhrQ53/iR0AyQ1wFz7ZcNTzw+7CBgAA/ehXHNewQ90XMYBtMfuYQ5e93TltwHz X-Received: by 2002:a17:906:924e:b0:782:2d3e:6340 with SMTP id c14-20020a170906924e00b007822d3e6340mr43608707ejx.234.1669641508095; Mon, 28 Nov 2022 05:18:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669641508; cv=none; d=google.com; s=arc-20160816; b=C/lw5TfqyN5XujfWu94nvWSfgcFELZcft0OY43PqwYlvFOzkNEaYSY/Jnhr+qhpmYG 1iw0R/3CrXe1erqoJgjUuXkLCICyY4o7sxTrJ88KOPNSJRf4gEbulQqd+8StGEleXAZg 4Nxvsd1f3yCDzMr0qy1J3czU5mUuCKzZDDr13/jv3gEb8HFUgP4u67FycgYFIPV9OCXC BLB8UC5qOKROVtl5hMOth7e7pNaUWA/hj/stsxCWaNWGwfpDQfainYMXWKSsVLl/O9yY dUDBDGfwIr45DX95XVUlHmWnqqVk4rnfxCDN9ARe3inHuk/bNwXrmST9uVhFJ+HsBkWB B2Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=Ada04ubPXLWlSUHTAsHzYqMgDnhmaYVx2WIce9Sb3nc=; b=b560Uj4uPc4koQf14wuxdQxY9cUVcTCBxDWQV7T/khHuyjguv3ALkbRsojmBhEDT7P XVG4EimNsvLEV4zdRO9uwbDcY2KxqsRBunCBPE2gvKeYVaKp8zKkNzRcXG8r/KQIql1n d3Zg8TjQ8tcsdiRrog6etATcuCUiKHuSC//jfVyC7RgV9gHnq0qxCtQ/QsNsbRgaAnkG tt+i8k0IELgAM4oirtUL06qKvDZmO2jXeZd4ClLgazG2XDltn5KA0d81Klq6o3tYrCmN CtvxvtaEIKqBrJzsiRVDyDyVRcVxEoxr4y4RAHpd/A/NqBCFIzSuL92pes4j2hT1gJ53 d+pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SQSfzVDV; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne4-20020a1709077b8400b007ade01e723bsi10501052ejc.30.2022.11.28.05.18.03; Mon, 28 Nov 2022 05:18:28 -0800 (PST) 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=SQSfzVDV; 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 S231886AbiK1NOk (ORCPT + 99 others); Mon, 28 Nov 2022 08:14:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231591AbiK1NNk (ORCPT ); Mon, 28 Nov 2022 08:13:40 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 269C4B7CD; Mon, 28 Nov 2022 05:13:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669641220; x=1701177220; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=qxJuo8ldTPva48VrC4qfDcG1QduoBAzNsZcRAMiSMzk=; b=SQSfzVDV4acHSgxO+V4fEB7SGuM6IXwhmyu3xFdfQ1kjwSwIb4r/quzz BJG7BVzw/Xmgo9oAsDUdGYlPzAMqQO9l4OvYeg4JKsHKANxXdnHkhSm09 E2dPiyApFjz4Hn1G2al7R+nFmQ/g5+nSmiXUkM2W6ZCucSJEv5+0/ONVe 9NEhRhedJSzYn3AFfHRUMVtMly1x5cn8g64spKA5FYbiE5IOWIGNQqtgn FO9TNgK/AcbrixzE6ZySqpBq+pveGInvudQWM/A8TTApwPBlCECpVichx pYzZL8vOkvjrPe2x574h1d1xJZSuf233YV3TKjtsc7gfAU3XDOPr19J7/ w==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="401117200" X-IronPort-AV: E=Sophos;i="5.96,200,1665471600"; d="scan'208";a="401117200" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2022 05:13:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="749381381" X-IronPort-AV: E=Sophos;i="5.96,200,1665471600"; d="scan'208";a="749381381" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga002.fm.intel.com with ESMTP; 28 Nov 2022 05:13:34 -0800 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, "Joel Fernandes (Google)" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ricardo Neri , "Tim C . Chen" Subject: [PATCH v2 15/22] thermal: intel: hfi: Define a default class for unclassified tasks Date: Mon, 28 Nov 2022 05:20:53 -0800 Message-Id: <20221128132100.30253-16-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221128132100.30253-1-ricardo.neri-calderon@linux.intel.com> References: <20221128132100.30253-1-ricardo.neri-calderon@linux.intel.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750746013730811250?= X-GMAIL-MSGID: =?utf-8?q?1750746013730811250?= A task may be unclassified if it has been recently created, spend most of its lifetime sleeping, or hardware has not provided a classification. Most tasks will be eventually classified as scheduler's IPC class 1 (HFI class 0). This class corresponds to the capabilities in the legacy, classless, HFI table. IPC class 1 is a reasonable choice until hardware provides an actual classification. Meanwhile, the scheduler will place other tasks with higher scores 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-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Ricardo Neri --- Changes since v1: * Now the default class is 1. --- drivers/thermal/intel/intel_hfi.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c index 1f7b18198bd4..1b3fd704ae9a 100644 --- a/drivers/thermal/intel/intel_hfi.c +++ b/drivers/thermal/intel/intel_hfi.c @@ -187,6 +187,19 @@ static struct workqueue_struct *hfi_updates_wq; #ifdef CONFIG_IPC_CLASSES static int __percpu *hfi_ipcc_scores; +/* + * A task may be unclassified if it has been recently created, spend most of + * its lifetime sleeping, or hardware has not provided a classification. + * + * Most tasks will be classified as scheduler's IPC class 1 (HFI class 0) + * eventually. Meanwhile, the scheduler will place tasks of higher IPC score + * on higher-performance CPUs. + * + * IPC class 1 is a reasonable choice. It matches the performance capability + * of the legacy, classless, HFI table. + */ +#define HFI_UNCLASSIFIED_DEFAULT 1 + int intel_hfi_has_ipc_classes(void) { return cpu_feature_enabled(X86_FEATURE_ITD); @@ -222,7 +235,7 @@ int intel_hfi_get_ipcc_score(unsigned short ipcc, int cpu) return -EINVAL; if (ipcc == IPC_CLASS_UNCLASSIFIED) - return -EINVAL; + ipcc = HFI_UNCLASSIFIED_DEFAULT; /* * Scheduler IPC classes start at 1. HFI classes start at 0.