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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 20 Sep 2021 15:54:33 +0300
From:   "Bayduraev, Alexey V" <alexey.v.bayduraev@...ux.intel.com>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Andi Kleen <ak@...ux.intel.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Alexander Antonov <alexander.antonov@...ux.intel.com>,
        Alexei Budankov <abudankov@...wei.com>,
        Riccardo Mancini <rickyman7@...il.com>
Subject: Re: [PATCH v11 09/24] perf record: Introduce bytes written stats to
 support --max-size option


On 12.09.2021 23:46, Jiri Olsa wrote:
> On Tue, Aug 17, 2021 at 11:23:12AM +0300, Alexey Bayduraev wrote:

<SNIP>

>>  static bool record__output_max_size_exceeded(struct record *rec)
>>  {
>>  	return rec->output_max_size &&
>> -	       (rec->bytes_written >= rec->output_max_size);
>> +	       (record__bytes_written(rec) >= rec->output_max_size);
>>  }
>>  
>>  static int record__write(struct record *rec, struct mmap *map __maybe_unused,
>> @@ -205,15 +223,21 @@ static int record__write(struct record *rec, struct mmap *map __maybe_unused,
>>  		return -1;
>>  	}
>>  
>> -	rec->bytes_written += size;
>> +	if (map && map->file)
>> +		map->bytes_written += size;
> 
> could we instead have bytes_written in thread data? so we don't
> need to iterate all the maps?

Hi,

As I remember the main issue is that bytes_written should be atomic64_t.
Unfortunately we don't have atomic64 framework in tools/lib (even 
atomic32_add is missing). Thus I decided to calculate total size on each 
iteration. But I think your suggestion to move record__output_max_size_exceeded 
to trigger framework is better.

> 
>> +	else
>> +		rec->bytes_written += size;
>>  
>>  	if (record__output_max_size_exceeded(rec) && !done) {
>>  		fprintf(stderr, "[ perf record: perf size limit reached (%" PRIu64 " KB),"
>>  				" stopping session ]\n",
>> -				rec->bytes_written >> 10);
>> +				record__bytes_written(rec) >> 10);
> 
> you're calling record__bytes_written twice.. could we just save the
> bytes_written from the first call and use it in the printf?
> 
>>  		done = 1;
>>  	}
>>  
>> +	if (map && map->file)
>> +		return 0;
> 
> please make comment why quit in here, we don't support switch-output for
> threads?

Yes, parallel streaming mode doesn't support switch-output and there is 
a special warning in [PATCH v11 14/24]

Thanks,
Alexey


> 
> jirka
> 
>> +
>>  	if (switch_output_size(rec))
>>  		trigger_hit(&switch_output_trigger);
>>  
>> diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h
>> index c4aed6e89549..67d41003d82e 100644
>> --- a/tools/perf/util/mmap.h
>> +++ b/tools/perf/util/mmap.h
>> @@ -46,6 +46,7 @@ struct mmap {
>>  	int		comp_level;
>>  	struct perf_data_file *file;
>>  	struct zstd_data      zstd_data;
>> +	u64		      bytes_written;
>>  };
>>  
>>  struct mmap_params {
>> -- 
>> 2.19.0
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