Re: [PATCH] samples/bpf: Fix broken samples.
From: Alexei Starovoitov
Date: Wed Oct 02 2019 - 14:45:14 EST
On Wed, Oct 02, 2019 at 07:46:32PM +0200, KP Singh wrote:
> From: KP Singh <kpsingh@xxxxxxxxxx>
>
> Rename asm_goto_workaround.h to asm_workaround.h and add a
> workaround for the newly added "asm_inline" in:
>
> commit eb111869301e ("compiler-types.h: add asm_inline definition")
>
> Add missing include for <linux/perf_event.h> which was removed from
> perf-sys.h in:
>
> commit 91854f9a077e ("perf tools: Move everything related to
> sys_perf_event_open() to perf-sys.h")
>
> Co-developed-by: Florent Revest <revest@xxxxxxxxxx>
> Signed-off-by: Florent Revest <revest@xxxxxxxxxx>
> Signed-off-by: KP Singh <kpsingh@xxxxxxxxxx>
> ---
> samples/bpf/Makefile | 2 +-
> .../{asm_goto_workaround.h => asm_workaround.h} | 17 ++++++++++++++---
> samples/bpf/task_fd_query_user.c | 1 +
> 3 files changed, 16 insertions(+), 4 deletions(-)
> rename samples/bpf/{asm_goto_workaround.h => asm_workaround.h} (46%)
>
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 42b571cde177..ab2b4d7ecb4b 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -289,7 +289,7 @@ $(obj)/%.o: $(src)/%.c
> -Wno-gnu-variable-sized-type-not-at-end \
> -Wno-address-of-packed-member -Wno-tautological-compare \
> -Wno-unknown-warning-option $(CLANG_ARCH_ARGS) \
> - -I$(srctree)/samples/bpf/ -include asm_goto_workaround.h \
> + -I$(srctree)/samples/bpf/ -include asm_workaround.h \
> -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf $(LLC_FLAGS) -filetype=obj -o $@
> ifeq ($(DWARF2BTF),y)
> $(BTF_PAHOLE) -J $@
> diff --git a/samples/bpf/asm_goto_workaround.h b/samples/bpf/asm_workaround.h
> similarity index 46%
> rename from samples/bpf/asm_goto_workaround.h
> rename to samples/bpf/asm_workaround.h
> index 7409722727ca..7c99ea6ae98c 100644
> --- a/samples/bpf/asm_goto_workaround.h
> +++ b/samples/bpf/asm_workaround.h
> @@ -1,9 +1,10 @@
> /* SPDX-License-Identifier: GPL-2.0 */
> /* Copyright (c) 2019 Facebook */
> -#ifndef __ASM_GOTO_WORKAROUND_H
> -#define __ASM_GOTO_WORKAROUND_H
> +#ifndef __ASM_WORKAROUND_H
> +#define __ASM_WORKAROUND_H
I don't think rename is necessary.
This file already has a hack for volatile().
Just add asm_inline hack to it.