From mboxrd@z Thu Jan 1 00:00:00 1970 From: Saeed Mahameed Subject: [RESEND net 1/3] net/mlx5: Fix read from coherent memory Date: Mon, 17 Sep 2018 20:49:26 -0700 Message-ID: <20180918034928.28651-2-saeedm@mellanox.com> References: <20180918034928.28651-1-saeedm@mellanox.com> Cc: netdev@vger.kernel.org, Eli Cohen , Saeed Mahameed To: "David S. Miller" Return-path: Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:51803 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726414AbeIRJUP (ORCPT ); Tue, 18 Sep 2018 05:20:15 -0400 In-Reply-To: <20180918034928.28651-1-saeedm@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Eli Cohen Use accessor function READ_ONCE to read from coherent memory modified by the device and read by the driver. This becomes most important in preemptive kernels where cond_resched implementation does not have the side effect which guaranteed the updated value. Fixes: 269d26f47f6f ("net/mlx5: Reduce command polling interval") Signed-off-by: Eli Cohen Reported-by: Jesper Dangaard Brouer Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index 3ce14d42ddc8..a53736c26c0c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -206,7 +206,7 @@ static void poll_timeout(struct mlx5_cmd_work_ent *ent) u8 own; do { - own = ent->lay->status_own; + own = READ_ONCE(ent->lay->status_own); if (!(own & CMD_OWNER_HW)) { ent->ret = 0; return; -- 2.17.1