Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755167AbbFSVl2 (ORCPT ); Fri, 19 Jun 2015 17:41:28 -0400 Received: from mail.kernel.org ([198.145.29.136]:54450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752014AbbFSVlX (ORCPT ); Fri, 19 Jun 2015 17:41:23 -0400 Date: Fri, 19 Jun 2015 18:41:18 -0300 From: Arnaldo Carvalho de Melo To: kan.liang@intel.com Cc: linux-kernel@vger.kernel.org, dsahern@gmail.com, ying.huang@intel.com, andi@firstfloor.org Subject: Re: [PATCH V4 1/2] perf,tools: add time out to force stop proc map processing Message-ID: <20150619214118.GD28405@kernel.org> References: <1434549071-25611-1-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1434549071-25611-1-git-send-email-kan.liang@intel.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1827 Lines: 44 Em Wed, Jun 17, 2015 at 09:51:10AM -0400, kan.liang@intel.com escreveu: > From: Kan Liang > System wide sampling like 'perf top' or 'perf record -a' read all > threads /proc/xxx/maps before sampling. If there are any threads which > generating a keeping growing huge maps, perf will do infinite loop > during synthesizing. Nothing will be sampled. > > This patch fixes this issue by adding per-thread timeout to force stop > this kind of endless proc map processing. > PERF_RECORD_MISC_PROC_MAP_PARSE_TIME_OUT is introduced to indicate that > the mmap record are truncated by time out. User will get warning > notification when truncated mmap records are detected. I am applying the patch, we indeed need to keep it in the last PERF_RECORD_MMAP2 we synthesized for a proc mmap file, i.e. it has to be stored in the perf.data file, so that later, at 'report' time, possibly in another machine, that situation can be reported to the user. But, the warning is only being showm for tools that process events via perf_session__process_events(), like 'perf report'. 'top' and 'trace', for instance, don't do that, so the users will not be warned in that case. To fix this we need to make machine__process_mmap2_event() notice that PERF_RECORD_MISC_PROC_MAP_PARSE_TIME_OUT is set, and bump a per-struct machine counter, something like machine->stats.nr_truncated_mmaps. The callchain is: builtin-top.c machine__synthesize_threads() __machine__synthesize_threads() perf_event__process() machine__process_event() machine__process_mmap2_event() At some point even a event_stats may make sense to be added to struct machine :-) - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/