Merge branch 's390-bpf-fix-gotol-with-large-offsets'

Ilya Leoshkevich says:

====================
s390/bpf: Fix gotol with large offsets

Hi,

While looking at a pyperf180 failure on s390x (must be related to [1],
I'm not done with the investigation yet) I noticed that I have
unfortunately messed up the gotol implementation. Patch 1 is the fix,
patch 2 is a small test infrastructure tweak, and patch 3 adds a
test.

[1] https://github.com/llvm/llvm-project/issues/55669

Best regards,
Ilya
====================

Link: https://lore.kernel.org/r/20240102193531.3169422-1-iii@linux.ibm.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
Alexei Starovoitov 2024-01-04 11:35:40 -08:00
commit 61a40c1249
3 changed files with 21 additions and 2 deletions

View File

@ -779,7 +779,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp,
int i, bool extra_pass, u32 stack_depth) int i, bool extra_pass, u32 stack_depth)
{ {
struct bpf_insn *insn = &fp->insnsi[i]; struct bpf_insn *insn = &fp->insnsi[i];
s16 branch_oc_off = insn->off; s32 branch_oc_off = insn->off;
u32 dst_reg = insn->dst_reg; u32 dst_reg = insn->dst_reg;
u32 src_reg = insn->src_reg; u32 src_reg = insn->src_reg;
int last, insn_count = 1; int last, insn_count = 1;

View File

@ -33,6 +33,25 @@ l3_%=: \
: __clobber_all); : __clobber_all);
} }
SEC("socket")
__description("gotol, large_imm")
__success __failure_unpriv __retval(40000)
__naked void gotol_large_imm(void)
{
asm volatile (" \
gotol 1f; \
0: \
r0 = 0; \
.rept 40000; \
r0 += 1; \
.endr; \
exit; \
1: gotol 0b; \
" :
:
: __clobber_all);
}
#else #else
SEC("socket") SEC("socket")

View File

@ -12,7 +12,7 @@
#define str_has_pfx(str, pfx) \ #define str_has_pfx(str, pfx) \
(strncmp(str, pfx, __builtin_constant_p(pfx) ? sizeof(pfx) - 1 : strlen(pfx)) == 0) (strncmp(str, pfx, __builtin_constant_p(pfx) ? sizeof(pfx) - 1 : strlen(pfx)) == 0)
#define TEST_LOADER_LOG_BUF_SZ 1048576 #define TEST_LOADER_LOG_BUF_SZ 2097152
#define TEST_TAG_EXPECT_FAILURE "comment:test_expect_failure" #define TEST_TAG_EXPECT_FAILURE "comment:test_expect_failure"
#define TEST_TAG_EXPECT_SUCCESS "comment:test_expect_success" #define TEST_TAG_EXPECT_SUCCESS "comment:test_expect_success"