All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf, x86: remove unnecessary handling of BPF_SUB atomic op
@ 2022-01-27  8:32 Hou Tao
  2022-01-27 10:48 ` Brendan Jackman
  2022-01-27 21:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Hou Tao @ 2022-01-27  8:32 UTC (permalink / raw)
  To: Alexei Starovoitov, John Fastabend
  Cc: Martin KaFai Lau, Yonghong Song, Daniel Borkmann,
	Andrii Nakryiko, David S . Miller, Jakub Kicinski,
	Brendan Jackman, netdev, bpf, houtao1

According to the LLVM commit (https://reviews.llvm.org/D72184),
sync_fetch_and_sub() is implemented as a negation followed by
sync_fetch_and_add(), so there will be no BPF_SUB op and just
remove it.

Signed-off-by: Hou Tao <houtao1@huawei.com>
---
 arch/x86/net/bpf_jit_comp.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index ce1f86f245c9..5d643ebb1e56 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -787,7 +787,6 @@ static int emit_atomic(u8 **pprog, u8 atomic_op,
 	/* emit opcode */
 	switch (atomic_op) {
 	case BPF_ADD:
-	case BPF_SUB:
 	case BPF_AND:
 	case BPF_OR:
 	case BPF_XOR:
-- 
2.29.2


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

* Re: [PATCH bpf-next] bpf, x86: remove unnecessary handling of BPF_SUB atomic op
  2022-01-27  8:32 [PATCH bpf-next] bpf, x86: remove unnecessary handling of BPF_SUB atomic op Hou Tao
@ 2022-01-27 10:48 ` Brendan Jackman
  2022-01-27 21:51   ` Daniel Borkmann
  2022-01-27 21:50 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Brendan Jackman @ 2022-01-27 10:48 UTC (permalink / raw)
  To: Hou Tao
  Cc: Alexei Starovoitov, John Fastabend, Martin KaFai Lau,
	Yonghong Song, Daniel Borkmann, Andrii Nakryiko,
	David S . Miller, Jakub Kicinski, netdev, bpf

Yep - BPF_SUB is also excluded in Documentation/networking/filter.rst,
plus the interpreter and verifier don't support it.

Thanks,

Acked-by: Brendan Jackman <jackmanb@google.com>


On Thu, 27 Jan 2022 at 09:17, Hou Tao <houtao1@huawei.com> wrote:
>
> According to the LLVM commit (https://reviews.llvm.org/D72184),
> sync_fetch_and_sub() is implemented as a negation followed by
> sync_fetch_and_add(), so there will be no BPF_SUB op and just
> remove it.
>
> Signed-off-by: Hou Tao <houtao1@huawei.com>
> ---
>  arch/x86/net/bpf_jit_comp.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
> index ce1f86f245c9..5d643ebb1e56 100644
> --- a/arch/x86/net/bpf_jit_comp.c
> +++ b/arch/x86/net/bpf_jit_comp.c
> @@ -787,7 +787,6 @@ static int emit_atomic(u8 **pprog, u8 atomic_op,
>         /* emit opcode */
>         switch (atomic_op) {
>         case BPF_ADD:
> -       case BPF_SUB:
>         case BPF_AND:
>         case BPF_OR:
>         case BPF_XOR:
> --
> 2.29.2
>

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

* Re: [PATCH bpf-next] bpf, x86: remove unnecessary handling of BPF_SUB atomic op
  2022-01-27  8:32 [PATCH bpf-next] bpf, x86: remove unnecessary handling of BPF_SUB atomic op Hou Tao
  2022-01-27 10:48 ` Brendan Jackman
