On 6 Jan 2022, at 12:45, Harry van Haaren wrote:
> This commit improves handling of packets where the allocated memory
> is less than 64 bytes. In the DPDK datapath this never matters, as
> an mbuf always pre-allocates enough space, however this can occur in
> test environments such as the dummy netdev. The fix is required to
> ensure ASAN enabled builds don't error on testing this, hence the
> fix is valuable.
>
> The solution implemented uses a mask-to-zero if the available buffer
> size is less than 64 bytes, and a branch for which type of load is used.
>
> Fixes: 250ceddcc2d0 ("dpif-netdev/mfex: Add AVX512 based optimized miniflow
> extract")
>
> Reported-by: Ilya Maximets <[email protected]>
> Signed-off-by: Harry van Haaren <[email protected]>
The change looks fine to me, can’t test, as I lack an AVX machine.
However, one small comment below.
//Eelco
> ---
> lib/dpif-netdev-extract-avx512.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/lib/dpif-netdev-extract-avx512.c
> b/lib/dpif-netdev-extract-avx512.c
> index e060ab14a..d23349482 100644
> --- a/lib/dpif-netdev-extract-avx512.c
> +++ b/lib/dpif-netdev-extract-avx512.c
> @@ -488,7 +488,14 @@ mfex_avx512_process(struct dp_packet_batch *packets,
>
> /* Load packet data and probe with AVX512 mask & compare. */
> const uint8_t *pkt = dp_packet_data(packet);
> - __m512i v_pkt0 = _mm512_loadu_si512(pkt);
> + __m512i v_pkt0;
> + if (size >= 64) {
Does it make sense to add an OVS_LIKELY() here?
> + v_pkt0 = _mm512_loadu_si512(pkt);
> + } else {
> + uint64_t load_kmask = (1ULL << size) - 1;
> + v_pkt0 = _mm512_maskz_loadu_epi8(load_kmask, pkt);
> + }
> +
> __m512i v_pkt0_masked = _mm512_and_si512(v_pkt0, v_mask);
> __mmask64 k_cmp = _mm512_cmpeq_epi8_mask(v_pkt0_masked, v_vals);
> if (k_cmp != UINT64_MAX) {
> --
> 2.25.1
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev