Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1537054 > unrolled thread

[PATCH 00/10] virtio: sparse fixes

Started by"Michael S. Tsirkin" <mst@redhat.com>
First post2016-12-06 16:50 +0100
Last post2016-12-07 05:20 +0100
Articles 5 on this page of 25 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/10] virtio: sparse fixes "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-06 16:50 +0100
    [PATCH 07/10] vsock/virtio: add a missing __le annotation "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-06 16:50 +0100
      Re: [PATCH 07/10] vsock/virtio: add a missing __le annotation Jason Wang <jasowang@redhat.com> - 2016-12-07 05:20 +0100
      Re: [PATCH 07/10] vsock/virtio: add a missing __le annotation Stefan Hajnoczi <stefanha@redhat.com> - 2016-12-07 15:20 +0100
    [PATCH 05/10] vhost: make interval tree static inline "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-06 16:50 +0100
    [PATCH 09/10] vsock/virtio: fix src/dst cid format "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-06 16:50 +0100
      Re: [PATCH 09/10] vsock/virtio: fix src/dst cid format Jason Wang <jasowang@redhat.com> - 2016-12-07 05:40 +0100
        Re: [PATCH 09/10] vsock/virtio: fix src/dst cid format "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-11 04:00 +0100
      Re: [PATCH 09/10] vsock/virtio: fix src/dst cid format Stefan Hajnoczi <stefanha@redhat.com> - 2016-12-07 15:10 +0100
    [PATCH 06/10] vhost: add missing __user annotations "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-06 16:50 +0100
      Re: [PATCH 06/10] vhost: add missing __user annotations Jason Wang <jasowang@redhat.com> - 2016-12-07 05:20 +0100
    [PATCH 10/10] virtio: enable endian checks for sparse builds "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-06 16:50 +0100
      Re: [PATCH 10/10] virtio: enable endian checks for sparse builds Jason Wang <jasowang@redhat.com> - 2016-12-07 06:30 +0100
      Re: [PATCH 10/10] virtio: enable endian checks for sparse builds Johannes Berg <johannes@sipsolutions.net> - 2016-12-07 07:30 +0100
        Re: [PATCH 10/10] virtio: enable endian checks for sparse builds "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-07 14:30 +0100
      Re: [PATCH 10/10] virtio: enable endian checks for sparse builds Christoph Hellwig <hch@infradead.org> - 2016-12-07 08:40 +0100
      Re: [PATCH 10/10] virtio: enable endian checks for sparse builds Stefan Hajnoczi <stefanha@redhat.com> - 2016-12-07 15:20 +0100
    [PATCH 02/10] drm/virtio: fix endianness in primary_plane_update "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-06 16:50 +0100
      Re: [PATCH 02/10] drm/virtio: fix endianness in primary_plane_update Jason Wang <jasowang@redhat.com> - 2016-12-07 05:20 +0100
    [PATCH 03/10] drm/virtio: fix lock context imbalance "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-06 16:50 +0100
      Re: [PATCH 03/10] drm/virtio: fix lock context imbalance Jason Wang <jasowang@redhat.com> - 2016-12-07 05:20 +0100
    [PATCH 04/10] drm/virtio: annotate  virtio_gpu_queue_ctrl_buffer_locked "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-06 16:50 +0100
      Re: [PATCH 04/10] drm/virtio: annotate  virtio_gpu_queue_ctrl_buffer_locked Jason Wang <jasowang@redhat.com> - 2016-12-07 05:20 +0100
    [PATCH 01/10] virtio_console: drop unused config fields "Michael S. Tsirkin" <mst@redhat.com> - 2016-12-06 16:50 +0100
      Re: [PATCH 01/10] virtio_console: drop unused config fields Jason Wang <jasowang@redhat.com> - 2016-12-07 05:20 +0100

Page 2 of 2 — ← Prev page 1 [2]


#1537475 — Re: [PATCH 03/10] drm/virtio: fix lock context imbalance

FromJason Wang <jasowang@redhat.com>
Date2016-12-07 05:20 +0100
SubjectRe: [PATCH 03/10] drm/virtio: fix lock context imbalance
Message-ID<sLBS1-3o7-13@gated-at.bofh.it>
In reply to#1537064

On 2016年12月06日 23:40, Michael S. Tsirkin wrote:
> When virtio_gpu_free_vbufs exits due to list empty, it does not
> drop the free_vbufs lock that it took.
> list empty is not expected to happen anyway, but it can't hurt to fix
> this and drop the lock.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>   drivers/gpu/drm/virtio/virtgpu_vq.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Jason Wang <jasowang@redhat.com>

