From patchwork Mon Dec 16 17:28:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dirk.brandewie@gmail.com X-Patchwork-Id: 3356071 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E67E8C0D4A for ; Mon, 16 Dec 2013 17:28:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0B522020A for ; Mon, 16 Dec 2013 17:28:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D70E220200 for ; Mon, 16 Dec 2013 17:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754814Ab3LPR2Y (ORCPT ); Mon, 16 Dec 2013 12:28:24 -0500 Received: from mail-pd0-f176.google.com ([209.85.192.176]:44730 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754752Ab3LPR2X (ORCPT ); Mon, 16 Dec 2013 12:28:23 -0500 Received: by mail-pd0-f176.google.com with SMTP id w10so5612778pde.35 for ; Mon, 16 Dec 2013 09:28:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=JFSyPij4QfrKjo0TbN1HIa8QUH8BUmhGND/drPLZxQI=; b=MhnYqNeB/it+CKA5CTEqZXceAsUcoWaINWRoOkVUH5v6mZW0j9SU8s8rd3dfFyX//9 HH5TYFsaWJtd0xwG9lBO3YWtMm6suMQM7ibV522hf1PStgY+nchOLtpBcJ7BRfid7NrT G4w9CdeOCEwIJi2rysbfYHRE0zMYiJGWfPROT0qDsFvTOXy1gsslZTKzid6UCayaoqvB UhSMFK2mZPH7Kai8DDAn5a4h87/5R9cOmlti2JmncH31GMWjrrvjNxKpvF08hOniIe6n YG+KNk6lqmGM4Xw0fyxFT/L16LkUm13fyirLHbNdKFalPEx4BrQgFEI33YDIM3P0z5NW Q+EA== X-Received: by 10.68.163.33 with SMTP id yf1mr21318925pbb.143.1387214902712; Mon, 16 Dec 2013 09:28:22 -0800 (PST) Received: from echolake.localdomain (static-50-43-35-129.bvtn.or.frontiernet.net. [50.43.35.129]) by mx.google.com with ESMTPSA id lh13sm37896671pab.4.2013.12.16.09.28.20 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Dec 2013 09:28:21 -0800 (PST) Message-ID: <52AF3833.1070204@gmail.com> Date: Mon, 16 Dec 2013 09:28:19 -0800 From: Dirk Brandewie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Viresh Kumar , Joakim Hernberg CC: Linux Kernel Mailing List , "Rafael J. Wysocki" , "linux-pm@vger.kernel.org" Subject: Re: Problem: Possible regression in intel_pstate on 3.12 References: <20131208172508.0cacabd0@tor.valhalla.alchemy.lu> In-Reply-To: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Joakim, Add the following patch to your v3.12 kernel and collect some data with the command and send the resulting perf.data file: perf record -a -c 1 -e power:pstate_sample sleep 10 TIA --Dirk commit b3dc2c2a106cea68e4c9c0f4747b15291113c4ae Author: Dirk Brandewie Date: Mon Dec 2 09:56:46 2013 -0800 intel_pstate: Add trace point to report internal state. Add perf trace event "power:pstate_sample" to report driver state to aid in diagnosing issues reported against intel_pstate. Signed-off-by: Dirk Brandewie --- drivers/cpufreq/intel_pstate.c | 22 ++++++++++++++++++ include/trace/events/power.h | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 5f1cbae..c4f14d1 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -50,6 +50,8 @@ static inline int32_t div_fp(int32_t x, int32_t y) return div_s64((int64_t)x << FRAC_BITS, (int64_t)y); } +static u64 energy_divisor; + struct sample { int32_t core_pct_busy; u64 aperf; @@ -512,6 +514,7 @@ static inline void intel_pstate_sample(struct cpudata *cpu) rdmsrl(MSR_IA32_APERF, aperf); rdmsrl(MSR_IA32_MPERF, mperf); + cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; cpu->samples[cpu->sample_ptr].aperf = aperf; cpu->samples[cpu->sample_ptr].mperf = mperf; @@ -565,10 +568,24 @@ static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) static void intel_pstate_timer_func(unsigned long __data) { struct cpudata *cpu = (struct cpudata *) __data; + struct sample *sample; + u64 energy; intel_pstate_sample(cpu); + + sample = &cpu->samples[cpu->sample_ptr]; + rdmsrl(MSR_PKG_ENERGY_STATUS, energy); + intel_pstate_adjust_busy_pstate(cpu); + trace_pstate_sample(fp_toint(sample->core_pct_busy), + fp_toint(intel_pstate_get_scaled_busy(cpu)), + cpu->pstate.current_pstate, + sample->mperf, + sample->aperf, + energy/energy_divisor, + sample->freq); + if (cpu->pstate.current_pstate == cpu->pstate.min_pstate) { cpu->min_pstate_count++; if (!(cpu->min_pstate_count % 5)) { @@ -849,6 +866,7 @@ static int __init intel_pstate_init(void) int cpu, rc = 0; const struct x86_cpu_id *id; struct cpu_defaults *cpu_info; + u64 units; if (no_load) return -ENODEV; @@ -882,8 +900,12 @@ static int __init intel_pstate_init(void) if (rc) goto out; + rdmsrl(MSR_RAPL_POWER_UNIT, units); + energy_divisor = 1 << ((units >> 8) & 0x1f); /* bits{12:8} */ + intel_pstate_debug_expose_params(); intel_pstate_sysfs_expose_params(); + return rc; out: get_online_cpus(); diff --git a/include/trace/events/power.h b/include/trace/events/power.h index cda100d..9e9475c 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h @@ -35,6 +35,59 @@ DEFINE_EVENT(cpu, cpu_idle, TP_ARGS(state, cpu_id) ); +TRACE_EVENT(pstate_sample, + + TP_PROTO(u32 core_busy, + u32 scaled_busy, + u32 state, + u64 mperf, + u64 aperf, + u32 energy, + u32 freq + ), + + TP_ARGS(core_busy, + scaled_busy, + state, + mperf, + aperf, + energy, + freq + ), + + TP_STRUCT__entry( + __field(u32, core_busy) + __field(u32, scaled_busy) + __field(u32, state) + __field(u64, mperf) + __field(u64, aperf) + __field(u32, energy) + __field(u32, freq) + + ), + -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html