test.c (8d10aae2741ec9ffd53c8d214f7ada6d543b3a46) test.c (22fa90c7fb479694d6affebc049d21f06b714be6)
1/* Copyright (C) 2009 Red Hat, Inc.
2 * Author: Michael S. Tsirkin <mst@redhat.com>
3 *
4 * This work is licensed under the terms of the GNU GPL, version 2.
5 *
6 * test virtio server in host kernel.
7 */
8
9#include <linux/compat.h>
10#include <linux/eventfd.h>
11#include <linux/vhost.h>
12#include <linux/miscdevice.h>
13#include <linux/module.h>
14#include <linux/mutex.h>
15#include <linux/workqueue.h>
1/* Copyright (C) 2009 Red Hat, Inc.
2 * Author: Michael S. Tsirkin <mst@redhat.com>
3 *
4 * This work is licensed under the terms of the GNU GPL, version 2.
5 *
6 * test virtio server in host kernel.
7 */
8
9#include <linux/compat.h>
10#include <linux/eventfd.h>
11#include <linux/vhost.h>
12#include <linux/miscdevice.h>
13#include <linux/module.h>
14#include <linux/mutex.h>
15#include <linux/workqueue.h>
16#include <linux/rcupdate.h>
17#include <linux/file.h>
18#include <linux/slab.h>
19
20#include "test.h"
21#include "vhost.h"
22
23/* Max number of bytes transferred before requeueing the job.
24 * Using this limit prevents one virtqueue from starving others. */

--- 170 unchanged lines hidden (view full) ---

195 }
196
197 for (index = 0; index < n->dev.nvqs; ++index) {
198 vq = n->vqs + index;
199 mutex_lock(&vq->mutex);
200 priv = test ? n : NULL;
201
202 /* start polling new socket */
16#include <linux/file.h>
17#include <linux/slab.h>
18
19#include "test.h"
20#include "vhost.h"
21
22/* Max number of bytes transferred before requeueing the job.
23 * Using this limit prevents one virtqueue from starving others. */

--- 170 unchanged lines hidden (view full) ---

194 }
195
196 for (index = 0; index < n->dev.nvqs; ++index) {
197 vq = n->vqs + index;
198 mutex_lock(&vq->mutex);
199 priv = test ? n : NULL;
200
201 /* start polling new socket */
203 oldpriv = rcu_dereference_protected(vq->private_data,
204 lockdep_is_held(&vq->mutex));
205 rcu_assign_pointer(vq->private_data, priv);
202 oldpriv = vq->private_data;
203 vq->private_data = priv;
206
207 r = vhost_init_used(&n->vqs[index]);
208
209 mutex_unlock(&vq->mutex);
210
211 if (r)
212 goto err;
213

--- 130 unchanged lines hidden ---
204
205 r = vhost_init_used(&n->vqs[index]);
206
207 mutex_unlock(&vq->mutex);
208
209 if (r)
210 goto err;
211

--- 130 unchanged lines hidden ---