[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87o9lkjf3w.fsf@linux.intel.com>
Date: Tue, 23 Jan 2018 16:05:23 -0800
From: Andi Kleen <ak@...ux.intel.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: David Woodhouse <dwmw2@...radead.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
KarimAllah Ahmed <karahmed@...zon.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Andy Lutomirski <luto@...nel.org>,
Arjan van de Ven <arjan@...ux.intel.com>,
Ashok Raj <ashok.raj@...el.com>,
Asit Mallick <asit.k.mallick@...el.com>,
Borislav Petkov <bp@...e.de>,
Dan Williams <dan.j.williams@...el.com>,
Dave Hansen <dave.hansen@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"H . Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Janakarajan Natarajan <Janakarajan.Natarajan@....com>,
Joerg Roedel <joro@...tes.org>,
Jun Nakajima <jun.nakajima@...el.com>,
Laura Abbott <labbott@...hat.com>
Subject: Re: [RFC 09/10] x86/enter: Create macros to restrict/unrestrict Indirect Branch Speculation
Ingo Molnar <mingo@...nel.org> writes:
>
> Is there any reason why this wouldn't work?
To actually maintain the true call depth you would need to intercept the
return of the function too, because the counter has to be decremented
at the end of the function.
Plain ftrace cannot do that because it only intercepts the function
entry.
The function graph tracer can do this, but only at the cost of
overwriting the return address (and saving return in a special stack)
This always causes a mispredict on every return, and other
overhead, and is one of the reasons why function graph
is so much slower than the plain function tracer.
I suspect the overhead would be significant.
To make your scheme work efficiently work likely we would
need custom gcc instrumentation for the returns.
FWIW our plan was to add enough manual stuffing at strategic
points, until we're sure enough of good enough coverage.
-Andi
Powered by blists - more mailing lists