From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933532AbeAXLZg (ORCPT ); Wed, 24 Jan 2018 06:25:36 -0500 Received: from terminus.zytor.com ([65.50.211.136]:44913 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933262AbeAXLZc (ORCPT ); Wed, 24 Jan 2018 06:25:32 -0500 Date: Wed, 24 Jan 2018 03:22:11 -0800 From: tip-bot for Wang YanQing Message-ID: Cc: mingo@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, hpa@zytor.com, jolsa@kernel.org, udknight@gmail.com, peterz@infradead.org, alexander.shishkin@linux.intel.com Reply-To: tglx@linutronix.de, jolsa@kernel.org, udknight@gmail.com, hpa@zytor.com, alexander.shishkin@linux.intel.com, peterz@infradead.org, mingo@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org In-Reply-To: <20180115050448.GA20759@udknight> References: <20180115050448.GA20759@udknight> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf symbols: Using O_CLOEXEC in do_open Git-Commit-ID: 4c0d8d27954d9efb2a02ec9fc16f39b02f248bb7 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 4c0d8d27954d9efb2a02ec9fc16f39b02f248bb7 Gitweb: https://git.kernel.org/tip/4c0d8d27954d9efb2a02ec9fc16f39b02f248bb7 Author: Wang YanQing AuthorDate: Mon, 15 Jan 2018 13:04:48 +0800 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 23 Jan 2018 09:49:28 -0300 perf symbols: Using O_CLOEXEC in do_open I've meet a strange behavior with these commands on my gentoo box: 1: perf kmem record 2: CTRL-C to stop 1 3: perf report 4: "Enter", "Enter", "Run scripts for all samples", "event_analyzing_sample". Then 'perf report' says: " No kallsyms or vmlinux with build-id xxxx was found /lib/modules/4.10.0+/build/vmlinux with build id xxxx not found, continuing without symbols ". It is strange because I am sure /lib/modules/4.10.0+/build/vmlinux is right for perf.data. After digging, I found out the reason is that "perf report" generates many open fds, then "script_browse" uses popen to run "perf script" which run out of open files. The gentoo box has a small default value for "max open files", 1024. Yes, "ulimit -n " with a bigger number could fix it, but I think that using O_CLOEXEC in do_open is a better way. Signed-off-by: Wang YanQing Acked-by: Jiri Olsa Cc: Alexander Shishkin Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20180115050448.GA20759@udknight [ Make sure O_CLOEXEC is available in old systems by adding a patch just before this one, to keep this bisectable in such systems ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/dso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index d5b6f7f..36ef45b 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -446,7 +446,7 @@ static int do_open(char *name) char sbuf[STRERR_BUFSIZE]; do { - fd = open(name, O_RDONLY); + fd = open(name, O_RDONLY|O_CLOEXEC); if (fd >= 0) return fd;