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: 1362755 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=cEuaKFtv; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BpHNN5Bmlz9sTH for ; Sat, 12 Sep 2020 12:57:24 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725859AbgILC5S (ORCPT ); Fri, 11 Sep 2020 22:57:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgILC5C (ORCPT ); Fri, 11 Sep 2020 22:57:02 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBDBDC061795 for ; Fri, 11 Sep 2020 19:56:59 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id i199so3575735ybg.22 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=JVj3OApxVE8kaFCDR2cCZMK2c1MIA4F4q5V9mmOCkJy651B0a6smL6kX0yb+6d4kT6 qXJR3lhiGHJOIfu2/Y+50kRGGpU5g1CZzeO0kqgSQHS3EvDLsZOmeAAeioKg+5SbCy1h 8qtYpgAjfI52RfcPeyrxcQsmz3DzkPKIUhTthDYcVv4oDpYkSxYUNrp67iWZsCU7rQon A3OpkNfl7Yt6Xy7hQuqR6hEk8FBkS3zcWiC4drOxqmKr7CVtmlNlVYS3qrHnhw7YCfjv Tn4nlw1oJ3Xsl3QSM8poPZdIanADc7mihAK7lmrZd64/ufBJ/rgsTPRz1gM+FWlW0z1v LSSg== X-Gm-Message-State: AOAM533WkCxPUv5UbW0Ze+ZpxFLM9N1bMnfRGZNARpWlQXD7c36clL+Z /GieGQtpI//4q9qTukzU+ItbRO8KaAbU 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: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@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; From patchwork Sat Sep 12 02:56:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 1362756 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=vrRzme4m; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BpHNW1q9Vz9sTR for ; Sat, 12 Sep 2020 12:57:31 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725865AbgILC5Y (ORCPT ); Fri, 11 Sep 2020 22:57:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725817AbgILC5C (ORCPT ); Fri, 11 Sep 2020 22:57:02 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFCAEC061757 for ; Fri, 11 Sep 2020 19:57:01 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id j5so6524298qvb.16 for ; Fri, 11 Sep 2020 19:57:01 -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=bg+MxZNFCgKDurzERbLmYD08SSX7LBUrRaEGEq8CFeP/z7AJtY5ABCkFfNEiZOQRwd HrcNrqhp37RUeVMVzceUYqIVWZZYORjz2jFBlmDUXG4qScDjItCL/rCrxgbr+CxNkUzm Hq57rGp5eDqlZIpC5tH8+eKlO+pd50E6VwVL5HISKxl9W3T4MfPgb3nQaIhOi/BPhrgc G0AaMWsQffBa/PLBqROzI4HutXsRGTBlNuRXgZvyl3Xmj3I+bFFu6ZAyHXbBYQSLdGeF SPXxCxcn6kjdQE89dCCjhYUJoLH6KFMJFwPN2zaJmSJoUgTOH9GkVnTSXrava3OG8UB1 ynWg== X-Gm-Message-State: AOAM532GMJbrQ2X8UbrcRKs9nF9ePTxh4ixj6ldxifwMCJeaMvWTtfEr snSQfHmecAtgiYTOIRIC9ZlJekMkUO3e 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 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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; From patchwork Sat Sep 12 02:56:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 1362757 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=pbPv6LoT; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BpHNb53Lpz9sTH for ; Sat, 12 Sep 2020 12:57:35 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725857AbgILC5S (ORCPT ); Fri, 11 Sep 2020 22:57:18 -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 S1725830AbgILC5D (ORCPT ); Fri, 11 Sep 2020 22:57:03 -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 AC9E0C0613ED for ; Fri, 11 Sep 2020 19:57:03 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 125so10865914ybg.12 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=S4BaSChoStuXn9hUjRtFrVEEliba+K91i8IvE/c8cWU=; b=pbPv6LoTFW9c9cgb1mIWL4TXAnmXnBP3zMCzGQT4KcZ4LkRTO9zyobxhuDAdLt0TLE Nf1zhQ2urZmVZga/imCGWFsImzFGhh6+S+JaXaQcSGRYYrxkWL1AqCEbSl7KKx30WL3x yhOQc/Qie9pC/KVnW+0U0CiC77suqzpyNuyTROVWMr7I977yEQiJsRYTlZ/w/t4GRHKM ctc2pp4bDM95NZAQnaMu/6SrTSGPpk6sEFIZi27286exnQw3qHUd4zxS4cK0dP8K4PCe ylkq0AvTJRbEV6nXKPYGWOv358H0PRerHbQOAuA7vrcfOAFxqf3ebJ4BYlcUpRSKSHyh 6NXg== 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=S4BaSChoStuXn9hUjRtFrVEEliba+K91i8IvE/c8cWU=; b=LotmtDWxlX8X365pfQDGeNx7vd1WLHpnaQXAZBcvq4Vtrji5WZhFHWuB2yLcQC8ZJ5 +g1q9HKZQqOyckG5LN1Kqk5wc6sV8WMcc46W3oAWaKUZ1pOoiucPUE1smKeun7mZS+xO /VMnCAbfQDnsbXd+52I2nUZgmLBwhGBcAlSgMK+arRXkODSQUl7hxCTk6s2Bb3wkt2w4 skquiw8UdCPurkqXu035fvQB9Y51xBsn62TZ2/7cXhk/lv2U+2rjoHGTQjRVeAkk17RK QFnxElLrH+V/WaTk9BmUX9lEYuqWuNwnLbuh8+nd3Dta6syPhh6M4Hn5YcnL1GmYBm5E dqTg== X-Gm-Message-State: AOAM530ETcv4P0O7EsaVrbejY1qWQ0JoFFyRUS7InMjQ+HZwXAYg2E5B CLrqyk6ddH0jFN19fVw0oXyzPwWHI01v X-Google-Smtp-Source: ABdhPJydvl5bZ5owq66oiX1WfPkpW16l0ovIc+lZVj9SuIGZawWsXOZx4KTvhzIJFWyCEUS5CSvNOxz6miJL X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:2:f693:9fff:fef4:4583]) (user=irogers job=sendgmr) by 2002:a25:5096:: with SMTP id e144mr5872381ybb.32.1599879422845; Fri, 11 Sep 2020 19:57:02 -0700 (PDT) Date: Fri, 11 Sep 2020 19:56:54 -0700 In-Reply-To: <20200912025655.1337192-1-irogers@google.com> Message-Id: <20200912025655.1337192-4-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 3/4] perf record: Don't clear event's period if set by a term 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 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If events in a group explicitly set a frequency or period with leader sampling, don't disable the samples on those events. Prior to 5.8: perf record -e '{cycles/period=12345000/,instructions/period=6789000/}:S' would clear the attributes then apply the config terms. In commit 5f34278867b7 leader sampling configuration was moved to after applying the config terms, in the example, making the instructions' event have its period cleared. This change makes it so that sampling is only disabled if configuration terms aren't present. Fixes: 5f34278867b7 ("perf evlist: Move leader-sampling configuration") Signed-off-by: Ian Rogers Acked-by: Adrian Hunter --- tools/perf/util/record.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c index a4cc11592f6b..ea9aa1d7cf50 100644 --- a/tools/perf/util/record.c +++ b/tools/perf/util/record.c @@ -2,6 +2,7 @@ #include "debug.h" #include "evlist.h" #include "evsel.h" +#include "evsel_config.h" #include "parse-events.h" #include #include @@ -33,11 +34,24 @@ static struct evsel *evsel__read_sampler(struct evsel *evsel, struct evlist *evl return leader; } +static u64 evsel__config_term_mask(struct evsel *evsel) +{ + struct evsel_config_term *term; + struct list_head *config_terms = &evsel->config_terms; + u64 term_types = 0; + + list_for_each_entry(term, config_terms, list) { + term_types |= 1 << term->type; + } + return term_types; +} + static void evsel__config_leader_sampling(struct evsel *evsel, struct evlist *evlist) { struct perf_event_attr *attr = &evsel->core.attr; struct evsel *leader = evsel->leader; struct evsel *read_sampler; + u64 term_types, freq_mask; if (!leader->sample_read) return; @@ -47,16 +61,20 @@ static void evsel__config_leader_sampling(struct evsel *evsel, struct evlist *ev if (evsel == read_sampler) return; + term_types = evsel__config_term_mask(evsel); /* - * Disable sampling for all group members other than the leader in - * case the leader 'leads' the sampling, except when the leader is an - * AUX area event, in which case the 2nd event in the group is the one - * that 'leads' the sampling. + * Disable sampling for all group members except those with explicit + * config terms or the leader. In the case of an AUX area event, the 2nd + * event in the group is the one that 'leads' the sampling. */ - attr->freq = 0; - attr->sample_freq = 0; - attr->sample_period = 0; - attr->write_backward = 0; + freq_mask = (1 << EVSEL__CONFIG_TERM_FREQ) | (1 << EVSEL__CONFIG_TERM_PERIOD); + if ((term_types & freq_mask) == 0) { + attr->freq = 0; + attr->sample_freq = 0; + attr->sample_period = 0; + } + if ((term_types & (1 << EVSEL__CONFIG_TERM_OVERWRITE)) == 0) + attr->write_backward = 0; /* * We don't get a sample for slave events, we make them when delivering From patchwork Sat Sep 12 02:56:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 1362759 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=QutX05ki; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BpHNl2xppz9sTR for ; Sat, 12 Sep 2020 12:57:43 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725821AbgILC5h (ORCPT ); Fri, 11 Sep 2020 22:57:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725801AbgILC5H (ORCPT ); Fri, 11 Sep 2020 22:57:07 -0400 Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F321DC06179B for ; Fri, 11 Sep 2020 19:57:05 -0700 (PDT) Received: by mail-qk1-x74a.google.com with SMTP id a2so7114200qkg.19 for ; Fri, 11 Sep 2020 19:57:05 -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=Xn4xTNQ0qrRVMBBl5RrCT8xh1AzgDEH+Hh8mfK+j8Yk=; b=QutX05kiuQW6lndX/80w/avnHkC238HxIrwzu3IbdbXxJWLTzWFGH+8HuOghrTpfmL wwMWkvBe7Yy/hZ4r7aoo8tHwu1/cwiClrGmQ39sjnyBnRofWi0Jx+Z5kGDfHKsk3hH/K 67wm/P4PCyWexfp8iiNGJQiK8Db3xjMCeYmMYrR5/hqkLH8liQgOzqt/4vDGStUKf33L D8IZ3Bxu5S8BP1doX3H4M8TCHkFfOytpFo+cICv65DUFaSF+0SX5afX7dbDaAblcja9L oYXHBJRohnqUSLgSN1Pyh7Itvt/vCSOShGztNo0jyM43HxTcDOV/CbwHwouBZFXDx4jq a+XA== 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=Xn4xTNQ0qrRVMBBl5RrCT8xh1AzgDEH+Hh8mfK+j8Yk=; b=WkD7d4LF9cQNvVX+NN1PSuejgMEvIGuWmwKb8yGqkWeUWTTK9nS4/uxZzZwUKSq2Iq xesyou3YsqYPRvm1J8jTmnPx8jCDTINFutztT/Tti1hZhseuMLeNKlYjRXOut6DsnvIn GlMEFKtjc4b16EBzBWst0yssqV5pknN++H1FEZfPg93niqM9P6o5SXh5xxSn9zDRJ9Po qSD7DUuKigLp2AwEQW1IE5INd3+LIQIqCvKO6NTvroc+lrtdfP9Hy6Y27aHqmvVHwT6X g29Zuccsb4cjb8oN9c0c2oBEZF3IqQm/uRFqy4SO63pzEVVRkW9qGWU6OH5MvcouFmN/ +1pg== X-Gm-Message-State: AOAM530uI4zYr+QiSfj8fXP3sH8rY5oJ47irlLJz6nZsqMqQF3hF6w0D 8/4RDo56QkPcH2a/3GC0zcnfkGnFp+64 X-Google-Smtp-Source: ABdhPJzjQi8hLV5O6tVcvN8UXIcPGAfrLlUvmEtGO53XDuBnmARnB4Tf2/XKdqB/W8CB8j6/ENen+FfOVP7F X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:2:f693:9fff:fef4:4583]) (user=irogers job=sendgmr) by 2002:ad4:57a7:: with SMTP id g7mr4839251qvx.10.1599879424736; Fri, 11 Sep 2020 19:57:04 -0700 (PDT) Date: Fri, 11 Sep 2020 19:56:55 -0700 In-Reply-To: <20200912025655.1337192-1-irogers@google.com> Message-Id: <20200912025655.1337192-5-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 4/4] perf test: Leader sampling shouldn't clear sample period 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 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Add test that a sibling with leader sampling doesn't have its period cleared. Signed-off-by: Ian Rogers --- tools/perf/tests/attr/README | 1 + tools/perf/tests/attr/test-record-group2 | 29 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tools/perf/tests/attr/test-record-group2 diff --git a/tools/perf/tests/attr/README b/tools/perf/tests/attr/README index 6cd408108595..a36f49fb4dbe 100644 --- a/tools/perf/tests/attr/README +++ b/tools/perf/tests/attr/README @@ -49,6 +49,7 @@ Following tests are defined (with perf commands): perf record --call-graph fp kill (test-record-graph-fp) perf record --group -e cycles,instructions kill (test-record-group) perf record -e '{cycles,instructions}' kill (test-record-group1) + perf record -e '{cycles/period=1/,instructions/period=2/}:S' kill (test-record-group2) perf record -D kill (test-record-no-delay) perf record -i kill (test-record-no-inherit) perf record -n kill (test-record-no-samples) diff --git a/tools/perf/tests/attr/test-record-group2 b/tools/perf/tests/attr/test-record-group2 new file mode 100644 index 000000000000..6b9f8d182ce1 --- /dev/null +++ b/tools/perf/tests/attr/test-record-group2 @@ -0,0 +1,29 @@ +[config] +command = record +args = --no-bpf-event -e '{cycles/period=1234000/,instructions/period=6789000/}:S' kill >/dev/null 2>&1 +ret = 1 + +[event-1:base-record] +fd=1 +group_fd=-1 +config=0|1 +sample_period=1234000 +sample_type=87 +read_format=12 +inherit=0 +freq=0 + +[event-2:base-record] +fd=2 +group_fd=1 +config=0|1 +sample_period=6789000 +sample_type=87 +read_format=12 +disabled=0 +inherit=0 +mmap=0 +comm=0 +freq=0 +enable_on_exec=0 +task=0