Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp869067ybz; Wed, 15 Apr 2020 21:14:11 -0700 (PDT) X-Google-Smtp-Source: APiQypK8Fa6SOMdY0LxYZg7bSmDUSxT9cYQW1faCNDypIGIrFQY71oh0i9o+8/x9anwjEEqeMWPm X-Received: by 2002:a17:906:3291:: with SMTP id 17mr7713541ejw.343.1587010451088; Wed, 15 Apr 2020 21:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587010451; cv=none; d=google.com; s=arc-20160816; b=bfWmakYOdpa0oTvtRjP/bKyqjNpsuruaC5xjNAnRBHrhV1q/yHLhUpwai9a5/st52F 7iyGCr/J5yRtspIq3j6u2hYtuleZRDm6Q2hMeCRmxH8Q07hIp8LAV60DO4H4h8Yw/JHs S1BRGx4SwA4edaTgG3vPuLOrSskfjDZkVdF1faNptPW2y9196EUm101Fpv8ppNeooWbB wZ21vC73Y4yzSPjA/W3ZI6TunZ0FzxdjTsu5ohJy3yrxwgfgP6V35xrkDCbdUDaMS5Fe InBomVqOQpaxQkehXkQOifej/nF7wrdfr6B33G66vpEpnzrqmn9jvcKxSeRoQ9cxc6io Gj5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:content-language :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from:dkim-signature; bh=Zn1xtELv6JCY8tNYhmpOgWYNjoqTG3j5w3+geDPacPc=; b=s5L531QOg1Zb6wZ3vlSlDlPpUPSO2hlBkc2aBLLNhYGtMIQcPglV8KvS72CRQbm+ha l1BbgVaPJZ0Ha2BvoS3kbWTNYM0WcnX1YSBGW+dweS6fETkmHunxDbDmES4fJlFQ92pt 7GJde21Q2wk70FKwMlUImtGh5Su5JCjykanHH3u5EcypJEjOLNjc2iUrbx8dlkOhay0t hdvhcVL7akkU/DeiAU7akPIi63tSeMXU7jz3kipMwAS9J+5Smp+IQtzLUOlbix+1p5Kk StjRr0HORl59sp028sdjDTC0htFsk7pG1fwwOKUE8olVMFE6dqM3I6PY4cajUZiY/s9Y X89g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@telus.net header.s=neo header.b=gEkXV0oH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=telus.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si8046165edr.480.2020.04.15.21.13.47; Wed, 15 Apr 2020 21:14:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@telus.net header.s=neo header.b=gEkXV0oH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=telus.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391783AbgDPEMA (ORCPT + 99 others); Thu, 16 Apr 2020 00:12:00 -0400 Received: from cmta19.telus.net ([209.171.16.92]:55853 "EHLO cmta19.telus.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389455AbgDPEL5 (ORCPT ); Thu, 16 Apr 2020 00:11:57 -0400 X-Greylist: delayed 494 seconds by postgrey-1.27 at vger.kernel.org; Thu, 16 Apr 2020 00:11:56 EDT Received: from dougxps ([173.180.45.4]) by cmsmtp with SMTP id OvkUjbfUfFblkOvkWj2yjM; Wed, 15 Apr 2020 22:03:37 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telus.net; s=neo; t=1587009817; bh=Zn1xtELv6JCY8tNYhmpOgWYNjoqTG3j5w3+geDPacPc=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=gEkXV0oHPIHN9wUtxHnAZFKw5C+A4TiIMnFMCv0gmuy3crm+tB9x5JhCCnNuaGjYO 635oFhrfzyr90AMDrpsOWBFPSr7V1LVbclQFNRZN+LB0DOQY+ld22MQ+s9UYPzwgdi ehP4B68C3nveG8AbojtKRmJb1dKocmRvHHda8pCUxPitw+3GdKLCALI3ovKeX9NrEQ xOukJhylGcjjwepwzrlFoFRogWakDAQnhnuAorlmpRceSrUB8A9cVXnAfEXDbjkEUl lxPXEnzOqGzLLMqPxWNC/dETuM/vDhxgolwqTDm3fyFPE6NEHMhXk5BoALci2QCkAk UwRBd6mDBeRJQ== X-Telus-Authed: none X-Authority-Analysis: v=2.3 cv=BNTNU2YG c=1 sm=1 tr=0 a=zJWegnE7BH9C0Gl4FFgQyA==:117 a=zJWegnE7BH9C0Gl4FFgQyA==:17 a=Pyq9K9CWowscuQLKlpiwfMBGOR0=:19 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=80HlKv23USs_H_yaKB0A:9 a=CjuIK1q_8ugA:10 From: "Doug Smythies" To: "'Chen Yu'" Cc: "'Len Brown'" , "'Rafael J. Wysocki'" , , References: In-Reply-To: Subject: RE: [PATCH 2/3][v2] tools/power turbostat: Introduce functions to accumulate RAPL consumption Date: Wed, 15 Apr 2020 21:03:34 -0700 Message-ID: <001901d613a4$010e0a70$032a1f50$@net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Content-Language: en-ca Thread-Index: AdYSXDnMXkJ5RB5zStyDB6tksB289gBRJlyA X-CMAE-Envelope: MS4wfBOnqG2ci47ZFLMGWqetE1328PnfGu28WGOKFsABayPB9upiYSGVZXppBbxXWifzyY+GYDvLMBtjnkN8OX/QvkqW+klj583SvoDZNlFanQxvpH6o9pU6 0vtzr/HnF2Mc/L5+m1g/8PjJWTsYCxu/+YDOqVXJGCpDdm751DS5xLnVQDcJ3UXtCtAWXcXWEFcfjFQYACxEvT9czTHQcili5C6oU3iJVd4H9ojJLwiqHV+6 LNm+PLEpByx0jDjcOMzt5Tc9/8pWqnaS4WEzdT0hx9I4XQRM0jTTNPVvdnEpIhT/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020.04.15 05:57 Chen Yu wrote: ... > v2: According to Len's suggestion: > 1. Enable the accumulated RAPL mechanism by default. I am not a fan of this, but O.K. > 2. Re-use the rapl_joule_counter_range to represent the > the timeout of periodical timer. No, please no. It is too easy to still have an overflow. ... > + /* > + * A wraparound time is calculated early. > + */ > + its.it_interval.tv_sec = rapl_joule_counter_range; Would this be o.K.? + its.it_interval.tv_sec = rapl_joule_counter_range / 2; > + its.it_interval.tv_nsec = 0; The way it was sent, this patch set does not work. It still overflows. Example, sample time calculated to ensure overflow: Busy% Bzy_MHz IRQ PkgTmp PkgWatt GFXWatt 100.00 3500 3592125 80 9.72 0.12 100.00 3500 3587391 79 9.77 0.12 Actual package watts was around 65. However, if this additional patch is applied (I only fixed one of them): doug@s18:~/temp-k-git/linux/tools/power/x86/turbostat$ git diff diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 29fc4069f467..4d72d9be5209 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -1350,7 +1350,8 @@ delta_package(struct pkg_data *new, struct pkg_data *old) old->gfx_mhz = new->gfx_mhz; - DELTA_WRAP32(new->energy_pkg, old->energy_pkg); +/* DELTA_WRAP32(new->energy_pkg, old->energy_pkg); */ + old->energy_pkg = new->energy_pkg - old->energy_pkg; DELTA_WRAP32(new->energy_cores, old->energy_cores); DELTA_WRAP32(new->energy_gfx, old->energy_gfx); DELTA_WRAP32(new->energy_dram, old->energy_dram); Then it seems to work. Example: doug@s15:~/temp-turbostat$ sudo ./turbostat --Summary --show Busy%,Bzy_MHz,PkgTmp,PkgWatt,GFXWatt,IRQ --interval 1200 ... RAPL: 690 sec. Joule Counter Range, at 95 Watts ... Busy% Bzy_MHz IRQ PkgTmp PkgWatt GFXWatt 100.00 3500 3592328 80 64.32 0.12 100.00 3500 3595195 79 64.37 0.12 ... Doug