Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753461AbbGXK4K (ORCPT ); Fri, 24 Jul 2015 06:56:10 -0400 Received: from casper.infradead.org ([85.118.1.10]:34003 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751109AbbGXK4I (ORCPT ); Fri, 24 Jul 2015 06:56:08 -0400 Date: Fri, 24 Jul 2015 12:56:02 +0200 From: Peter Zijlstra To: Jason Baron Cc: Borislav Petkov , 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" , Steven Rostedt Subject: Re: Kernel broken on processors without performance counters Message-ID: <20150724105602.GF19282@twins.programming.kicks-ass.net> References: <20150721161215.GU19282@twins.programming.kicks-ass.net> <20150721181553.GA3378@nazgul.tnic> <55AE9471.1000601@gmail.com> <20150722042403.GA6345@nazgul.tnic> <55AFCDA4.5010406@gmail.com> <20150723104215.GH25159@twins.programming.kicks-ass.net> <55B0F808.2060302@gmail.com> <20150723143308.GD19282@twins.programming.kicks-ass.net> <20150723144930.GK18673@twins.programming.kicks-ass.net> <55B13D05.9050304@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55B13D05.9050304@gmail.com> 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: 1171 Lines: 28 On Thu, Jul 23, 2015 at 03:14:13PM -0400, Jason Baron wrote: > > +static enum jump_label_type jump_label_type(struct jump_entry *entry) > > +{ > > + struct static_key *key = static_key_cast(iter->key); > > + bool true_branch = jump_label_get_branch_default(key); > > + bool state = static_key_enabled(key); > > + bool inv = static_key_inv(iter->key); > > + > > + return (true_branch ^ state) ^ inv; > > iiuc...this allows both the old style keys to co-exist with the > new ones. IE state wouldn't be set for the new ones. And inv > shouldn't be set for the old ones. Is that correct? @state is the dynamic variable here, the other two are compile time. @true_branch denotes the default (compile time) value, and @inv denotes the (compile time) branch preference. So @state will still be set for the new ones, but you're right in that @inv will not be set for the 'legacy' stuff. This one little line needs a big comment. -- 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/