Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+31 -16
+28 -15
drivers/vhost/scsi.c
··· 461 461 u32 i; 462 462 for (i = 0; i < tv_cmd->tvc_sgl_count; i++) 463 463 put_page(sg_page(&tv_cmd->tvc_sgl[i])); 464 - } 464 + } 465 465 466 466 tcm_vhost_put_inflight(tv_cmd->inflight); 467 467 percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag); ··· 1373 1373 return 0; 1374 1374 } 1375 1375 1376 + static void vhost_scsi_free(struct vhost_scsi *vs) 1377 + { 1378 + if (is_vmalloc_addr(vs)) 1379 + vfree(vs); 1380 + else 1381 + kfree(vs); 1382 + } 1383 + 1376 1384 static int vhost_scsi_open(struct inode *inode, struct file *f) 1377 1385 { 1378 1386 struct vhost_scsi *vs; 1379 1387 struct vhost_virtqueue **vqs; 1380 - int r, i; 1388 + int r = -ENOMEM, i; 1381 1389 1382 - vs = kzalloc(sizeof(*vs), GFP_KERNEL); 1383 - if (!vs) 1384 - return -ENOMEM; 1390 + vs = kzalloc(sizeof(*vs), GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); 1391 + if (!vs) { 1392 + vs = vzalloc(sizeof(*vs)); 1393 + if (!vs) 1394 + goto err_vs; 1395 + } 1385 1396 1386 1397 vqs = kmalloc(VHOST_SCSI_MAX_VQ * sizeof(*vqs), GFP_KERNEL); 1387 - if (!vqs) { 1388 - kfree(vs); 1389 - return -ENOMEM; 1390 - } 1398 + if (!vqs) 1399 + goto err_vqs; 1391 1400 1392 1401 vhost_work_init(&vs->vs_completion_work, vhost_scsi_complete_cmd_work); 1393 1402 vhost_work_init(&vs->vs_event_work, tcm_vhost_evt_work); ··· 1416 1407 1417 1408 tcm_vhost_init_inflight(vs, NULL); 1418 1409 1419 - if (r < 0) { 1420 - kfree(vqs); 1421 - kfree(vs); 1422 - return r; 1423 - } 1410 + if (r < 0) 1411 + goto err_init; 1424 1412 1425 1413 f->private_data = vs; 1426 1414 return 0; 1415 + 1416 + err_init: 1417 + kfree(vqs); 1418 + err_vqs: 1419 + vhost_scsi_free(vs); 1420 + err_vs: 1421 + return r; 1427 1422 } 1428 1423 1429 1424 static int vhost_scsi_release(struct inode *inode, struct file *f) ··· 1444 1431 /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */ 1445 1432 vhost_scsi_flush(vs); 1446 1433 kfree(vs->dev.vqs); 1447 - kfree(vs); 1434 + vhost_scsi_free(vs); 1448 1435 return 0; 1449 1436 } 1450 1437
+3 -1
drivers/vhost/vhost.c
··· 161 161 if (list_empty(&work->node)) { 162 162 list_add_tail(&work->node, &dev->work_list); 163 163 work->queue_seq++; 164 + spin_unlock_irqrestore(&dev->work_lock, flags); 164 165 wake_up_process(dev->worker); 166 + } else { 167 + spin_unlock_irqrestore(&dev->work_lock, flags); 165 168 } 166 - spin_unlock_irqrestore(&dev->work_lock, flags); 167 169 } 168 170 EXPORT_SYMBOL_GPL(vhost_work_queue); 169 171