Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1169700 > unrolled thread

Re: [PATCH] lib: test_bpf: purge CPP register redefinitions

Started byAlexei Starovoitov <alexei.starovoitov@gmail.com>
First post2015-06-22 08:10 +0200
Last post2015-06-22 09:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] lib: test_bpf: purge CPP register redefinitions Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2015-06-22 08:10 +0200
    Re: [PATCH] lib: test_bpf: purge CPP register redefinitions Richard Weinberger <richard@nod.at> - 2015-06-22 09:00 +0200

#1169700 — Re: [PATCH] lib: test_bpf: purge CPP register redefinitions

FromAlexei Starovoitov <alexei.starovoitov@gmail.com>
Date2015-06-22 08:10 +0200
SubjectRe: [PATCH] lib: test_bpf: purge CPP register redefinitions
Message-ID<pE35D-3Do-1@gated-at.bofh.it>
On Sun, Jun 21, 2015 at 09:41:03PM +0200, Nicolai Stange wrote:
> Fix compilation failer with allmodconfig on ARCH=um:
>   lib/test_bpf.c:50:0: warning: "R8" redefined
>    #define R8  BPF_REG_8
>    ^
>   In file included from arch/um/include/asm/ptrace-generic.h:11:0,
>                    from arch/x86/um/asm/ptrace.h:8,
>                    from arch/x86/include/asm/alternative.h:8,
>                    from arch/x86/include/asm/bitops.h:16,
>                    from include/linux/bitops.h:36,
>                    from include/linux/kernel.h:10,
>                    from include/linux/list.h:8,
>                    from include/linux/module.h:9,
>                    from lib/test_bpf.c:19:
>   arch/x86/include/uapi/asm/ptrace-abi.h:42:0:
>     note: this is the location of the previous definition
>      #define R8 72
> 
> Get rid of the
>   #define Rx BPF_REG_x
> defines by substituting the Rx macros with their BPF_REG_x expansion
> in test_bpf.c.
> 
> Signed-off-by: Nicolai Stange <nicstange@gmail.com>
> ---
> Tested:
>   - compilation for ARCH=x86_64 and ARCH=um
>   - 'modprobe test_bpf' on ARCH=x86_64
> 
>  lib/test_bpf.c | 2374 ++++++++++++++++++++++++++++----------------------------
>  1 file changed, 1193 insertions(+), 1181 deletions(-)

to get rid of warning you proposing to do 1k line renames?!
Just add:
+#undef R8
+#undef R9
+#undef R10
 #define R0             BPF_REG_0

Though I think the better fix woud be to clean up:
arch/x86/include/uapi/asm/ptrace-abi.h
What's the point of:
#define R8 72
from 'uapi' point of view?
Look like kernel details that shouldn't be exposed in uapi.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1169737

FromRichard Weinberger <richard@nod.at>
Date2015-06-22 09:00 +0200
Message-ID<pE3S2-4xB-11@gated-at.bofh.it>
In reply to#1169700
Am 22.06.2015 um 08:05 schrieb Alexei Starovoitov:
> to get rid of warning you proposing to do 1k line renames?!
> Just add:
> +#undef R8
> +#undef R9
> +#undef R10
>  #define R0             BPF_REG_0

This would be also just another hack.

> Though I think the better fix woud be to clean up:
> arch/x86/include/uapi/asm/ptrace-abi.h
> What's the point of:
> #define R8 72
> from 'uapi' point of view?

To query cpu registers using ptrace(2).

> Look like kernel details that shouldn't be exposed in uapi.

These are not kernel details.

Actually the problem is the other way around.
UML is Linux ported to it's own userspace ABI.
Hence, the arch/um and arch/x86/um use uapi header files.

Maybe we can rework UML's header files such that
no uapi header pollutes the kernel namespace.

That said, lib/test_bpf.c should still not use
defines like R8 as such symbols are very generic.

Thanks,
//richard
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web