From patchwork Sat Sep 12 02:56:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 261005 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 27E62C43461 for ; Sat, 12 Sep 2020 02:57:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E031C221EB for ; Sat, 12 Sep 2020 02:57:53 +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="cEuaKFtv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725889AbgILC5t (ORCPT ); Fri, 11 Sep 2020 22:57:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725808AbgILC5B (ORCPT ); Fri, 11 Sep 2020 22:57:01 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBF9BC061796 for ; Fri, 11 Sep 2020 19:56:59 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id y6so15592ybi.11 for ; Fri, 11 Sep 2020 19:56:59 -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=JjLhvyF9iMwelIcaw0DBsu//Y1+/ZRLd9VReK2mwSGs=; b=cEuaKFtvziVsuhVvQm/MR9FV9+QVZlR9FW5IU+nia4FDj/qXfvp6uzCu734+nn4QQW nzF3mMWnA9wzXvXef021Ejg1zSdN+eXgjWdpqR/0hXCy9p+k28u0yiIMa75YaOkqlD84 ZETk+umBq/6+72xE21jwKbBMDK3GbO4Pt5g0oD0NGp/bX512d2oJlTSfHp59Ffzm6Z4f 3J1qFgWluIsOtMbusuaXSBgUjQ2dIuF859kOnyZzAYfiFwuYbxwjcYHNTy5iu2j9YCpk ZFQbbCNARJlNVVsnesgFR29Ioho5jW4Op21MZTxVxAhvESXqEqWRxVZOcYAkNL1Hv7B/ I6LA== 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=JjLhvyF9iMwelIcaw0DBsu//Y1+/ZRLd9VReK2mwSGs=; b=tGL0zNZQ9GF/T2MX+syF+YRZGu3BvREn5kJRSuqTTTw4ESObAbSUDyF8GSojDrKtws BIOZkaBTB6JDg1aw6As6XbAzCzjBV3jyciUvJ10cT9VnOxx9y7UOdbrXDnncGNSTL5AZ oIADNSXiVhuczn9xg/qGJz5Qw9+Ad4yorvCEWHzy8wySbMZl++OwthsZMN/dJc1ELo0x Frk2v9z4oLNKyEGynpA1FQrMmuI4aNC5KGk/yluA3vkJInu9VKVFS95kFeh7Km5ePu40 vPzYOyoTn00n1mVpEbs4L7JRZlfGkRSL54SO1UCh9FHGPshqvCtHTg8c0wkh+1wbiLMi tsvg== X-Gm-Message-State: AOAM533pRUj8f4lkyUBmM7BT3+vddDs9FfOf6W19t6ok/cbvh2P868Zi zLiwE/LRQBpuUgFoRKb7OGaCOUiNQfku X-Google-Smtp-Source: ABdhPJz3ff6ZAhAaEVz80+FABBEVLhzUutcRr/Uhs+2mnjS21WRcmYL5tmOf4eZWJ+py9c5W+hUwdj339FiU X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:2:f693:9fff:fef4:4583]) (user=irogers job=sendgmr) by 2002:a25:dcc6:: with SMTP id y189mr7066582ybe.178.1599879418975; Fri, 11 Sep 2020 19:56:58 -0700 (PDT) Date: Fri, 11 Sep 2020 19:56:52 -0700 In-Reply-To: <20200912025655.1337192-1-irogers@google.com> Message-Id: <20200912025655.1337192-2-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 1/4] perf record: Set PERF_RECORD_PERIOD if attr->freq is set. 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 , David Sharp , Ian Rogers Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: David Sharp evsel__config() would only set PERF_RECORD_PERIOD if it set attr->freq from perf record options. When it is set by libpfm events, it would not get set. This changes evsel__config to see if attr->freq is set outside of whether or not it changes attr->freq itself. Signed-off-by: David Sharp Signed-off-by: Ian Rogers --- tools/perf/util/evsel.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index fd865002cbbd..3e985016da7e 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -979,13 +979,18 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts, if (!attr->sample_period || (opts->user_freq != UINT_MAX || opts->user_interval != ULLONG_MAX)) { if (opts->freq) { - evsel__set_sample_bit(evsel, PERIOD); attr->freq = 1; attr->sample_freq = opts->freq; } else { attr->sample_period = opts->default_interval; } } + /* + * If attr->freq was set (here or earlier), ask for period + * to be sampled. + */ + if (attr->freq) + evsel__set_sample_bit(evsel, PERIOD); if (opts->no_samples) attr->sample_freq = 0;