mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-16 20:56:42 +07:00
ARM: net: bpf: avoid reloading 'array'
Rearranging the order of the initial tail call code a little allows is to avoid reloading the 'array' pointer. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
aaffd2f5c3
commit
b504522998
@ -1064,16 +1064,16 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx)
|
|||||||
BUILD_BUG_ON(offsetof(struct bpf_array, map.max_entries) >
|
BUILD_BUG_ON(offsetof(struct bpf_array, map.max_entries) >
|
||||||
ARM_INST_LDST__IMM12);
|
ARM_INST_LDST__IMM12);
|
||||||
off = offsetof(struct bpf_array, map.max_entries);
|
off = offsetof(struct bpf_array, map.max_entries);
|
||||||
/* array->map.max_entries */
|
r_array = arm_bpf_get_reg32(r2[1], tmp2[0], ctx);
|
||||||
r_array = arm_bpf_get_reg32(r2[1], tmp2[1], ctx);
|
|
||||||
emit(ARM_LDR_I(tmp[1], r_array, off), ctx);
|
|
||||||
/* index is 32-bit for arrays */
|
/* index is 32-bit for arrays */
|
||||||
r_index = arm_bpf_get_reg32(r3[1], tmp2[1], ctx);
|
r_index = arm_bpf_get_reg32(r3[1], tmp2[1], ctx);
|
||||||
|
/* array->map.max_entries */
|
||||||
|
emit(ARM_LDR_I(tmp[1], r_array, off), ctx);
|
||||||
/* index >= array->map.max_entries */
|
/* index >= array->map.max_entries */
|
||||||
emit(ARM_CMP_R(r_index, tmp[1]), ctx);
|
emit(ARM_CMP_R(r_index, tmp[1]), ctx);
|
||||||
_emit(ARM_COND_CS, ARM_B(jmp_offset), ctx);
|
_emit(ARM_COND_CS, ARM_B(jmp_offset), ctx);
|
||||||
|
|
||||||
/* tmp2[1] = index */
|
/* tmp2[0] = array, tmp2[1] = index */
|
||||||
|
|
||||||
/* if (tail_call_cnt > MAX_TAIL_CALL_CNT)
|
/* if (tail_call_cnt > MAX_TAIL_CALL_CNT)
|
||||||
* goto out;
|
* goto out;
|
||||||
@ -1095,7 +1095,6 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx)
|
|||||||
*/
|
*/
|
||||||
BUILD_BUG_ON(imm8m(offsetof(struct bpf_array, ptrs)) < 0);
|
BUILD_BUG_ON(imm8m(offsetof(struct bpf_array, ptrs)) < 0);
|
||||||
off = imm8m(offsetof(struct bpf_array, ptrs));
|
off = imm8m(offsetof(struct bpf_array, ptrs));
|
||||||
r_array = arm_bpf_get_reg32(r2[1], tmp2[0], ctx);
|
|
||||||
emit(ARM_ADD_I(tmp[1], r_array, off), ctx);
|
emit(ARM_ADD_I(tmp[1], r_array, off), ctx);
|
||||||
emit(ARM_LDR_R_SI(tmp[1], tmp[1], r_index, SRTYPE_ASL, 2), ctx);
|
emit(ARM_LDR_R_SI(tmp[1], tmp[1], r_index, SRTYPE_ASL, 2), ctx);
|
||||||
emit(ARM_CMP_I(tmp[1], 0), ctx);
|
emit(ARM_CMP_I(tmp[1], 0), ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user