Commit 61a40c12 authored by Alexei Starovoitov's avatar Alexei Starovoitov
Browse files

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: default avatarAlexei Starovoitov <ast@kernel.org>
parents 98e20e5e 63fac346
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)
{
	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 src_reg = insn->src_reg;
	int last, insn_count = 1;
+19 −0
Original line number Diff line number Diff line
@@ -33,6 +33,25 @@ l3_%=: \
	: __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

SEC("socket")
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
#define str_has_pfx(str, pfx) \
	(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_SUCCESS "comment:test_expect_success"