Hi Christophe,

Thanks for doing this work. I saw that you intend to submit a v3 due to failure in Ubuntu. Please, see my comment regarding emit_b below.

+       /* A64_R(0) = mbuf->buf_addr */
+       emit_mov_imm(ctx, 1, tmp1, offsetof(struct rte_mbuf, buf_addr));
+       emit_ldr(ctx, EBPF_DW, A64_R(0), r6, tmp1);
+       /* tmp2 = * mbuf->data_off */
+       emit_mov_imm(ctx, 1, tmp2, offsetof(struct rte_mbuf, data_off));
+       emit_ldr(ctx, BPF_H, tmp2, r6, tmp2);
+
+       /* A64_R(0) += data_off + off */
+       emit_add(ctx, 1, A64_R(0), tmp2);
+       emit_add(ctx, 1, A64_R(0), A64_R(1));
+
+       /* End of Fast Path, skip slow path */
+       emit_b(ctx, 4);
+
Followed by emit_b() above there is an emit_call(). It invokes emit_mov_imm() which could possibly generate different number of movk instructions depending on the address of the __rte_pktmbuf_read. So, emit_b(ctx, 4), may not  necessarily land at the intended location because there could be more than 4 instructions emitted by emit_call.
+       /* slow path, call __rte_pktmbuf_read */
+       emit_call(ctx, tmp1, __rte_pktmbuf_read);
+       /* check return value of __rte_pktmbuf_read */
+       emit_return_zero_if_src_zero(ctx, 1, A64_R(0));
+
+       /* A64_R(0) points to the data, load 1/2/4 bytes into r0*/
+       emit_ldr(ctx, opsz, r0, A64_R(0), A64_ZR);
+       if (sz != sizeof(uint8_t))
+               emit_be(ctx, r0, sz * CHAR_BIT);
+}
+

--wathsala


Reply via email to