Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3587486ybb; Mon, 6 Apr 2020 11:31:41 -0700 (PDT) X-Google-Smtp-Source: APiQypLIrl1PI/7rIGh1Z7VpxBV+64PHFVL7gwXGQceZtEMOwQQAgTjgsTGTFVSrmzG6Iy0L18Av X-Received: by 2002:aca:cdd1:: with SMTP id d200mr524384oig.153.1586197901394; Mon, 06 Apr 2020 11:31:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586197901; cv=none; d=google.com; s=arc-20160816; b=STVYZpWLE7AP206eXo9HtWBJORiZiX+1okmg+9si07lfZYrrSyjK3qmGst4kwso7ft v4eefTqSo3jXIWFP/dkX2LNWQml9XZaDZPo85dzRPsYzBQXwqE65J6hKdzUb+qB83I8p bUGoTPKVHG+qP8m/t/DdL9vI6SpCV0HBGAOED1/VIrL+eOdP5x3MXzvMVCSyYBm/DMa5 Q6qCOkZztb6RJIGr7oWQwhcftbf3YxIKKOAUs59BWKuFZMFN4F8ZO97mdUmtxXRZE71d nqVJ1e26ihuSLnHpSyYe4lAZoZjkZHcaFb618DVPCkcdiJcM+A8XqQBim0+/6h+K0lep 767g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=bzgH14cowT5NOH2YXPfOKwZ5lmbgMroAquim/LRzAhU=; b=QGvT9kw02NFLY41huGrd/idJIg2hcL2SpNwzv0ttKK2y8cT3kD/Fcs8heyg2X+7n7N mzbrbhFyEMcRtc/ukBVUifLVfR3N/OHXm/DGv6oSjxE1E5PVxDM6YDUTp/3sJNpAnYhD kLQEipsJeiIGESMQJ6mwdQS0srkTkXK7sp5hLo6U23pQGI/AmfLqYnOHyD7EkY3G/LbA OUNi8PGx2Kzu9LrpeRs3VEFKGUUw/iL4Aa9AF9OWb7Xa/C5KfIAD1nHl+rlfylSasq3I uZyzsBtWwVD6QuDAIY5pSz0UxEd4GaAcGR7sWrWBVtRYJPWKuD4paZvbk/ilDQQHDiTp SLfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aAOSAIrD; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s15si7552494oie.175.2020.04.06.11.31.29; Mon, 06 Apr 2020 11:31:41 -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=pass header.i=@google.com header.s=20161025 header.b=aAOSAIrD; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726329AbgDFS3t (ORCPT + 99 others); Mon, 6 Apr 2020 14:29:49 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:47012 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbgDFS3s (ORCPT ); Mon, 6 Apr 2020 14:29:48 -0400 Received: by mail-pl1-f193.google.com with SMTP id s23so141185plq.13 for ; Mon, 06 Apr 2020 11:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bzgH14cowT5NOH2YXPfOKwZ5lmbgMroAquim/LRzAhU=; b=aAOSAIrDkWpEGky9IFQuA9uSBE7wYOQC1JT+2Lomjz0H2gpHXbajlsuxjJY141ilSs 0SVNnp7eUpSGuOJaB51JSw5Qb7ncbxEZkFXirUuxNWDRdtiy6mX1o+R8oqE1LKu4o5Az +51gBKE4XoL5lzxsnG2lEX0jzlRQQtKrW93SJBxbpy6tljYhpCOJHNT56045vXxYclwY PcfmYmgQTRlDIkEHZ2x4SZtDz2DFng1OhlpAikNsiWTatdywAXHrUIDnBlkBTt9UGXcx boCxCjkEfSaxgndpiWGg9fGFoaRnRX36sxYo9wVWP1yj1xrBZ6OciIwG0K68fXJcXNpA 6Rxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bzgH14cowT5NOH2YXPfOKwZ5lmbgMroAquim/LRzAhU=; b=crs6S2g+Kh+jQXs910UHsOQ9yxQCBJ2Qo9hLx6FmvUS7zVeYKNmnrssRrOAcCRIcnd Ul3RTAJ06kPZnJSfezSrx4ZHXCNsViqnCtSFbwV/GGJFXanNfg/3fDBpLtVrArw6TA9H UEnzh+tiTD/o71nufBldvT7/MFHRNR4UTM4Hpf8fcDhTiNDiGIaYekFzETU6VNcqzBXE KWODonGB/49OQ3rCgItMZ7asT5J+zlkfQNpDdS741NCv4dPb14717SqMpqjvgPmBbocK Yx6ajwDogDVT34HvvXH5ejcmVmpejKpuRANhFaVj5PF0y7IeGXonX+73bJFc4mfnMsU0 37ZA== X-Gm-Message-State: AGi0PubSr/IEqQNN6FcJW4E/GqU4t518wHi8IZWjZ5t44z5yTzjWFUbB 5BYWfXKiWN6UeHwJqNKjKQEjexS42RBD4BiheMq0xQ== X-Received: by 2002:a17:90b:3783:: with SMTP id mz3mr579681pjb.27.1586197786666; Mon, 06 Apr 2020 11:29:46 -0700 (PDT) MIME-Version: 1.0 References: <20200324135603.483964896@infradead.org> <20200324142245.819003994@infradead.org> <20200406010859.bcfouhukcgmg2on7@google.com> <20200406110438.GJ20730@hirez.programming.kicks-ass.net> In-Reply-To: <20200406110438.GJ20730@hirez.programming.kicks-ass.net> From: Nick Desaulniers Date: Mon, 6 Apr 2020 11:29:36 -0700 Message-ID: Subject: Re: [RESEND][PATCH v3 09/17] x86/static_call: Add out-of-line static call implementation To: Peter Zijlstra Cc: Fangrui Song , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , LKML , Steven Rostedt , Masami Hiramatsu , bristot@redhat.com, Jason Baron , Linus Torvalds , Thomas Gleixner , Ingo Molnar , Nadav Amit , "H. Peter Anvin" , Andy Lutomirski , Ard Biesheuvel , Josh Poimboeuf , clang-built-linux , "H.J. Lu" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 6, 2020 at 4:04 AM Peter Zijlstra wrote: > > 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. If it seems like it would be useful, let us know. If it doesn't have some ridiculous baggage or inconsistency or unspecified behavior, we're generally happy to do so. We have finite resources so knowing where to focus our attention helps us sort the never ending TODO list. It's not easy to predict which feature we'll need to drop everything to implement next, so any help there would be much appreciated. > > > 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. > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200406110438.GJ20730%40hirez.programming.kicks-ass.net. -- Thanks, ~Nick Desaulniers