Skip to contentSkip to conversation

s390x BPF JIT failures with test_bpf

DISCUSSION Kleber Souza 2 participants 5 messages Jun 27, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

When I load the test_bpf module from mainline (v4.18-rc2) with CONFIG_BPF_JIT_ALWAYS_ON=y on a s390x system I get the following errors:

test_bpf: #289 BPF_MAXINSNS: Ctx heavy transformations FAIL to prog_create err=-524 len=4096
test_bpf: #290 BPF_MAXINSNS: Call heavy transformations FAIL to prog_create err=-524 len=4096
[...]
test_bpf: #296 BPF_MAXINSNS: exec all MSH FAIL to prog_create err=-524 len=4096
test_bpf: #297 BPF_MAXINSNS: ld_abs+get_processor_id FAIL to prog_create err=-524 len=4096

From a quick look at the code it seems that arch/s390/net/bpf_jit_comp.c:bpf_int_jit_compile() is failing to JIT compile the test code.

Are those failures expected and could be flagged with FLAG_EXPECTED_FAIL on lib/test_bpf.c or are those caused by some issue with the s390x JIT compiler that needs to be fixed?

Thanks,
Kleber

#1 lore raw

Hi Kleber,

On 06/27/2018 11:40 AM, Kleber Souza wrote:
[...]

Quoted 13 lines

When I load the test_bpf module from mainline (v4.18-rc2) with CONFIG_BPF_JIT_ALWAYS_ON=y on a s390x system I get the following errors:

test_bpf: #289 BPF_MAXINSNS: Ctx heavy transformations FAIL to prog_create err=-524 len=4096
test_bpf: #290 BPF_MAXINSNS: Call heavy transformations FAIL to prog_create err=-524 len=4096
[...]
test_bpf: #296 BPF_MAXINSNS: exec all MSH FAIL to prog_create err=-524 len=4096
test_bpf: #297 BPF_MAXINSNS: ld_abs+get_processor_id FAIL to prog_create err=-524 len=4096

Quoted 7 lines

From a quick look at the code it seems that arch/s390/net/bpf_jit_comp.c:bpf_int_jit_compile() is failing to JIT compile the test code.

Are those failures expected and could be flagged with FLAG_EXPECTED_FAIL on lib/test_bpf.c or are those caused by some issue with the s390x JIT compiler that needs to be fixed?

JIT doesn't guarantee in general to map really all programs to native insns, so some, mostly crafted corner cases could fail. E.g. x86-64 JIT doesn't converge on some programs in test_bpf.c and thus falls back to interpreter or simply rejects the program in case of CONFIG_BPF_JIT_ALWAYS_ON=y. Above would seem likely that it's hitting the BPF_SIZE_MAX that s390 would do. I think it might make sense to either have the FLAG_EXPECTED_FAIL in lib/test_bpf.c more fine grained as a flag per arch, so we could say it's expected to fail on e.g. s390 but not on x86 and the like, or just denote it as 'could potentially fail but doesn't have to be the case everywhere'.

Thanks,
Daniel

#2 lore raw
Quoted 25 lines · Daniel Borkmann

Hi Kleber,

On 06/27/2018 11:40 AM, Kleber Souza wrote:
[...]

Quoted 13 lines

When I load the test_bpf module from mainline (v4.18-rc2) with CONFIG_BPF_JIT_ALWAYS_ON=y on a s390x system I get the following errors:

test_bpf: #289 BPF_MAXINSNS: Ctx heavy transformations FAIL to prog_create err=-524 len=4096
test_bpf: #290 BPF_MAXINSNS: Call heavy transformations FAIL to prog_create err=-524 len=4096
[...]
test_bpf: #296 BPF_MAXINSNS: exec all MSH FAIL to prog_create err=-524 len=4096
test_bpf: #297 BPF_MAXINSNS: ld_abs+get_processor_id FAIL to prog_create err=-524 len=4096

Quoted 7 lines

From a quick look at the code it seems that arch/s390/net/bpf_jit_comp.c:bpf_int_jit_compile() is failing to JIT compile the test code.

Are those failures expected and could be flagged with FLAG_EXPECTED_FAIL on lib/test_bpf.c or are those caused by some issue with the s390x JIT compiler that needs to be fixed?

Quoted 9 lines

JIT doesn't guarantee in general to map really all programs to native insns, so some, mostly crafted corner cases could fail. E.g. x86-64 JIT doesn't converge on some programs in test_bpf.c and thus falls back to interpreter or simply rejects the program in case of CONFIG_BPF_JIT_ALWAYS_ON=y. Above would seem likely that it's hitting the BPF_SIZE_MAX that s390 would do. I think it might make sense to either have the FLAG_EXPECTED_FAIL in lib/test_bpf.c more fine grained as a flag per arch, so we could say it's expected to fail on e.g. s390 but not on x86 and the like, or just denote it as 'could potentially fail but doesn't have to be the case everywhere'.

