All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
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
Date: Fri, 19 Jun 2015 18:41:18 -0300	[thread overview]
Message-ID: <20150619214118.GD28405@kernel.org> (raw)
In-Reply-To: <1434549071-25611-1-git-send-email-kan.liang@intel.com>

Em Wed, Jun 17, 2015 at 09:51:10AM -0400, kan.liang@intel.com escreveu:
> From: Kan Liang <kan.liang@intel.com>
> 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/

  parent reply	other threads:[~2015-06-19 21:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-17 13:51 [PATCH V4 1/2] perf,tools: add time out to force stop proc map processing kan.liang
2015-06-17 13:51 ` [PATCH V4 2/2] perf,tools: configurable per thread proc map processing time out kan.liang
2015-06-19 23:18   ` [tip:perf/core] perf tools: Configurable " tip-bot for Kan Liang
2015-06-19 21:41 ` Arnaldo Carvalho de Melo [this message]
2015-06-22 18:01   ` [PATCH V4 1/2] perf,tools: add time out to force stop proc map processing Liang, Kan
2015-06-19 23:18 ` [tip:perf/core] perf tools: Add " tip-bot for Kan Liang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150619214118.GD28405@kernel.org \
    --to=acme@kernel.org \
    --cc=andi@firstfloor.org \
    --cc=dsahern@gmail.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.