qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 034d00: e1000: set RX descriptor status in a


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 034d00: e1000: set RX descriptor status in a separate oper...
Date: Tue, 05 Jul 2022 22:13:10 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 034d00d4858161e1d4cff82d8d230bce874a04d3
      
https://github.com/qemu/qemu/commit/034d00d4858161e1d4cff82d8d230bce874a04d3
  Author: Ding Hui <dinghui@sangfor.com.cn>
  Date:   2022-07-06 (Wed, 06 Jul 2022)

  Changed paths:
    M hw/net/e1000.c

  Log Message:
  -----------
  e1000: set RX descriptor status in a separate operation

The code of setting RX descriptor status field maybe work fine in
previously, however with the update of glibc version, it shows two
issues when guest using dpdk receive packets:

  1. The dpdk has a certain probability getting wrong buffer_addr

     this impact may be not obvious, such as lost a packet once in
     a while

  2. The dpdk may consume a packet twice when scan the RX desc queue
     over again

     this impact will lead a infinite wait in Qemu, since the RDT
     (tail pointer) be inscreased to equal to RDH by unexpected,
     which regard as the RX desc queue is full

Write a whole of RX desc with DD flag on is not quite correct, because
when the underlying implementation of memcpy using XMM registers to
copy e1000_rx_desc (when AVX or something else CPU feature is usable),
the bytes order of desc writing to memory is indeterminacy

We can use full-scale test case to reproduce the issue-2 by
https://github.com/BASM/qemu_dpdk_e1000_test (thanks to Leonid Myravjev)

I also write a POC test case at https://github.com/cdkey/e1000_poc
which can reproduce both of them, and easy to verify the patch effect.

The hw watchpoint also shows that, when Qemu using XMM related instructions
writing 16 bytes e1000_rx_desc, concurrent with DPDK using movb
writing 1 byte status, the final result of writing to memory will be one
of them, if it made by Qemu which DD flag is on, DPDK will consume it
again.

Setting DD status in a separate operation, can prevent the impact of
disorder memory writing by memcpy, also avoid unexpected data when
concurrent writing status by qemu and guest dpdk.

Links: 
https://lore.kernel.org/qemu-devel/20200102110504.GG121208@stefanha-x1.localdomain/T/

Reported-by: Leonid Myravjev <asm@asm.pp.ru>
Cc: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: qemu-stable@nongnu.org
Tested-by: Jing Zhang <zhangjing@sangfor.com.cn>
Reviewed-by: Frank Lee <lifan38153@sangfor.com.cn>
Signed-off-by: Ding Hui <dinghui@sangfor.com.cn>
Signed-off-by: Jason Wang <jasowang@redhat.com>


  Commit: a495eba03c31c96d6a0817b13598ce2219326691
      
https://github.com/qemu/qemu/commit/a495eba03c31c96d6a0817b13598ce2219326691
  Author: Haochen Tong <i@hexchain.org>
  Date:   2022-07-06 (Wed, 06 Jul 2022)

  Changed paths:
    M ebpf/ebpf_rss.c

  Log Message:
  -----------
  ebpf: replace deprecated bpf_program__set_socket_filter

bpf_program__set_<TYPE> functions have been deprecated since libbpf 0.8.
Replace with the equivalent bpf_program__set_type call to avoid a
deprecation warning.

Signed-off-by: Haochen Tong <i@hexchain.org>
Reviewed-by: Zhang Chen <chen.zhang@intel.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>


  Commit: 180c2f24d5e8eada41e012a3899d29bb695aae06
      
https://github.com/qemu/qemu/commit/180c2f24d5e8eada41e012a3899d29bb695aae06
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-07-06 (Wed, 06 Jul 2022)

  Changed paths:
    M ebpf/ebpf_rss.c
    M hw/net/e1000.c

  Log Message:
  -----------
  Merge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging

# -----BEGIN PGP SIGNATURE-----
# Version: GnuPG v1
#
# iQEcBAABAgAGBQJixQP1AAoJEO8Ells5jWIRAsEH/jDlZa1m8jM7vGn6VVUhC6gR
# wnwMZVVrg/N+P6614dQ6jFEhTL52AhNONCwl+nzKZDksWMtkX/Owy3DEx0HqXk3m
# DyQyI5ngBiRPOOOlgyVHMyc304TFmf9qh4Cz80o5UNsI50lpLMA/vpwgK3zz/KXZ
# V6d5C3+kL2y7l5dmHuASiUD8xRTQvDn3/mY94VNzwU36uqODwAizm6Ft6ohTkvdO
# WtPQ9AXiVUyHigCxX4r7l9vZjBw0sobVYS1TEoagB2wiEpwTnOYbPhGntBP1eMzv
# E1Wf2tJbz67SP+DHuUCrrUyFaDCVLmG7IAh44wIoK4XCGqfrjTxwUftvo1XZ6Gk=
# =yqUz
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 06 Jul 2022 09:09:33 AM +0530
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) 
<jasowang@redhat.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* tag 'net-pull-request' of https://github.com/jasowang/qemu:
  ebpf: replace deprecated bpf_program__set_socket_filter
  e1000: set RX descriptor status in a separate operation

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/39e19f5f67d9...180c2f24d5e8



reply via email to

[Prev in Thread] Current Thread [Next in Thread]