Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1685420 > unrolled thread

Re: [PATCH v4 15/16] perf tools: add feature header record to pipe-mode

Started byDavid Carrillo-Cisneros <davidcc@google.com>
First post2017-07-12 02:40 +0200
Last post2017-07-18 06:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v4 15/16] perf tools: add feature header record to pipe-mode David Carrillo-Cisneros <davidcc@google.com> - 2017-07-12 02:40 +0200
    Re: [PATCH v4 15/16] perf tools: add feature header record to  pipe-mode Jiri Olsa <jolsa@redhat.com> - 2017-07-12 09:40 +0200
      Re: [PATCH v4 15/16] perf tools: add feature header record to pipe-mode David Carrillo-Cisneros <davidcc@google.com> - 2017-07-18 06:40 +0200

#1685420 — Re: [PATCH v4 15/16] perf tools: add feature header record to pipe-mode

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-07-12 02:40 +0200
SubjectRe: [PATCH v4 15/16] perf tools: add feature header record to pipe-mode
Message-ID<u2dR8-Vf-21@gated-at.bofh.it>
On Tue, Jun 13, 2017 at 11:54 AM, Jiri Olsa <jolsa@redhat.com> wrote:
> On Mon, Jun 12, 2017 at 09:29:31PM -0700, David Carrillo-Cisneros wrote:
>
> SNIP
>
>>
>>  void perf_event__print_totals(void);
>> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
>> index ddfaf157913d..6f6a54c15cb0 100644
>> --- a/tools/perf/util/header.c
>> +++ b/tools/perf/util/header.c
>> @@ -34,6 +34,7 @@
>>  #include "data.h"
>>  #include <api/fs/fs.h>
>>  #include "asm/bug.h"
>> +#include "tool.h"
>>
>>  #include "sane_ctype.h"
>>
>> @@ -97,11 +98,14 @@ static int __do_write_buf(struct feat_fd *ff,  const void *buf, size_t size)
>>
>>  retry:
>>       if (size > (ff->size - ff->offset)) {
>> -             addr = realloc(ff->buf, ff->size << 1);
>> +             size = ff->size << 1;
>> +             if (size > page_size)
>
> event size could be 0xffff - sizeof(struct perf_event_header)
> also the initial size is most likely > page_size anyway
>
> please put this into the patch that introduced __do_write_buf
>

Thank you for reviewing this. I just realized that I sent v5 without
properly addressing this issue. In v4 I tried to add a quick check
without properly understanding the issue. Why is 0xffff the maximum
size for an event? where is this constraint coming from?

Thanks,
David

[toc] | [next] | [standalone]


#1685569 — Re: [PATCH v4 15/16] perf tools: add feature header record to pipe-mode

FromJiri Olsa <jolsa@redhat.com>
Date2017-07-12 09:40 +0200
SubjectRe: [PATCH v4 15/16] perf tools: add feature header record to pipe-mode
Message-ID<u2kpz-5f6-7@gated-at.bofh.it>
In reply to#1685420
On Tue, Jul 11, 2017 at 05:32:40PM -0700, David Carrillo-Cisneros wrote:
> On Tue, Jun 13, 2017 at 11:54 AM, Jiri Olsa <jolsa@redhat.com> wrote:
> > On Mon, Jun 12, 2017 at 09:29:31PM -0700, David Carrillo-Cisneros wrote:
> >
> > SNIP
> >
> >>
> >>  void perf_event__print_totals(void);
> >> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> >> index ddfaf157913d..6f6a54c15cb0 100644
> >> --- a/tools/perf/util/header.c
> >> +++ b/tools/perf/util/header.c
> >> @@ -34,6 +34,7 @@
> >>  #include "data.h"
> >>  #include <api/fs/fs.h>
> >>  #include "asm/bug.h"
> >> +#include "tool.h"
> >>
> >>  #include "sane_ctype.h"
> >>
> >> @@ -97,11 +98,14 @@ static int __do_write_buf(struct feat_fd *ff,  const void *buf, size_t size)
> >>
> >>  retry:
> >>       if (size > (ff->size - ff->offset)) {
> >> -             addr = realloc(ff->buf, ff->size << 1);
> >> +             size = ff->size << 1;
> >> +             if (size > page_size)
> >
> > event size could be 0xffff - sizeof(struct perf_event_header)
> > also the initial size is most likely > page_size anyway
> >
> > please put this into the patch that introduced __do_write_buf
> >
> 
> Thank you for reviewing this. I just realized that I sent v5 without
> properly addressing this issue. In v4 I tried to add a quick check
> without properly understanding the issue. Why is 0xffff the maximum
> size for an event? where is this constraint coming from?

the struct perf_event_header::size is u16

jirka

[toc] | [prev] | [next] | [standalone]


#1689688

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-07-18 06:40 +0200
Message-ID<u4ssG-6bP-23@gated-at.bofh.it>
In reply to#1685569
On Wed, Jul 12, 2017 at 12:38 AM, Jiri Olsa <jolsa@redhat.com> wrote:
> On Tue, Jul 11, 2017 at 05:32:40PM -0700, David Carrillo-Cisneros wrote:
>> On Tue, Jun 13, 2017 at 11:54 AM, Jiri Olsa <jolsa@redhat.com> wrote:
>> > On Mon, Jun 12, 2017 at 09:29:31PM -0700, David Carrillo-Cisneros wrote:
>> >
>> > SNIP
>> >
>> >>
>> >>  void perf_event__print_totals(void);
>> >> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
>> >> index ddfaf157913d..6f6a54c15cb0 100644
>> >> --- a/tools/perf/util/header.c
>> >> +++ b/tools/perf/util/header.c
>> >> @@ -34,6 +34,7 @@
>> >>  #include "data.h"
>> >>  #include <api/fs/fs.h>
>> >>  #include "asm/bug.h"
>> >> +#include "tool.h"
>> >>
>> >>  #include "sane_ctype.h"
>> >>
>> >> @@ -97,11 +98,14 @@ static int __do_write_buf(struct feat_fd *ff,  const void *buf, size_t size)
>> >>
>> >>  retry:
>> >>       if (size > (ff->size - ff->offset)) {
>> >> -             addr = realloc(ff->buf, ff->size << 1);
>> >> +             size = ff->size << 1;
>> >> +             if (size > page_size)
>> >
>> > event size could be 0xffff - sizeof(struct perf_event_header)
>> > also the initial size is most likely > page_size anyway
>> >
>> > please put this into the patch that introduced __do_write_buf
>> >
>>
>> Thank you for reviewing this. I just realized that I sent v5 without
>> properly addressing this issue. In v4 I tried to add a quick check
>> without properly understanding the issue. Why is 0xffff the maximum
>> size for an event? where is this constraint coming from?
>
> the struct perf_event_header::size is u16

ok, it makes sense now. I submitted v6, hopefully handling the resize properly.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web