search for: c_ivq_lock

Displaying 20 results from an estimated 27 matches for "c_ivq_lock".

2013 Mar 29
3
[PATCH v2 0/2] virtio: console: add locking around control out-vq
The in-vq operations were protected by a lock, but the out-vq operations were not. This caused panics / errors as described in patch 2. Fix that. The first patch renames the existing cvq_lock to c_ivq_lock to match c_ivq. The second patch introduces the c_ovq_lock for the c_ovq. Please apply. I also believe this is a candidate for stable. v2: * Use spin_lock instead of spin_lock_irq. Pointed out by Wanlong Gao. Amit Shah (2): virtio: console: rename cvq_lock to c_ivq_lock virtio: console:...
2013 Mar 29
3
[PATCH v2 0/2] virtio: console: add locking around control out-vq
The in-vq operations were protected by a lock, but the out-vq operations were not. This caused panics / errors as described in patch 2. Fix that. The first patch renames the existing cvq_lock to c_ivq_lock to match c_ivq. The second patch introduces the c_ovq_lock for the c_ovq. Please apply. I also believe this is a candidate for stable. v2: * Use spin_lock instead of spin_lock_irq. Pointed out by Wanlong Gao. Amit Shah (2): virtio: console: rename cvq_lock to c_ivq_lock virtio: console:...
2013 Mar 28
5
[PATCH 0/2] virtio: console: add locking around control out-vq
The in-vq operations were protected by a lock, but the out-vq operations were not. This caused panics / errors as described in patch 2. Fix that. The first patch renames the existing cvq_lock to c_ivq_lock to match c_ivq. The second patch introduces the c_ovq_lock for the c_ovq. Please apply. I also believe this is a candidate for stable. Amit Shah (2): virtio: console: rename cvq_lock to c_ivq_lock virtio: console: add locking around c_ovq operations drivers/char/virtio_console.c | 22 +++...
2013 Mar 28
5
[PATCH 0/2] virtio: console: add locking around control out-vq
The in-vq operations were protected by a lock, but the out-vq operations were not. This caused panics / errors as described in patch 2. Fix that. The first patch renames the existing cvq_lock to c_ivq_lock to match c_ivq. The second patch introduces the c_ovq_lock for the c_ovq. Please apply. I also believe this is a candidate for stable. Amit Shah (2): virtio: console: rename cvq_lock to c_ivq_lock virtio: console: add locking around c_ovq operations drivers/char/virtio_console.c | 22 +++...
2019 Nov 13
2
[PATCH v2] virtio_console: allocate inbufs in add_port() only if it is needed
...inbufs\n"); - err = -ENOMEM; goto free_device; } @@ -2059,14 +2056,11 @@ static int virtcons_probe(struct virtio_device *vdev) INIT_WORK(&portdev->control_work, &control_work_handler); if (multiport) { - unsigned int nr_added_bufs; - spin_lock_init(&portdev->c_ivq_lock); spin_lock_init(&portdev->c_ovq_lock); - nr_added_bufs = fill_queue(portdev->c_ivq, - &portdev->c_ivq_lock); - if (!nr_added_bufs) { + err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); + if (err < 0) { dev_err(&vdev->dev, "Er...
2019 Nov 13
2
[PATCH v2] virtio_console: allocate inbufs in add_port() only if it is needed
...inbufs\n"); - err = -ENOMEM; goto free_device; } @@ -2059,14 +2056,11 @@ static int virtcons_probe(struct virtio_device *vdev) INIT_WORK(&portdev->control_work, &control_work_handler); if (multiport) { - unsigned int nr_added_bufs; - spin_lock_init(&portdev->c_ivq_lock); spin_lock_init(&portdev->c_ovq_lock); - nr_added_bufs = fill_queue(portdev->c_ivq, - &portdev->c_ivq_lock); - if (!nr_added_bufs) { + err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); + if (err < 0) { dev_err(&vdev->dev, "Er...
2019 Nov 14
3
[PATCH v3] virtio_console: allocate inbufs in add_port() only if it is needed
...inbufs\n"); - err = -ENOMEM; goto free_device; } @@ -2059,14 +2060,11 @@ static int virtcons_probe(struct virtio_device *vdev) INIT_WORK(&portdev->control_work, &control_work_handler); if (multiport) { - unsigned int nr_added_bufs; - spin_lock_init(&portdev->c_ivq_lock); spin_lock_init(&portdev->c_ovq_lock); - nr_added_bufs = fill_queue(portdev->c_ivq, - &portdev->c_ivq_lock); - if (!nr_added_bufs) { + err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); + if (err < 0) { dev_err(&vdev->dev, "Er...
2019 Nov 14
3
[PATCH v3] virtio_console: allocate inbufs in add_port() only if it is needed
...inbufs\n"); - err = -ENOMEM; goto free_device; } @@ -2059,14 +2060,11 @@ static int virtcons_probe(struct virtio_device *vdev) INIT_WORK(&portdev->control_work, &control_work_handler); if (multiport) { - unsigned int nr_added_bufs; - spin_lock_init(&portdev->c_ivq_lock); spin_lock_init(&portdev->c_ovq_lock); - nr_added_bufs = fill_queue(portdev->c_ivq, - &portdev->c_ivq_lock); - if (!nr_added_bufs) { + err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); + if (err < 0) { dev_err(&vdev->dev, "Er...
2019 Nov 13
0
[PATCH v2] virtio_console: allocate inbufs in add_port() only if it is needed
.... from previous detach). > @@ -2059,14 +2056,11 @@ static int virtcons_probe(struct virtio_device *vdev) > INIT_WORK(&portdev->control_work, &control_work_handler); > > if (multiport) { > - unsigned int nr_added_bufs; > - > spin_lock_init(&portdev->c_ivq_lock); > spin_lock_init(&portdev->c_ovq_lock); > > - nr_added_bufs = fill_queue(portdev->c_ivq, > - &portdev->c_ivq_lock); > - if (!nr_added_bufs) { > + err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); > + if (err < 0) { >...
2019 Dec 03
0
[PATCH v3] virtio_console: allocate inbufs in add_port() only if it is needed
...vice; > } > > @@ -2059,14 +2060,11 @@ static int virtcons_probe(struct > virtio_device *vdev) > INIT_WORK(&portdev->control_work, &control_work_handler); > > if (multiport) { > - unsigned int nr_added_bufs; > - > spin_lock_init(&portdev->c_ivq_lock); > spin_lock_init(&portdev->c_ovq_lock); > > - nr_added_bufs = fill_queue(portdev->c_ivq, > - &portdev->c_ivq_lock); > - if (!nr_added_bufs) { > + err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); > + if (err < 0) { >...
2019 Dec 03
1
[PATCH v3] virtio_console: allocate inbufs in add_port() only if it is needed
...,14 +2060,11 @@ static int virtcons_probe(struct > > virtio_device *vdev) > > INIT_WORK(&portdev->control_work, &control_work_handler); > > > > if (multiport) { > > - unsigned int nr_added_bufs; > > - > > spin_lock_init(&portdev->c_ivq_lock); > > spin_lock_init(&portdev->c_ovq_lock); > > > > - nr_added_bufs = fill_queue(portdev->c_ivq, > > - &portdev->c_ivq_lock); > > - if (!nr_added_bufs) { > > + err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); >...
2015 Feb 28
2
[PATCH] virtio_console: init work unconditionally
...virtio_console.c @@ -2040,12 +2040,13 @@ static int virtcons_probe(struct virtio_device *vdev) virtio_device_ready(portdev->vdev); + INIT_WORK(&portdev->control_work, &control_work_handler); + if (multiport) { unsigned int nr_added_bufs; spin_lock_init(&portdev->c_ivq_lock); spin_lock_init(&portdev->c_ovq_lock); - INIT_WORK(&portdev->control_work, &control_work_handler); nr_added_bufs = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); -- MST
2015 Feb 28
2
[PATCH] virtio_console: init work unconditionally
...virtio_console.c @@ -2040,12 +2040,13 @@ static int virtcons_probe(struct virtio_device *vdev) virtio_device_ready(portdev->vdev); + INIT_WORK(&portdev->control_work, &control_work_handler); + if (multiport) { unsigned int nr_added_bufs; spin_lock_init(&portdev->c_ivq_lock); spin_lock_init(&portdev->c_ovq_lock); - INIT_WORK(&portdev->control_work, &control_work_handler); nr_added_bufs = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); -- MST
2019 Nov 13
2
[PATCH v2] virtio_console: allocate inbufs in add_port() only if it is needed
...; @@ -2059,14 +2056,11 @@ static int virtcons_probe(struct virtio_device *vdev) > > INIT_WORK(&portdev->control_work, &control_work_handler); > > > > if (multiport) { > > - unsigned int nr_added_bufs; > > - > > spin_lock_init(&portdev->c_ivq_lock); > > spin_lock_init(&portdev->c_ovq_lock); > > > > - nr_added_bufs = fill_queue(portdev->c_ivq, > > - &portdev->c_ivq_lock); > > - if (!nr_added_bufs) { > > + err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); >...
2019 Nov 13
2
[PATCH v2] virtio_console: allocate inbufs in add_port() only if it is needed
...; @@ -2059,14 +2056,11 @@ static int virtcons_probe(struct virtio_device *vdev) > > INIT_WORK(&portdev->control_work, &control_work_handler); > > > > if (multiport) { > > - unsigned int nr_added_bufs; > > - > > spin_lock_init(&portdev->c_ivq_lock); > > spin_lock_init(&portdev->c_ovq_lock); > > > > - nr_added_bufs = fill_queue(portdev->c_ivq, > > - &portdev->c_ivq_lock); > > - if (!nr_added_bufs) { > > + err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); >...
2016 Dec 06
0
[PATCH 01/10] virtio_console: drop unused config fields
...14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 5649234..8b00e79 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -152,8 +152,8 @@ struct ports_device { spinlock_t c_ivq_lock; spinlock_t c_ovq_lock; - /* The current config space is stored here */ - struct virtio_console_config config; + /* max. number of ports this device can hold */ + u32 max_nr_ports; /* The virtio device we're associated with */ struct virtio_device *vdev; @@ -1649,11 +1649,11 @@ static...
2018 Apr 20
0
[PATCH 3/6] virtio_console: free buffers after reset
...port->outvq_lock); - buf = virtqueue_detach_unused_buf(port->out_vq); - spin_unlock_irq(&port->outvq_lock); - if (buf) - free_buf(buf, true); - } while (buf); } /* @@ -1791,13 +1768,24 @@ static void control_work_handler(struct work_struct *work) spin_unlock(&portdev->c_ivq_lock); } +static void flush_bufs(struct virtqueue *vq, bool can_sleep) +{ + struct port_buffer *buf; + unsigned int len; + + while ((buf = virtqueue_get_buf(vq, &len))) + free_buf(buf, can_sleep); +} + static void out_intr(struct virtqueue *vq) { struct port *port; port = find_port_by_vq...
2014 Dec 01
0
[PATCH v8 47/50] virtio_console: virtio 1.0 support
...he host port got closed and the host had any @@ -1752,7 +1756,7 @@ static void control_work_handler(struct work_struct *work) buf->len = len; buf->offset = 0; - handle_control_message(portdev, buf); + handle_control_message(vq->vdev, portdev, buf); spin_lock(&portdev->c_ivq_lock); if (add_inbuf(portdev->c_ivq, buf) < 0) { @@ -2126,6 +2130,7 @@ static struct virtio_device_id id_table[] = { static unsigned int features[] = { VIRTIO_CONSOLE_F_SIZE, VIRTIO_CONSOLE_F_MULTIPORT, + VIRTIO_F_VERSION_1, }; static struct virtio_device_id rproc_serial_id_table[] = {...
2014 Dec 01
0
[PATCH v8 47/50] virtio_console: virtio 1.0 support
...he host port got closed and the host had any @@ -1752,7 +1756,7 @@ static void control_work_handler(struct work_struct *work) buf->len = len; buf->offset = 0; - handle_control_message(portdev, buf); + handle_control_message(vq->vdev, portdev, buf); spin_lock(&portdev->c_ivq_lock); if (add_inbuf(portdev->c_ivq, buf) < 0) { @@ -2126,6 +2130,7 @@ static struct virtio_device_id id_table[] = { static unsigned int features[] = { VIRTIO_CONSOLE_F_SIZE, VIRTIO_CONSOLE_F_MULTIPORT, + VIRTIO_F_VERSION_1, }; static struct virtio_device_id rproc_serial_id_table[] = {...
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: