Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1503974imm; Tue, 15 May 2018 21:49:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpGr74RQ1IImphpPU4TmZhmLevwux4zGOwgEf/+HOU9fpiZ1U2F8R7If7Vypk6RjxnnRqvB X-Received: by 2002:a62:dc4e:: with SMTP id t75-v6mr18033142pfg.139.1526446189331; Tue, 15 May 2018 21:49:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526446189; cv=none; d=google.com; s=arc-20160816; b=ggKysbijDK/Jr00YPj08f4fyYJb1594BbXrfMRNpXxsGfsJDaAEQ0INvYLuov0agMF LnvGAr94DH094HLuCzsHRp3BQnuJE2a6kmlmxOn3Dkk9I99tqnLbZtxnWxSWt1wxONjE HsYS+8D4DOTw4Pxdk+/eZ5A2SX26ZGxqZVJay2jhaUECTGUo2AEfhyTdy4AnU2/JVFDQ J2ww9J5LNanRLsN6BUSd08yf8lA1KgzYqTYSc+Eahga9YTCUMtRmcMcL4S69Agn4DjeA 8OhZcMPVC8jMZVSeHsI3RNJlaTcwZ/c2pjiN4xpPy4M1k4ajKAXPX61HSg/6R4JVB1VK 1img== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=bEm2qf2pLVQu2z2PgbpAaXs0kbLMhdzUAw5r+6jodOY=; b=QB1ZHq9JtZo4DCeo3+3AjCGihuN8tuWk8xAxyn+qy0ycj6qU/HE+zQS/e+UHC9hQH9 HtXNrTkW6YCNyBROvXv+8Dh5JsvaxHxyHG5Vu/g4tHyoZ2tabGFtubbDIOS5IETDT515 GCCuNHy64v9wuEamk0QmBYG4wmtBZSl1UfYTPoZbJdc9UwlprVo316T9CuSiANzi8vLm ZnIy4oIrCDkInb28AkJ9B0SWFdKAzekbF+bFp+nazRJ6vcViFaLIxC8Ff39F1ArDfW26 CNpzfKUDm0fTnvvf1HUM6pBtc5fk8udIL4eb/yHJd4WJOvgu8wMNgbRkiUO5gORMTQc8 u5jw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v80-v6si1787087pfa.173.2018.05.15.21.49.34; Tue, 15 May 2018 21:49:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752101AbeEPEtX (ORCPT + 99 others); Wed, 16 May 2018 00:49:23 -0400 Received: from mga04.intel.com ([192.55.52.120]:1168 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751490AbeEPEtU (ORCPT ); Wed, 16 May 2018 00:49:20 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 May 2018 21:49:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,404,1520924400"; d="scan'208";a="41300344" Received: from sunandaa-mobl.amr.corp.intel.com (HELO spandruv-mobl.jf.intel.com) ([10.252.135.192]) by orsmga007.jf.intel.com with ESMTP; 15 May 2018 21:49:18 -0700 From: Srinivas Pandruvada To: srinivas.pandruvada@linux.intel.com, tglx@linutronix.de, mingo@redhat.com, peterz@infradead.org, bp@suse.de, lenb@kernel.org, rjw@rjwysocki.net, mgorman@techsingularity.net Cc: x86@kernel.org, linux-pm@vger.kernel.org, viresh.kumar@linaro.org, juri.lelli@arm.com, linux-kernel@vger.kernel.org Subject: [RFC/RFT] [PATCH 04/10] cpufreq: intel_pstate: Add update_util_hook for HWP Date: Tue, 15 May 2018 21:49:05 -0700 Message-Id: <20180516044911.28797-5-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180516044911.28797-1-srinivas.pandruvada@linux.intel.com> References: <20180516044911.28797-1-srinivas.pandruvada@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When HWP dynamic boost is active then set the HWP specific update util hook. Also start and stop processing in frequency invariant accounting based on the HWP dyanmic boost setting Signed-off-by: Srinivas Pandruvada --- drivers/cpufreq/intel_pstate.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index dc7dfa9..e200887 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -290,6 +290,7 @@ static struct pstate_funcs pstate_funcs __read_mostly; static int hwp_active __read_mostly; static bool per_cpu_limits __read_mostly; +static bool hwp_boost __read_mostly; static struct cpufreq_driver *intel_pstate_driver __read_mostly; @@ -1420,6 +1421,12 @@ static void csd_init(struct cpudata *cpu) cpu->csd.info = cpu; } +static inline void intel_pstate_update_util_hwp(struct update_util_data *data, + u64 time, unsigned int flags) +{ + +} + static inline void intel_pstate_calc_avg_perf(struct cpudata *cpu) { struct sample *sample = &cpu->sample; @@ -1723,7 +1730,7 @@ static void intel_pstate_set_update_util_hook(unsigned int cpu_num) { struct cpudata *cpu = all_cpu_data[cpu_num]; - if (hwp_active) + if (hwp_active && !hwp_boost) return; if (cpu->update_util_set) @@ -1731,8 +1738,12 @@ static void intel_pstate_set_update_util_hook(unsigned int cpu_num) /* Prevent intel_pstate_update_util() from using stale data. */ cpu->sample.time = 0; - cpufreq_add_update_util_hook(cpu_num, &cpu->update_util, - intel_pstate_update_util); + if (hwp_active) + cpufreq_add_update_util_hook(cpu_num, &cpu->update_util, + intel_pstate_update_util_hwp); + else + cpufreq_add_update_util_hook(cpu_num, &cpu->update_util, + intel_pstate_update_util); cpu->update_util_set = true; } @@ -1844,8 +1855,15 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) intel_pstate_set_update_util_hook(policy->cpu); } - if (hwp_active) + if (hwp_active) { + if (hwp_boost) { + x86_arch_scale_freq_tick_enable(); + } else { + intel_pstate_clear_update_util_hook(policy->cpu); + x86_arch_scale_freq_tick_disable(); + } intel_pstate_hwp_set(policy->cpu); + } mutex_unlock(&intel_pstate_limits_lock); -- 2.9.5