search for: inbuf_lock

Displaying 20 results from an estimated 105 matches for "inbuf_lock".

2019 Mar 04
5
[PATCH] virtio_console: free unused buffers with virtio port
...d remove_port(struct kref *kref) kfree(port); } +static void remove_unused_bufs(struct virtqueue *vq) +{ + struct port_buffer *buf; + + while ((buf = virtqueue_detach_unused_buf(vq))) + free_buf(buf, true); +} + static void remove_port_data(struct port *port) { spin_lock_irq(&port->inbuf_lock); /* Remove unused data this port might have received. */ discard_port_data(port); + remove_unused_bufs(port->in_vq); spin_unlock_irq(&port->inbuf_lock); spin_lock_irq(&port->outvq_lock); reclaim_consumed_buffers(port); + remove_unused_bufs(port->out_vq); spin_unlo...
2019 Mar 04
5
[PATCH] virtio_console: free unused buffers with virtio port
...d remove_port(struct kref *kref) kfree(port); } +static void remove_unused_bufs(struct virtqueue *vq) +{ + struct port_buffer *buf; + + while ((buf = virtqueue_detach_unused_buf(vq))) + free_buf(buf, true); +} + static void remove_port_data(struct port *port) { spin_lock_irq(&port->inbuf_lock); /* Remove unused data this port might have received. */ discard_port_data(port); + remove_unused_bufs(port->in_vq); spin_unlock_irq(&port->inbuf_lock); spin_lock_irq(&port->outvq_lock); reclaim_consumed_buffers(port); + remove_unused_bufs(port->out_vq); spin_unlo...
2013 Jul 25
0
[PATCH v3 8/9] virtio: console: fix locking around send_sigio_to_port()
send_sigio_to_port() checks the value of guest_connected, which we always modify under the inbuf_lock; make sure invocations of send_sigio_to_port() have take the inbuf_lock around the call. Signed-off-by: Amit Shah <amit.shah at redhat.com> --- drivers/char/virtio_console.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/char/virtio_console.c b/drivers/c...
2018 Apr 20
0
[PATCH 3/6] virtio_console: free buffers after reset
...>in_vq))) - free_buf(buf, true); free_device: device_destroy(pdrvdata.class, port->dev->devt); free_cdev: @@ -1539,34 +1536,14 @@ static void remove_port(struct kref *kref) static void remove_port_data(struct port *port) { - struct port_buffer *buf; - spin_lock_irq(&port->inbuf_lock); /* Remove unused data this port might have received. */ discard_port_data(port); spin_unlock_irq(&port->inbuf_lock); - /* Remove buffers we queued up for the Host to send us data in. */ - do { - spin_lock_irq(&port->inbuf_lock); - buf = virtqueue_detach_unused_buf(port-&gt...
2013 Jul 25
18
[PATCH v3 0/9] virtio: console: fixes for bugs and races with unplug
Hello, This series fixes a few bugs and races with port unplug and the various file operations: read(), write() and close(). I started coding up an alternative locking mechanism based on the discussion earlier in this series, but some of what we already have has to remain, and the new code is sufficiently different, so I'd rather it bakes for a while, and I ensure there are no regressions
2013 Jul 25
18
[PATCH v3 0/9] virtio: console: fixes for bugs and races with unplug
Hello, This series fixes a few bugs and races with port unplug and the various file operations: read(), write() and close(). I started coding up an alternative locking mechanism based on the discussion earlier in this series, but some of what we already have has to remain, and the new code is sufficiently different, so I'd rather it bakes for a while, and I ensure there are no regressions
2019 Oct 18
3
[PATCH] virtio_console: allocate inbufs in add_port() only if it is needed
...@ -1421,12 +1421,17 @@ static int add_port(struct ports_device *portdev, u32 id) spin_lock_init(&port->outvq_lock); init_waitqueue_head(&port->waitqueue); - /* Fill the in_vq with buffers so the host can send us data. */ - nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock); - if (!nr_added_bufs) { - dev_err(port->dev, "Error allocating inbufs\n"); - err = -ENOMEM; - goto free_device; + /* if the in_vq has not already been filled (the port has already been + * used and unplugged), fill the in_vq with buffers so the host can + * send us data. + */ +...
2019 Oct 18
3
[PATCH] virtio_console: allocate inbufs in add_port() only if it is needed
...@ -1421,12 +1421,17 @@ static int add_port(struct ports_device *portdev, u32 id) spin_lock_init(&port->outvq_lock); init_waitqueue_head(&port->waitqueue); - /* Fill the in_vq with buffers so the host can send us data. */ - nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock); - if (!nr_added_bufs) { - dev_err(port->dev, "Error allocating inbufs\n"); - err = -ENOMEM; - goto free_device; + /* if the in_vq has not already been filled (the port has already been + * used and unplugged), fill the in_vq with buffers so the host can + * send us data. + */ +...
2013 Jul 18
16
[PATCH 00/10] virtio: console: fixes for races with port unplug
Hello, This series fixes a few races with port unplug and the various file operations: read(), write(), close() and poll(). There still might be more races lurking, but testing this series looks good to at least solve the easily-triggerable ones. I've run the virtio-serial testsuite and a few open/close/unplug tests, and haven't seen any badness. I've marked these patches for
2013 Jul 18
16
[PATCH 00/10] virtio: console: fixes for races with port unplug
Hello, This series fixes a few races with port unplug and the various file operations: read(), write(), close() and poll(). There still might be more races lurking, but testing this series looks good to at least solve the easily-triggerable ones. I've run the virtio-serial testsuite and a few open/close/unplug tests, and haven't seen any badness. I've marked these patches for
2016 Oct 11
2
[PATCH] virtio: console: Unlock vqs while freeing buffers
...etions(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 5da47e26a012..4aae0d27e382 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1540,19 +1540,29 @@ static void remove_port_data(struct port *port) spin_lock_irq(&port->inbuf_lock); /* Remove unused data this port might have received. */ discard_port_data(port); + spin_unlock_irq(&port->inbuf_lock); /* Remove buffers we queued up for the Host to send us data in. */ - while ((buf = virtqueue_detach_unused_buf(port->in_vq))) - free_buf(buf, true); - spin_unl...
2016 Oct 11
2
[PATCH] virtio: console: Unlock vqs while freeing buffers
...etions(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 5da47e26a012..4aae0d27e382 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1540,19 +1540,29 @@ static void remove_port_data(struct port *port) spin_lock_irq(&port->inbuf_lock); /* Remove unused data this port might have received. */ discard_port_data(port); + spin_unlock_irq(&port->inbuf_lock); /* Remove buffers we queued up for the Host to send us data in. */ - while ((buf = virtqueue_detach_unused_buf(port->in_vq))) - free_buf(buf, true); - spin_unl...
2019 Nov 06
3
[PATCH] virtio_console: allocate inbufs in add_port() only if it is needed
...ruct ports_device *portdev, u32 id) >> spin_lock_init(&port->outvq_lock); >> init_waitqueue_head(&port->waitqueue); >> >> - /* Fill the in_vq with buffers so the host can send us data. */ >> - nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock); >> - if (!nr_added_bufs) { >> - dev_err(port->dev, "Error allocating inbufs\n"); >> - err = -ENOMEM; >> - goto free_device; >> + /* if the in_vq has not already been filled (the port has already been >> + * used and unplugged), fill the in_vq w...
2019 Nov 06
3
[PATCH] virtio_console: allocate inbufs in add_port() only if it is needed
...ruct ports_device *portdev, u32 id) >> spin_lock_init(&port->outvq_lock); >> init_waitqueue_head(&port->waitqueue); >> >> - /* Fill the in_vq with buffers so the host can send us data. */ >> - nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock); >> - if (!nr_added_bufs) { >> - dev_err(port->dev, "Error allocating inbufs\n"); >> - err = -ENOMEM; >> - goto free_device; >> + /* if the in_vq has not already been filled (the port has already been >> + * used and unplugged), fill the in_vq w...
2013 Apr 11
1
[PATCH 1/1] virtio: console: replace EMFILE with EBUSY for already-open port
...(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index ce5f3fc..b94be04 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1040,7 +1040,7 @@ static int port_fops_open(struct inode *inode, struct file *filp) spin_lock_irq(&port->inbuf_lock); if (port->guest_connected) { spin_unlock_irq(&port->inbuf_lock); - ret = -EMFILE; + ret = -EBUSY; goto out; } -- 1.8.1.4
2013 Apr 11
1
[PATCH 1/1] virtio: console: replace EMFILE with EBUSY for already-open port
...(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index ce5f3fc..b94be04 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1040,7 +1040,7 @@ static int port_fops_open(struct inode *inode, struct file *filp) spin_lock_irq(&port->inbuf_lock); if (port->guest_connected) { spin_unlock_irq(&port->inbuf_lock); - ret = -EMFILE; + ret = -EBUSY; goto out; } -- 1.8.1.4
2013 Jul 19
12
[PATCH v2 00/11] virtio: console: fixes for port unplug
Hello, This series fixes a few bugs and races with port unplug and the various file operations: read(), write(), close() and poll(). There still might be more races lurking, but testing this series looks good to at least solve the easily-triggerable ones. I've run the virtio-serial testsuite and a few open/close/unplug tests, and haven't seen any badness. I've marked these patches
2013 Jul 19
12
[PATCH v2 00/11] virtio: console: fixes for port unplug
Hello, This series fixes a few bugs and races with port unplug and the various file operations: read(), write(), close() and poll(). There still might be more races lurking, but testing this series looks good to at least solve the easily-triggerable ones. I've run the virtio-serial testsuite and a few open/close/unplug tests, and haven't seen any badness. I've marked these patches
2019 Mar 05
2
[PATCH] virtio_console: free unused buffers with virtio port
...struct port_buffer *buf; > > + > > + while ((buf = virtqueue_detach_unused_buf(vq))) > > + free_buf(buf, true); > > +} > > + > > static void remove_port_data(struct port *port) > > { > > spin_lock_irq(&port->inbuf_lock); > > /* Remove unused data this port might have received. */ > > discard_port_data(port); > > + remove_unused_bufs(port->in_vq); > > spin_unlock_irq(&port->inbuf_lock); > > > > spin_lock_irq(&port->ou...
2019 Mar 05
2
[PATCH] virtio_console: free unused buffers with virtio port
...struct port_buffer *buf; > > + > > + while ((buf = virtqueue_detach_unused_buf(vq))) > > + free_buf(buf, true); > > +} > > + > > static void remove_port_data(struct port *port) > > { > > spin_lock_irq(&port->inbuf_lock); > > /* Remove unused data this port might have received. */ > > discard_port_data(port); > > + remove_unused_bufs(port->in_vq); > > spin_unlock_irq(&port->inbuf_lock); > > > > spin_lock_irq(&port->ou...