Received: by 10.223.176.5 with SMTP id f5csp1078132wra; Fri, 2 Feb 2018 10:47:45 -0800 (PST) X-Google-Smtp-Source: AH8x227aLJjIE6rJg2LPKCeXpyGiFk+ODXed9zoriN2nXbR1zliWgVD4Y6MxVzbXSgrHiIDphewG X-Received: by 10.99.182.68 with SMTP id v4mr31335197pgt.389.1517597265246; Fri, 02 Feb 2018 10:47:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517597265; cv=none; d=google.com; s=arc-20160816; b=sTbAcCx0t/HWK/m3HAnj6888FIz7/p5DUGc09nIPSHgTO+vRlD4QRJPBRqvtdFX8O1 tDSYLo6DtqUc2v5UVFrjfk1oFQD59sCEcrXJml84FgimwbhDbLyaEhCT815sYZOGLBXP 2PdNMgEooypMvdEn6M8a9kmPdbyU4CADoU07pv4F42FKxBdlKnxIoBCnOTqr0twbrXY+ P9UIm6AM85sZJZftUkm7B7UI7Kyujhg3rHyYIN0LBzZlMat8anHjsNB26gSS/30YMULY KiiPA3mMl5PnaO6hk0GI7VqXZjtY6j148XbtjtNHD1whEHnP9R5+CS8IxsoPJa36sBwn sCdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=wVZXHLMG1H2/QtmzA6LmSDVJL9jpI1MmafurRF1+5wI=; b=eBOLlpn7siZ+c3Yn6DeAU/bRJrndc59RQQkVuLRUts6Ep3p3VzpMIWV9eYk03FJtQN NqjaU1lAiFkZTEY6iNBsbjls1dIfGAjqBxvMnYqiN9H8c01Hg8t/e7LAKzGsEOwVw9Ye 06zJBVBG0S82lyEkNAgz3anKI186pNW/A05HDHclktOKN9NqXaP95aaqtldcWozJ3aua qJEH55+knUcaxQEcf1MbRRnyoVNMM/EdblEQlQ5XFsp1V+CBXf92mw7sUl30gm8Zknx8 KPq60O10bmSR5s+E/EGs+feGnUKAbYoxLH0ghhqgAvtx9sHAkeR+mnvy5hQIEU/+4WlF 0iCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=goFgMTBC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62-v6si2245106pla.713.2018.02.02.10.47.30; Fri, 02 Feb 2018 10:47:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=goFgMTBC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753116AbeBBSpz (ORCPT + 99 others); Fri, 2 Feb 2018 13:45:55 -0500 Received: from mail-it0-f68.google.com ([209.85.214.68]:54247 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751907AbeBBSpu (ORCPT ); Fri, 2 Feb 2018 13:45:50 -0500 Received: by mail-it0-f68.google.com with SMTP id i144so2754427ita.3 for ; Fri, 02 Feb 2018 10:45:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=wVZXHLMG1H2/QtmzA6LmSDVJL9jpI1MmafurRF1+5wI=; b=goFgMTBCvFEKlf3213HXoXoQ6LxeVyXuBVWgPZC6g5Qaw13L5tdDhJlL7L1XLPFuP5 qRyozjlKT7lGJCh70DIQiwhW2C+1p3uHj0s9nRQ2j5gbTGj4CijCQJiFL7e5nbGMxySJ WH/sB9L1A1x6iHT44zR0Kndp/sQ4xGzGbUFdDaj0W+NjBJnSu8swgkkn68Mm1k/uBrqn wTDNxkqOoJmMRKew4iyfo5P+gvskyTgVbBGh26MjkQ42N+Uy+kTE9Pwzlh5PgBocomnL cb/gFR2d1HLzXgqv9WsBsABEXdIYwACc/i/nWtRuiLs2OdQT8vPswmX461miRpq5QMi2 ajpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=wVZXHLMG1H2/QtmzA6LmSDVJL9jpI1MmafurRF1+5wI=; b=f2ZssePFbvkk+0xrrY4RfxvsgnNULD87+J1xFWRRqqOPHtWNIukTW1DbFhx0C54I0m bgxnbkzD9mMzBvZqrZwRhCvs9nYzCk7piaD55tJ2BvAKieGIOP/55RqSWhsx7GLl1PuO NWlVbfVJupI8qHJbBOIJa9FPRXKT7NPtJrPkDhKoUvNPsm/YI8K2/2we0P6oFCDHoD6P VJYbc/hWzqUTv+pTxKTLGmVaGPzKrrGVQRSwY99JXPdS+YxxzraVZfJosJOY3DhC4JkL 0xY3jIUplBQEbGdZoO3t87xpm5wii7EAUTmH+hPw8fHVcVyvzS1ZwpG2CYdZeHb3mo4T XpYw== X-Gm-Message-State: AKwxytc3S82aPS3alGtfOYLWgEw7F7O4hV1CDLXWL2c9g8Y8XpMYFZ+j BB4/3is46uE7vml/eVjsHo8C1c8kU6bp+nr3J6nDLA== X-Received: by 10.36.192.10 with SMTP id u10mr46740515itf.73.1517597149255; Fri, 02 Feb 2018 10:45:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.164.160 with HTTP; Fri, 2 Feb 2018 10:45:46 -0800 (PST) In-Reply-To: <20180201083812.11359-2-jolsa@kernel.org> References: <20180201083812.11359-1-jolsa@kernel.org> <20180201083812.11359-2-jolsa@kernel.org> From: Stephane Eranian Date: Fri, 2 Feb 2018 10:45:46 -0800 Message-ID: Subject: Re: [PATCH 1/3] perf tools: Fix period/freq terms setup To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , David Ahern , Andi Kleen , Alexander Shishkin , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jiri, On Thu, Feb 1, 2018 at 12:38 AM, Jiri Olsa wrote: > Stephane reported that we don't set properly PERIOD > sample type for events with period term defined. > > Before: > $ perf record -e cpu/cpu-cycles,period=1000/u ls > $ perf evlist -v > cpu/cpu-cycles,period=1000/u: ... sample_type: IP|TID|TIME|PERIOD, ... > > After: > $ perf record -e cpu/cpu-cycles,period=1000/u ls > $ perf evlist -v > cpu/cpu-cycles,period=1000/u: ... sample_type: IP|TID|TIME, ... > > Setting PERIOD sample type based on period term setup. > there is still one problem remaining here. It has to do with the handling of cycles:pp or :p or :ppp. Suppose I want to set a period for it while I am also sampling on other events: Something like: $ perf record -e cycles:pp,instructions,cpu/event=0xd0,umaks=0x81,period=100000/ ..... I want to set the period for cycles:pp, but not for instructions. I cannot use -c because it would also force a period on instructions. I could use the raw hw raw event code for cycles:pp. But that does not work because recent kernels prevent use of hw filters on events programmed for PEBS, e.g., cpu/event=0xc2,umask=0x1,cmask=16,inv/pp is rejected. PEBS does not support filters. It works in the case of cycles:pp simply by the nature on the underlying event and the stalls. To get precise cycles, the only event syntax you can use is cycles:pp, but then you cannot specify an event-specific period. This needs to be fixed as well. I'd like to be able to say: $ perf record -e cycles:pp:period=10000001,cpu/event=0xd0,umaks=0x81,period=100000/ Or something equivalent. Otherwise, I tested what you have written so far and it works. Thanks. > Reported-by: Stephane Eranian > Link: http://lkml.kernel.org/n/tip-anrtntkwfto5rqulegfwitn5@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/perf/util/evsel.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > index 66fa45198a11..f2f2eaafde6d 100644 > --- a/tools/perf/util/evsel.c > +++ b/tools/perf/util/evsel.c > @@ -745,12 +745,14 @@ static void apply_config_terms(struct perf_evsel *evsel, > if (!(term->weak && opts->user_interval != ULLONG_MAX)) { > attr->sample_period = term->val.period; > attr->freq = 0; > + perf_evsel__reset_sample_bit(evsel, PERIOD); > } > break; > case PERF_EVSEL__CONFIG_TERM_FREQ: > if (!(term->weak && opts->user_freq != UINT_MAX)) { > attr->sample_freq = term->val.freq; > attr->freq = 1; > + perf_evsel__set_sample_bit(evsel, PERIOD); > } > break; > case PERF_EVSEL__CONFIG_TERM_TIME: > -- > 2.13.6 >