Received: by 10.192.165.148 with SMTP id m20csp940156imm; Thu, 10 May 2018 03:09:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZooz9nznnQPVK2HUtcesnTozxA3bBHXy17WCxTTYIqi9z819IzwixeBPINw+vokT3yThjQb X-Received: by 2002:a62:9d5a:: with SMTP id i87-v6mr782564pfd.190.1525946988888; Thu, 10 May 2018 03:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525946988; cv=none; d=google.com; s=arc-20160816; b=KFJG+vR+FtlUv/IibalwcYTaIooWlapIHmKjzjMfhXUsxL2muGM2m5Gv3h1bP9B0+K kRvSs47XTqIlnUqWJaBew8w38uBxcrcIOXjCeIwPPAScbahAs3Z31GYvFFpk+It5K+jQ 9C4l1H5ZFjzL9bO7oOM/Z0VKlqC/X0MK5PZMzfr1GqSWrhHVhT6mGGP0DWNLIYUMBXE3 2G5cbYI7GpTFpufcIg1sFePWfLD8tCSlV+MqGbukmyMu2zBnc596hYPRYlxN1QKLuSzz sTIMTzaWo0KHckfX2sq63MXt5nHrmSpnddMv03IttBHb9RjZ/a70JHJPVCBJowSBb4oS nmKQ== 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:dkim-signature:arc-authentication-results; bh=b5NqLPz/6whWnB5/cHjjQVn/97lf0qVYmP+fp51rahc=; b=VaRtR1/lrwU1FzXYBVjIun7Er2m3gtVSMTsnSsIu++rvsMlYzm/XUj3QCN3H1YsMMF j8tZw9wG87WkFNdDvek7mc3qYDwfcHW2mLPOg1ObctLboTeL5zh0y3s57aDKIZ7PV2Gx sgEazvzDTtXnSO+N5dW1vUdbledP+2DIR8WBg8+mXbXjdO/qj0I98vRQT6tBDitwp1wY 89LKbeZxf9gTIDmBCF3EoundZaU4WIVkx4v/sM1faE+e5uyv3Zw0VuYPP3sDyuZle1KY Da9Y1oQI7M6GDdLJMrIJSBcLTNjltFlrtp76dEHJ4jImv3wc3CyqmaWfyrAcoisAl8nM GCtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=qOGOXpCv; 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 k72-v6si498914pfa.53.2018.05.10.03.09.32; Thu, 10 May 2018 03:09:48 -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=merlin.20170209 header.b=qOGOXpCv; 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 S934739AbeEJKGw (ORCPT + 99 others); Thu, 10 May 2018 06:06:52 -0400 Received: from merlin.infradead.org ([205.233.59.134]:41308 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753944AbeEJKGu (ORCPT ); Thu, 10 May 2018 06:06:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=b5NqLPz/6whWnB5/cHjjQVn/97lf0qVYmP+fp51rahc=; b=qOGOXpCvsuZh+kicePdQY2waX O5E6cmgWTLYd+ZRIh8WOGw65OpVgJYRIAFWG3GDJ4T+3otna25g+ivV3UnAGt9Ijt8V/J0owaLwWS 313C2vlmIFsxjFBG57+jV5VVQO4afI/doBU07UTJiKtaw4HKsp0tCLlcVp1D858WPC2BCz3Ys4N38 5cZjUD54pmI0qMFM5VGeQfiUm5s9njwyCKWwDJk40nyMqtPLWbJgHflobrb/wPpSoDbteZanvtBkw qIiUx9XI36cE4v1CG+xeKcg1WJN1v4gidjcjHqnMPeCa1nWUgvzWSxg8xJlmLofRBftS6OaSwv5Ju tXDgh6TDg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGiT7-0008Fb-FU; Thu, 10 May 2018 10:06:37 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9DD092029FA13; Thu, 10 May 2018 12:06:34 +0200 (CEST) Date: Thu, 10 May 2018 12:06:34 +0200 From: Peter Zijlstra To: Yonghong Song Cc: mingo@kernel.org, torvalds@linux-foundation.org, ast@fb.com, daniel@iogearbox.net, linux-kernel@vger.kernel.org, x86@kernel.org, netdev@vger.kernel.org, kernel-team@fb.com, Thomas Gleixner Subject: Re: [PATCH bpf v3] x86/cpufeature: bpf hack for clang not supporting asm goto Message-ID: <20180510100634.GZ12217@hirez.programming.kicks-ass.net> References: <20180504033119.2130788-1-yhs@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180504033119.2130788-1-yhs@fb.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 03, 2018 at 08:31:19PM -0700, Yonghong Song wrote: > This approach is preferred since the already deployed bcc scripts, or > any other bpf applicaitons utilizing LLVM JIT compilation functionality, > will continue work with the new kernel without re-compilation and > re-deployment. So I really hate this and would much rather see the BPF build environment changed. It not consistenyly having __BPF__ defined really smells like a bug on your end. Sometimes you just need to update tools... Is it really too hard to do -D__BPF__ in the bpf build process that we need to mollest the kernel for it? > Note that this is a hack in the kernel to workaround bpf compilation issue. > The hack will be removed once clang starts to support asm goto. Note that that ^^ already mandates people re-deploy their bpf tools, so why is llvm supporting asm-goto a better point to re-deploy than fixing a consistent __BPF__ define for the bpf build environment? > diff --git a/Makefile b/Makefile > index 83b6c54..cfd8759 100644 > --- a/Makefile > +++ b/Makefile > @@ -504,6 +504,7 @@ export RETPOLINE_CFLAGS > ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) > CC_HAVE_ASM_GOTO := 1 > KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO > + KBUILD_CFLAGS += -D__NO_CLANG_BPF_HACK > KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO > endif I really think this is the wrong thing to do; but if the x86 maintainers are willing to take this, I'll grudingly shut up. Ingo, Thomas? > diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h > index b27da96..42edd5d 100644 > --- a/arch/x86/include/asm/cpufeature.h > +++ b/arch/x86/include/asm/cpufeature.h > @@ -140,6 +140,8 @@ extern void clear_cpu_cap(struct cpuinfo_x86 *c, unsigned int bit); > > #define setup_force_cpu_bug(bit) setup_force_cpu_cap(bit) > > +/* this macro is a temporary hack for bpf until clang gains asm-goto support */ > +#ifdef __NO_CLANG_BPF_HACK > /* > * Static testing of CPU features. Used the same as boot_cpu_has(). > * These will statically patch the target code for additional > @@ -195,6 +197,9 @@ static __always_inline __pure bool _static_cpu_has(u16 bit) > boot_cpu_has(bit) : \ > _static_cpu_has(bit) \ > ) > +#else > +#define static_cpu_has(bit) boot_cpu_has(bit) > +#endif > > #define cpu_has_bug(c, bit) cpu_has(c, (bit)) > #define set_cpu_bug(c, bit) set_cpu_cap(c, (bit)) > -- > 2.9.5 >