Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3517754ybi; Mon, 10 Jun 2019 11:35:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzip4dmw6fMmiE755fiUjMlUoTHDoFRbE4ipGs0qiS3rStdr9u1IOWP6wzMJj+x4uZk8ayp X-Received: by 2002:a17:902:8a87:: with SMTP id p7mr55066141plo.124.1560191725855; Mon, 10 Jun 2019 11:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560191725; cv=none; d=google.com; s=arc-20160816; b=C8503IhhxOUKF7iGTEQEnPgMOtMIwod430bIUFytBLcY4DikdONetxK/d/r12JxtXm +GUY/4yCFSd3kXXgbiFqa9BUPmEFWfXkEsPZNionSNypdM+qaicHpmtN6nUjHFVSaD5P TTZLhVjP2jKcNmWGB/EbP9MYo5KqFfTXkJTdD/Q6qzEC/6fzcGOTsFenvLQRjtvkZvC5 fBXHSim0wOIppj9eg9V2l2/wiwIdXF8OjWiFG4gnt3wbQ7xfSirpBzh9u7WCva3hLTGM 0Ei0S+ZC0la6YuDyTTWtBLJM/AwAwAfVFa0ZWtPd4z85RajiBoGGv69eQDatvzRz/afs YpgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=xP8YIx4eBoKaPTzSKYpNsuWVh/x/YK5ss3hjHZFTcMY=; b=whuNkfKEPjiclieCxcHcMbUWtkFgb7OLcERmDj2KmEmHx4VCMLSQtPbFSFzowHRhVf 1GEExpCbvqUg4yyAZN4jdnv7/23nevwyTYF7dctFB05b4eY3wBlkne8l9NOilO4KV70h QXAmA1f1+gcbV+F96yGyc0vkLFVIgAYP8qUEyQH2E5RWhySoFIlqLbaZyuOZKou2JxsR YKJZfTobpPxPnz1LTsBKOHjXbTGfQcA9kvi4Aaw6SNGYU0l12e1y5XJAqUEYfgmrjXKD wXGv5aA1u8hGFM/wv9gDH6r4k/sz6phJSMns5uo0HrLkANeajfMOrlfue0QJrnV+IXcb WYcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3si103021pjk.86.2019.06.10.11.35.11; Mon, 10 Jun 2019 11:35:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387638AbfFJSea (ORCPT + 99 others); Mon, 10 Jun 2019 14:34:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46192 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726214AbfFJSea (ORCPT ); Mon, 10 Jun 2019 14:34:30 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 66615C18B2E5; Mon, 10 Jun 2019 18:34:29 +0000 (UTC) Received: from treble (ovpn-121-189.rdu2.redhat.com [10.10.121.189]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 67EC419C59; Mon, 10 Jun 2019 18:34:07 +0000 (UTC) Date: Mon, 10 Jun 2019 13:33:57 -0500 From: Josh Poimboeuf To: Peter Zijlstra Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Ard Biesheuvel , Andy Lutomirski , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov , Julia Cartwright , Jessica Yu , "H. Peter Anvin" , Nadav Amit , Rasmus Villemoes , Edward Cree , Daniel Bristot de Oliveira Subject: Re: [PATCH 13/15] x86/static_call: Add inline static call implementation for x86-64 Message-ID: <20190610183357.zj6rwdpgw36anpfc@treble> References: <20190605130753.327195108@infradead.org> <20190605131945.313688119@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190605131945.313688119@infradead.org> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 10 Jun 2019 18:34:29 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 05, 2019 at 03:08:06PM +0200, Peter Zijlstra wrote: > --- a/arch/x86/include/asm/static_call.h > +++ b/arch/x86/include/asm/static_call.h > @@ -2,6 +2,20 @@ > #ifndef _ASM_STATIC_CALL_H > #define _ASM_STATIC_CALL_H > > +#include > + > +#ifdef CONFIG_HAVE_STATIC_CALL_INLINE > + > +/* > + * This trampoline is only used during boot / module init, so it's safe to use > + * the indirect branch without a retpoline. > + */ > +#define __ARCH_STATIC_CALL_TRAMP_JMP(key, func) \ > + ANNOTATE_RETPOLINE_SAFE \ > + "jmpq *" __stringify(key) "+" __stringify(SC_KEY_func) "(%rip) \n" > + > +#else /* !CONFIG_HAVE_STATIC_CALL_INLINE */ I wonder if we can simplify this (and drop the indirect branch) by getting rid of the above cruft, and instead just use the out-of-line trampoline as the default for inline as well. Then the inline case could fall back to the out-of-line implementation (by patching the trampoline's jmp dest) before static_call_initialized is set. -- Josh