From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758051Ab3KICDR (ORCPT ); Fri, 8 Nov 2013 21:03:17 -0500 Received: from e31.co.us.ibm.com ([32.97.110.149]:45784 "EHLO e31.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757309Ab3KICDP (ORCPT ); Fri, 8 Nov 2013 21:03:15 -0500 Date: Fri, 8 Nov 2013 18:02:33 -0800 From: Sukadev Bhattiprolu To: Arnaldo Carvalho de Melo , Jiri Olsa , a.p.zijlstra@chello.nl, namhyung@kernel.org Cc: linux-kernel@vger.kernel.org, Maynard Johnson Subject: [RFC][PATCH] Fix inhert with perf record --pid Message-ID: <20131109020233.GA10009@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: Linux 2.0.32 on an i486 User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13110902-8236-0000-0000-000003998BD7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A gently tested RFC patch... --- >>From 38554891fc41082b767f24ce3293658f7329a691 Mon Sep 17 00:00:00 2001 From: Sukadev Bhattiprolu Date: Fri, 8 Nov 2013 17:14:06 -0800 Subject: [PATCH] Fix inhert with perf record --pid If a target process is identified by its pid: perf record --pid 1234 perf record does not follow any _newly_ created children of the process. perf_evlist__config() clears the ->inherit flag. if (evlist->cpus->map[0] < 0) opts->no_inherit = true; It can be fixed and descendants can be followed, by this change below, but is this behavior by design ? We do follow the children if the same process is started by perf: perf record ./a.out This was reported by Maynard Johnson On a related note, perf_target__validate() has this: /* CPU and PID are mutually exclusive */ if (target->tid && target->cpu_list) { target->cpu_list = NULL; if (ret == PERF_ERRNO_TARGET__SUCCESS) ret = PERF_ERRNO_TARGET__PID_OVERRIDE_CPU; } Again, its not clear why pid and cpu are exclusive in this case: perf record --pid 1234 -C 0,1,2 The system call allows the both pid and cpu to be specified. Looking at commit, I see that this check was pulled in from builtin-top.c. commit 4bd0f2d2c0cf14de9c84c2fe689120c6b0f667c8 Author: Namhyung Kim Date: Thu Apr 26 14:15:18 2012 +0900 Does that check apply to 'perf record' or only 'perf top' ? Appreciate any comments. --- tools/perf/util/evlist.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index e584cd3..c81d01a 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -742,7 +742,7 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, return -1; if (perf_target__has_task(target)) - evlist->cpus = cpu_map__dummy_new(); + evlist->cpus = cpu_map__new(target->cpu_list); else if (!perf_target__has_cpu(target) && !target->uses_mmap) evlist->cpus = cpu_map__dummy_new(); else -- 1.7.1