From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753650AbbJZLm2 (ORCPT ); Mon, 26 Oct 2015 07:42:28 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:11098 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751725AbbJZLm0 (ORCPT ); Mon, 26 Oct 2015 07:42:26 -0400 From: Wang Nan To: , , CC: , , , Wang Nan Subject: [RFC PATCH v2 0/2] perf tools: Don't set inherit bit for system wide evsel Date: Mon, 26 Oct 2015 11:41:58 +0000 Message-ID: <1445859720-146146-1-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.562E119D.00E6,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: b8f6cde970ea8229b1c10f7666e56648 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Previous version can be found from [1]. To make bpf_perf_event_output() and bpf_perf_event_read() easier to be used, these two patches set inherit to 0 for system wide evsels. After applying them, users are possible to pass system wide events to BPF programs in following command, and don't need to consider the setting of inherit: # perf record -a -e evt=cycles -e ./test__map.c/maps.pmu_map.event=evt/ ... Patch 1/2 set evsel->system_wide for system wide target. I have checked in current evlist.c and evsel.c. The only behavior change I found is in evlist.c: /* * The system_wide flag causes a selected event to be opened * always without a pid. Consequently it will never get a * POLLHUP, but it is used for tracking in combination with * other events, so it should not need to be polled anyway. * Therefore don't add it for polling. */ if (!evsel->system_wide && __perf_evlist__add_pollfd(evlist, fd, idx) < 0) { perf_evlist__mmap_put(evlist, idx); return -1; } With patch 1/2, __perf_evlist__add_pollfd() won't be called. From the comment I pasted this modification looks harmless. [1] http://lkml.kernel.org/r/1445597029-133332-1-git-send-email-wangnan0@huawei.com Wang Nan (2): perf tools: Set evsel->system_wide field for global system wide recording perf tools: Don't set inherit bit for system wide evsel tools/perf/util/evsel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 1.8.3.4