From patchwork Tue Aug 8 21:05:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Smythies X-Patchwork-Id: 9889109 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8739E60352 for ; Tue, 8 Aug 2017 21:06:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 743A0289F2 for ; Tue, 8 Aug 2017 21:06:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6822E28A2E; Tue, 8 Aug 2017 21:06:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8F19289F2 for ; Tue, 8 Aug 2017 21:06:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752293AbdHHVFg (ORCPT ); Tue, 8 Aug 2017 17:05:36 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:37190 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752280AbdHHVFf (ORCPT ); Tue, 8 Aug 2017 17:05:35 -0400 Received: by mail-pg0-f67.google.com with SMTP id 83so4076012pgb.4; Tue, 08 Aug 2017 14:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ghLIUAWVo1Sb42Z5CEhJnsAXDoyhqRoS2+py2t7En8I=; b=NE6v+GybGXHK6HalIDBdeUnkXG12a9XlTmadPerkhDaNV7bPU+L7MztiBYqSgaNueU +kw9PXhbEF9v28f27+duXhEYQsiIVGc3eR4myhgxjlaEs61yuL3oPovObHb/KrJmUQly 4g5OLtJGPxxmqNvvLl2B4NuH5E+VvLKetcLdaZLNJsu0SN+NFT5/WQeFjBb9FXxoiiKp xagY/cImI9ymC0QUUjRc0mhLWRL0GBlfnG0Qt91rdZCm7bLCjMB1qQkuTV2trm7gHRfc lb5B5zKdt4hjRJqAjLonBzMCzZ0JdMVqt4WK8N/OUkin4D66yd2hAscC5T9kt7qeOEhR BTdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ghLIUAWVo1Sb42Z5CEhJnsAXDoyhqRoS2+py2t7En8I=; b=tJH35L4VcVzfMvsNL0Fe9fdf/OdWdB8ciOtIoLlEtfatHdDS3L7obCQgjLc93Jki0E 6uXsEW8wYbmldUEji9vU/rjQF9EHOT6ZQjLAfFGEGhM+xAL0fMpNKEVcWg18IBao9dBt qNvobrv0f19A/0Ac4nc4k0Szt8GUl79gGGTFKwcil3dYTm6Uy7RKTR8XqngSnlhgzG03 Cmpz550e7/uCAKCDqQBwUwALO5ibIARcppKywTQ2WkyI4+VmoEiCe2AZKVB99VO0Edf3 8awm4eU4YBxn1nQPmcKri8D6r7fcZdHYhtmwZDEB8lJIrloP8Jb5JRjTB4O/7wtG2LAc 8cOQ== X-Gm-Message-State: AHYfb5iV/aRnhkQ7EtAVthJzVfmjWl8KKAveGrLNaYA9lJP6RcJ/o+j9 4iAqojLcg6rSMA== X-Received: by 10.99.121.1 with SMTP id u1mr5328074pgc.217.1502226335060; Tue, 08 Aug 2017 14:05:35 -0700 (PDT) Received: from s15.smythies.com (mail.smythies.com. [173.180.45.4]) by smtp.gmail.com with ESMTPSA id o21sm4178811pfi.25.2017.08.08.14.05.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Aug 2017 14:05:34 -0700 (PDT) From: Doug Smythies X-Google-Original-From: Doug Smythies To: srinivas.pandruvada@linux.intel.com, rafael@kernel.org, len.brown@intel.com Cc: dsmythies@telus.net, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH] cpufreq: intel_pstate: report correct CPU frequencies during trace. Date: Tue, 8 Aug 2017 14:05:12 -0700 Message-Id: <1502226312-5451-1-git-send-email-dsmythies@telus.net> X-Mailer: git-send-email 2.7.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The intel_pstate cpu frequency scaling driver has always calculated CPU frequency incorrectly. Recent changes have eliminted most of the issues, however the frequency reported in the trace buffer, if used, is incorrect. It remains desireable that cpu->pstate.scaling still be a nice round number for things such as when setting max and min frequencies. So the proposal is to just fix the reported frequency in the trace data. Fixes what remains of: https://bugzilla.kernel.org/show_bug.cgi?id=96521 Signed-off-by: Doug Smythies --- drivers/cpufreq/intel_pstate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 0566455..65ee4fc 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -1613,8 +1613,7 @@ static inline bool intel_pstate_sample(struct cpudata *cpu, u64 time) static inline int32_t get_avg_frequency(struct cpudata *cpu) { - return mul_ext_fp(cpu->sample.core_avg_perf, - cpu->pstate.max_pstate_physical * cpu->pstate.scaling); + return mul_ext_fp(cpu->sample.core_avg_perf, cpu_khz); } static inline int32_t get_avg_pstate(struct cpudata *cpu)