[1/4] net/vmbus: add missing barrier

Message ID 20200427232822.21695-2-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series net/netvsc: minor fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Stephen Hemminger April 27, 2020, 11:28 p.m. UTC
  The check for event ring being empty needs a barrier
to avoid any over agressive optimization.
This is same barrier as Linux kernel.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/bus/vmbus/vmbus_channel.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Ruifeng Wang April 29, 2020, 2:31 a.m. UTC | #1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Stephen Hemminger
> Sent: Tuesday, April 28, 2020 7:28 AM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH 1/4] net/vmbus: add missing barrier
>
> The check for event ring being empty needs a barrier to avoid any over
> agressive optimization.
> This is same barrier as Linux kernel.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  drivers/bus/vmbus/vmbus_channel.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/bus/vmbus/vmbus_channel.c
> b/drivers/bus/vmbus/vmbus_channel.c
> index 46b3ba3f9f9e..ff2985c25758 100644
> --- a/drivers/bus/vmbus/vmbus_channel.c
> +++ b/drivers/bus/vmbus/vmbus_channel.c
> @@ -199,6 +199,7 @@ bool rte_vmbus_chan_rx_empty(const struct
> vmbus_channel *channel)  {
>  const struct vmbus_br *br = &channel->rxbr;
>
> +rte_smp_rmb();
>  return br->vbr->rindex == br->vbr->windex;  }
>
> --
> 2.20.1

Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
  

Patch

diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c
index 46b3ba3f9f9e..ff2985c25758 100644
--- a/drivers/bus/vmbus/vmbus_channel.c
+++ b/drivers/bus/vmbus/vmbus_channel.c
@@ -199,6 +199,7 @@  bool rte_vmbus_chan_rx_empty(const struct vmbus_channel *channel)
 {
 	const struct vmbus_br *br = &channel->rxbr;
 
+	rte_smp_rmb();
 	return br->vbr->rindex == br->vbr->windex;
 }