From patchwork Fri Jul 18 15:37:28 2014 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: 4586371 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 E6DCBC0515 for ; Fri, 18 Jul 2014 15:38:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C752B201C8 for ; Fri, 18 Jul 2014 15:38:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1AD920179 for ; Fri, 18 Jul 2014 15:38:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422813AbaGRPiA (ORCPT ); Fri, 18 Jul 2014 11:38:00 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:48323 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422773AbaGRPh6 (ORCPT ); Fri, 18 Jul 2014 11:37:58 -0400 Received: by mail-pa0-f44.google.com with SMTP id eu11so5687399pac.3 for ; Fri, 18 Jul 2014 08:37:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=G3kZU1O07WirjeXrVuTU1vyRXZJrNCcJUWBBEEsokXI=; b=M4mCKYwjV8b7JrqoHG0D3w1Jc9kHK+87Z00ALBUkodm258ZcdHIKZIEsyLtxys8KvW EaVo/5WdWmXzgzb2GDsLuHUjqBGQXtuyOKOeDb2pKFJs1JDch60xiHlzPNXSQV6C8AQ9 pUTnoMb+bAuKJc9W+zTBxDfYG/UslJeUzU9ZkhVuu7vXlkPeQ9uXkyVspzbCS+SyWjBT 83Kj81nHKAq+di5qUMOdKftge0Ukpq9VztI060KvyMNthBco3GaXxal6P+i4R6IsouPV fbTcdVDNa0obYtbcK5er0p23VfeZPEUEwl9xD5fuMhT5u7S9fhwunwsl+12ilrKZqzVo mEMw== X-Received: by 10.68.220.70 with SMTP id pu6mr6131860pbc.15.1405697877635; Fri, 18 Jul 2014 08:37:57 -0700 (PDT) Received: from echolake.localdomain (static-50-43-41-81.bvtn.or.frontiernet.net. [50.43.41.81]) by mx.google.com with ESMTPSA id be7sm7894439pdb.37.2014.07.18.08.37.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jul 2014 08:37:56 -0700 (PDT) From: dirk.brandewie@gmail.com X-Google-Original-From: dirk.j.brandewie@intel.com To: linux-pm@vger.kernel.org Cc: rjw@rjwysocki.net, Stratos Karafotis , Dirk Brandewie Subject: [PATCH 11/11] cpufreq: intel_pstate: Keep values in aperf/mperf in full precision Date: Fri, 18 Jul 2014 08:37:28 -0700 Message-Id: <1405697848-13546-13-git-send-email-dirk.j.brandewie@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1405697848-13546-1-git-send-email-dirk.j.brandewie@intel.com> References: <1405697848-13546-1-git-send-email-dirk.j.brandewie@intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 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 From: Stratos Karafotis Currently we shift right aperf and mperf variables by FRAC_BITS to prevent overflow when we convert them to fix point numbers (shift left by FRAC_BITS). But this is not necessary, because we actually use delta aperf and mperf which are much less than APERF and MPERF values. So, use the unmodified APERF and MPERF values in calculation. This also adds 8 bits in precision, although the gain is insignificant. Signed-off-by: Stratos Karafotis Signed-off-by: Dirk Brandewie --- drivers/cpufreq/intel_pstate.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index dc6e6bf..c5eac94 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -565,9 +565,6 @@ static inline void intel_pstate_sample(struct cpudata *cpu) rdmsrl(MSR_IA32_MPERF, mperf); local_irq_restore(flags); - aperf = aperf >> FRAC_BITS; - mperf = mperf >> FRAC_BITS; - cpu->last_sample_time = cpu->sample.time; cpu->sample.time = ktime_get(); cpu->sample.aperf = aperf;