Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3189860ybb; Mon, 6 Apr 2020 04:05:36 -0700 (PDT) X-Google-Smtp-Source: APiQypJeUrakCTeWkSgk5aGESK4P69qGhrzSAO9pU+SIZvwiWTMTUbv2cm082ei9z8y7qcfcXU68 X-Received: by 2002:aca:39c3:: with SMTP id g186mr12532097oia.168.1586171136584; Mon, 06 Apr 2020 04:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586171136; cv=none; d=google.com; s=arc-20160816; b=utXXOBdWzKDW3O1lulpMq3uAjRFeD6awaoHz5xxtVAeYPRNKHQmckLVinsERO3S+9Q 7z/ksna/3OfHc7VKdaC55NIOy8IUf++g81VJEuL8bLWqN3JPAP0Ra83Pvxz0p9jY7C2O fJnk2caISf1vee0fM7IeqcoKKRiAxk+YE8kXKD4bpQmECXVosnHKdH3+W54/JXCwm6Xv iz8LSpTpSA0BrbLaK5TyTArOAKhcNw3NB630nDLuT+b4sArQ7yR+poiwUhjnaCJisdPK PbvicTpvgg6XpM7xMIpebReStVR8w62nm40hfKDtv6Y7Wm28zAsapB/v2cCZCIiPkOA/ utKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=91jomgqgEShWhxWCDxxUvWHFtjKYAeVic8T17yZiSn8=; b=t6+zc9a+v6WWlQhh9HKVh1o+FES4PwRte0+cY8kYQI/dVrTE7jV1V+KtXQjlUwF4j+ ruPsfI/83u2hwFdeifHeUrBfSIuWAsHgbFx+n+Ad4789wqLTbNAo/t3Ifra2CXHomu5M gvDOUeEH2+UI1La4ArFwh7DGUN0KRyl8H8aShKNHtBAy2zjc4hPAqlKsd2jw6/T4eCUK Ryhl7WJs4WLcpy/G1d7Z07lRvTaYsvJtpV+CQ8fuYS8k6Oh3eU/YuW61WILBwMA9neAN tTXbmrw6gejv7Vz8Mhg+FrQSuZxVJErJNQiOuxY7tgnbXX/Vb2oQzTpfHZ66zKrpUaVD bVmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NlmLniwP; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y65si7358984oie.92.2020.04.06.04.05.23; Mon, 06 Apr 2020 04:05:36 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NlmLniwP; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727327AbgDFLEz (ORCPT + 99 others); Mon, 6 Apr 2020 07:04:55 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:46722 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726883AbgDFLEz (ORCPT ); Mon, 6 Apr 2020 07:04:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=91jomgqgEShWhxWCDxxUvWHFtjKYAeVic8T17yZiSn8=; b=NlmLniwPmUoH7YNLXVJdXPrK+l BSO/zxAlrDgIJGujl0MsOfF08n+YIxscjpHe/C9oL+Vu7U8axjLxRB/5kcttKWJ+eCdZxE+tW6HUH If1hKl2oaimP6hbVLps5D4MDFT3d4bbFkibKLPmq9qui6MxO4SPzptmtPLYVgAW7d8alHnvRx52ai X5PaXfw+ovZ8oZWzV2yPq0qTgnlFjSWWYFNDKfAQ3lMckmhw16UNGhB7mZeGM3iEGHwsgTq3Owe/m w9ElvyKlI2yDoZl93WASyZTVuln50boW6iBuhck7D826fc/ct9HzvKom8P7DDcUh935dAPmNJ9Wt/ f+BUW8rQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jLPYX-0005ld-8D; Mon, 06 Apr 2020 11:04:41 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id C6B41304121; Mon, 6 Apr 2020 13:04:38 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AB48F2BAC6A8E; Mon, 6 Apr 2020 13:04:38 +0200 (CEST) Date: Mon, 6 Apr 2020 13:04:38 +0200 From: Peter Zijlstra To: Fangrui Song Cc: x86@kernel.org, linux-kernel@vger.kernel.org, rostedt@goodmis.org, mhiramat@kernel.org, bristot@redhat.com, jbaron@akamai.com, torvalds@linux-foundation.org, tglx@linutronix.de, mingo@kernel.org, namit@vmware.com, hpa@zytor.com, luto@kernel.org, ard.biesheuvel@linaro.org, jpoimboe@redhat.com, clang-built-linux@googlegroups.com, hjl.tools@gmail.com Subject: Re: [RESEND][PATCH v3 09/17] x86/static_call: Add out-of-line static call implementation Message-ID: <20200406110438.GJ20730@hirez.programming.kicks-ass.net> References: <20200324135603.483964896@infradead.org> <20200324142245.819003994@infradead.org> <20200406010859.bcfouhukcgmg2on7@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200406010859.bcfouhukcgmg2on7@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 05, 2020 at 06:08:59PM -0700, Fangrui Song wrote: > On 2020-03-24, Peter Zijlstra wrote: > > +#define ARCH_DEFINE_STATIC_CALL_TRAMP(name, func) \ > > + asm(".pushsection .text, \"ax\" \n" \ > > + ".align 4 \n" \ > > + ".globl " STATIC_CALL_TRAMP_STR(name) " \n" \ > > + STATIC_CALL_TRAMP_STR(name) ": \n" \ > > + " jmp.d32 " #func " \n" \ > > + ".type " STATIC_CALL_TRAMP_STR(name) ", @function \n" \ > > + ".size " STATIC_CALL_TRAMP_STR(name) ", . - " STATIC_CALL_TRAMP_STR(name) " \n" \ > > + ".popsection \n") > > + > > +#endif /* _ASM_STATIC_CALL_H */ > > Hi Peter, > > Coming here from https://github.com/ClangBuiltLinux/linux/issues/974 > > jmp.d32 is not recognized by clang integrated assembler. > The syntax appears to be very rarely used. According to Debian Code Search, > u-boot is the only project using this syntax. *groan*... I was going to use it in more places :-/ > In March 2017, gas added the pseudo prefix {disp32} > https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=86fa6981e7487e2c2df4337aa75ed2d93c32eaf2 > which generalizes jmp.d32 ({disp32} jmp foo) That's all well and cute, but I can't use that because its too new. Not until we raise the minimum gcc/bintils version to something that includes that. > I wonder whether the instruction jmp.d32 can be replaced with the trick in > arch/x86/include/asm/jump_label.h for clang portability. > > % grep -A2 'jmp.d32' arch/x86/include/asm/jump_label.h > /* Equivalent to "jmp.d32 \target" */ > .byte 0xe9 > .long \target - .Lstatic_jump_after_\@ Sure, but I was hoping to move away from that since all assemblers should now support jmp.d32. Except of course, you have to go ruin things. The thing is, jmp.d32 reads so much nicer than the above crap. Also, I still need a meta instruction like: nopjmp $label what works just like 'jmp' but instead emits either a nop2 or a nop5. I tried various hacks to get GAS to emit that, but no luck :/ The only up-side from that new syntax is that I suppose we can go write: {disp8} push \vec without gas shitting itself and emitting a 5 byte push just because.. Except of course we can't, for the same reason I can't go around and use: {disp32} jmp in the above code.