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=-18.1 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=ham 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 04555C433E2 for ; Fri, 4 Sep 2020 16:22:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B061C2067C for ; Fri, 4 Sep 2020 16:22:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pM4zSYED" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727115AbgIDQW1 (ORCPT ); Fri, 4 Sep 2020 12:22:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726196AbgIDQWZ (ORCPT ); Fri, 4 Sep 2020 12:22:25 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACB5BC061245 for ; Fri, 4 Sep 2020 09:22:23 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id c18so7294738wrm.9 for ; Fri, 04 Sep 2020 09:22:23 -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=iUBmsm1x2IjnP/vvaMS9kAvkCHrQJaf0jWdnYFgluME=; b=pM4zSYEDH8rIALEQFgas6IpcrK9Kwnfi0QTIA+JO1xCa+et9UJk/Y5Uja1ezkn37Hu E56ZnTwuPhX33oHp0FNw9Ku43IDcnxNe6YfpoGyk+5c2+FZKe4x9gUkn2ZEFCpv6fEwy 6r1bmx7G3efw7aVCikhg9ESQgCiEe6+PgKBCy5s2hVeBlVLUvpg2IMQ+eUpLpk2Q3da9 XcMZOTIC2SaQJP8HTUuJXiyu6gol5/gm+ZXZdS8Hz+E0Nh99XY6bY4BsvYwIii+S16OK 0IjjpP3RCLCn3VdHVSTNju8NoBPA3JNpUkfwz9po5oXprvtgF4qjPsScxIzhJxNiNTzK hv7Q== 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=iUBmsm1x2IjnP/vvaMS9kAvkCHrQJaf0jWdnYFgluME=; b=NxopWxEVWdqvYWyxk4dHDEZUCZgZ14B9U9O/YZ9RTQM/Gvb8O4uFHojjvTZEoW4HYN e+hNji63dxg3al1i2gnRQ1u6RDBInsb9qJ6Ks02feW3yNAp0tFBq8gqTmNRW/qZSdk1d CuWVGwp5le6RjmmswGlwjmw9ApKGLLOiqUEGKZBpTDmiHPPINPvFRaIZ0ZpD68WBnqzN JAKElIw4lsiHH4JMAIuMQIYuAoMWJkozzgkS0bwQm8oesB1gHeDxgrUQaa2w6PqG7FqV 4cnvrxOuKPCZxDtsq0FCmtEZYnCrPhNrQ8QYjOtn0Z4XSZAnqbBXpctVSNP5bhxesP7u 8qVA== X-Gm-Message-State: AOAM5334Yv0mHCVyrpfbJ8ZMHvBPDrQtbv2tUVPBI5/CHljGRpUbnp0Z TRCrcoTPGi8f1MhK+tGk5gRfkXNuvKD0Pji+YlQm7w== X-Google-Smtp-Source: ABdhPJySfIz8aAcQ9J1AamPC0cWNdBGNAI75Wc0N8M5+kih7VPDyB0ZJhly7HEz5L6PjHFBOXOFNgYbe/rcGjkqCQKg= X-Received: by 2002:adf:f88b:: with SMTP id u11mr8134820wrp.376.1599236542160; Fri, 04 Sep 2020 09:22:22 -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> <20200904160303.GD939481@krava> In-Reply-To: <20200904160303.GD939481@krava> From: Ian Rogers Date: Fri, 4 Sep 2020 09:22:10 -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 Fri, Sep 4, 2020 at 9:03 AM Jiri Olsa wrote: > > On Thu, Sep 03, 2020 at 10:41:14PM -0700, Ian Rogers wrote: > > On Wed, Jul 29, 2020 at 4:24 PM Ian Rogers wrote: > > > > > > 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 > > > > Jiri, any update? Thanks, > > sorry, I rebased and ran it again and it passes for me now, > so it got fixed along the way No worries, thanks for the update! It'd be nice to land this and the other libpfm fixes. Ian > jirka >