Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1730675pxk; Sun, 13 Sep 2020 14:07:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwt1Nhx3ufouIcXMKrJRixpD8eTD17f7dyBq0/fSGxWLdRyz21kGvm4hh17mrbudWfmsbls X-Received: by 2002:a17:906:b0a:: with SMTP id u10mr11391380ejg.226.1600031278417; Sun, 13 Sep 2020 14:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600031278; cv=none; d=google.com; s=arc-20160816; b=aJ2hbsCH16fp1nitX8KdIlXxfUcRjLv/CxetKu7eSnWE5vC0yl8rt9SOSD5B3BUvtD luyZfhDGnbR7wlgp6xJPxmA0ZhGncc49E6+JY/x8f34JZygWgW2dW2lNGb2LsUhcwap6 PqfuAYKw3SWNRktPl/EJVze1MGv8DQ0UJeFGr1O3u9bcUWbw9IlIROU5yDXPjk2WlcI7 N80IyyW0J6AwpOEq11K70XFCBF1N0M0hINNmybU9DFSt+xnvrpHuJJ9ggirmq+O83rOa givxEbg1WEDuiyOyeLnt37QntrR6XGq6yFj6J1lY4F+IlA2P1TeNVUwoESPVmLgvrqzi sdgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=wtGRm5/lQVLemgFQOXIG2WjDHE1zJKQqhMd8e1XDufU=; b=xn3Z+lj5Un4A+DTmvkqeXDOJXEEHvvGTaiawhIis0RuJtByVbigHppX03VQ3Idh0oQ bP28Byc6oX+k4b4QK8H/A6OIGdgVRH2JVJwVTPSseEjxpK6d74UQr6HNFnRJxQ+a8zaa 7JCeLaSBiHqf1ndi9bK3UL4fhpu3SN+GshH5SPIr4vdwicS78mEsGRMyC+8mdZOUm9JR IUCb9LM4Jci6vk7inBlB3Ui2o6HL1EvI9UwrTVyZsi3hXVl+krLZDDyhN3bD3R1Grscf IAoyFY98jjXQpnZBkMIFuVrzq7zNBIdXtIfsby9Zxu+DNOsenBg5PSmjJV63b1Ln30ie bUdg== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fy26si5939126ejb.319.2020.09.13.14.07.36; Sun, 13 Sep 2020 14:07:58 -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; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726121AbgIMVF6 convert rfc822-to-8bit (ORCPT + 99 others); Sun, 13 Sep 2020 17:05:58 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:23864 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726069AbgIMVFU (ORCPT ); Sun, 13 Sep 2020 17:05:20 -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-416-1o2gZlrGNMGJLKCnL55AQw-1; Sun, 13 Sep 2020 17:04:10 -0400 X-MC-Unique: 1o2gZlrGNMGJLKCnL55AQw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 66C3D801AAE; Sun, 13 Sep 2020 21:04:08 +0000 (UTC) Received: from krava.redhat.com (ovpn-112-4.ams2.redhat.com [10.36.112.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id B1A771002388; Sun, 13 Sep 2020 21:04:02 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Song Liu , "Frank Ch. Eigler" , Ian Rogers , Stephane Eranian , Alexey Budankov , Andi Kleen , Adrian Hunter Subject: [PATCH 10/26] perf tools: Enable mmap3 map event when supported Date: Sun, 13 Sep 2020 23:02:57 +0200 Message-Id: <20200913210313.1985612-11-jolsa@kernel.org> In-Reply-To: <20200913210313.1985612-1-jolsa@kernel.org> References: <20200913210313.1985612-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@kernel.org X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Enabling mmap3 map event when supported and adding its disable fallback when it fails. Also adding mmap3 bit to verbose open output: $ perf record -vv kill perf_event_attr: size 120 { sample_period, sample_freq } 4000 ... bpf_event 1 mmap3 1 Signed-off-by: Jiri Olsa --- tools/perf/util/evsel.c | 9 ++++++++- tools/perf/util/evsel.h | 1 + tools/perf/util/perf_event_attr_fprintf.c | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 14baf8542b40..c2cc9b4b30bf 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1065,6 +1065,7 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts, attr->task = track; attr->mmap = track; attr->mmap2 = track && !perf_missing_features.mmap2; + attr->mmap3 = track && !perf_missing_features.mmap3; attr->comm = track; /* * ksymbol is tracked separately with text poke because it needs to be @@ -1657,6 +1658,8 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus, evsel->core.attr.bpf_event = 0; if (perf_missing_features.branch_hw_idx) evsel->core.attr.branch_sample_type &= ~PERF_SAMPLE_BRANCH_HW_INDEX; + if (perf_missing_features.mmap3) + evsel->core.attr.mmap3 = 0; retry_sample_id: if (perf_missing_features.sample_id_all) evsel->core.attr.sample_id_all = 0; @@ -1770,7 +1773,11 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus, * Must probe features in the order they were added to the * perf_event_attr interface. */ - if (!perf_missing_features.cgroup && evsel->core.attr.cgroup) { + if (!perf_missing_features.mmap3 && evsel->core.attr.mmap3) { + perf_missing_features.mmap3 = true; + pr_debug2("switching off mmap3\n"); + goto fallback_missing_features; + } else if (!perf_missing_features.cgroup && evsel->core.attr.cgroup) { perf_missing_features.cgroup = true; pr_debug2_peo("Kernel has no cgroup sampling support, bailing out\n"); goto out_close; diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 35e3f6d66085..d49922b22eca 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -119,6 +119,7 @@ struct perf_missing_features { bool sample_id_all; bool exclude_guest; bool mmap2; + bool mmap3; bool cloexec; bool clockid; bool clockid_wrong; diff --git a/tools/perf/util/perf_event_attr_fprintf.c b/tools/perf/util/perf_event_attr_fprintf.c index e67a227c0ce7..3c52c081693d 100644 --- a/tools/perf/util/perf_event_attr_fprintf.c +++ b/tools/perf/util/perf_event_attr_fprintf.c @@ -134,6 +134,7 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr, PRINT_ATTRf(bpf_event, p_unsigned); PRINT_ATTRf(aux_output, p_unsigned); PRINT_ATTRf(cgroup, p_unsigned); + PRINT_ATTRf(mmap3, p_unsigned); PRINT_ATTRn("{ wakeup_events, wakeup_watermark }", wakeup_events, p_unsigned); PRINT_ATTRf(bp_type, p_unsigned); -- 2.26.2