2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-02 10:23:55 +08:00

vhost: minor changes on top of 3.12-rc1

This fixes module loading for vhost-scsi, and tweaks locking in vhost core
 a bit. Both of these are not exactly release blockers but it's early
 in the cycle so I think it's a good idea to apply them now.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iQEcBAABAgAGBQJSOWVbAAoJECgfDbjSjVRp10UIALB3nkEdmhC011ld+7xgVxMt
 hB5gN1Uw3nhZOxOd1t+udHERSuZWw2CjkGRetpLHPh22bMHpHIb++Y0FvNGG9kIY
 RRSrBuFupPTCpLlsI8bkCx1uqO8VpZiKwEh1h9SxmqWmuGIJgno1ZnVhMx+fTwmn
 Av4ERtc3LrzR4RgaZqYLBf/6Ed+ElZzwi6xNvwV6rrN9oKZR2pRJSSvkJkDQzwN7
 lRdHZJrtwd5KyMoUdPmSoafwCZnrjGIwYQpXq3jpvePAYF1Ot6p/+r/M1BaEHR7N
 eUfMp4ItCXZubrUeiXuqlX/dPCq+DtQePoO86OyviVS7URlHEpAkOu2hPpi8m5M=
 =I209
 -----END PGP SIGNATURE-----

Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

Pull vhost updates from Michael Tsirkin:
 "vhost: minor changes on top of 3.12-rc1

  This fixes module loading for vhost-scsi, and tweaks locking in vhost
  core a bit.  Both of these are not exactly release blockers but it's
  early in the cycle so I think it's a good idea to apply them now"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  vhost-scsi: whitespace tweak
  vhost/scsi: use vmalloc for order-10 allocation
  vhost: wake up worker outside spin_lock
This commit is contained in:
Linus Torvalds 2013-09-20 15:16:15 -07:00
commit d45004f994
2 changed files with 31 additions and 16 deletions

View File

@ -461,7 +461,7 @@ static void tcm_vhost_release_cmd(struct se_cmd *se_cmd)
u32 i;
for (i = 0; i < tv_cmd->tvc_sgl_count; i++)
put_page(sg_page(&tv_cmd->tvc_sgl[i]));
}
}
tcm_vhost_put_inflight(tv_cmd->inflight);
percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag);
@ -1373,21 +1373,30 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features)
return 0;
}
static void vhost_scsi_free(struct vhost_scsi *vs)
{
if (is_vmalloc_addr(vs))
vfree(vs);
else
kfree(vs);
}
static int vhost_scsi_open(struct inode *inode, struct file *f)
{
struct vhost_scsi *vs;
struct vhost_virtqueue **vqs;
int r, i;
int r = -ENOMEM, i;
vs = kzalloc(sizeof(*vs), GFP_KERNEL);
if (!vs)
return -ENOMEM;
vs = kzalloc(sizeof(*vs), GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT);
if (!vs) {
vs = vzalloc(sizeof(*vs));
if (!vs)
goto err_vs;
}
vqs = kmalloc(VHOST_SCSI_MAX_VQ * sizeof(*vqs), GFP_KERNEL);
if (!vqs) {
kfree(vs);
return -ENOMEM;
}
if (!vqs)
goto err_vqs;
vhost_work_init(&vs->vs_completion_work, vhost_scsi_complete_cmd_work);
vhost_work_init(&vs->vs_event_work, tcm_vhost_evt_work);
@ -1407,14 +1416,18 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
tcm_vhost_init_inflight(vs, NULL);
if (r < 0) {
kfree(vqs);
kfree(vs);
return r;
}
if (r < 0)
goto err_init;
f->private_data = vs;
return 0;
err_init:
kfree(vqs);
err_vqs:
vhost_scsi_free(vs);
err_vs:
return r;
}
static int vhost_scsi_release(struct inode *inode, struct file *f)
@ -1431,7 +1444,7 @@ static int vhost_scsi_release(struct inode *inode, struct file *f)
/* Jobs can re-queue themselves in evt kick handler. Do extra flush. */
vhost_scsi_flush(vs);
kfree(vs->dev.vqs);
kfree(vs);
vhost_scsi_free(vs);
return 0;
}

View File

@ -161,9 +161,11 @@ void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work)
if (list_empty(&work->node)) {
list_add_tail(&work->node, &dev->work_list);
work->queue_seq++;
spin_unlock_irqrestore(&dev->work_lock, flags);
wake_up_process(dev->worker);
} else {
spin_unlock_irqrestore(&dev->work_lock, flags);
}
spin_unlock_irqrestore(&dev->work_lock, flags);
}
EXPORT_SYMBOL_GPL(vhost_work_queue);