[PATCH bpf] bpf: fix UML x86_64 compile failure

Maciej Żenczykowski posted 1 patch 1 year, 8 months ago
There is a newer version of this series
kernel/bpf/verifier.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH bpf] bpf: fix UML x86_64 compile failure
Posted by Maciej Żenczykowski 1 year, 8 months ago
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Fixes: 1ae6921009e5 ("bpf: inline bpf_get_smp_processor_id() helper")
Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 kernel/bpf/verifier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 36ef8e96787e..7a354b1e6197 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -20313,7 +20313,7 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
 			goto next_insn;
 		}
 
-#ifdef CONFIG_X86_64
+#if defined(CONFIG_X86_64) && !defined(CONFIG_UML)
 		/* Implement bpf_get_smp_processor_id() inline. */
 		if (insn->imm == BPF_FUNC_get_smp_processor_id &&
 		    prog->jit_requested && bpf_jit_supports_percpu_insn()) {
-- 
2.45.2.505.gda0bf45e8d-goog
Re: [PATCH bpf] bpf: fix UML x86_64 compile failure
Posted by Shung-Hsi Yu 1 year, 8 months ago
On Thu, Jun 13, 2024 at 04:25:20AM GMT, Maciej Żenczykowski wrote:
> Cc: Andrii Nakryiko <andrii@kernel.org>
> Cc: John Fastabend <john.fastabend@gmail.com>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Fixes: 1ae6921009e5 ("bpf: inline bpf_get_smp_processor_id() helper")
> Signed-off-by: Maciej Żenczykowski <maze@google.com>
> ---
>  kernel/bpf/verifier.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 36ef8e96787e..7a354b1e6197 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -20313,7 +20313,7 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
>  			goto next_insn;
>  		}
>  
> -#ifdef CONFIG_X86_64
> +#if defined(CONFIG_X86_64) && !defined(CONFIG_UML)
>  		/* Implement bpf_get_smp_processor_id() inline. */
>  		if (insn->imm == BPF_FUNC_get_smp_processor_id &&
>  		    prog->jit_requested && bpf_jit_supports_percpu_insn()) {

The patch needs a change description[1].

Maybe something along the line of why pcpu_hot.cpu_number not accessible
in User-mode Linux? (I don't know bpf_get_smp_processor_id() or UML that
well, just suggesting possible change description)

1: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
Re: [PATCH bpf] bpf: fix UML x86_64 compile failure
Posted by Alexei Starovoitov 1 year, 8 months ago
On Thu, Jun 13, 2024 at 8:30 AM Shung-Hsi Yu <shung-hsi.yu@suse.com> wrote:
>
> On Thu, Jun 13, 2024 at 04:25:20AM GMT, Maciej Żenczykowski wrote:
> > Cc: Andrii Nakryiko <andrii@kernel.org>
> > Cc: John Fastabend <john.fastabend@gmail.com>
> > Cc: Alexei Starovoitov <ast@kernel.org>
> > Fixes: 1ae6921009e5 ("bpf: inline bpf_get_smp_processor_id() helper")
> > Signed-off-by: Maciej Żenczykowski <maze@google.com>
> > ---
> >  kernel/bpf/verifier.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> > index 36ef8e96787e..7a354b1e6197 100644
> > --- a/kernel/bpf/verifier.c
> > +++ b/kernel/bpf/verifier.c
> > @@ -20313,7 +20313,7 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
> >                       goto next_insn;
> >               }
> >
> > -#ifdef CONFIG_X86_64
> > +#if defined(CONFIG_X86_64) && !defined(CONFIG_UML)
> >               /* Implement bpf_get_smp_processor_id() inline. */
> >               if (insn->imm == BPF_FUNC_get_smp_processor_id &&
> >                   prog->jit_requested && bpf_jit_supports_percpu_insn()) {
>
> The patch needs a change description[1].
>
> Maybe something along the line of why pcpu_hot.cpu_number not accessible
> in User-mode Linux? (I don't know bpf_get_smp_processor_id() or UML that
> well, just suggesting possible change description)

+1


pw-bot: cr