>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
> index 5a0f8a7..2f0c2f9 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_vq.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
> @@ -109,8 +109,10 @@ void virtio_gpu_free_vbufs(struct virtio_gpu_device *vgdev)
>   
>   	spin_lock(&vgdev->free_vbufs_lock);
>   	for (i = 0; i < count; i++) {
> -		if (WARN_ON(list_empty(&vgdev->free_vbufs)))
> +		if (WARN_ON(list_empty(&vgdev->free_vbufs))) {
> +			spin_unlock(&vgdev->free_vbufs_lock);
>   			return;
> +		}
>   		vbuf = list_first_entry(&vgdev->free_vbufs,
>   					struct virtio_gpu_vbuffer, list);
>   		list_del(&vbuf->list);

[toc] | [prev] | [next] | [standalone]


#1537065 — [PATCH 04/10] drm/virtio: annotate virtio_gpu_queue_ctrl_buffer_locked

From"Michael S. Tsirkin" <mst@redhat.com>
Date2016-12-06 16:50 +0100
Subject[PATCH 04/10] drm/virtio: annotate virtio_gpu_queue_ctrl_buffer_locked
Message-ID<sLqai-3UD-195@gated-at.bofh.it>
In reply to#1537054
virtio_gpu_queue_ctrl_buffer_locked is called with ctrlq.qlock taken, it
releases and acquires this lock.  This causes a sparse warning.  Add
appropriate annotations for sparse context checking.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/gpu/drm/virtio/virtgpu_vq.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
index 2f0c2f9..a6e2ce4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
+++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
@@ -297,6 +297,8 @@ void virtio_gpu_dequeue_cursor_func(struct work_struct *work)
 
 static int virtio_gpu_queue_ctrl_buffer_locked(struct virtio_gpu_device *vgdev,
 					       struct virtio_gpu_vbuffer *vbuf)
+		__releases(&vgdev->ctrlq.qlock)
+		__acquires(&vgdev->ctrlq.qlock)
 {
 	struct virtqueue *vq = vgdev->ctrlq.vq;
 	struct scatterlist *sgs[3], vcmd, vout, vresp;
-- 
MST

[toc] | [prev] | [next] | [standalone]


#1537476 — Re: [PATCH 04/10] drm/virtio: annotate virtio_gpu_queue_ctrl_buffer_locked

FromJason Wang <jasowang@redhat.com>
Date2016-12-07 05:20 +0100
SubjectRe: [PATCH 04/10] drm/virtio: annotate virtio_gpu_queue_ctrl_buffer_locked
Message-ID<sLBS1-3o7-7@gated-at.bofh.it>
In reply to#1537065

On 2016年12月06日 23:40, Michael S. Tsirkin wrote:
> virtio_gpu_queue_ctrl_buffer_locked is called with ctrlq.qlock taken, it
> releases and acquires this lock.  This causes a sparse warning.  Add
> appropriate annotations for sparse context checking.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>   drivers/gpu/drm/virtio/virtgpu_vq.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
> index 2f0c2f9..a6e2ce4 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_vq.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
> @@ -297,6 +297,8 @@ void virtio_gpu_dequeue_cursor_func(struct work_struct *work)
>   
>   static int virtio_gpu_queue_ctrl_buffer_locked(struct virtio_gpu_device *vgdev,
>   					       struct virtio_gpu_vbuffer *vbuf)
> +		__releases(&vgdev->ctrlq.qlock)
> +		__acquires(&vgdev->ctrlq.qlock)
>   {
>   	struct virtqueue *vq = vgdev->ctrlq.vq;
>   	struct scatterlist *sgs[3], vcmd, vout, vresp;

Reviewed-by: Jason Wang <jasowang@redhat.com>

[toc] | [prev] | [next] | [standalone]


#1537066 — [PATCH 01/10] virtio_console: drop unused config fields

From"Michael S. Tsirkin" <mst@redhat.com>
Date2016-12-06 16:50 +0100
Subject[PATCH 01/10] virtio_console: drop unused config fields
Message-ID<sLqai-3UD-197@gated-at.bofh.it>
In reply to#1537054
struct ports_device includes a config field including the whole
virtio_console_config, but only max_nr_ports in there is ever updated or
used. The rest is unused and in fact does not even mirror the
device config. Drop everything except max_nr_ports,
saving some memory.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/char/virtio_console.c | 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 void handle_control_message(struct virtio_device *vdev,
 			break;
 		}
 		if (virtio32_to_cpu(vdev, cpkt->id) >=
-		    portdev->config.max_nr_ports) {
+		    portdev->max_nr_ports) {
 			dev_warn(&portdev->vdev->dev,
 				"Request for adding port with "
 				"out-of-bound id %u, max. supported id: %u\n",
-				cpkt->id, portdev->config.max_nr_ports - 1);
+				cpkt->id, portdev->max_nr_ports - 1);
 			break;
 		}
 		add_port(portdev, virtio32_to_cpu(vdev, cpkt->id));
@@ -1894,7 +1894,7 @@ static int init_vqs(struct ports_device *portdev)
 	u32 i, j, nr_ports, nr_queues;
 	int err;
 
-	nr_ports = portdev->config.max_nr_ports;
+	nr_ports = portdev->max_nr_ports;
 	nr_queues = use_multiport(portdev) ? (nr_ports + 1) * 2 : 2;
 
 	vqs = kmalloc(nr_queues * sizeof(struct virtqueue *), GFP_KERNEL);
@@ -2047,13 +2047,13 @@ static int virtcons_probe(struct virtio_device *vdev)
 	}
 
 	multiport = false;
-	portdev->config.max_nr_ports = 1;
+	portdev->max_nr_ports = 1;
 
 	/* Don't test MULTIPORT at all if we're rproc: not a valid feature! */
 	if (!is_rproc_serial(vdev) &&
 	    virtio_cread_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT,
 				 struct virtio_console_config, max_nr_ports,
-				 &portdev->config.max_nr_ports) == 0) {
+				 &portdev->max_nr_ports) == 0) {
 		multiport = true;
 	}
 
