From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754610AbcFPVK6 (ORCPT ); Thu, 16 Jun 2016 17:10:58 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:33754 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754613AbcFPVK5 (ORCPT ); Thu, 16 Jun 2016 17:10:57 -0400 From: Vince Weaver X-Google-Original-From: Vince Weaver Date: Thu, 16 Jun 2016 17:10:54 -0400 (EDT) X-X-Sender: vince@macbook-air To: Huang Rui cc: Vince Weaver , Borislav Petkov , Thomas Gleixner , Peter Zijlstra , Ingo Molnar , Andy Lutomirski , Robert Richter , Jacob Shin , Arnaldo Carvalho de Melo , Kan Liang , linux-kernel@vger.kernel.org, x86@kernel.org, Suravee Suthikulpanit , Aravind Gopalakrishnan , Borislav Petkov , Guenter Roeck , Fengguang Wu Subject: Re: [REDO PATCH v7] perf/x86/amd/power: Add AMD accumulated power reporting mechanism In-Reply-To: <20160616055933.GA8522@hr-amur2> Message-ID: References: <1457502306-2559-1-git-send-email-ray.huang@amd.com> <20160616053802.GA7810@hr-amur2> <20160616055933.GA8522@hr-amur2> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 16 Jun 2016, Huang Rui wrote: > On Thu, Jun 16, 2016 at 01:38:13PM +0800, Huang Rui wrote: > > After considering carefully, the original method should be OK. > > AMD nomenclature for CMT systems: > > [node 0] -> [Compute Unit 0] -> [Compute Unit Core 0] -> Linux CPU 0 > -> [Compute Unit Core 1] -> Linux CPU 1 > -> [Compute Unit 1] -> [Compute Unit Core 0] -> Linux CPU 2 > -> [Compute Unit Core 1] -> Linux CPU 3 > > The deltaN is power per compute unit. Current one package has two CUs. > In the *same* interval, CU0's power is 10W, CU1's power is 15W. The > package (CU0 + CU1) power should be 15W, right? Because the interval > is the same. > > Q = Q1 + Q2. P = Q/t = (Q1 + Q2)/t = Q1/t + Q2/t = P1 + P2. > > Is that clear? OK, I was misunderstanding. I somehow thought there was a periodic timer that was adding accumulating power over time. But no, the driver just assumes the PTSC does not overflow? And that addition is just there to handle adding all the cores together? If so, then I agree that the addition makes sense, sorry for confusing things. Although I think it would be better if we reported Joules (like RAPL does) rather than average power, but too late to change that now. Also, on my machine I get results that make no physical sense, such as: sudo perf stat -a -e power/power-pkg/ /usr/games/primes 1 500000000 > /dev/null Performance counter stats for 'system wide': 4,472,401.06 mWatts power/power-pkg/ 6.956135769 seconds time elapsed I somehow don't think the CPU is really burning 4kW of Power. Vince