diff mbox series

[bpf-next,v2,4/4] LoongArch: Enable BPF_JIT and TEST_BPF in default config

Message ID 1661857809-10828-5-git-send-email-yangtiezhu@loongson.cn (mailing list archive)
State Superseded
Delegated to: BPF
Headers show
Series Add BPF JIT support for LoongArch | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR fail merge-conflict
netdev/tree_selection success Clearly marked for bpf-next, async
netdev/apply fail Patch does not apply to bpf-next

Commit Message

Tiezhu Yang Aug. 30, 2022, 11:10 a.m. UTC
For now, BPF JIT for LoongArch is supported, update loongson3_defconfig to
enable BPF_JIT to allow the kernel to generate native code when a program
is loaded into the kernel, and also enable TEST_BPF to test BPF JIT.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/loongarch/configs/loongson3_defconfig | 2 ++
 1 file changed, 2 insertions(+)

Comments

Huacai Chen Aug. 30, 2022, 2:46 p.m. UTC | #1
Hi, Tiezhu,

On Tue, Aug 30, 2022 at 7:10 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>
> For now, BPF JIT for LoongArch is supported, update loongson3_defconfig to
> enable BPF_JIT to allow the kernel to generate native code when a program
> is loaded into the kernel, and also enable TEST_BPF to test BPF JIT.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  arch/loongarch/configs/loongson3_defconfig | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/loongarch/configs/loongson3_defconfig b/arch/loongarch/configs/loongson3_defconfig
> index 3712552..93dc072 100644
> --- a/arch/loongarch/configs/loongson3_defconfig
> +++ b/arch/loongarch/configs/loongson3_defconfig
> @@ -4,6 +4,7 @@ CONFIG_POSIX_MQUEUE=y
>  CONFIG_NO_HZ=y
>  CONFIG_HIGH_RES_TIMERS=y
>  CONFIG_BPF_SYSCALL=y
> +CONFIG_BPF_JIT=y
>  CONFIG_PREEMPT=y
>  CONFIG_BSD_PROCESS_ACCT=y
>  CONFIG_BSD_PROCESS_ACCT_V3=y
> @@ -801,3 +802,4 @@ CONFIG_MAGIC_SYSRQ=y
>  CONFIG_SCHEDSTATS=y
>  # CONFIG_DEBUG_PREEMPT is not set
>  # CONFIG_FTRACE is not set
> +CONFIG_TEST_BPF=m
I don't want the test module be built by default, but I don't insist
if you have a strong requirement.

Huacai
> --
> 2.1.0
>
Tiezhu Yang Aug. 31, 2022, 1:23 a.m. UTC | #2
On 08/30/2022 10:46 PM, Huacai Chen wrote:
> Hi, Tiezhu,
>
> On Tue, Aug 30, 2022 at 7:10 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>>
>> For now, BPF JIT for LoongArch is supported, update loongson3_defconfig to
>> enable BPF_JIT to allow the kernel to generate native code when a program
>> is loaded into the kernel, and also enable TEST_BPF to test BPF JIT.
>>
>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>> ---
>>  arch/loongarch/configs/loongson3_defconfig | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/loongarch/configs/loongson3_defconfig b/arch/loongarch/configs/loongson3_defconfig
>> index 3712552..93dc072 100644
>> --- a/arch/loongarch/configs/loongson3_defconfig
>> +++ b/arch/loongarch/configs/loongson3_defconfig
>> @@ -4,6 +4,7 @@ CONFIG_POSIX_MQUEUE=y
>>  CONFIG_NO_HZ=y
>>  CONFIG_HIGH_RES_TIMERS=y
>>  CONFIG_BPF_SYSCALL=y
>> +CONFIG_BPF_JIT=y
>>  CONFIG_PREEMPT=y
>>  CONFIG_BSD_PROCESS_ACCT=y
>>  CONFIG_BSD_PROCESS_ACCT_V3=y
>> @@ -801,3 +802,4 @@ CONFIG_MAGIC_SYSRQ=y
>>  CONFIG_SCHEDSTATS=y
>>  # CONFIG_DEBUG_PREEMPT is not set
>>  # CONFIG_FTRACE is not set
>> +CONFIG_TEST_BPF=m
> I don't want the test module be built by default, but I don't insist
> if you have a strong requirement.
>

Hi Huacai,

It is useful to enable TEST_BPF in default config, otherwise we
need to use "make menuconfig" to select it manually if we want
to test bpf jit, and build it as a module by default has no side
effect, so I prefer to enable TEST_BPF in default config.

