Skip to contentSkip to conversation

drivers: hv: check interrupt mask before read_index

PATCH In review Jason Wang 2 participants 2 messages Jun 20, 2013 Hyper-V/Azure core and drivers

lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/1 drivers: hv: check interrupt mask before read_index

This patches add a read barriers to force the driver to check the interrupt mask before read_index. Otherwise we may lost a kick to host.

Cc K. Y. Srinivasan <[email protected]>
Cc Haiyang Zhang <[email protected]>
---
 drivers/hv/ring_buffer.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/hv/ring_buffer.c +2 -0
index 791f45d..26c93cf 100644
@@ -75,6 +75,8 @@ static bool hv_need_to_signal(u32 old_write, struct hv_ring_buffer_info *rbi)
 	if (rbi->ring_buffer->interrupt_mask)
 		return false;
 
+	/* check interrupt_mask before read_index */
+	rmb();
 	/*
 	 * This is the only case we need to signal when the
 	 * ring transitions from being empty to non-empty.
Signature · 1 line
1.7.1
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Thursday, June 20, 2013 12:59 AM
To: KY Srinivasan; [email protected]; [email protected]; [email protected]
Cc: Haiyang Zhang; Jason Wang
Subject: [PATCH] drivers: hv: check interrupt mask before read_index

Quoted 6 lines

This patches add a read barriers to force the driver to check the interrupt mask before read_index. Otherwise we may lost a kick to host.

Cc K. Y. Srinivasan <[email protected]>
Cc Haiyang Zhang <[email protected]>
Quoted 22 lines
---
 drivers/hv/ring_buffer.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/hv/ring_buffer.c +2 -0
index 791f45d..26c93cf 100644
@@ -75,6 +75,8 @@ static bool hv_need_to_signal(u32 old_write, struct
 hv_ring_buffer_info *rbi)
 	if (rbi->ring_buffer->interrupt_mask)
 		return false;
 
+	/* check interrupt_mask before read_index */
+	rmb();
 	/*
 	 * This is the only case we need to signal when the

* ring transitions from being empty to non-empty.
--
1.7.1