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: <20090417002831.GC20513@Krystal>
Date:	Thu, 16 Apr 2009 20:28:31 -0400
From:	Mathieu Desnoyers <compudj@...stal.dyndns.org>
To:	Jeremy Fitzhardinge <jeremy@...p.org>
Cc:	Steven Rostedt <rostedt@...dmis.org>, linux-kernel@...r.kernel.org,
	Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <peterz@...radead.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Theodore Tso <tytso@....edu>,
	Arjan van de Ven <arjan@...radead.org>,
	Christoph Hellwig <hch@....de>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	Zhaolei <zhaolei@...fujitsu.com>, Li Zefan <lizf@...fujitsu.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	Masami Hiramatsu <mhiramat@...hat.com>,
	"Frank Ch. Eigler" <fche@...stic.org>,
	Tom Zanussi <tzanussi@...il.com>,
	Jiaying Zhang <jiayingz@...gle.com>,
	Michael Rubin <mrubin@...gle.com>,
	Martin Bligh <mbligh@...gle.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Neil Horman <nhorman@...driver.com>,
	Eduard - Gabriel Munteanu <eduard.munteanu@...ux360.ro>,
	Pekka Enberg <penberg@...helsinki.fi>
Subject: Re: [PATCH 2/8] tracing: create automated trace defines

* Jeremy Fitzhardinge (jeremy@...p.org) wrote:
> Mathieu Desnoyers wrote:
>>> Are they?  They're generally considered to be "free", because the 
>>> call  and return are predicted 100% accurately.
>>>
>>>     
>>
>> Adding a simple function call within the tracer fast path, in LTTng, has
>> a very measurable performance impact on the tbench workload. This is why
>> I don't use any function call-based trace clocks in LTTng, but rather my
>> own inline trace clock.
>
> I'm a bit concerned about all the code that tracing puts inline though.   
> It seems it would put quite a lot of icache overhead on the codepath  
> when the tracepoint is disabled, not least because its duplicated in  
> every instance of the tracepoint.  And if the compiler decides to put  
> the unlikely() branch code out of line, then that's the same as making  
> it a function call (except that if it is a function call, all the  
> tracepoints will share the same code, and get a higher likelihood of  
> getting icache hits).
>

"all this code" is actually :

               rcu_read_lock_sched_notrace();                          \
                it_func = rcu_dereference((tp)->funcs);                 \
                if (it_func) {                                          \
                        do {                                            \
                                ((void(*)(proto))(*it_func))(args);     \
                        } while (*(++it_func));                         \
                }                                                       \
                rcu_read_unlock_sched_notrace();                        \

Which does nothing more than disabling preemption and a for loop to
call all the tracepoint handlers. I don't see the big win in laying out
the stack to call this code out-of-line; we would just remove the
preempt disable and the loop, which are minimal compared to most
call stacks.

So basically, tracepoints are already just doing a function call, with a
few more bytes for preempt disable and multiple handler support.

About the compiler deciding to put the unlikely branch out-of-line, I've
never seen any function calls generated just for the sake of saving
those few bytes, that would be crazy of the part of the compiler.
However, it can (and should) freely put the stack setup in the coldest
cache-lines possible, which are reachable by a near jump.

Mathieu

>
>    J
>

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
--
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