LKML Archive on
help / color / mirror / Atom feed
From: Yonghong Song <>
To: Peter Zijlstra <>
Cc: <>, <>, <>,
	<>, <>,
Subject: Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND
Date: Fri, 20 Apr 2018 11:06:03 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 4/20/18 1:19 AM, Peter Zijlstra wrote:
> On Sat, Apr 14, 2018 at 09:27:38PM -0700, Yonghong Song wrote:
>> This patch adds a preprocessor guard NO_BPF_WORKAROUND around the
>> asm_volatile_goto based static_cpu_has(). NO_BPF_WORKAROUND is set
>> at toplevel Makefile when compiler supports asm-goto. That is,
>> if the compiler supports asm-goto, the kernel build will use
>> asm-goto version of static_cpu_has().
> Hurm, so adding __BPF__ for BPF compiles isn't an option? It seems to me
> having a CPP flag to identify BPF compile context might be useful in
> general.

With "clang -target bpf", we already have __BPF__ defined.
For tracing, esp. ptrace.h is included, "clang -target <native_arch>" 
where "-target <native_arch>" can be omitted, is typically used.
The reason is the native architecture header files typically
include a lot of various asm related stuff where "-target bpf" cannot
really handle. We relay on native clang to flush out all these
asm constructs and only bpf program needed stuff survives
reach to backend compiler.

The backend compiler, llc, will have option "-march=bpf" to do
right thing to generate bpf byte codes.

So the patch is really a workaround for "clang -target x86_64" with
intention of using "llc -march=bpf" later on.

  reply	other threads:[~2018-04-20 18:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-15  4:27 Yonghong Song
2018-04-19 16:36 ` Yonghong Song
2018-04-20  8:19 ` Peter Zijlstra
2018-04-20 18:06   ` Yonghong Song [this message]
2018-04-23 10:52     ` Peter Zijlstra
2018-04-23 16:50       ` Yonghong Song
2018-04-27 16:34         ` Yonghong Song
2018-05-02 14:01           ` Yonghong Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).