From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751794AbcBLPnG (ORCPT ); Fri, 12 Feb 2016 10:43:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59486 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751764AbcBLPnD (ORCPT ); Fri, 12 Feb 2016 10:43:03 -0500 From: Vitaly Kuznetsov To: devel@linuxdriverproject.org Cc: linux-kernel@vger.kernel.org, "K. Y. Srinivasan" , Haiyang Zhang , Radim Krcmar , Cathy Avery Subject: [PATCH 4/4] Drivers: hv: vmbus: avoid unneeded compiler optimizations in vmbus_wait_for_unload() Date: Fri, 12 Feb 2016 16:42:50 +0100 Message-Id: <1455291770-15672-5-git-send-email-vkuznets@redhat.com> In-Reply-To: <1455291770-15672-1-git-send-email-vkuznets@redhat.com> References: <1455291770-15672-1-git-send-email-vkuznets@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Message header is modified by the hypervisor and we read it in a loop, we need to prevent compilers from optimizing accesses. There are no such optimizations at this moment, this is just a future proof. Suggested-by: Radim Krcmar Signed-off-by: Vitaly Kuznetsov --- drivers/hv/channel_mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 1e43967..b10e8f74 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -520,7 +520,7 @@ static void vmbus_wait_for_unload(void) bool unloaded = false; while (1) { - if (msg->header.message_type == HVMSG_NONE) { + if (READ_ONCE(msg->header.message_type) == HVMSG_NONE) { mdelay(10); continue; } -- 2.5.0