search for: ports_lock

Displaying 20 results from an estimated 52 matches for "ports_lock".

2013 Jul 25
0
[PATCH v3 1/9] virtio: console: fix race with port unplug and open/close
...e.c b/drivers/char/virtio_console.c index 1b456fe..291f437 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -272,9 +272,12 @@ static struct port *find_port_by_devt_in_portdev(struct ports_device *portdev, unsigned long flags; spin_lock_irqsave(&portdev->ports_lock, flags); - list_for_each_entry(port, &portdev->ports, list) - if (port->cdev->dev == dev) + list_for_each_entry(port, &portdev->ports, list) { + if (port->cdev->dev == dev) { + kref_get(&port->kref); goto out; + } + } port = NULL; out: spin_unlock_irqr...
2013 Jul 29
1
[PATCH v3 1/9] virtio: console: fix race with port unplug and open/close
...> index 1b456fe..291f437 100644 > --- a/drivers/char/virtio_console.c > +++ b/drivers/char/virtio_console.c > @@ -272,9 +272,12 @@ static struct port *find_port_by_devt_in_portdev(struct ports_device *portdev, > unsigned long flags; > > spin_lock_irqsave(&portdev->ports_lock, flags); > - list_for_each_entry(port, &portdev->ports, list) > - if (port->cdev->dev == dev) > + list_for_each_entry(port, &portdev->ports, list) { > + if (port->cdev->dev == dev) { > + kref_get(&port->kref); > goto out; > + } > + }...
2013 Jul 29
1
[PATCH v3 1/9] virtio: console: fix race with port unplug and open/close
...> index 1b456fe..291f437 100644 > --- a/drivers/char/virtio_console.c > +++ b/drivers/char/virtio_console.c > @@ -272,9 +272,12 @@ static struct port *find_port_by_devt_in_portdev(struct ports_device *portdev, > unsigned long flags; > > spin_lock_irqsave(&portdev->ports_lock, flags); > - list_for_each_entry(port, &portdev->ports, list) > - if (port->cdev->dev == dev) > + list_for_each_entry(port, &portdev->ports, list) { > + if (port->cdev->dev == dev) { > + kref_get(&port->kref); > goto out; > + } > + }...
2010 Sep 02
14
[PATCH 00/14] virtio: console: Hot-unplug fixes
Hey Rusty, These are the patches that rework a few bits to make hot-unplug while ports are open not crash apps (or kernels). The problem is when hot-unplug is performed when a port is open, the cdev struct is kept around by the file pointers and when the app later does a 'close', things go boom-boom. This patch series makes sure port as well as device hot-unplug is now safe to perform
2010 Sep 02
14
[PATCH 00/14] virtio: console: Hot-unplug fixes
Hey Rusty, These are the patches that rework a few bits to make hot-unplug while ports are open not crash apps (or kernels). The problem is when hot-unplug is performed when a port is open, the cdev struct is kept around by the file pointers and when the app later does a 'close', things go boom-boom. This patch series makes sure port as well as device hot-unplug is now safe to perform
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
2010 Jan 29
3
virtio: console: Return -EFAULT on copy_xx_user errors, allow larger writes
...irst time. */ add_inbuf(port->in_vq, inbuf); @@ -1158,7 +1144,7 @@ static int add_port(struct ports_device *portdev, u32 id) if (!use_multiport(port->portdev)) { err = init_port_console(port); if (err) - goto free_outbuf; + goto free_inbuf; } spin_lock_irq(&portdev->ports_lock); @@ -1186,8 +1172,6 @@ static int add_port(struct ports_device *portdev, u32 id) } return 0; -free_outbuf: - free_buf(port->outbuf); free_inbuf: free_buf(inbuf); free_device:
2010 Jan 29
3
virtio: console: Return -EFAULT on copy_xx_user errors, allow larger writes
...irst time. */ add_inbuf(port->in_vq, inbuf); @@ -1158,7 +1144,7 @@ static int add_port(struct ports_device *portdev, u32 id) if (!use_multiport(port->portdev)) { err = init_port_console(port); if (err) - goto free_outbuf; + goto free_inbuf; } spin_lock_irq(&portdev->ports_lock); @@ -1186,8 +1172,6 @@ static int add_port(struct ports_device *portdev, u32 id) } return 0; -free_outbuf: - free_buf(port->outbuf); free_inbuf: free_buf(inbuf); free_device:
2012 Feb 01
1
[PATCH 2/2] virtio-serial: setup_port_vq when adding port
...gt; { > char debugfs_name[16]; > @@ -1163,6 +1212,14 @@ static int add_port(struct ports_device *portdev, u32 id) > > port->outvq_full = false; > > + if (!portdev->in_vqs[port->id] && !portdev->out_vqs[port->id]) { > + spin_lock(&portdev->ports_lock); > + err = setup_port_vq(portdev, port->id); > + spin_unlock(&portdev->ports_lock); > + if (err) > + goto free_port; > + } > + > port->in_vq = portdev->in_vqs[port->id]; > port->out_vq = portdev->out_vqs[port->id]; > > @@ -1614,8...
2012 Feb 01
1
[PATCH 2/2] virtio-serial: setup_port_vq when adding port
...gt; { > char debugfs_name[16]; > @@ -1163,6 +1212,14 @@ static int add_port(struct ports_device *portdev, u32 id) > > port->outvq_full = false; > > + if (!portdev->in_vqs[port->id] && !portdev->out_vqs[port->id]) { > + spin_lock(&portdev->ports_lock); > + err = setup_port_vq(portdev, port->id); > + spin_unlock(&portdev->ports_lock); > + if (err) > + goto free_port; > + } > + > port->in_vq = portdev->in_vqs[port->id]; > port->out_vq = portdev->out_vqs[port->id]; > > @@ -1614,8...
2012 Apr 18
3
[RFC PATCH] virtio_console: link vq to port with a private pointer in struct virtqueue
...4..cfc7a63 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -297,17 +297,7 @@ out: static struct port *find_port_by_vq(struct ports_device *portdev, struct virtqueue *vq) { - struct port *port; - unsigned long flags; - - spin_lock_irqsave(&portdev->ports_lock, flags); - list_for_each_entry(port, &portdev->ports, list) - if (port->in_vq == vq || port->out_vq == vq) - goto out; - port = NULL; -out: - spin_unlock_irqrestore(&portdev->ports_lock, flags); - return port; + return vq->vdev_priv; } static bool is_console_port(struc...
2012 Apr 18
3
[RFC PATCH] virtio_console: link vq to port with a private pointer in struct virtqueue
...4..cfc7a63 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -297,17 +297,7 @@ out: static struct port *find_port_by_vq(struct ports_device *portdev, struct virtqueue *vq) { - struct port *port; - unsigned long flags; - - spin_lock_irqsave(&portdev->ports_lock, flags); - list_for_each_entry(port, &portdev->ports, list) - if (port->in_vq == vq || port->out_vq == vq) - goto out; - port = NULL; -out: - spin_unlock_irqrestore(&portdev->ports_lock, flags); - return port; + return vq->vdev_priv; } static bool is_console_port(struc...
2014 Oct 20
4
[PATCH v4 13/25] virtio_console: enable VQs early
...- > /* 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) { > @@ -2026,6 +2024,8 @@ static int virtcons_probe(struct virtio_device *vdev) > spin_lock_init(&portdev->ports_lock); > INIT_LIST_HEAD(&portdev->ports); > > + virtio_device_ready(portdev->vdev); > + > if (multiport) { > unsigned int nr_added_bufs; > I wanted to set DRIVER_OK as late as possible, to both reduce the chance it can fail after DRIVER_OK and to reduce the ri...
2014 Oct 20
4
[PATCH v4 13/25] virtio_console: enable VQs early
...- > /* 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) { > @@ -2026,6 +2024,8 @@ static int virtcons_probe(struct virtio_device *vdev) > spin_lock_init(&portdev->ports_lock); > INIT_LIST_HEAD(&portdev->ports); > > + virtio_device_ready(portdev->vdev); > + > if (multiport) { > unsigned int nr_added_bufs; > I wanted to set DRIVER_OK as late as possible, to both reduce the chance it can fail after DRIVER_OK and to reduce the ri...
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
2010 May 27
3
[PATCH 1/2] virtio: console: Fix crash when hot-unplugging a port and read is blocked
...port) { struct port_buffer *buf; + if (port->guest_connected) { + port->guest_connected = false; + port->host_connected = false; + wake_up_interruptible(&port->waitqueue); + send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0); + } + spin_lock_irq(&port->portdev->ports_lock); list_del(&port->list); spin_unlock_irq(&port->portdev->ports_lock); @@ -1120,9 +1127,6 @@ static int remove_port(struct port *port) hvc_remove(port->cons.hvc); #endif } - if (port->guest_connected) - send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0); - sysfs_...
2010 May 27
3
[PATCH 1/2] virtio: console: Fix crash when hot-unplugging a port and read is blocked
...port) { struct port_buffer *buf; + if (port->guest_connected) { + port->guest_connected = false; + port->host_connected = false; + wake_up_interruptible(&port->waitqueue); + send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0); + } + spin_lock_irq(&port->portdev->ports_lock); list_del(&port->list); spin_unlock_irq(&port->portdev->ports_lock); @@ -1120,9 +1127,6 @@ static int remove_port(struct port *port) hvc_remove(port->cons.hvc); #endif } - if (port->guest_connected) - send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0); - sysfs_...
2014 Oct 20
1
[PATCH] virtio_console: move early VQ enablement
..._ready(portdev->vdev); - /* 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) { @@ -2026,6 +2024,8 @@ static int virtcons_probe(struct virtio_device *vdev) spin_lock_init(&portdev->ports_lock); INIT_LIST_HEAD(&portdev->ports); + virtio_device_ready(portdev->vdev); + if (multiport) { unsigned int nr_added_bufs; -- 1.8.5.5