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=-12.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT 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 D720CC433E2 for ; Sat, 12 Sep 2020 02:57:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A0CB6221EB for ; Sat, 12 Sep 2020 02:57:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="vrRzme4m" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725852AbgILC5R (ORCPT ); Fri, 11 Sep 2020 22:57:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725834AbgILC5E (ORCPT ); Fri, 11 Sep 2020 22:57:04 -0400 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B62FFC061799 for ; Fri, 11 Sep 2020 19:57:03 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id o28so2770808qkm.23 for ; Fri, 11 Sep 2020 19:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=tlUZFOaKJ5LE59ggiryY4frJEaxFxgx4ldifqmKiWLA=; b=vrRzme4mxyE5sgvckk7Y/j1HMCgj6vdjO3lKb7NEGoa6AnOs/PLWkSLu7VPdcd0/KZ 3QZxraOTN2lzSzt+HhIZA6gErKzzixtBxjUjm2Vco6hRr/79FIcSJqX2+5oSy3n0c+0v EPhJobzAs9gBisTqfZJJ/UFyLYbHteWa9MAMqrUH2Zk+HZ8PAW3eHGJg8s5n7aBQbmH7 nUFL+t1+QtqjJLljLczij2i3/h2yRXZ6VLVznZyk93lx6sjtdZNXxjbQIniBMX0jyLra MaOuAFrQnJ1HEm0HMi/2t38FI8N+PNApMcpE9xklBs8HLFsHl504rkuPt2AWr0kB9cHy C6qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=tlUZFOaKJ5LE59ggiryY4frJEaxFxgx4ldifqmKiWLA=; b=iltNdKRrCGWngTEZaEMkq/aALmaDhtJCSrTogxZOrz8uZoVCm8ZMznldnLDsRq2pFw bncDyWdkPCTiZx9GhWkYXuzzVrPOBisHEajakBUm9TRHSdLweRZKCsGAQoMfY8JCdlLF bMLy79Vd06F1Rkl3sg/tb7b0IbLng8dLczOA6otcQrr8tOW/kf3+Of1/LKJTvVUVOeLr 0EHhwnjU3NnGm7TONZfHnRF220Jhk1+0rGsq4a3h49lN2L9/ujlFXzF4uvhPTyjYaC3/ u2bhdajgCNoXckPTVJQo/08OeRZz0YXI30ssibQCANUj1hqV4DbHGQTsNO1EzVdec/UD Ay3g== X-Gm-Message-State: AOAM530T1gj1duV2Pb5ZigklnzvTBUws4a9W9d1rG677RVJrAf3Lu52v eM7Jiawf4mh7waCrLLPwEGWbIU5h4xWp X-Google-Smtp-Source: ABdhPJzwN2NTqtuyrq3jkjZseDDdYzyQAyQtx5se2QgH30k2etj5OZ0koctyixMjeqsFh7j6dPk+gP3+kzhd X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:2:f693:9fff:fef4:4583]) (user=irogers job=sendgmr) by 2002:a0c:eeca:: with SMTP id h10mr4954039qvs.13.1599879420884; Fri, 11 Sep 2020 19:57:00 -0700 (PDT) Date: Fri, 11 Sep 2020 19:56:53 -0700 In-Reply-To: <20200912025655.1337192-1-irogers@google.com> Message-Id: <20200912025655.1337192-3-irogers@google.com> Mime-Version: 1.0 References: <20200912025655.1337192-1-irogers@google.com> X-Mailer: git-send-email 2.28.0.618.gf4bc123cb7-goog Subject: [PATCH v3 2/4] perf record: Prevent override of attr->sample_period for libpfm4 events From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , 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 , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Cc: Stephane Eranian , Ian Rogers Content-Type: text/plain; charset="UTF-8" Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org 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 Signed-off-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 3e985016da7e..459b51e90063 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) { if (opts->freq) { attr->freq = 1; attr->sample_freq = opts->freq; -- 2.28.0.618.gf4bc123cb7-goog