lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 15 Nov 2019 20:09:19 +0300
From:   Alexey Budankov <alexey.budankov@...ux.intel.com>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Ingo Molnar <mingo@...hat.com>,
        Andi Kleen <ak@...ux.intel.com>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1] perf session: fix decompression of
 PERF_RECORD_COMPRESSED records


On 15.11.2019 18:11, Jiri Olsa wrote:
> On Fri, Nov 15, 2019 at 12:05:14PM +0300, Alexey Budankov wrote:
<SNIP>
>> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
>> index f07b8ecb91bc..3f6f812ec4ed 100644
>> --- a/tools/perf/util/session.c
>> +++ b/tools/perf/util/session.c
>> @@ -1957,9 +1957,31 @@ static int __perf_session__process_pipe_events(struct perf_session *session)
>>  	return err;
>>  }
>>  
>> +static union perf_event *
>> +prefetch_event(char *buf, u64 head, size_t mmap_size,
>> +	       bool needs_swap, union perf_event *ret);
> 
> why not move prefetch_event definition in here?
> I don't see any need for the static declaration..

It is just for the sake of more readable patch formatting 
and, yes, could be avoided and replaced by the definition.

> 
>> +
>>  static union perf_event *
>>  fetch_mmaped_event(struct perf_session *session,
>>  		   u64 head, size_t mmap_size, char *buf)
>> +{
>> +	return prefetch_event(buf, head, mmap_size,
>> +			      session->header.needs_swap,
>> +			      ERR_PTR(-EINVAL));
>> +}
>> +
>> +static union perf_event *
>> +fetch_decomp_event(struct perf_session *session,
>> +		   u64 head, size_t mmap_size, char *buf)
>> +{
> 
> if this is decomp specific, it could take 'struct decomp*' as argument

Well, it makes sense. whole session object is not required here.
Just session->header.needs_swap could be passed as a param.
Shall we make it like this?

static union perf_event * 
fetch_decomp_event(u64 head, size_t mmap_size, char *buf, bool needs_swap)

> 
>> +	return prefetch_event(buf, head, mmap_size,
>> +			      session->header.needs_swap,
>> +			      NULL);
>> +}
>> +
>> +static union perf_event *
>> +prefetch_event(char *buf, u64 head, size_t mmap_size,
>> +	       bool needs_swap, union perf_event *ret)
>>  {
> 
> 'error' might be more suitable then ret in here

Accepted for v2.

~Alexey

> 
> thanks,
> jirka
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