Thanks,
Tiezhu
Xi Ruoyao Aug. 31, 2022, 4:12 a.m. UTC | #3
On Wed, 2022-08-31 at 09:23 +0800, Tiezhu Yang wrote:
> 
> 
> On 08/30/2022 10:46 PM, Huacai Chen wrote:
> > Hi, Tiezhu,
> > 
> > On Tue, Aug 30, 2022 at 7:10 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
> > > 
> > > For now, BPF JIT for LoongArch is supported, update loongson3_defconfig to
> > > enable BPF_JIT to allow the kernel to generate native code when a program
> > > is loaded into the kernel, and also enable TEST_BPF to test BPF JIT.
> > > 
> > > Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> > > ---
> > >  arch/loongarch/configs/loongson3_defconfig | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/arch/loongarch/configs/loongson3_defconfig b/arch/loongarch/configs/loongson3_defconfig
> > > index 3712552..93dc072 100644
> > > --- a/arch/loongarch/configs/loongson3_defconfig
> > > +++ b/arch/loongarch/configs/loongson3_defconfig
> > > @@ -4,6 +4,7 @@ CONFIG_POSIX_MQUEUE=y
> > >  CONFIG_NO_HZ=y
> > >  CONFIG_HIGH_RES_TIMERS=y
> > >  CONFIG_BPF_SYSCALL=y
> > > +CONFIG_BPF_JIT=y
> > >  CONFIG_PREEMPT=y
> > >  CONFIG_BSD_PROCESS_ACCT=y
> > >  CONFIG_BSD_PROCESS_ACCT_V3=y
> > > @@ -801,3 +802,4 @@ CONFIG_MAGIC_SYSRQ=y
> > >  CONFIG_SCHEDSTATS=y
> > >  # CONFIG_DEBUG_PREEMPT is not set
> > >  # CONFIG_FTRACE is not set
> > > +CONFIG_TEST_BPF=m
> > I don't want the test module be built by default, but I don't insist
> > if you have a strong requirement.
> > 
> 
> Hi Huacai,
> 
> It is useful to enable TEST_BPF in default config, otherwise we
> need to use "make menuconfig" to select it manually if we want
> to test bpf jit, and build it as a module by default has no side
> effect, so I prefer to enable TEST_BPF in default config.

IMO we shouldn't enable a test feature which is never used by 99% of
users in the default.
Xi Ruoyao Aug. 31, 2022, 9:02 a.m. UTC | #4
On Wed, 2022-08-31 at 12:12 +0800, Xi Ruoyao wrote:
> On Wed, 2022-08-31 at 09:23 +0800, Tiezhu Yang wrote:
> > 
> > 
> > On 08/30/2022 10:46 PM, Huacai Chen wrote:
> > > Hi, Tiezhu,
> > > 
> > > On Tue, Aug 30, 2022 at 7:10 PM Tiezhu Yang
> > > <yangtiezhu@loongson.cn> wrote:
> > > > 
> > > > For now, BPF JIT for LoongArch is supported, update
> > > > loongson3_defconfig to
> > > > enable BPF_JIT to allow the kernel to generate native code when
> > > > a program
> > > > is loaded into the kernel, and also enable TEST_BPF to test BPF
> > > > JIT.
> > > > 
> > > > Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> > > > ---
> > > >  arch/loongarch/configs/loongson3_defconfig | 2 ++
> > > >  1 file changed, 2 insertions(+)
> > > > 
> > > > diff --git a/arch/loongarch/configs/loongson3_defconfig
> > > > b/arch/loongarch/configs/loongson3_defconfig
> > > > index 3712552..93dc072 100644
> > > > --- a/arch/loongarch/configs/loongson3_defconfig
> > > > +++ b/arch/loongarch/configs/loongson3_defconfig
> > > > @@ -4,6 +4,7 @@ CONFIG_POSIX_MQUEUE=y
> > > >  CONFIG_NO_HZ=y
> > > >  CONFIG_HIGH_RES_TIMERS=y
> > > >  CONFIG_BPF_SYSCALL=y
> > > > +CONFIG_BPF_JIT=y
> > > >  CONFIG_PREEMPT=y
> > > >  CONFIG_BSD_PROCESS_ACCT=y
> > > >  CONFIG_BSD_PROCESS_ACCT_V3=y
> > > > @@ -801,3 +802,4 @@ CONFIG_MAGIC_SYSRQ=y
> > > >  CONFIG_SCHEDSTATS=y
> > > >  # CONFIG_DEBUG_PREEMPT is not set
> > > >  # CONFIG_FTRACE is not set
> > > > +CONFIG_TEST_BPF=m
> > > I don't want the test module be built by default, but I don't
> > > insist
> > > if you have a strong requirement.
> > > 
> > 
> > Hi Huacai,
> > 
> > It is useful to enable TEST_BPF in default config, otherwise we
> > need to use "make menuconfig" to select it manually if we want
> > to test bpf jit, and build it as a module by default has no side
> > effect, so I prefer to enable TEST_BPF in default config.
> 
> IMO we shouldn't enable a test feature which is never used by 99% of
> users in the default.

