Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp319649pjb; Tue, 28 Jul 2020 01:58:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpxG3qdH4z1+VYDzKwGrj5a174tYgdc7JyaT9q2pqYEvtv2IVXCP5bzLviLlMdnZuu49Em X-Received: by 2002:a17:906:c44c:: with SMTP id ck12mr25494957ejb.145.1595926698434; Tue, 28 Jul 2020 01:58:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595926698; cv=none; d=google.com; s=arc-20160816; b=V0gNNpJitmplYiGt4vY3a29p2Z+F8UJ94VcR6ikp/nhB4pcoiTYbtPoO3yAJU7pDDN D1+1ZPkNSF4qINFYlgaT6MgvTIeVvDwFFW5xIOmkLFYS7LsBlj8dGJnBlwsW9BTvFOoa k/23/AnM0u8AppMNL0j32hS6miAPdHL80jzU1mdBcUIlClLLpawYW/Mc8lAL1XT565S9 dC6IAYuWKGpPaqfXCGDBfIQ9sER9uydQx9scS4QIi/GugZkYdHreipkTNuzAs6OqQ2mg THFY1NQ6/b9mczeJFDzz/LlQfwxOOkk8G8M8i2tNVisTjyISB3k3UIc/zcWXLqKjLsFI 3f7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=zApPOTJ5w6WkPmUvx5vPVowaf73ni3+MSfyTlKnuOkc=; b=PJkRit3C2TQ8ro1wJlO61mlKezkOx3enUxQTY2Sm598CGCWHp8T2OogdMi6JGCzw+O JJ+5BnoFK4ZssylVBoemIGsVg7+iOmY2DrS9oysIBCSlT4pkX4K5ABudcrZTtUQM9Egs If/DFStE9PBjcfoPQhGSIzzckIt++9eoH+OAjQKWY2q3a7aMIs9c++KkRqwrYjZLgkeg gGJ9I1Nn3hl5sNYqOOmNrH/S2NZBUG6rE9VtWtakIVfmiaVY1OZY3OwqFUdB4yU4YcXn 3d3xzOinnFn685pBK5v4qiNuK++o2gxQxRbQRpWMw01MmiEfO0QuVqTtUsCxOMKSpA1N gTQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qVPctGuH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h27si7946997ejd.184.2020.07.28.01.57.55; Tue, 28 Jul 2020 01:58:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qVPctGuH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728355AbgG1I5m (ORCPT + 99 others); Tue, 28 Jul 2020 04:57:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728327AbgG1I5i (ORCPT ); Tue, 28 Jul 2020 04:57:38 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8EF0C061794 for ; Tue, 28 Jul 2020 01:57:38 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id z16so14911193pgh.21 for ; Tue, 28 Jul 2020 01:57:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=zApPOTJ5w6WkPmUvx5vPVowaf73ni3+MSfyTlKnuOkc=; b=qVPctGuH/HG4+XTA7hvFME+borLjNB7Wi/258LIlYdJxDTcrRABI2np+69GhB8L0nO 6vpVGcpyvsaEXO0pk7Fz4v+exN7394Kc0Z2069OsX3fa6PS79AKb6XD+Detd9Ee0geGM a4d6fEFc0dNgSKuqnBCDaM4VKS0f5jhUhv2/zzhq5/ANb2fgfsSjfe+kQ6rMFfrBcyDu xuAHW7+j1UPNSZ+B9zGEDfrqi9COIwp9srOyW25eelrqDW3ZwQzN7n8OLgoOPqdiCRdW EmCbkMIj3d8F92W9duND0KeSxxX4WjS5aVSb/vCt7u+3vO+4EvqeZXMPKnd0zvTh+fDj ozXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=zApPOTJ5w6WkPmUvx5vPVowaf73ni3+MSfyTlKnuOkc=; b=NJs5UCOhcFkUp+Zi9DdSbf0xBCOWEZnxDGb+Eq0qri+ykRk9228X1hUC2TojbVk8DX pzjUDMgSSILPze4i13SeuWGNGc2DzxSD+iUUWUaU9f3Lhh2hfhpJQ3eqBuAVPAyX6irf 46pg/jO1p00uO9d+wUs6T/yTP1UVPlhiP/+6ZkK2WdDIjE9Lyrz+EMm8becOZHT0GMiA QUb0mJUxUJXB2/FfLbzixb9F7PvGEIKDH0bVvp4HPGI6XnWhPzvMQkOBzMtXBhbMmUOz xV67ZaHNmVUH+7uN4HT3tfnGazjKvy0RgA7HdxNnU2gwlFLbDK6GBdmmWYCFmXcatz70 tspw== X-Gm-Message-State: AOAM533Fity77o2qfThqMbbcQfkSVBt9ddVsbXUYwcqs2j/0Rt0EjSdN yB1Rz20V1CXtyta/GxNHKDQnmI3mpvis X-Received: by 2002:a17:90b:4acd:: with SMTP id mh13mr3542331pjb.147.1595926658191; Tue, 28 Jul 2020 01:57:38 -0700 (PDT) Date: Tue, 28 Jul 2020 01:57:30 -0700 In-Reply-To: <20200728085734.609930-1-irogers@google.com> Message-Id: <20200728085734.609930-2-irogers@google.com> Mime-Version: 1.0 References: <20200728085734.609930-1-irogers@google.com> X-Mailer: git-send-email 2.28.0.163.g6104cc2f0b6-goog Subject: [PATCH v2 1/5] 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 ef802f6d40c1..811f538f7d77 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; -- 2.28.0.163.g6104cc2f0b6-goog