search for: spin_lock_irq

Displaying 20 results from an estimated 367 matches for "spin_lock_irq".

2019 Mar 04
5
[PATCH] virtio_console: free unused buffers with virtio port
...06,15 +1506,25 @@ static void 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...
2019 Mar 04
5
[PATCH] virtio_console: free unused buffers with virtio port
...06,15 +1506,25 @@ static void 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...
2014 Oct 06
1
[PATCH 05/16] virtio: defer config changed notifications
...drv_to_virtio(dev->dev.driver); > + > + if (!dev->config_enabled) > + dev->config_changed = true; > + else if (drv && drv->config_changed) > + drv->config_changed(dev); > +} > + > +void virtio_config_changed(struct virtio_device *dev) > +{ > + spin_lock_irq(&dev->config_lock); > + __virtio_config_changed(dev); > + spin_unlock_irq(&dev->config_lock); Hm, isn't this function called from the interrupt handler? > +} > +EXPORT_SYMBOL_GPL(virtio_config_changed); > + > +static void virtio_config_disable(struct virtio_dev...
2014 Oct 06
1
[PATCH 05/16] virtio: defer config changed notifications
...drv_to_virtio(dev->dev.driver); > + > + if (!dev->config_enabled) > + dev->config_changed = true; > + else if (drv && drv->config_changed) > + drv->config_changed(dev); > +} > + > +void virtio_config_changed(struct virtio_device *dev) > +{ > + spin_lock_irq(&dev->config_lock); > + __virtio_config_changed(dev); > + spin_unlock_irq(&dev->config_lock); Hm, isn't this function called from the interrupt handler? > +} > +EXPORT_SYMBOL_GPL(virtio_config_changed); > + > +static void virtio_config_disable(struct virtio_dev...
2010 Sep 05
0
[PATCH] vhost: fix attach to cgroups regression
...calling this, don't hold any - * locks that are also used by the callback. */ -void vhost_poll_flush(struct vhost_poll *poll) +void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work) { - struct vhost_work *work = &poll->work; unsigned seq; int left; int flushing; - spin_lock_irq(&poll->dev->work_lock); + spin_lock_irq(&dev->work_lock); seq = work->queue_seq; work->flushing++; - spin_unlock_irq(&poll->dev->work_lock); + spin_unlock_irq(&dev->work_lock); wait_event(work->done, ({ - spin_lock_irq(&poll->dev->work_...
2010 Sep 05
0
[PATCH] vhost: fix attach to cgroups regression
...calling this, don't hold any - * locks that are also used by the callback. */ -void vhost_poll_flush(struct vhost_poll *poll) +void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work) { - struct vhost_work *work = &poll->work; unsigned seq; int left; int flushing; - spin_lock_irq(&poll->dev->work_lock); + spin_lock_irq(&dev->work_lock); seq = work->queue_seq; work->flushing++; - spin_unlock_irq(&poll->dev->work_lock); + spin_unlock_irq(&dev->work_lock); wait_event(work->done, ({ - spin_lock_irq(&poll->dev->work_...
2011 Jan 10
0
[PATCH] vhost: fix signed/unsigned comparison
...--- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -98,22 +98,26 @@ void vhost_poll_stop(struct vhost_poll *poll) remove_wait_queue(poll->wqh, &poll->wait); } +static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work, + unsigned seq) +{ + int left; + spin_lock_irq(&dev->work_lock); + left = seq - work->done_seq; + spin_unlock_irq(&dev->work_lock); + return left <= 0; +} + static void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work) { unsigned seq; - int left; int flushing; spin_lock_irq(&dev->work_lock);...
2011 Jan 10
0
[PATCH] vhost: fix signed/unsigned comparison
...--- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -98,22 +98,26 @@ void vhost_poll_stop(struct vhost_poll *poll) remove_wait_queue(poll->wqh, &poll->wait); } +static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work, + unsigned seq) +{ + int left; + spin_lock_irq(&dev->work_lock); + left = seq - work->done_seq; + spin_unlock_irq(&dev->work_lock); + return left <= 0; +} + static void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work) { unsigned seq; - int left; int flushing; spin_lock_irq(&dev->work_lock);...
2018 Apr 20
0
[PATCH 3/6] virtio_console: free buffers after reset
...ueue_detach_unused_buf(port->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_d...
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_...
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_...
2019 Aug 10
2
[PATCH v3 1/2] virtio_console: free unused buffers with port delete
...ree(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_buffe...
2019 Aug 10
2
[PATCH v3 1/2] virtio_console: free unused buffers with port delete
...ree(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_buffe...
2016 Apr 26
2
[PATCH 1/2] vhost: simplify work flushing
...seq = work->done_seq = 0; } EXPORT_SYMBOL_GPL(vhost_work_init); @@ -211,31 +222,17 @@ void vhost_poll_stop(struct vhost_poll *poll) } EXPORT_SYMBOL_GPL(vhost_poll_stop); -static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work, - unsigned seq) -{ - int left; - - spin_lock_irq(&dev->work_lock); - left = seq - work->done_seq; - spin_unlock_irq(&dev->work_lock); - return left <= 0; -} - void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work) { - unsigned seq; - int flushing; + struct vhost_flush_struct flush; + + if (dev->worker) { +...
2016 Apr 26
2
[PATCH 1/2] vhost: simplify work flushing
...seq = work->done_seq = 0; } EXPORT_SYMBOL_GPL(vhost_work_init); @@ -211,31 +222,17 @@ void vhost_poll_stop(struct vhost_poll *poll) } EXPORT_SYMBOL_GPL(vhost_poll_stop); -static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work, - unsigned seq) -{ - int left; - - spin_lock_irq(&dev->work_lock); - left = seq - work->done_seq; - spin_unlock_irq(&dev->work_lock); - return left <= 0; -} - void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work) { - unsigned seq; - int flushing; + struct vhost_flush_struct flush; + + if (dev->worker) { +...
2016 Oct 11
2
[PATCH] virtio: console: Unlock vqs while freeing buffers
...ged, 16 insertions(+), 6 deletions(-) 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_b...
2016 Oct 11
2
[PATCH] virtio: console: Unlock vqs while freeing buffers
...ged, 16 insertions(+), 6 deletions(-) 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_b...
2018 Apr 20
13
[PATCH 0/6] virtio-console: spec compliance fixes
Turns out virtio console tries to take a buffer out of an active vq. Works by sheer luck, and is explicitly forbidden by spec. And while going over it I saw that error handling is also broken - failure is easy to trigger if I force allocations to fail. Lightly tested. Michael S. Tsirkin (6): virtio_console: don't tie bufs to a vq virtio: add ability to iterate over vqs virtio_console:
2018 Apr 20
13
[PATCH 0/6] virtio-console: spec compliance fixes
Turns out virtio console tries to take a buffer out of an active vq. Works by sheer luck, and is explicitly forbidden by spec. And while going over it I saw that error handling is also broken - failure is easy to trigger if I force allocations to fail. Lightly tested. Michael S. Tsirkin (6): virtio_console: don't tie bufs to a vq virtio: add ability to iterate over vqs virtio_console:
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