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=-10.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS 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 73FD2C433E2 for ; Fri, 4 Sep 2020 16:03:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5272A2074D for ; Fri, 4 Sep 2020 16:03:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727025AbgIDQDe (ORCPT ); Fri, 4 Sep 2020 12:03:34 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:43795 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726005AbgIDQDd (ORCPT ); Fri, 4 Sep 2020 12:03:33 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-540-hb8g6iE0O5mrNFWlNdWvUA-1; Fri, 04 Sep 2020 12:03:28 -0400 X-MC-Unique: hb8g6iE0O5mrNFWlNdWvUA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 22B2E108050D; Fri, 4 Sep 2020 16:03:15 +0000 (UTC) Received: from krava (ovpn-112-34.ams2.redhat.com [10.36.112.34]) by smtp.corp.redhat.com (Postfix) with SMTP id 86FEE88F2A; Fri, 4 Sep 2020 16:03:09 +0000 (UTC) Date: Fri, 4 Sep 2020 18:03:03 +0200 From: Jiri Olsa To: Ian Rogers 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 Subject: Re: [PATCH v2 2/5] perf record: Prevent override of attr->sample_period for libpfm4 events Message-ID: <20200904160303.GD939481@krava> References: <20200728085734.609930-1-irogers@google.com> <20200728085734.609930-3-irogers@google.com> <20200728155940.GC1319041@krava> <20200728160954.GD1319041@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 jirka