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]
Message-ID: <9f8f8b08-04f5-38af-bb03-e86ac8d67d01@linux.intel.com>
Date:   Mon, 20 Dec 2021 12:49:25 +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 v12 05/16] perf record: Introduce thread local variable


On 05.12.2021 18:14, Jiri Olsa wrote:
> On Tue, Nov 23, 2021 at 05:08:01PM +0300, Alexey Bayduraev wrote:
> 
> SNIP
> 
>>  
>> +	if (record__start_threads(rec))
>> +		goto out_free_threads;
>> +
>>  	/*
>>  	 * When perf is starting the traced process, all the events
>>  	 * (apart from group members) have enable_on_exec=1 set,
>> @@ -2122,7 +2175,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>>  	trigger_ready(&switch_output_trigger);
>>  	perf_hooks__invoke_record_start();
>>  	for (;;) {
>> -		unsigned long long hits = rec->samples;
>> +		unsigned long long hits = thread->samples;
>>  
>>  		/*
>>  		 * rec->evlist->bkw_mmap_state is possible to be
>> @@ -2176,8 +2229,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>>  
>>  			if (!quiet)
>>  				fprintf(stderr, "[ perf record: dump data: Woken up %ld times ]\n",
>> -					waking);
>> -			waking = 0;
>> +					record__waking(rec));
>> +			thread->waking = 0;
>>  			fd = record__switch_output(rec, false);
>>  			if (fd < 0) {
>>  				pr_err("Failed to switch to new file\n");
>> @@ -2191,20 +2244,24 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>>  				alarm(rec->switch_output.time);
>>  		}
>>  
>> -		if (hits == rec->samples) {
>> +		if (hits == thread->samples) {
>>  			if (done || draining)
>>  				break;
>> -			err = evlist__poll(rec->evlist, -1);
>> +			err = fdarray__poll(&thread->pollfd, -1);
>>  			/*
>>  			 * Propagate error, only if there's any. Ignore positive
>>  			 * number of returned events and interrupt error.
>>  			 */
>>  			if (err > 0 || (err < 0 && errno == EINTR))
>>  				err = 0;
>> -			waking++;
>> +			thread->waking++;
>>  
>> -			if (evlist__filter_pollfd(rec->evlist, POLLERR | POLLHUP) == 0)
>> +			if (fdarray__filter(&thread->pollfd, POLLERR | POLLHUP,
>> +					    record__thread_munmap_filtered, NULL) == 0)
>>  				draining = true;
>> +
>> +			evlist__ctlfd_update(rec->evlist,
>> +				&thread->pollfd.entries[thread->ctlfd_pos]);
> 
> hm, why is this needed? we only switch to record_thread data, right?
> there should not be any processing change

Hi,

This is necessary to propagate ctlfd events from thread->pollfd to rec->evlist
to enable evlist__ctlfd_*() functionality, see [PATCH v12 04/16].
I will add explanations to the description of the patch.

Regards,
Alexey

> 
> jirka
> 
>>  		}
>>  
>>  		if (evlist__ctlfd_process(rec->evlist, &cmd) > 0) {
>> @@ -2258,15 +2315,18 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>>  	}
>>  
>>  	if (!quiet)
>> -		fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking);
>> +		fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n",
>> +			record__waking(rec));
>>  
>>  	if (target__none(&rec->opts.target))
>>  		record__synthesize_workload(rec, true);
>>  
>>  out_child:
>> -	evlist__finalize_ctlfd(rec->evlist);
>> +	record__stop_threads(rec);
>>  	record__mmap_read_all(rec, true);
>> +out_free_threads:
>>  	record__free_thread_data(rec);
>> +	evlist__finalize_ctlfd(rec->evlist);
>>  	record__aio_mmap_read_sync(rec);
>>  
>>  	if (rec->session->bytes_transferred && rec->session->bytes_compressed) {
>> @@ -3158,17 +3218,6 @@ int cmd_record(int argc, const char **argv)
>>  
>>  	symbol__init(NULL);
>>  
>> -	if (rec->opts.affinity != PERF_AFFINITY_SYS) {
>> -		rec->affinity_mask.nbits = cpu__max_cpu();
>> -		rec->affinity_mask.bits = bitmap_zalloc(rec->affinity_mask.nbits);
>> -		if (!rec->affinity_mask.bits) {
>> -			pr_err("Failed to allocate thread mask for %zd cpus\n", rec->affinity_mask.nbits);
>> -			err = -ENOMEM;
>> -			goto out_opts;
>> -		}
>> -		pr_debug2("thread mask[%zd]: empty\n", rec->affinity_mask.nbits);
>> -	}
>> -
>>  	err = record__auxtrace_init(rec);
>>  	if (err)
>>  		goto out;
>> @@ -3313,7 +3362,6 @@ int cmd_record(int argc, const char **argv)
>>  
>>  	err = __cmd_record(&record, argc, argv);
>>  out:
>> -	bitmap_free(rec->affinity_mask.bits);
>>  	evlist__delete(rec->evlist);
>>  	symbol__exit();
>>  	auxtrace_record__free(rec->itr);
>> -- 
>> 2.19.0
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