From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752650AbdFTVnV (ORCPT ); Tue, 20 Jun 2017 17:43:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60772 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752338AbdFTVnU (ORCPT ); Tue, 20 Jun 2017 17:43:20 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 83D894ACC9 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jolsa@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 83D894ACC9 Date: Tue, 20 Jun 2017 23:43:12 +0200 From: Jiri Olsa To: kan.liang@intel.com Cc: acme@kernel.org, tglx@linutronix.de, mingo@redhat.com, linux-kernel@vger.kernel.org, peterz@infradead.org, eranian@google.com, jolsa@kernel.org, elliott@hpe.com, ak@linux.intel.com Subject: Re: [PATCH V2 0/2] measure SMI cost (user) Message-ID: <20170620214050.GA5880@krava> References: <1495825538-5230-1-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1495825538-5230-1-git-send-email-kan.liang@intel.com> User-Agent: Mutt/1.8.0 (2017-02-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 20 Jun 2017 21:43:19 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 26, 2017 at 12:05:36PM -0700, kan.liang@intel.com wrote: > From: Kan Liang > > Currently, there is no way to measure the time cost in System management > mode (SMM) by perf. > > Intel perfmon supports FREEZE_WHILE_SMM bit in IA32_DEBUGCTL. Once it sets, > the PMU core counters will freeze on SMI handler. But it will not have an > effect on free running counters. E.g. APERF counter. > The cost of SMI can be measured by (aperf - unhalted core cycles). > > A new sysfs entry /sys/device/cpu/freeze_on_smi is introduced to set > FREEZE_WHILE_SMM bit in IA32_DEBUGCTL. (kernel patch, which has been merged. > The commit ID is 6089327f5424f227bb6a8cf92363c2617e054453) > > A new --smi-cost mode in perf stat is implemented to measure the SMI cost > by calculating unhalted core cycles and aperf results. > > In practice, the percentages of SMI cycles is very useful for performance > oriented analysis. So the output will be SMI cycles% and SMI#. > For users who wants to get the actual value, they can apply --no-metric-only. > > Here is an example of default output. > > Performance counter stats for 'sudo echo ': > > SMI cycles% SMI# > 0.1% 1 > > 0.010858678 seconds time elapsed > > Changes since V1: > - Check path array before trying to open that path. (Robert) > - Refine change logs > > Kan Liang (2): > tools lib api fs: Add sysfs__write_int function > perf stat: Add support to measure SMI cost Acked-by: Jiri Olsa thanks, jirka