P. S. this is not a strong option.  CONFIG_TEST_BPF seems enabled by
default for S390, and I'm not sure if defconfig is designed for "kernel
developers" or "distro builders", or even "normal users".
Daniel Borkmann Aug. 31, 2022, 7:31 p.m. UTC | #5
On 8/31/22 11:02 AM, Xi Ruoyao wrote:
> On Wed, 2022-08-31 at 12:12 +0800, Xi Ruoyao wrote:
>> On Wed, 2022-08-31 at 09:23 +0800, Tiezhu Yang wrote:
>>>
>>>
>>> On 08/30/2022 10:46 PM, Huacai Chen wrote:
>>>> Hi, Tiezhu,
>>>>
>>>> On Tue, Aug 30, 2022 at 7:10 PM Tiezhu Yang
>>>> <yangtiezhu@loongson.cn> wrote:
>>>>>
>>>>> For now, BPF JIT for LoongArch is supported, update
>>>>> loongson3_defconfig to
>>>>> enable BPF_JIT to allow the kernel to generate native code when
>>>>> a program
>>>>> is loaded into the kernel, and also enable TEST_BPF to test BPF
>>>>> JIT.
>>>>>
>>>>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>>>>> ---
>>>>>   arch/loongarch/configs/loongson3_defconfig | 2 ++
>>>>>   1 file changed, 2 insertions(+)
>>>>>
>>>>> diff --git a/arch/loongarch/configs/loongson3_defconfig
>>>>> b/arch/loongarch/configs/loongson3_defconfig
>>>>> index 3712552..93dc072 100644
>>>>> --- a/arch/loongarch/configs/loongson3_defconfig
>>>>> +++ b/arch/loongarch/configs/loongson3_defconfig
>>>>> @@ -4,6 +4,7 @@ CONFIG_POSIX_MQUEUE=y
>>>>>   CONFIG_NO_HZ=y
>>>>>   CONFIG_HIGH_RES_TIMERS=y
>>>>>   CONFIG_BPF_SYSCALL=y
>>>>> +CONFIG_BPF_JIT=y
>>>>>   CONFIG_PREEMPT=y
>>>>>   CONFIG_BSD_PROCESS_ACCT=y
>>>>>   CONFIG_BSD_PROCESS_ACCT_V3=y
>>>>> @@ -801,3 +802,4 @@ CONFIG_MAGIC_SYSRQ=y
>>>>>   CONFIG_SCHEDSTATS=y
>>>>>   # CONFIG_DEBUG_PREEMPT is not set
>>>>>   # CONFIG_FTRACE is not set
>>>>> +CONFIG_TEST_BPF=m
>>>> I don't want the test module be built by default, but I don't
>>>> insist
>>>> if you have a strong requirement.
>>>>
>>>
>>> Hi Huacai,
>>>
>>> It is useful to enable TEST_BPF in default config, otherwise we
>>> need to use "make menuconfig" to select it manually if we want
>>> to test bpf jit, and build it as a module by default has no side
>>> effect, so I prefer to enable TEST_BPF in default config.
>>
>> IMO we shouldn't enable a test feature which is never used by 99% of
>> users in the default.
> 
> P. S. this is not a strong option.  CONFIG_TEST_BPF seems enabled by
> default for S390, and I'm not sure if defconfig is designed for "kernel
> developers" or "distro builders", or even "normal users".

Right now BPF CI [0] tests x86_64 and s390x archs, would be nice to also
add others in future to increase test coverage and then include test_bpf
as part of the executed test suites. If noone beats me to it, the latter
still sits in my bucket list. But either way, that would make more sense
than adding CONFIG_TEST_BPF to defconfig. Looks like for odd reasons m68k
and s390x has it, it shouldn't be there, really.

Thanks,
Daniel

   [0] https://github.com/kernel-patches/bpf/pulls
