Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752524AbbG2Gnf (ORCPT ); Wed, 29 Jul 2015 02:43:35 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:41619 "EHLO e06smtp10.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751891AbbG2Gnd (ORCPT ); Wed, 29 Jul 2015 02:43:33 -0400 X-Helo: d06dlp01.portsmouth.uk.ibm.com X-MailFrom: heiko.carstens@de.ibm.com X-RcptTo: linux-kernel@vger.kernel.org Date: Wed, 29 Jul 2015 08:43:22 +0200 From: Heiko Carstens To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jasonbaron0@gmail.com, bp@alien8.de, luto@amacapital.net, tglx@linutronix.de, rostedt@goodmis.org, will.deacon@arm.com, liuj97@gmail.com, rabin@rab.in, ralf@linux-mips.org, ddaney@caviumnetworks.com, benh@kernel.crashing.org, michael@ellerman.id.au, davem@davemloft.net, vbabka@suse.cz Subject: Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Message-ID: <20150729064322.GA3953@osiris> References: <20150728132055.203176565@infradead.org> <20150728132313.164884020@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150728132313.164884020@infradead.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15072906-0041-0000-0000-00000514C16F Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2149 Lines: 59 On Tue, Jul 28, 2015 at 03:21:01PM +0200, Peter Zijlstra wrote: > There are various problems and short-comings with the current > static_key interface: > > - static_key_{true,false}() read like a branch depending on the key > value, instead of the actual likely/unlikely branch depending on > init value. > > - static_key_{true,false}() are, as stated above, tied to the > static_key init values STATIC_KEY_INIT_{TRUE,FALSE}. > > - we're limited to the 2 (out of 4) possible options that compile to > a default NOP because that's what our arch_static_branch() assembly > emits. > > So provide a new static_key interface: > > DEFINE_STATIC_KEY_TRUE(name); > DEFINE_STATIC_KEY_FALSE(name); > > Which define a key of different types with an initial true/false > value. > > Then allow: > > static_branch_likely() > static_branch_unlikely() > > to take a key of either type and emit the right instruction for the > case. > > This means adding a second arch_static_branch_jump() assembly helper > which emits a JMP per default. > > In order to determine the right instruction for the right state, > encode the branch type in the LSB of jump_entry::key. > > Signed-off-by: Peter Zijlstra (Intel) > --- > arch/arm/include/asm/jump_label.h | 24 +++-- > arch/arm64/include/asm/jump_label.h | 18 +++- > arch/mips/include/asm/jump_label.h | 19 ++++ > arch/powerpc/include/asm/jump_label.h | 19 ++++ > arch/s390/include/asm/jump_label.h | 19 ++++ > arch/sparc/include/asm/jump_label.h | 35 ++++++-- > arch/x86/include/asm/jump_label.h | 21 ++++ > include/linux/jump_label.h | 143 ++++++++++++++++++++++++++++++++-- > kernel/jump_label.c | 35 ++++++-- > 9 files changed, 294 insertions(+), 39 deletions(-) for the s390 part: Acked-by: Heiko Carstens -- 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/