-- 
MST

[toc] | [prev] | [next] | [standalone]


#1537477 — Re: [PATCH 01/10] virtio_console: drop unused config fields

FromJason Wang <jasowang@redhat.com>
Date2016-12-07 05:20 +0100
SubjectRe: [PATCH 01/10] virtio_console: drop unused config fields
Message-ID<sLBS2-3o7-19@gated-at.bofh.it>
In reply to#1537066

On 2016年12月06日 23:40, Michael S. Tsirkin wrote:
> struct ports_device includes a config field including the whole
> virtio_console_config, but only max_nr_ports in there is ever updated or
> used. The rest is unused and in fact does not even mirror the
> device config. Drop everything except max_nr_ports,
> saving some memory.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>   drivers/char/virtio_console.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)

Reviewed-by: Jason Wang <jasowang@redhat.com>

>
> 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 void handle_control_message(struct virtio_device *vdev,
>   			break;
>   		}
>   		if (virtio32_to_cpu(vdev, cpkt->id) >=
> -		    portdev->config.max_nr_ports) {
> +		    portdev->max_nr_ports) {
>   			dev_warn(&portdev->vdev->dev,
>   				"Request for adding port with "
>   				"out-of-bound id %u, max. supported id: %u\n",
> -				cpkt->id, portdev->config.max_nr_ports - 1);
> +				cpkt->id, portdev->max_nr_ports - 1);
>   			break;
>   		}
>   		add_port(portdev, virtio32_to_cpu(vdev, cpkt->id));
> @@ -1894,7 +1894,7 @@ static int init_vqs(struct ports_device *portdev)
>   	u32 i, j, nr_ports, nr_queues;
>   	int err;
>   
> -	nr_ports = portdev->config.max_nr_ports;
> +	nr_ports = portdev->max_nr_ports;
>   	nr_queues = use_multiport(portdev) ? (nr_ports + 1) * 2 : 2;
>   
>   	vqs = kmalloc(nr_queues * sizeof(struct virtqueue *), GFP_KERNEL);
> @@ -2047,13 +2047,13 @@ static int virtcons_probe(struct virtio_device *vdev)
>   	}
>   
>   	multiport = false;
> -	portdev->config.max_nr_ports = 1;
> +	portdev->max_nr_ports = 1;
>   
>   	/* Don't test MULTIPORT at all if we're rproc: not a valid feature! */
>   	if (!is_rproc_serial(vdev) &&
>   	    virtio_cread_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT,
>   				 struct virtio_console_config, max_nr_ports,
> -				 &portdev->config.max_nr_ports) == 0) {
> +				 &portdev->max_nr_ports) == 0) {
>   		multiport = true;
>   	}
>   

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web