@ 2022-01-27 21:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-27 21:50 UTC (permalink / raw)
  To: Hou Tao
  Cc: ast, john.fastabend, kafai, yhs, daniel, andrii, davem, kuba,
	jackmanb, netdev, bpf

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Thu, 27 Jan 2022 16:32:40 +0800 you wrote:
> According to the LLVM commit (https://reviews.llvm.org/D72184),
> sync_fetch_and_sub() is implemented as a negation followed by
> sync_fetch_and_add(), so there will be no BPF_SUB op and just
> remove it.
> 
> Signed-off-by: Hou Tao <houtao1@huawei.com>
> 
> [...]

Here is the summary with links:
  - [bpf-next] bpf, x86: remove unnecessary handling of BPF_SUB atomic op
    https://git.kernel.org/bpf/bpf-next/c/b6ec79518ef0

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH bpf-next] bpf, x86: remove unnecessary handling of BPF_SUB atomic op
  2022-01-27 10:48 ` Brendan Jackman
@ 2022-01-27 21:51   ` Daniel Borkmann
  2022-01-28  2:40     ` John Fastabend
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2022-01-27 21:51 UTC (permalink / raw)
  To: Brendan Jackman, Hou Tao
  Cc: Alexei Starovoitov, John Fastabend, Martin KaFai Lau,
	Yonghong Song, Andrii Nakryiko, David S . Miller, Jakub Kicinski,
	netdev, bpf

On 1/27/22 11:48 AM, Brendan Jackman wrote:
> Yep - BPF_SUB is also excluded in Documentation/networking/filter.rst,
> plus the interpreter and verifier don't support it.
> 
> Thanks,
> 
> Acked-by: Brendan Jackman <jackmanb@google.com>

I was wondering about verifier specifically as well. Added a note to the
commit log that verifier rejects BPF_SUB while applying, thanks!

> On Thu, 27 Jan 2022 at 09:17, Hou Tao <houtao1@huawei.com> wrote:
>>
>> According to the LLVM commit (https://reviews.llvm.org/D72184),
>> sync_fetch_and_sub() is implemented as a negation followed by
>> sync_fetch_and_add(), so there will be no BPF_SUB op and just
>> remove it.
>>
>> Signed-off-by: Hou Tao <houtao1@huawei.com>
>> ---
>>   arch/x86/net/bpf_jit_comp.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
>> index ce1f86f245c9..5d643ebb1e56 100644
>> --- a/arch/x86/net/bpf_jit_comp.c
>> +++ b/arch/x86/net/bpf_jit_comp.c
>> @@ -787,7 +787,6 @@ static int emit_atomic(u8 **pprog, u8 atomic_op,
>>          /* emit opcode */
>>          switch (atomic_op) {
>>          case BPF_ADD:
>> -       case BPF_SUB:
>>          case BPF_AND:
>>          case BPF_OR:
>>          case BPF_XOR:
>> --
>> 2.29.2
>>


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

* Re: [PATCH bpf-next] bpf, x86: remove unnecessary handling of BPF_SUB atomic op
  2022-01-27 21:51   ` Daniel Borkmann
@ 2022-01-28  2:40     ` John Fastabend
  0 siblings, 0 replies; 5+ messages in thread
From: John Fastabend @ 2022-01-28  2:40 UTC (permalink / raw)
  To: Daniel Borkmann, Brendan Jackman, Hou Tao
  Cc: Alexei Starovoitov, John Fastabend, Martin KaFai Lau,
	Yonghong Song, Andrii Nakryiko, David S . Miller, Jakub Kicinski,
	netdev, bpf

Daniel Borkmann wrote:
> On 1/27/22 11:48 AM, Brendan Jackman wrote:
> > Yep - BPF_SUB is also excluded in Documentation/networking/filter.rst,
> > plus the interpreter and verifier don't support it.
> > 
> > Thanks,
> > 
> > Acked-by: Brendan Jackman <jackmanb@google.com>
> 
> I was wondering about verifier specifically as well. Added a note to the
> commit log that verifier rejects BPF_SUB while applying, thanks!
> 

Thanks for the follow up Hou/Brendan LGTM as well. After its been
merged, but ACK from me as well.

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

end of thread, other threads:[~2022-01-28  2:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27  8:32 [PATCH bpf-next] bpf, x86: remove unnecessary handling of BPF_SUB atomic op Hou Tao
2022-01-27 10:48 ` Brendan Jackman
2022-01-27 21:51   ` Daniel Borkmann
2022-01-28  2:40     ` John Fastabend
2022-01-27 21:50 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.