From patchwork Tue Sep 9 22:12:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Chaugule X-Patchwork-Id: 4873031 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 12CA8C033A for ; Tue, 9 Sep 2014 22:13:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4112D201BA for ; Tue, 9 Sep 2014 22:13:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B5BB201B9 for ; Tue, 9 Sep 2014 22:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752765AbaIIWMm (ORCPT ); Tue, 9 Sep 2014 18:12:42 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:45922 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752734AbaIIWMk (ORCPT ); Tue, 9 Sep 2014 18:12:40 -0400 Received: by mail-pa0-f41.google.com with SMTP id bj1so5003132pad.0 for ; Tue, 09 Sep 2014 15:12:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=d54tZwVpT7DVSr1bNKTetnOI2VODUnziby+bPcTfiYo=; b=mTAXB0XTUID0wFEA/PidWh6YmTgG21iaP6BqbK6VNkMe9VVDRJWOPKZhb11l4c1Tdy RQ8X/+VNjptj9n98IZa2lahjrJpOoIHU6AxKD7PIcyyoK/bI2jqgP3F/tAAivqN+XMyP qF0QHtYOJeBreCiA3F6im9h+WiBk+4dyDy21Ko6HpqbA0LzFvgguBRJ2wm6/nAPKkPXG tdQAXvy0mpuExaktvPC5BMI0MTn/x0vvd6q7Py/rtBUDHoCzLoRk5+48GE0Y8pr3LgsU 9oh6vH+0AWV1Y10y1cHFpQme5QMG3De8YZc8/uMfg9L1OP8dU4I6COzrLpJAfOapdzk8 +Yng== X-Gm-Message-State: ALoCoQlDYmofTvBoHFiSciE1ulxxhFuwVde9tuvXcAQhO2ZLCMkEqCHXcyDetjyBnNXgF69hjDS4 X-Received: by 10.66.231.200 with SMTP id ti8mr38199191pac.27.1410300759512; Tue, 09 Sep 2014 15:12:39 -0700 (PDT) Received: from esagroth.qualcomm.com (rrcs-67-52-130-30.west.biz.rr.com. [67.52.130.30]) by mx.google.com with ESMTPSA id gr5sm12524216pbc.33.2014.09.09.15.12.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Sep 2014 15:12:38 -0700 (PDT) From: Ashwin Chaugule To: dirk.j.brandewie@intel.com Cc: rjw@rjwysocki.net, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Ashwin Chaugule Subject: [PATCH 5/6] PID: Rename counters to make them more generic Date: Tue, 9 Sep 2014 18:12:07 -0400 Message-Id: <1410300728-26637-6-git-send-email-ashwin.chaugule@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1410300728-26637-1-git-send-email-ashwin.chaugule@linaro.org> References: <1410300728-26637-1-git-send-email-ashwin.chaugule@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Aperf/Mperf are very X86 specific names but effectively count Delivered and Reference Cpu performance values. Signed-off-by: Ashwin Chaugule --- drivers/cpufreq/intel_pid_ctrl.c | 12 ++++++------ drivers/cpufreq/pid_ctrl.c | 10 +++++----- drivers/cpufreq/pid_ctrl.h | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/cpufreq/intel_pid_ctrl.c b/drivers/cpufreq/intel_pid_ctrl.c index 73faaf8..e0b007d 100644 --- a/drivers/cpufreq/intel_pid_ctrl.c +++ b/drivers/cpufreq/intel_pid_ctrl.c @@ -193,14 +193,14 @@ static void intel_get_sample(struct cpudata *cpu) aperf = aperf >> FRAC_BITS; mperf = mperf >> FRAC_BITS; - cpu->sample.aperf = aperf; - cpu->sample.mperf = mperf; + cpu->sample.delivered = aperf; + cpu->sample.reference = mperf; - cpu->sample.aperf -= cpu->prev_aperf; - cpu->sample.mperf -= cpu->prev_mperf; + cpu->sample.delivered -= cpu->prev_delivered; + cpu->sample.reference -= cpu->prev_reference; - cpu->prev_aperf = aperf; - cpu->prev_mperf = mperf; + cpu->prev_delivered = aperf; + cpu->prev_reference = mperf; } static struct cpu_defaults core_params = { diff --git a/drivers/cpufreq/pid_ctrl.c b/drivers/cpufreq/pid_ctrl.c index a011f05..2c197b2 100644 --- a/drivers/cpufreq/pid_ctrl.c +++ b/drivers/cpufreq/pid_ctrl.c @@ -321,10 +321,10 @@ static inline void pid_ctrl_calc_busy(struct cpudata *cpu) int64_t core_pct; int32_t rem; - core_pct = int_tofp(sample->aperf) * int_tofp(100); - core_pct = div_u64_rem(core_pct, int_tofp(sample->mperf), &rem); + core_pct = int_tofp(sample->delivered) * int_tofp(100); + core_pct = div_u64_rem(core_pct, int_tofp(sample->reference), &rem); - if ((rem << 1) >= int_tofp(sample->mperf)) + if ((rem << 1) >= int_tofp(sample->reference)) core_pct += 1; sample->freq = fp_toint( @@ -410,8 +410,8 @@ static void pid_ctrl_timer_func(unsigned long __data) trace_pstate_sample(fp_toint(sample->core_pct_busy), fp_toint(pid_ctrl_get_scaled_busy(cpu)), cpu->pstate.current_pstate, - sample->mperf, - sample->aperf, + sample->reference, + sample->delivered, sample->freq); pid_ctrl_set_sample_time(cpu); diff --git a/drivers/cpufreq/pid_ctrl.h b/drivers/cpufreq/pid_ctrl.h index 7f732e6..65f08bc 100644 --- a/drivers/cpufreq/pid_ctrl.h +++ b/drivers/cpufreq/pid_ctrl.h @@ -24,8 +24,8 @@ struct sample { int32_t core_pct_busy; - u64 aperf; - u64 mperf; + u64 delivered; + u64 reference; int freq; ktime_t time; }; @@ -65,8 +65,8 @@ struct cpudata { struct _pid pid; ktime_t last_sample_time; - u64 prev_aperf; - u64 prev_mperf; + u64 prev_delivered; + u64 prev_reference; struct sample sample; };