linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] include/linux/bpf.h - fix missing prototype warnings...
@ 2019-01-29  6:04 valdis.kletnieks
  2019-01-29  7:07 ` Song Liu
  2019-01-31  9:39 ` Daniel Borkmann
  0 siblings, 2 replies; 3+ messages in thread
From: valdis.kletnieks @ 2019-01-29  6:04 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann; +Cc: netdev, linux-kernel

Compiling with W=1 generates warnings:

  CC      kernel/bpf/core.o
kernel/bpf/core.c:721:12: warning: no previous prototype for ?bpf_jit_alloc_exec_limit? [-Wmissing-prototypes]
  721 | u64 __weak bpf_jit_alloc_exec_limit(void)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/core.c:757:14: warning: no previous prototype for ?bpf_jit_alloc_exec? [-Wmissing-prototypes]
  757 | void *__weak bpf_jit_alloc_exec(unsigned long size)
      |              ^~~~~~~~~~~~~~~~~~
kernel/bpf/core.c:762:13: warning: no previous prototype for ?bpf_jit_free_exec? [-Wmissing-prototypes]
  762 | void __weak bpf_jit_free_exec(void *addr)
      |             ^~~~~~~~~~~~~~~~~

All three are weak functions that archs can override, although none do so
currently.  Provide prototypes for when a new arch provides its own.

Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>

diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 3851529062ec..99e55313123f 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -472,6 +472,10 @@ _out:							\
 #define BPF_PROG_RUN_ARRAY_CHECK(array, ctx, func)	\
 	__BPF_PROG_RUN_ARRAY(array, ctx, func, true)
 
+u64 __weak bpf_jit_alloc_exec_limit(void);
+void *__weak bpf_jit_alloc_exec(unsigned long size);
+void __weak bpf_jit_free_exec(void *addr);
+
 #ifdef CONFIG_BPF_SYSCALL
 DECLARE_PER_CPU(int, bpf_prog_active);
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] include/linux/bpf.h - fix missing prototype warnings...
  2019-01-29  6:04 [PATCH] include/linux/bpf.h - fix missing prototype warnings valdis.kletnieks
@ 2019-01-29  7:07 ` Song Liu
  2019-01-31  9:39 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Song Liu @ 2019-01-29  7:07 UTC (permalink / raw)
  To: Valdis Kletnieks
  Cc: Alexei Starovoitov, Daniel Borkmann, Networking, open list

On Mon, Jan 28, 2019 at 10:05 PM <valdis.kletnieks@vt.edu> wrote:
>
> Compiling with W=1 generates warnings:
>
>   CC      kernel/bpf/core.o
> kernel/bpf/core.c:721:12: warning: no previous prototype for ?bpf_jit_alloc_exec_limit? [-Wmissing-prototypes]
>   721 | u64 __weak bpf_jit_alloc_exec_limit(void)
>       |            ^~~~~~~~~~~~~~~~~~~~~~~~
> kernel/bpf/core.c:757:14: warning: no previous prototype for ?bpf_jit_alloc_exec? [-Wmissing-prototypes]
>   757 | void *__weak bpf_jit_alloc_exec(unsigned long size)
>       |              ^~~~~~~~~~~~~~~~~~
> kernel/bpf/core.c:762:13: warning: no previous prototype for ?bpf_jit_free_exec? [-Wmissing-prototypes]
>   762 | void __weak bpf_jit_free_exec(void *addr)
>       |             ^~~~~~~~~~~~~~~~~
>
> All three are weak functions that archs can override, although none do so
> currently.  Provide prototypes for when a new arch provides its own.
>
> Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>

Acked-by: Song Liu <songliubraving@fb.com>

>
> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index 3851529062ec..99e55313123f 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -472,6 +472,10 @@ _out:                                                      \
>  #define BPF_PROG_RUN_ARRAY_CHECK(array, ctx, func)     \
>         __BPF_PROG_RUN_ARRAY(array, ctx, func, true)
>
> +u64 __weak bpf_jit_alloc_exec_limit(void);
> +void *__weak bpf_jit_alloc_exec(unsigned long size);
> +void __weak bpf_jit_free_exec(void *addr);
> +
>  #ifdef CONFIG_BPF_SYSCALL
>  DECLARE_PER_CPU(int, bpf_prog_active);
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] include/linux/bpf.h - fix missing prototype warnings...
  2019-01-29  6:04 [PATCH] include/linux/bpf.h - fix missing prototype warnings valdis.kletnieks
  2019-01-29  7:07 ` Song Liu
@ 2019-01-31  9:39 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2019-01-31  9:39 UTC (permalink / raw)
  To: valdis.kletnieks, Alexei Starovoitov; +Cc: netdev, linux-kernel

On 01/29/2019 07:04 AM, valdis.kletnieks@vt.edu wrote:
> Compiling with W=1 generates warnings:
> 
>   CC      kernel/bpf/core.o
> kernel/bpf/core.c:721:12: warning: no previous prototype for ?bpf_jit_alloc_exec_limit? [-Wmissing-prototypes]
>   721 | u64 __weak bpf_jit_alloc_exec_limit(void)
>       |            ^~~~~~~~~~~~~~~~~~~~~~~~
> kernel/bpf/core.c:757:14: warning: no previous prototype for ?bpf_jit_alloc_exec? [-Wmissing-prototypes]
>   757 | void *__weak bpf_jit_alloc_exec(unsigned long size)
>       |              ^~~~~~~~~~~~~~~~~~
> kernel/bpf/core.c:762:13: warning: no previous prototype for ?bpf_jit_free_exec? [-Wmissing-prototypes]
>   762 | void __weak bpf_jit_free_exec(void *addr)
>       |             ^~~~~~~~~~~~~~~~~
> 
> All three are weak functions that archs can override, although none do so
> currently.  Provide prototypes for when a new arch provides its own.
> 
> Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>

Applied all 3 to bpf-next, thanks Valdis!

> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index 3851529062ec..99e55313123f 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -472,6 +472,10 @@ _out:							\
>  #define BPF_PROG_RUN_ARRAY_CHECK(array, ctx, func)	\
>  	__BPF_PROG_RUN_ARRAY(array, ctx, func, true)
>  
> +u64 __weak bpf_jit_alloc_exec_limit(void);
> +void *__weak bpf_jit_alloc_exec(unsigned long size);
> +void __weak bpf_jit_free_exec(void *addr);
> +

(I moved these to include/linux/filter.h while applying where we have all the
 other prototypes from JIT core already.)

>  #ifdef CONFIG_BPF_SYSCALL
>  DECLARE_PER_CPU(int, bpf_prog_active);
>  
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-31  9:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29  6:04 [PATCH] include/linux/bpf.h - fix missing prototype warnings valdis.kletnieks
2019-01-29  7:07 ` Song Liu
2019-01-31  9:39 ` Daniel Borkmann

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).