Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 211558
b: refs/heads/master
c: 531295e
h: refs/heads/master
v: v3
  • Loading branch information
Amit Shah authored and Linus Torvalds committed Oct 20, 2010
1 parent 5c940dd commit b043428
Show file tree
Hide file tree
Showing 2 changed files with 15 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: 30c278192f9ab06125fb042f6e46763e0fd7140a
refs/heads/master: 531295e63be8c2b8b909d7400739e8b8df60d61f
17 changes: 14 additions & 3 deletions trunk/drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,12 @@ static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count,

/*
* Wait till the host acknowledges it pushed out the data we
* sent. This is done for ports in blocking mode or for data
* from the hvc_console; the tty operations are performed with
* spinlocks held so we can't sleep here.
* sent. This is done for data from the hvc_console; the tty
* operations are performed with spinlocks held so we can't
* sleep here. An alternative would be to copy the data to a
* buffer and relax the spinning requirement. The downside is
* we need to kmalloc a GFP_ATOMIC buffer each time the
* console driver writes something out.
*/
while (!virtqueue_get_buf(out_vq, &len))
cpu_relax();
Expand Down Expand Up @@ -626,6 +629,14 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf,
goto free_buf;
}

/*
* We now ask send_buf() to not spin for generic ports -- we
* can re-use the same code path that non-blocking file
* descriptors take for blocking file descriptors since the
* wait is already done and we're certain the write will go
* through to the host.
*/
nonblock = true;
ret = send_buf(port, buf, count, nonblock);

if (nonblock && ret > 0)
Expand Down

0 comments on commit b043428

Please sign in to comment.