From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.6 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8200DC433E3 for ; Wed, 29 Jul 2020 23:24:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6019C2074B for ; Wed, 29 Jul 2020 23:24:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="wGuLColH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728028AbgG2XYn (ORCPT ); Wed, 29 Jul 2020 19:24:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727083AbgG2XYm (ORCPT ); Wed, 29 Jul 2020 19:24:42 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 510F6C0619D4 for ; Wed, 29 Jul 2020 16:24:42 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id f18so3126296wmc.0 for ; Wed, 29 Jul 2020 16:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6Vid/bDwyKAx4BwcecnBtz+573/IH5tF8O95k6nel7Q=; b=wGuLColHUeEnR/+pnRTEHr+CehDViADj2T/7m0JQzD4OJ25qpDd0Frb0QO7pXd+4MU oR8iEDFQravsltjXVqqQgfGLvIkBjls1WV1pB9dSo0qloTLnQ7M9lhTTF905On1xmQcw Z4khFbpFIW+8sEpWGmbWDSYlxTtlEGBHqQL4SvKVGjt8bQWmDVT6vRHpulidLrsrChMg 3ON13gdAKqV96e3I7vUrspej3hskaAOvJYiCqEzBik+XeWWcge5IqPz2OBWzl9drgseE RNXiYCZRrSu9tVGJNJgnqSTVe7CBzvV/Tqgxd0DfeQw/mWAj7r6++2taGt2rBI8TOgbj e+2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6Vid/bDwyKAx4BwcecnBtz+573/IH5tF8O95k6nel7Q=; b=KqoBlbfZdV8Q7M+DiLDN+FS2DNhXIAslTqNubP6+51gMfruDD50mtYBH/fFzWqUWSW 4QfvGpZdPQBBdYGyPO+TPWHrZP5BaefJNKe2zdXCU4Bvbra88kontI6J3kOWb5mxF2ZD 6Uk179YWktBSQJuVT2nwfmJflhPmy72dtn5bN29e8NGYRFjsEZqQ/TFivKdQMjnTt3y+ n2DfQ9yVxHd7smcWxAYDOjNvOloA1DY3zRul9UEPgTxOlsJwjYZqSZyl7VnsUaxU15DS Ya3yqxqJm2ov9mqixRWq632Oa8/SPVMpm/5kA4lBdyemfqzyq0lxthLaq2D+x8C1p3qg Wltw== X-Gm-Message-State: AOAM531QWrb8R+W48cVzhJ4E84gM35NnDq9hCpXZu57DimWnjVo6YyA/ IhdlfUOuyFPJdo1iEIIlsDh1365GB6N2hJTE652uyA== X-Google-Smtp-Source: ABdhPJyOuua7jlIFxpN/h+EHbIiE+S3oPLKPPuDHHT6GbYoawNV8FbDgzCDPHGbBm+BMUS9rJoIcmqcspMYdpR7fDGU= X-Received: by 2002:a1c:a9ce:: with SMTP id s197mr10474653wme.58.1596065080650; Wed, 29 Jul 2020 16:24:40 -0700 (PDT) MIME-Version: 1.0 References: <20200728085734.609930-1-irogers@google.com> <20200728085734.609930-3-irogers@google.com> <20200728155940.GC1319041@krava> <20200728160954.GD1319041@krava> In-Reply-To: <20200728160954.GD1319041@krava> From: Ian Rogers Date: Wed, 29 Jul 2020 16:24:28 -0700 Message-ID: Subject: Re: [PATCH v2 2/5] perf record: Prevent override of attr->sample_period for libpfm4 events To: Jiri Olsa Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , Adrian Hunter , Andi Kleen , Athira Rajeev , LKML , Networking , bpf , Stephane Eranian Content-Type: text/plain; charset="UTF-8" Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Tue, Jul 28, 2020 at 9:10 AM Jiri Olsa wrote: > > On Tue, Jul 28, 2020 at 05:59:46PM +0200, Jiri Olsa wrote: > > On Tue, Jul 28, 2020 at 01:57:31AM -0700, Ian Rogers wrote: > > > From: Stephane Eranian > > > > > > Before: > > > $ perf record -c 10000 --pfm-events=cycles:period=77777 > > > > > > Would yield a cycles event with period=10000, instead of 77777. > > > > > > This was due to an ordering issue between libpfm4 parsing > > > the event string and perf record initializing the event. > > > > > > This patch fixes the problem by preventing override for > > > events with attr->sample_period != 0 by the time > > > perf_evsel__config() is invoked. This seems to have been the > > > intent of the author. > > > > > > Signed-off-by: Stephane Eranian > > > Reviewed-by: Ian Rogers > > > --- > > > tools/perf/util/evsel.c | 3 +-- > > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > > > index 811f538f7d77..8afc24e2ec52 100644 > > > --- a/tools/perf/util/evsel.c > > > +++ b/tools/perf/util/evsel.c > > > @@ -976,8 +976,7 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts, > > > * We default some events to have a default interval. But keep > > > * it a weak assumption overridable by the user. > > > */ > > > - if (!attr->sample_period || (opts->user_freq != UINT_MAX || > > > - opts->user_interval != ULLONG_MAX)) { > > > + if (!attr->sample_period) { > > > > I was wondering why this wouldn't break record/top > > but we take care of the via record_opts__config > > > > as long as 'perf test attr' works it looks ok to me > > hum ;-) > > [jolsa@krava perf]$ sudo ./perf test 17 -v > 17: Setup struct perf_event_attr : > ... > running './tests/attr/test-record-C0' > expected sample_period=4000, got 3000 > FAILED './tests/attr/test-record-C0' - match failure I'm not able to reproduce this. Do you have a build configuration or something else to look at? The test doesn't seem obviously connected with this patch. Thanks, Ian > jirka > > > > > Acked-by: Jiri Olsa > > > > thanks, > > jirka >