From aa788a3942b94c8e5ff36c350f49b68852bd36d1 Mon Sep 17 00:00:00 2001 From: sephe Date: Wed, 15 Jun 2016 05:31:35 +0000 Subject: [PATCH] MFC 296180,297634 296180 hyperv: Use proper fence function to keep store-load order for msgs sfence only makes sure about the store-store order, which is not sufficient here. Use atomic_thread_fence_seq_cst() as suggested jhb and kib (a locked op in the nutshell, which should have the Reviewed by: jhb, kib, Jun Su MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5436 297634 hyperv: Use mb() instead of atomic_thread_fence_seq_cst() Since atomic_thread_fence_seq_cst() will become compiler fence on UP kernel. Reviewed by: kib, Dexuan Cui MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5852 git-svn-id: svn://svn.freebsd.org/base/stable/10@301914 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c b/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c index c8d689490..2e17e53f8 100644 --- a/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c +++ b/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c @@ -116,8 +116,12 @@ vmbus_msg_swintr(void *arg) * message_pending and EOMing. Otherwise, the EOMing will * not deliver any more messages * since there is no empty slot + * + * NOTE: + * mb() is used here, since atomic_thread_fence_seq_cst() + * will become compler fence on UP kernel. */ - wmb(); + mb(); if (msg->header.message_flags.u.message_pending) { /* @@ -186,8 +190,12 @@ hv_vmbus_isr(struct trapframe *frame) * message_pending and EOMing. Otherwise, the EOMing will * not deliver any more messages * since there is no empty slot + * + * NOTE: + * mb() is used here, since atomic_thread_fence_seq_cst() + * will become compler fence on UP kernel. */ - wmb(); + mb(); if (msg->header.message_flags.u.message_pending) { /* -- 2.45.0