Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-29 Thread Peter Zijlstra
On Fri, Jun 28, 2019 at 11:44:16AM -0700, Nick Desaulniers wrote: > On Fri, Jun 28, 2019 at 6:31 AM Peter Zijlstra wrote: > > For those with interest; full patches at: > > > > https://lkml.kernel.org/r/20190628102113.360432...@infradead.org > > Do you have a branch pushed that I can pull this

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-28 Thread Nick Desaulniers
On Fri, Jun 28, 2019 at 6:31 AM Peter Zijlstra wrote: > > On Thu, Jun 27, 2019 at 09:12:50AM +0200, Peter Zijlstra wrote: > > > Josh came up with the following: > > > > + /* If the jump target is close, do a 2-byte nop: */ > > + ".skip -(%l[l_yes] - 1b <= 126), 0x66\n" > >

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-28 Thread Peter Zijlstra
On Thu, Jun 27, 2019 at 09:12:50AM +0200, Peter Zijlstra wrote: > Josh came up with the following: > > + /* If the jump target is close, do a 2-byte nop: */ > + ".skip -(%l[l_yes] - 1b <= 126), 0x66\n" > + ".skip -(%l[l_yes] - 1b <= 126), 0x90\n" > +

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-27 Thread Peter Zijlstra
On Wed, Jun 26, 2019 at 03:23:24PM -0700, Nick Desaulniers wrote: > On Wed, Jun 26, 2019 at 2:55 AM Peter Zijlstra wrote: > > > > On Wed, Jun 26, 2019 at 11:24:32AM +0200, Peter Zijlstra wrote: > > > That's pretty atrocious code-gen :/ > > > > And I know nobody reads comments (I don't either),

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-27 Thread Peter Zijlstra
On Wed, Jun 26, 2019 at 03:15:38PM -0700, Nick Desaulniers wrote: > On Wed, Jun 26, 2019 at 2:24 AM Peter Zijlstra wrote: > > > > On Tue, Jun 25, 2019 at 11:47:06PM +0200, Thomas Gleixner wrote: > > > > On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > > > > > > > but it also

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-27 Thread Peter Zijlstra
On Wed, Jun 26, 2019 at 03:14:05PM -0700, Nick Desaulniers wrote: > On Wed, Jun 26, 2019 at 1:49 AM Peter Zijlstra wrote: > > > > On Tue, Jun 25, 2019 at 11:15:57AM -0700, Nick Desaulniers wrote: > > > > > Unreleased versions of Clang built from source can; > > > > I've bad experiences with using

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-27 Thread Peter Zijlstra
On Wed, Jun 26, 2019 at 03:33:36PM -0700, Nick Desaulniers wrote: > On Wed, Jun 26, 2019 at 9:31 AM Peter Zijlstra wrote: > > > > On Tue, Jun 25, 2019 at 11:47:06PM +0200, Thomas Gleixner wrote: > > > > On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > > > > > > > but it also

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Thomas Gleixner
On Wed, 26 Jun 2019, Nick Desaulniers wrote: > On Wed, Jun 26, 2019 at 9:31 AM Peter Zijlstra wrote: > > On Tue, Jun 25, 2019 at 11:47:06PM +0200, Thomas Gleixner wrote: > > > I just checked two of them in the disassembly. In both cases it's jump > > > label related. Here is one: > > > > > >

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Nick Desaulniers
On Wed, Jun 26, 2019 at 9:31 AM Peter Zijlstra wrote: > > On Tue, Jun 25, 2019 at 11:47:06PM +0200, Thomas Gleixner wrote: > > > On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > > > > > but it also makes objtool unhappy: > > > > > arch/x86/kernel/cpu/mtrr/generic.o: warning:

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Nick Desaulniers
On Wed, Jun 26, 2019 at 2:55 AM Peter Zijlstra wrote: > > On Wed, Jun 26, 2019 at 11:24:32AM +0200, Peter Zijlstra wrote: > > That's pretty atrocious code-gen :/ > > And I know nobody reads comments (I don't either), but I did write one > on this as it happens. I've definitely read that block in

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Nick Desaulniers
On Wed, Jun 26, 2019 at 2:24 AM Peter Zijlstra wrote: > > On Tue, Jun 25, 2019 at 11:47:06PM +0200, Thomas Gleixner wrote: > > > On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > > > > > but it also makes objtool unhappy: > > > > > > > > arch/x86/events/intel/core.o: warning:

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Nick Desaulniers
On Wed, Jun 26, 2019 at 1:49 AM Peter Zijlstra wrote: > > On Tue, Jun 25, 2019 at 11:15:57AM -0700, Nick Desaulniers wrote: > > > Unreleased versions of Clang built from source can; > > I've bad experiences with using unreleased compilers; life is too short. Yes; but before release is when they

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Nathan Chancellor
On Wed, Jun 26, 2019 at 09:46:02PM +0200, Thomas Gleixner wrote: > On Wed, 26 Jun 2019, Nathan Chancellor wrote: > > On Wed, Jun 26, 2019 at 05:18:37PM +0200, Thomas Gleixner wrote: > > > tarball with log and the preprocessed source and run scripts: > > > > > >

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Thomas Gleixner
On Wed, 26 Jun 2019, Nathan Chancellor wrote: > On Wed, Jun 26, 2019 at 05:18:37PM +0200, Thomas Gleixner wrote: > > tarball with log and the preprocessed source and run scripts: > > > > https://tglx.de/~tglx/tc-crash.tar.bz2 > > > > The machine runs up to date debian stretch which has

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Nathan Chancellor
On Wed, Jun 26, 2019 at 05:18:37PM +0200, Thomas Gleixner wrote: > tarball with log and the preprocessed source and run scripts: > > https://tglx.de/~tglx/tc-crash.tar.bz2 > > The machine runs up to date debian stretch which has backports enabled and > I just used the install command from

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Peter Zijlstra
On Tue, Jun 25, 2019 at 11:47:06PM +0200, Thomas Gleixner wrote: > > On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > > > but it also makes objtool unhappy: > > > arch/x86/kernel/cpu/mtrr/generic.o: warning: objtool: > > > get_fixed_ranges()+0x9b: unreachable instruction > I

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Thomas Gleixner
On Tue, 25 Jun 2019, Nathan Chancellor wrote: > On Tue, Jun 25, 2019 at 11:47:06PM +0200, Thomas Gleixner wrote: > > On Tue, 25 Jun 2019, Nathan Chancellor wrote: > > > On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > > > > > > > > But can the script please check for a minimal

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Peter Zijlstra
On Wed, Jun 26, 2019 at 11:24:32AM +0200, Peter Zijlstra wrote: > That is, would something like this: > > diff --git a/arch/x86/include/asm/jump_label.h > b/arch/x86/include/asm/jump_label.h > index 06c3cc22a058..1761b1e76ddc 100644 > --- a/arch/x86/include/asm/jump_label.h > +++

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Peter Zijlstra
On Wed, Jun 26, 2019 at 11:24:32AM +0200, Peter Zijlstra wrote: > On Tue, Jun 25, 2019 at 11:47:06PM +0200, Thomas Gleixner wrote: > > > On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > > > > > but it also makes objtool unhappy: > > > > > > > > arch/x86/events/intel/core.o:

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Peter Zijlstra
On Tue, Jun 25, 2019 at 11:47:06PM +0200, Thomas Gleixner wrote: > > On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > > > but it also makes objtool unhappy: > > > > > > arch/x86/events/intel/core.o: warning: objtool: > > > intel_pmu_nhm_workaround()+0xb3: unreachable

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Peter Zijlstra
On Tue, Jun 25, 2019 at 11:15:57AM -0700, Nick Desaulniers wrote: > Unreleased versions of Clang built from source can; I've bad experiences with using unreleased compilers; life is too short. > We're currently planning multiple output constraint support w/ asm > goto, and have recently

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-26 Thread Peter Zijlstra
On Tue, Jun 25, 2019 at 10:12:42AM -0700, Kees Cook wrote: > On Tue, Jun 25, 2019 at 09:18:46AM +0200, Peter Zijlstra wrote: > > Can it build a kernel without patches yet? That is, why should I care > > what LLVM does? > > Yes. LLVM trunk builds and boots x86 now. As for distro availability, If

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Nathan Chancellor
On Tue, Jun 25, 2019 at 08:46:26PM -0300, Arnaldo Carvalho de Melo wrote: > Em Tue, Jun 25, 2019 at 01:27:46PM -0700, Nathan Chancellor escreveu: > > On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > > > On Tue, 25 Jun 2019, Nathan Chancellor wrote: > > > > On Tue, Jun 25, 2019 at

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Nathan Chancellor
On Tue, Jun 25, 2019 at 11:47:06PM +0200, Thomas Gleixner wrote: > On Tue, 25 Jun 2019, Nathan Chancellor wrote: > > On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > > > > > > But can the script please check for a minimal clang version required to > > > build that thing. > > >

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Arnaldo Carvalho de Melo
Em Tue, Jun 25, 2019 at 01:27:46PM -0700, Nathan Chancellor escreveu: > On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > > On Tue, 25 Jun 2019, Nathan Chancellor wrote: > > > On Tue, Jun 25, 2019 at 10:12:42AM -0700, Kees Cook wrote: > > > > On Tue, Jun 25, 2019 at 09:18:46AM

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Joe Perches
On Tue, 2019-06-25 at 15:57 -0700, Nick Desaulniers wrote: > consider most other GNU C extensions. How do I > test whether they exist in my compiler or not? Is it everything or > nothing (do they all have to exist?). Until such time as the linux source code supports alternate mechanisms for

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Nick Desaulniers
On Tue, Jun 25, 2019 at 3:29 PM Joe Perches wrote: > > On Tue, 2019-06-25 at 11:15 -0700, Nick Desaulniers wrote: > > Unreleased versions of Clang built from source can; the latest release > > of Clang-8 doesn't have asm goto support required for > > CONFIG_JUMP_LABEL. Things can get complicated

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Joe Perches
On Tue, 2019-06-25 at 11:15 -0700, Nick Desaulniers wrote: > Unreleased versions of Clang built from source can; the latest release > of Clang-8 doesn't have asm goto support required for > CONFIG_JUMP_LABEL. Things can get complicated based on which kernel > tree/branch (mainline, -next,

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Thomas Gleixner
Nathan, On Tue, 25 Jun 2019, Nathan Chancellor wrote: > On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > > > > But can the script please check for a minimal clang version required to > > build that thing. > > > > The default clang-3.8 which is installed on Debian stretch

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Nick Desaulniers
On Tue, Jun 25, 2019 at 1:27 PM Nathan Chancellor wrote: > On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > > On Tue, 25 Jun 2019, Nathan Chancellor wrote: > > > On Tue, Jun 25, 2019 at 10:12:42AM -0700, Kees Cook wrote: > > > > On Tue, Jun 25, 2019 at 09:18:46AM +0200, Peter

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Nathan Chancellor
Hi Thomas, On Tue, Jun 25, 2019 at 09:53:09PM +0200, Thomas Gleixner wrote: > On Tue, 25 Jun 2019, Nathan Chancellor wrote: > > On Tue, Jun 25, 2019 at 10:12:42AM -0700, Kees Cook wrote: > > > On Tue, Jun 25, 2019 at 09:18:46AM +0200, Peter Zijlstra wrote: > > > > Can it build a kernel without

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Kees Cook
On Tue, Jun 25, 2019 at 11:05:25AM -0700, Nathan Chancellor wrote: > On Tue, Jun 25, 2019 at 10:12:42AM -0700, Kees Cook wrote: > > On Tue, Jun 25, 2019 at 09:18:46AM +0200, Peter Zijlstra wrote: > > > Can it build a kernel without patches yet? That is, why should I care > > > what LLVM does? > >

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Thomas Gleixner
On Tue, 25 Jun 2019, Nathan Chancellor wrote: > On Tue, Jun 25, 2019 at 10:12:42AM -0700, Kees Cook wrote: > > On Tue, Jun 25, 2019 at 09:18:46AM +0200, Peter Zijlstra wrote: > > > Can it build a kernel without patches yet? That is, why should I care > > > what LLVM does? > > > > Yes. LLVM trunk

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Nick Desaulniers
On Tue, Jun 25, 2019 at 5:47 AM Miguel Ojeda wrote: > > On Tue, Jun 25, 2019 at 9:19 AM Peter Zijlstra wrote: > > > > Can it build a kernel without patches yet? That is, why should I care > > what LLVM does? Unreleased versions of Clang built from source can; the latest release of Clang-8

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Nathan Chancellor
On Tue, Jun 25, 2019 at 10:12:42AM -0700, Kees Cook wrote: > On Tue, Jun 25, 2019 at 09:18:46AM +0200, Peter Zijlstra wrote: > > Can it build a kernel without patches yet? That is, why should I care > > what LLVM does? > > Yes. LLVM trunk builds and boots x86 now. As for distro availability, >

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Kees Cook
On Tue, Jun 25, 2019 at 09:18:46AM +0200, Peter Zijlstra wrote: > Can it build a kernel without patches yet? That is, why should I care > what LLVM does? Yes. LLVM trunk builds and boots x86 now. As for distro availability, AIUI, the asm-goto feature missed the 9.0 LLVM branch point, so it'll

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Miguel Ojeda
On Tue, Jun 25, 2019 at 9:19 AM Peter Zijlstra wrote: > > Can it build a kernel without patches yet? That is, why should I care > what LLVM does? Having more than a single compiler is always a good idea. You benefit from more warnings, more tooling, a second implementation for

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Peter Zijlstra
On Mon, Jun 24, 2019 at 01:57:49PM -0700, Joe Perches wrote: > > Once the C++17 `__attribute__((fallthrough))` is more widely handled by C > > compilers, > I doubt waiting is better. > If the latest compilers catch it, it's > probably good enough. Yeah, I don't see the point either; GCC does

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Peter Zijlstra
On Tue, Jun 25, 2019 at 12:28:23AM +0200, Miguel Ojeda wrote: > On Mon, Jun 24, 2019 at 10:53 PM Gustavo A. R. Silva > wrote: > > > > Once the C++17 `__attribute__((fallthrough))` is more widely handled by C > > compilers, > > static analyzers, and IDEs, we can switch to using that instead.

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-25 Thread Peter Zijlstra
On Mon, Jun 24, 2019 at 03:53:04PM -0500, Gustavo A. R. Silva wrote: > Once the C++17 `__attribute__((fallthrough))` is more widely handled by C > compilers, >From what I read that attribute landed in the exact same GCC version as the warning. And last I checked clang wasn't there yet anyway. >

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-24 Thread Miguel Ojeda
On Mon, Jun 24, 2019 at 10:53 PM Gustavo A. R. Silva wrote: > > Once the C++17 `__attribute__((fallthrough))` is more widely handled by C > compilers, > static analyzers, and IDEs, we can switch to using that instead. Also, we are > a few > warnings away (less than five) from being able to

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-24 Thread Joe Perches
On Mon, 2019-06-24 at 15:53 -0500, Gustavo A. R. Silva wrote: > On 6/24/19 3:37 PM, Peter Zijlstra wrote: > > On Mon, Jun 24, 2019 at 12:45:54PM -0700, Joe Perches wrote: > > > On Mon, 2019-06-24 at 21:31 +0200, Peter Zijlstra wrote: > > > > I still consider it an abomination that the C parser

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-24 Thread Gustavo A. R. Silva
On 6/24/19 3:37 PM, Peter Zijlstra wrote: > On Mon, Jun 24, 2019 at 12:45:54PM -0700, Joe Perches wrote: >> On Mon, 2019-06-24 at 21:31 +0200, Peter Zijlstra wrote: >>> On Mon, Jun 24, 2019 at 11:19:13AM -0500, Gustavo A. R. Silva wrote: In preparation to enabling -Wimplicit-fallthrough,

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-24 Thread Peter Zijlstra
On Mon, Jun 24, 2019 at 12:45:54PM -0700, Joe Perches wrote: > On Mon, 2019-06-24 at 21:31 +0200, Peter Zijlstra wrote: > > On Mon, Jun 24, 2019 at 11:19:13AM -0500, Gustavo A. R. Silva wrote: > > > In preparation to enabling -Wimplicit-fallthrough, mark switch > > > cases where we are expecting

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-24 Thread Joe Perches
On Mon, 2019-06-24 at 21:31 +0200, Peter Zijlstra wrote: > On Mon, Jun 24, 2019 at 11:19:13AM -0500, Gustavo A. R. Silva wrote: > > In preparation to enabling -Wimplicit-fallthrough, mark switch > > cases where we are expecting to fall through. > > > > This patch fixes the following warnings: > >

Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-24 Thread Peter Zijlstra
On Mon, Jun 24, 2019 at 11:19:13AM -0500, Gustavo A. R. Silva wrote: > In preparation to enabling -Wimplicit-fallthrough, mark switch > cases where we are expecting to fall through. > > This patch fixes the following warnings: > > arch/x86/events/intel/core.c: In function ‘intel_pmu_init’: >

[PATCH] perf/x86/intel: Mark expected switch fall-throughs

2019-06-24 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. This patch fixes the following warnings: arch/x86/events/intel/core.c: In function ‘intel_pmu_init’: arch/x86/events/intel/core.c:4959:8: warning: this statement may fall through