Hi Daniel,

Thank you for your reply. I will run some more tests to make sure we are hitting BPF_SIZE_MAX or what exactly is failing and send a patch to flag it conditionally for s390x.

Thanks,
Kleber

#3 lore raw
Quoted 34 lines · Kleber Souza
Quoted 23 lines · Daniel Borkmann

On 06/27/2018 11:40 AM, Kleber Souza wrote:
[...]

Quoted 13 lines

When I load the test_bpf module from mainline (v4.18-rc2) with CONFIG_BPF_JIT_ALWAYS_ON=y on a s390x system I get the following errors:

test_bpf: #289 BPF_MAXINSNS: Ctx heavy transformations FAIL to prog_create err=-524 len=4096
test_bpf: #290 BPF_MAXINSNS: Call heavy transformations FAIL to prog_create err=-524 len=4096
[...]
test_bpf: #296 BPF_MAXINSNS: exec all MSH FAIL to prog_create err=-524 len=4096
test_bpf: #297 BPF_MAXINSNS: ld_abs+get_processor_id FAIL to prog_create err=-524 len=4096

Quoted 7 lines

From a quick look at the code it seems that arch/s390/net/bpf_jit_comp.c:bpf_int_jit_compile() is failing to JIT compile the test code.

Are those failures expected and could be flagged with FLAG_EXPECTED_FAIL on lib/test_bpf.c or are those caused by some issue with the s390x JIT compiler that needs to be fixed?

Quoted 9 lines

JIT doesn't guarantee in general to map really all programs to native insns, so some, mostly crafted corner cases could fail. E.g. x86-64 JIT doesn't converge on some programs in test_bpf.c and thus falls back to interpreter or simply rejects the program in case of CONFIG_BPF_JIT_ALWAYS_ON=y. Above would seem likely that it's hitting the BPF_SIZE_MAX that s390 would do. I think it might make sense to either have the FLAG_EXPECTED_FAIL in lib/test_bpf.c more fine grained as a flag per arch, so we could say it's expected to fail on e.g. s390 but not on x86 and the like, or just denote it as 'could potentially fail but doesn't have to be the case everywhere'.

Quoted 3 lines

Thank you for your reply. I will run some more tests to make sure we are hitting BPF_SIZE_MAX or what exactly is failing and send a patch to flag it conditionally for s390x.

Sounds good, thanks! In any case, please let us know your findings.

Best,
Daniel

#4 lore raw
Quoted 35 lines · Daniel Borkmann
Quoted 34 lines · Kleber Souza
Quoted 32 lines · Daniel Borkmann

On 06/27/2018 11:40 AM, Kleber Souza wrote:
[...]

Quoted 13 lines

When I load the test_bpf module from mainline (v4.18-rc2) with CONFIG_BPF_JIT_ALWAYS_ON=y on a s390x system I get the following errors:

test_bpf: #289 BPF_MAXINSNS: Ctx heavy transformations FAIL to prog_create err=-524 len=4096
test_bpf: #290 BPF_MAXINSNS: Call heavy transformations FAIL to prog_create err=-524 len=4096
[...]
test_bpf: #296 BPF_MAXINSNS: exec all MSH FAIL to prog_create err=-524 len=4096
test_bpf: #297 BPF_MAXINSNS: ld_abs+get_processor_id FAIL to prog_create err=-524 len=4096

Quoted 7 lines

From a quick look at the code it seems that arch/s390/net/bpf_jit_comp.c:bpf_int_jit_compile() is failing to JIT compile the test code.

Are those failures expected and could be flagged with FLAG_EXPECTED_FAIL on lib/test_bpf.c or are those caused by some issue with the s390x JIT compiler that needs to be fixed?

JIT doesn't guarantee in general to map really all programs to native insns, so some, mostly crafted corner cases could fail. E.g. x86-64 JIT doesn't converge on some programs in test_bpf.c and thus falls back to interpreter or simply rejects the program in case of CONFIG_BPF_JIT_ALWAYS_ON=y. Above would seem likely that it's hitting the BPF_SIZE_MAX that s390 would do. I think it might make sense to either have the FLAG_EXPECTED_FAIL in lib/test_bpf.c more fine grained as a flag per arch, so we could say it's expected to fail on e.g. s390 but not on x86 and the like, or just denote it as 'could potentially fail but doesn't have to be the case everywhere'.

Quoted 9 lines
Quoted 3 lines

Thank you for your reply. I will run some more tests to make sure we are hitting BPF_SIZE_MAX or what exactly is failing and send a patch to flag it conditionally for s390x.

Sounds good, thanks! In any case, please let us know your findings.

Best,
Daniel

Hi Daniel,

Your presumption was correct, all four tests are failing because they exceed BPF_SIZE_MAX. I'll send a patch shortly.

Thanks!
Kleber