Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354978
b: refs/heads/master
c: f878f3d
h: refs/heads/master
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Jan 17, 2013
1 parent 52fd236 commit 764e29e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7ae3e035195735f9b6ce3308b6240af877a41ea0
refs/heads/master: f878f3d59ed26f489add852ed6d5c8e5f3bbb1aa
28 changes: 25 additions & 3 deletions trunk/drivers/hv/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ static void process_chn_event(u32 relid)
{
struct vmbus_channel *channel;
unsigned long flags;
void *arg;
bool read_state;
u32 bytes_to_read;

/*
* Find the channel based on this relid and invokes the
Expand All @@ -234,10 +237,29 @@ static void process_chn_event(u32 relid)
*/

spin_lock_irqsave(&channel->inbound_lock, flags);
if (channel->onchannel_callback != NULL)
channel->onchannel_callback(channel->channel_callback_context);
else
if (channel->onchannel_callback != NULL) {
arg = channel->channel_callback_context;
read_state = channel->batched_reading;
/*
* This callback reads the messages sent by the host.
* We can optimize host to guest signaling by ensuring:
* 1. While reading the channel, we disable interrupts from
* host.
* 2. Ensure that we process all posted messages from the host
* before returning from this callback.
* 3. Once we return, enable signaling from the host. Once this
* state is set we check to see if additional packets are
* available to read. In this case we repeat the process.
*/

do {
hv_begin_read(&channel->inbound);
channel->onchannel_callback(arg);
bytes_to_read = hv_end_read(&channel->inbound);
} while (read_state && (bytes_to_read != 0));
} else {
pr_err("no channel callback for relid - %u\n", relid);
}

spin_unlock_irqrestore(&channel->inbound_lock, flags);
}
Expand Down

0 comments on commit 764e29e

Please sign in to comment.