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] [thread-next>] [day] [month] [year] [list]
Message-ID: <2199C5F6-31A9-46F1-8656-F63087F2C67C@fb.com>
Date:   Thu, 30 Aug 2018 18:51:07 +0000
From:   Song Liu <songliubraving@...com>
To:     Jiri Olsa <jolsa@...hat.com>
CC:     lkml <linux-kernel@...r.kernel.org>,
        "lkp@...el.com" <lkp@...el.com>, Kernel Team <Kernel-team@...com>,
        Tejun Heo <tj@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Jiri Olsa <jolsa@...nel.org>,
        Alexey Budankov <alexey.budankov@...ux.intel.com>
Subject: Re: [PATCH v2 1/1] perf: Sharing PMU counters across compatible
 events



> On Aug 30, 2018, at 8:18 AM, Jiri Olsa <jolsa@...hat.com> wrote:
> 
> On Wed, Aug 15, 2018 at 10:03:13AM -0700, Song Liu wrote:
> 
> SNIP
> 
>> @@ -6100,7 +6333,7 @@ static void perf_output_read_group(struct perf_output_handle *handle,
>> 
>> 		if ((sub != event) &&
>> 		    (sub->state == PERF_EVENT_STATE_ACTIVE))
>> -			sub->pmu->read(sub);
>> +			event_pmu_read(sub);
>> 
>> 		values[n++] = perf_event_count(sub);
>> 		if (read_format & PERF_FORMAT_ID)
>> @@ -9109,7 +9342,7 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
>> 	if (event->state != PERF_EVENT_STATE_ACTIVE)
>> 		return HRTIMER_NORESTART;
>> 
>> -	event->pmu->read(event);
>> +	event_pmu_read(event);
>> 
>> 	perf_sample_data_init(&data, 0, event->hw.last_period);
>> 	regs = get_irq_regs();
>> @@ -10504,6 +10737,14 @@ SYSCALL_DEFINE5(perf_event_open,
>> 		goto err_cred;
>> 	}
>> 
>> +	if (perf_event_can_share(event)) {
>> +		event->tmp_master = perf_event_alloc(&event->attr, cpu,
>> +						     task, NULL, NULL,
>> +						     NULL, NULL, -1);
> 
> can't get around this.. I understand the need, but AFAICS you allocate
> the whole 'struct perf_event', just because there's count field in it
> otherwise the 'struct hw_perf_event' should be enough to carry all that's
> needed to read hw event
> 
> would it be better to move the count to 'struct hw_perf_event' and use
> that instead? assuming I'm not missing anything..
> 
> jirka

I am trying to make the master event function the same as a real event, 
while keep dup events as followers. This avoids "switching master" in 
earlier versions (and Tejun's RFC). 

I also read your version that does it at hardware level, and found it 
simplifies some parts of the change. I picked current approach mostly 
because this approach keeps all logic about PMU sharing in one place, 
and the rest of the perf subsystem can stay as-is. If this approach 
doesn't work out, I will probably try the hardware level approach.

Thanks,
Song


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