diff options
author | K. Y. Srinivasan <kys@microsoft.com> | 2012-12-01 09:46:32 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-17 13:46:39 -0500 |
commit | 6fdf3b21433e901dcba0ac186f00d604ce944f56 (patch) | |
tree | 57ba241493d522388a1d8eda8663f43c96b57f32 /drivers/hv/ring_buffer.c | |
parent | 0bffd25ce919f88ea6473150b66d26e7fa5712af (diff) |
Drivers: hv: Implement routines for read side signaling optimization
Implement functions that will support read-side signaling optimization.
By having the reader indicate the start of the "read" operation and the
"end" of the read operation we can more efficiently handle the signaling
protocol: while the read is in progress, there is no need for the "writer"
to signal the "reader" as new items are put on the read queue.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv/ring_buffer.c')
-rw-r--r-- | drivers/hv/ring_buffer.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 7233c88f01b8..001079287709 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c | |||
@@ -29,6 +29,30 @@ | |||
29 | 29 | ||
30 | #include "hyperv_vmbus.h" | 30 | #include "hyperv_vmbus.h" |
31 | 31 | ||
32 | void hv_begin_read(struct hv_ring_buffer_info *rbi) | ||
33 | { | ||
34 | rbi->ring_buffer->interrupt_mask = 1; | ||
35 | smp_mb(); | ||
36 | } | ||
37 | |||
38 | u32 hv_end_read(struct hv_ring_buffer_info *rbi) | ||
39 | { | ||
40 | u32 read; | ||
41 | u32 write; | ||
42 | |||
43 | rbi->ring_buffer->interrupt_mask = 0; | ||
44 | smp_mb(); | ||
45 | |||
46 | /* | ||
47 | * Now check to see if the ring buffer is still empty. | ||
48 | * If it is not, we raced and we need to process new | ||
49 | * incoming messages. | ||
50 | */ | ||
51 | hv_get_ringbuffer_availbytes(rbi, &read, &write); | ||
52 | |||
53 | return read; | ||
54 | } | ||
55 | |||
32 | 56 | ||
33 | /* | 57 | /* |
34 | * hv_get_next_write_location() | 58 | * hv_get_next_write_location() |