drivers: hv: switch to use mb() instead of smp_mb()
Subsystems (2)
PATCH 1/1 drivers: hv: switch to use mb() instead of smp_mb()
Even if guest were compiled without SMP support, it could not assume that host wasn't. So switch to use mb() instead of smp_mb() to force memory barriers for UP guest.
Cc K. Y. Srinivasan <[email protected]>
Cc Haiyang Zhang <[email protected]>
Signed-off-by Jason Wang <[email protected]>
--- drivers/hv/ring_buffer.c | 10 +++++----- drivers/hv/vmbus_drv.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/hv/ring_buffer.c +5 -5
@@ -32,7 +32,7 @@void hv_begin_read (struct hv_ring_buffer_info *rbi) { rbi->ring_buffer->interrupt_mask =1 ; -smp_mb (); +mb (); }u32 hv_end_read (struct hv_ring_buffer_info *rbi)
@@ -41,7 +41,7 @@ u32 hv_end_read(struct hv_ring_buffer_info *rbi)u32 write; rbi->ring_buffer->interrupt_mask =0 ; -smp_mb (); +mb ();/* * Now check to see if the ring buffer is still empty.
@@ -71,7 +71,7 @@ u32 hv_end_read(struct hv_ring_buffer_info *rbi)static bool hv_need_to_signal (u32 old_write,struct hv_ring_buffer_info *rbi) { -smp_mb (); +mb ();if (rbi->ring_buffer->interrupt_mask)return false;
@@ -442,7 +442,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info, sizeof(u64));/* Issue a full memory barrier before updating the write index */ -smp_mb (); +mb ();/* Now, update the write location */ hv_set_next_write_location (outring_info, next_write_location);
@@ -549,7 +549,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,/* Make sure all reads are done before we update the read index since */ /* the writer may start writing to the read area once the read index */ /*is updated */ -smp_mb (); +mb ();/* Update the read index */ hv_set_next_read_location (inring_info, next_read_location);
drivers/hv/vmbus_drv.c +1 -1
@@ -434,7 +434,7 @@ static void vmbus_on_msg_dpc(unsigned long data)* will not deliver any more messages since there is * no empty slot */ -smp_mb (); +mb ();if (msg->header.message_flags.msg_pending) {/*
Signature · 1 line
1.7.1
Quoted 10 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Tuesday, June 18, 2013 1:04 AM
To: KY Srinivasan; Haiyang Zhang; [email protected]; linux- [email protected]
Cc: Jason Wang; [email protected]
Subject: [PATCH] drivers: hv: switch to usemb()instead ofsmp_mb()
Quoted 8 lines
Even if guest were compiled without SMP support, it could not assume that host wasn't. So switch to use
mb()instead ofsmp_mb()to force memory barriers for UP guest.Cc K. Y. Srinivasan <[email protected]>Cc Haiyang Zhang <[email protected]>Signed-off-by Jason Wang <[email protected]>
Signed-off-by K. Y. Srinivasan <[email protected]>
Quoted 74 lines
--- drivers/hv/ring_buffer.c | 10 +++++----- drivers/hv/vmbus_drv.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)drivers/hv/ring_buffer.c +4
-4@@ -32,7 +32,7 @@void hv_begin_read (struct hv_ring_buffer_info *rbi) { rbi->ring_buffer->interrupt_mask =1 ; -smp_mb (); +mb (); }u32 hv_end_read (struct hv_ring_buffer_info *rbi)@@ -41,7 +41,7 @@ u32 hv_end_read(struct hv_ring_buffer_info *rbi)u32 write; rbi->ring_buffer->interrupt_mask =0 ; -smp_mb (); +mb ();/* * Now check to see if the ring buffer is still empty. @@ -71,7 +71,7 @@ u32 hv_end_read(struct hv_ring_buffer_info *rbi)static bool hv_need_to_signal (u32 old_write,struct hv_ring_buffer_info *rbi) { -smp_mb (); +mb ();if (rbi->ring_buffer->interrupt_mask)return false;@@ -442,7 +442,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info, sizeof(u64));/* Issue a full memory barrier before updating the write index */ -smp_mb (); +mb ();/* Now, update the write location */ drivers/hv/ring_buffer.c +1
-1hv_set_next_write_location (outring_info, next_write_location);@@ -549,7 +549,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,/* Make sure all reads are done before we update the read index since */ /* the writer may start writing to the read area once the read index */ /*is updated */ -smp_mb (); +mb ();drivers/hv/ring_buffer.c +0
-0/* Update the read index */ hv_set_next_read_location (inring_info, next_read_location);drivers/hv/vmbus_drv.c +1
-2@@ -434,7 +434,7 @@ static void vmbus_on_msg_dpc(unsigned long data)* will not deliver any more messages since there is * no empty slot */ -smp_mb (); +mb ();if (msg->header.message_flags.msg_pending) {/* -- 1.7.1