Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753264AbbGXKgf (ORCPT ); Fri, 24 Jul 2015 06:36:35 -0400 Received: from casper.infradead.org ([85.118.1.10]:33248 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751017AbbGXKga (ORCPT ); Fri, 24 Jul 2015 06:36:30 -0400 Date: Fri, 24 Jul 2015 12:36:09 +0200 From: Peter Zijlstra To: Borislav Petkov Cc: Steven Rostedt , Jason Baron , Andy Lutomirski , Thomas Gleixner , Mikulas Patocka , Paul Mackerras , Arnaldo Carvalho de Melo , Kees Cook , Andrea Arcangeli , Vince Weaver , "hillf.zj" , Valdis Kletnieks , "linux-kernel@vger.kernel.org" Subject: Re: Kernel broken on processors without performance counters Message-ID: <20150724103609.GE19282@twins.programming.kicks-ass.net> References: <20150721181553.GA3378@nazgul.tnic> <55AE9471.1000601@gmail.com> <20150722042403.GA6345@nazgul.tnic> <55AFCDA4.5010406@gmail.com> <20150723104215.GH25159@twins.programming.kicks-ass.net> <20150723113450.67db0152@gandalf.local.home> <20150723170811.GJ25159@twins.programming.kicks-ass.net> <20150723175436.GA12218@nazgul.tnic> <20150723190214.GK25159@twins.programming.kicks-ass.net> <20150724052905.GA17008@nazgul.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150724052905.GA17008@nazgul.tnic> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1538 Lines: 43 On Fri, Jul 24, 2015 at 07:29:05AM +0200, Borislav Petkov wrote: > On Thu, Jul 23, 2015 at 09:02:14PM +0200, Peter Zijlstra wrote: > > On Thu, Jul 23, 2015 at 07:54:36PM +0200, Borislav Petkov wrote: > > > On Thu, Jul 23, 2015 at 07:08:11PM +0200, Peter Zijlstra wrote: > > > > That would be bad, how can we force it to emit 5 bytes? > > > > > > .byte 0xe9 like we used to do in static_cpu_has_safe(). > > > > Like so then? > > > > static __always_inline bool arch_static_branch_jump(struct static_key *key, bool inv) > > { > > unsigned long kval = (unsigned long)key + inv; > > > > asm_volatile_goto("1:" > > ".byte 0xe9\n\t .long %l[l_yes]\n\t" > > ".pushsection __jump_table, \"aw\" \n\t" > > _ASM_ALIGN "\n\t" > > _ASM_PTR "1b, %l[l_yes], %c0 \n\t" > > ".popsection \n\t" > > : : "i" (kval) : : l_yes); > > > > return false; > > l_yes: > > return true; > > } > > Yap. > > But, we can do even better and note down what kind of JMP the compiler > generated and teach __jump_label_transform() to generate the right one. > Maybe this struct jump_entry would get a flags member or so. This way > we're optimal. > > Methinks... Yes, Jason and Steve already have patches to go do that, but I'd really like to keep that separate for now, this thing is big enough as is. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/