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]
Date:	Thu, 8 Dec 2011 14:06:48 -0800
From:	Stephane Eranian <eranian@...gle.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	linux-kernel@...r.kernel.org, mingo@...e.hu, acme@...hat.com,
	ming.m.lin@...el.com, andi@...stfloor.org, robert.richter@....com,
	ravitillo@....gov, will.deacon@....com, paulus@...ba.org,
	benh@...nel.crashing.org, rth@...ddle.net, ralf@...ux-mips.org,
	davem@...emloft.net, lethal@...ux-sh.org
Subject: Re: [PATCH 09/12] perf_events: add hook to flush branch_stack on
 context switch (v2)

On Thu, Dec 8, 2011 at 10:13 AM, Peter Zijlstra <peterz@...radead.org> wrote:
> On Thu, 2011-12-08 at 10:04 -0800, Stephane Eranian wrote:
>> The whole motivation behind the flush_branch_stack is explained in the
>> Changelog of the patch. In summary, we need to flush the LBR (regardless
>> of TOS) because in system-wide we need to be able to associate the content
>> of the LBR with a specific task. Given that the HW does not capture the PID
>> in the LBR buffer, the kernel has to intervene.
>
> That's not regardless of the TOS. If the TOS was a full u64 you wouldn't
> need the TID (which would be good, since the hardware has no such
> concept).
>
Maybe I missed the trick but I don't quite see how a 64-bit TOS would
solve the TID
problem. It's not about the wraparound issue, i.e., not like the
sampling buffer indexes.
Could you describe the trick again?

>> Why don't we have this already?
>> Because we are capturing at all priv levels. But with this patchset, it becomes
>> possible to filter taken branches based on priv levels. Thus, if you only sample
>> at the user level and run in system-wide mode, it is more likely you could end
>> up with branches belonging to two different tasks in the LBR buffer. But you'd
>> have no way of determining this just by looking at the content of the buffer.
>> So instead, we need to flush the LBR on context switch to associate a PID
>> with them.
>
> Yeah, I get that.
>
>> Because this is an expensive operation, we want to do this only when we
>> sample on LBR. That's what the ctx->nr_branch_stack is about. We could
>> refine that some more by checking for system-wide events with only
>> user priv level on the branch stack. But I did not do that yet.
>>
>> Does this make more sense now?
>
> It already did. The only thing I wanted to do was get rid of that method
> check. Initially I overlooked the fact that its optional, even if you
> support the branch stack. My reply from today argued for it, since
> installing a dummy method would still have the needless ctx_lock &&
> pmu_disable overhead.
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