Tiezhu Yang Sept. 1, 2022, 1:30 a.m. UTC | #6
On 09/01/2022 03:31 AM, Daniel Borkmann wrote:
> On 8/31/22 11:02 AM, Xi Ruoyao wrote:
>> On Wed, 2022-08-31 at 12:12 +0800, Xi Ruoyao wrote:
>>> On Wed, 2022-08-31 at 09:23 +0800, Tiezhu Yang wrote:
>>>>
>>>>
>>>> On 08/30/2022 10:46 PM, Huacai Chen wrote:
>>>>> Hi, Tiezhu,
>>>>>
>>>>> On Tue, Aug 30, 2022 at 7:10 PM Tiezhu Yang
>>>>> <yangtiezhu@loongson.cn> wrote:
>>>>>>
>>>>>> For now, BPF JIT for LoongArch is supported, update
>>>>>> loongson3_defconfig to
>>>>>> enable BPF_JIT to allow the kernel to generate native code when
>>>>>> a program
>>>>>> is loaded into the kernel, and also enable TEST_BPF to test BPF
>>>>>> JIT.
>>>>>>
>>>>>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>>>>>> ---
>>>>>>   arch/loongarch/configs/loongson3_defconfig | 2 ++
>>>>>>   1 file changed, 2 insertions(+)
>>>>>>
>>>>>> diff --git a/arch/loongarch/configs/loongson3_defconfig
>>>>>> b/arch/loongarch/configs/loongson3_defconfig
>>>>>> index 3712552..93dc072 100644
>>>>>> --- a/arch/loongarch/configs/loongson3_defconfig
>>>>>> +++ b/arch/loongarch/configs/loongson3_defconfig
>>>>>> @@ -4,6 +4,7 @@ CONFIG_POSIX_MQUEUE=y
>>>>>>   CONFIG_NO_HZ=y
>>>>>>   CONFIG_HIGH_RES_TIMERS=y
>>>>>>   CONFIG_BPF_SYSCALL=y
>>>>>> +CONFIG_BPF_JIT=y
>>>>>>   CONFIG_PREEMPT=y
>>>>>>   CONFIG_BSD_PROCESS_ACCT=y
>>>>>>   CONFIG_BSD_PROCESS_ACCT_V3=y
>>>>>> @@ -801,3 +802,4 @@ CONFIG_MAGIC_SYSRQ=y
>>>>>>   CONFIG_SCHEDSTATS=y
>>>>>>   # CONFIG_DEBUG_PREEMPT is not set
>>>>>>   # CONFIG_FTRACE is not set
>>>>>> +CONFIG_TEST_BPF=m
>>>>> I don't want the test module be built by default, but I don't
>>>>> insist
>>>>> if you have a strong requirement.
>>>>>
>>>>
>>>> Hi Huacai,
>>>>
>>>> It is useful to enable TEST_BPF in default config, otherwise we
>>>> need to use "make menuconfig" to select it manually if we want
>>>> to test bpf jit, and build it as a module by default has no side
>>>> effect, so I prefer to enable TEST_BPF in default config.
>>>
>>> IMO we shouldn't enable a test feature which is never used by 99% of
>>> users in the default.
>>
>> P. S. this is not a strong option.  CONFIG_TEST_BPF seems enabled by
>> default for S390, and I'm not sure if defconfig is designed for "kernel
>> developers" or "distro builders", or even "normal users".
>
> Right now BPF CI [0] tests x86_64 and s390x archs, would be nice to also
> add others in future to increase test coverage and then include test_bpf
> as part of the executed test suites. If noone beats me to it, the latter
> still sits in my bucket list. But either way, that would make more sense
> than adding CONFIG_TEST_BPF to defconfig. Looks like for odd reasons m68k
> and s390x has it, it shouldn't be there, really.
>
> Thanks,
> Daniel
>
>   [0] https://github.com/kernel-patches/bpf/pulls

OK, it is clear now, let me remove CONFIG_TEST_BPF in
loongson3_defconfig, thank you all.

Thanks,
Tiezhu
diff mbox series

Patch

diff --git a/arch/loongarch/configs/loongson3_defconfig b/arch/loongarch/configs/loongson3_defconfig
index 3712552..93dc072 100644
--- a/arch/loongarch/configs/loongson3_defconfig
+++ b/arch/loongarch/configs/loongson3_defconfig
@@ -4,6 +4,7 @@  CONFIG_POSIX_MQUEUE=y
 CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_BPF_SYSCALL=y
+CONFIG_BPF_JIT=y
 CONFIG_PREEMPT=y
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_BSD_PROCESS_ACCT_V3=y
@@ -801,3 +802,4 @@  CONFIG_MAGIC_SYSRQ=y
 CONFIG_SCHEDSTATS=y
 # CONFIG_DEBUG_PREEMPT is not set
 # CONFIG_FTRACE is not set
+CONFIG_TEST_BPF=m