From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: kan.liang@intel.com
Cc: peterz@infradead.org, mingo@redhat.com,
linux-kernel@vger.kernel.org, wangnan0@huawei.com,
jolsa@kernel.org, namhyung@kernel.org, ak@linux.intel.com,
yao.jin@linux.intel.com
Subject: Re: [PATCH V5 02/17] perf mmap: fix: recalculate size for overwrite mode.
Date: Thu, 1 Feb 2018 18:23:13 -0300 [thread overview]
Message-ID: <20180201212313.GD4835@kernel.org> (raw)
In-Reply-To: <1516310792-208685-3-git-send-email-kan.liang@intel.com>
Em Thu, Jan 18, 2018 at 01:26:17PM -0800, kan.liang@intel.com escreveu:
> From: Kan Liang <kan.liang@intel.com>
>
> In perf_mmap__push(), the 'size' need to be recalculated, otherwise the
> invalid data might be pushed to the record in overwrite mode.
>
> The issue is introduced by commit 7fb4b407a124 ("perf mmap: Don't
> discard prev in backward mode").
In these cases, please add the Fixes tag, like:
Fixes: 7fb4b407a124 ("perf mmap: Don't discard prev in backward mode")
I'm doing it this time.
Thanks,
- Arnaldo
> When the ringbuffer is full in overwrite mode, backward_rb_find_range
> will be called to recalculate the 'start' and 'end'. The 'size' needs to
> be recalculated accordingly.
>
> Unconditionally recalculate the 'size', not just for full ringbuffer in
> overwrite mode. Because,
> - There is no harmful to recalculate the 'size' for other cases.
> - The code of calculating 'start' and 'end' will be factored out later.
> The new function does not need to return 'size'.
>
> Signed-off-by: Kan Liang <kan.liang@intel.com>
> ---
> tools/perf/util/mmap.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
> index 05076e6..97cf4fa 100644
> --- a/tools/perf/util/mmap.c
> +++ b/tools/perf/util/mmap.c
> @@ -302,6 +302,8 @@ int perf_mmap__push(struct perf_mmap *md, bool overwrite,
> return -1;
> }
>
> + size = end - start;
> +
> if ((start & md->mask) + size != (end & md->mask)) {
> buf = &data[start & md->mask];
> size = md->mask + 1 - (start & md->mask);
> --
> 2.5.5
next prev parent reply other threads:[~2018-02-01 21:23 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-18 21:26 [PATCH V5 00/17] perf top overwrite mode kan.liang
2018-01-18 21:26 ` [PATCH V5 01/17] perf evlist: remove stale mmap read for backward kan.liang
2018-02-13 12:04 ` [tip:perf/urgent] perf evlist: Remove " tip-bot for Kan Liang
2018-02-16 9:34 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 02/17] perf mmap: fix: recalculate size for overwrite mode kan.liang
2018-02-01 21:23 ` Arnaldo Carvalho de Melo [this message]
2018-02-01 21:55 ` Liang, Kan
2018-02-13 12:04 ` [tip:perf/urgent] perf mmap: Recalculate " tip-bot for Kan Liang
2018-02-16 9:34 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 03/17] perf mmap: cleanup perf_mmap__push() kan.liang
2018-02-13 12:05 ` [tip:perf/urgent] perf mmap: Cleanup perf_mmap__push() tip-bot for Kan Liang
2018-02-16 9:35 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 04/17] perf mmap: introduce perf_mmap__read_init() kan.liang
2018-02-13 12:05 ` [tip:perf/urgent] perf mmap: Introduce perf_mmap__read_init() tip-bot for Kan Liang
2018-02-16 9:35 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 05/17] perf mmap: add new return value logic for perf_mmap__read_init() kan.liang
2018-02-13 12:06 ` [tip:perf/urgent] perf mmap: Add " tip-bot for Kan Liang
2018-02-16 9:36 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 06/17] perf mmap: discard 'prev' in perf_mmap__read() kan.liang
2018-02-13 12:06 ` [tip:perf/urgent] perf mmap: Discard " tip-bot for Kan Liang
2018-02-16 9:36 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 07/17] perf mmap: introduce perf_mmap__read_done kan.liang
2018-02-13 12:07 ` [tip:perf/urgent] perf mmap: Introduce perf_mmap__read_done() tip-bot for Kan Liang
2018-02-16 9:37 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 08/17] perf mmap: introduce perf_mmap__read_event() kan.liang
2018-02-13 12:07 ` [tip:perf/urgent] perf mmap: Introduce perf_mmap__read_event() tip-bot for Kan Liang
2018-02-16 9:37 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 09/17] perf test: update mmap read functions for backward-ring-buffer test kan.liang
2018-02-13 12:07 ` [tip:perf/urgent] perf test: Update " tip-bot for Kan Liang
2018-02-16 9:38 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 10/17] perf mmap: discard legacy interface for mmap read kan.liang
2018-02-13 12:08 ` [tip:perf/urgent] perf mmap: Discard " tip-bot for Kan Liang
2018-02-16 9:38 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 11/17] perf top: check per-event overwrite term kan.liang
2018-02-13 12:08 ` [tip:perf/urgent] perf top: Check " tip-bot for Kan Liang
2018-02-16 9:39 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 12/17] perf evsel: expose perf_missing_features.write_backward kan.liang
2018-02-02 14:26 ` Arnaldo Carvalho de Melo
2018-02-02 14:53 ` Liang, Kan
2018-01-18 21:26 ` [PATCH V5 13/17] perf top: add overwrite fall back kan.liang
2018-02-13 12:09 ` [tip:perf/urgent] perf top: Add " tip-bot for Kan Liang
2018-02-16 9:40 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 14/17] perf hists browser: add parameter to disable lost event warning kan.liang
2018-02-13 12:10 ` [tip:perf/urgent] perf hists browser: Add " tip-bot for Kan Liang
2018-02-16 9:40 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 15/17] perf top: remove lost events checking kan.liang
2018-02-13 12:10 ` [tip:perf/urgent] perf top: Remove " tip-bot for Kan Liang
2018-02-16 9:41 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 16/17] perf top: switch default mode to overwrite mode kan.liang
2018-02-13 12:10 ` [tip:perf/urgent] perf top: Switch " tip-bot for Kan Liang
2018-02-16 9:41 ` tip-bot for Kan Liang
2018-01-18 21:26 ` [PATCH V5 17/17] perf top: check the latency of perf_top__mmap_read() kan.liang
2018-02-13 12:11 ` [tip:perf/urgent] perf top: Check " tip-bot for Kan Liang
2018-02-16 9:42 ` tip-bot for Kan Liang
2018-01-21 12:59 ` [PATCH V5 00/17] perf top overwrite mode Jiri Olsa
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=20180201212313.GD4835@kernel.org \
--to=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=wangnan0@huawei.com \
--cc=yao.jin@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox