search for: sg_elem

Displaying 20 results from an estimated 215 matches for "sg_elem".

Did you mean: sg_elems
2012 Sep 05
4
[patch] virtio-blk: fix NULL checking in virtblk_alloc_req()
...ivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -90,10 +90,11 @@ static inline struct virtblk_req *virtblk_alloc_req(struct virtio_blk *vblk, struct virtblk_req *vbr; vbr = mempool_alloc(vblk->pool, gfp_mask); - if (vbr && use_bio) - sg_init_table(vbr->sg, vblk->sg_elems); + if (!vbr) + return NULL; - vbr->vblk = vblk; + if (use_bio) + sg_init_table(vbr->sg, vblk->sg_elems); return vbr; }
2012 Sep 05
4
[patch] virtio-blk: fix NULL checking in virtblk_alloc_req()
...ivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -90,10 +90,11 @@ static inline struct virtblk_req *virtblk_alloc_req(struct virtio_blk *vblk, struct virtblk_req *vbr; vbr = mempool_alloc(vblk->pool, gfp_mask); - if (vbr && use_bio) - sg_init_table(vbr->sg, vblk->sg_elems); + if (!vbr) + return NULL; - vbr->vblk = vblk; + if (use_bio) + sg_init_table(vbr->sg, vblk->sg_elems); return vbr; }
2015 Oct 01
2
req->nr_phys_segments > queue_max_segments (was Re: kernel BUG at drivers/block/virtio_blk.c:172!)
...c68fe84248174e998922b39e508375e7c1. > commit 1cf7e9c68fe84248174e998922b39e508375e7c1 > Author: Jens Axboe <axboe at kernel.dk> > Date: Fri Nov 1 10:52:52 2013 -0600 > > virtio_blk: blk-mq support > > > BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems); > > > On probe, we do > /* We can handle whatever the host told us to handle. */ > blk_queue_max_segments(q, vblk->sg_elems-2); > > > To debug this, > maybe you can print out sg_elems at init time and when this fails, > to make sure some kind of...
2015 Oct 01
2
req->nr_phys_segments > queue_max_segments (was Re: kernel BUG at drivers/block/virtio_blk.c:172!)
...c68fe84248174e998922b39e508375e7c1. > commit 1cf7e9c68fe84248174e998922b39e508375e7c1 > Author: Jens Axboe <axboe at kernel.dk> > Date: Fri Nov 1 10:52:52 2013 -0600 > > virtio_blk: blk-mq support > > > BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems); > > > On probe, we do > /* We can handle whatever the host told us to handle. */ > blk_queue_max_segments(q, vblk->sg_elems-2); > > > To debug this, > maybe you can print out sg_elems at init time and when this fails, > to make sure some kind of...
2011 Dec 07
2
[PATCH RFC] virtio_blk: fix config handler race
...virtio_blk /* Process context for config space updates */ struct work_struct config_work; + /* Lock for config space updates */ + struct mutex config_lock; + + /* enable config space updates */ + bool config_enable; + /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -318,6 +325,10 @@ static void virtblk_config_changed_work(struct work_struct *work) char cap_str_2[10], cap_str_10[10]; u64 capacity, size; + mutex_lock(&vblk->config_lock); + if (!vblk->config_enable) + goto done; + /* Host must always specify the capacity. */ vdev->...
2011 Dec 07
2
[PATCH RFC] virtio_blk: fix config handler race
...virtio_blk /* Process context for config space updates */ struct work_struct config_work; + /* Lock for config space updates */ + struct mutex config_lock; + + /* enable config space updates */ + bool config_enable; + /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -318,6 +325,10 @@ static void virtblk_config_changed_work(struct work_struct *work) char cap_str_2[10], cap_str_10[10]; u64 capacity, size; + mutex_lock(&vblk->config_lock); + if (!vblk->config_enable) + goto done; + /* Host must always specify the capacity. */ vdev->...
2015 Oct 01
2
req->nr_phys_segments > queue_max_segments (was Re: kernel BUG at drivers/block/virtio_blk.c:172!)
...8fe84248174e998922b39e508375e7c1. > commit 1cf7e9c68fe84248174e998922b39e508375e7c1 > Author: Jens Axboe <axboe at kernel.dk> > Date: Fri Nov 1 10:52:52 2013 -0600 > > virtio_blk: blk-mq support > > > BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems); > > > On probe, we do > /* We can handle whatever the host told us to handle. */ > blk_queue_max_segments(q, vblk->sg_elems-2); > > > To debug this, > maybe you can print out sg_elems at init time and when this fails, > to make sure some kind...
2015 Oct 01
2
req->nr_phys_segments > queue_max_segments (was Re: kernel BUG at drivers/block/virtio_blk.c:172!)
...8fe84248174e998922b39e508375e7c1. > commit 1cf7e9c68fe84248174e998922b39e508375e7c1 > Author: Jens Axboe <axboe at kernel.dk> > Date: Fri Nov 1 10:52:52 2013 -0600 > > virtio_blk: blk-mq support > > > BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems); > > > On probe, we do > /* We can handle whatever the host told us to handle. */ > blk_queue_max_segments(q, vblk->sg_elems-2); > > > To debug this, > maybe you can print out sg_elems at init time and when this fails, > to make sure some kind...
2014 Oct 13
0
BUG_ON in virtio-ring.c
...otal_sg > vq->vring.num && !vq->indirect); > > Shall I submit the patch or is a more elaborate fix required? This is wrong. It looks like the block layer is spending down more sg elements than we have ring entries, yet we tell it not to: blk_queue_max_segments(q, vblk->sg_elems-2); If you apply this patch, what happens? Here it prints: [ 0.616564] virtqueue elements = 128, max_segments = 126 (1 queues) [ 0.621244] vda: vda1 vda2 < vda5 > [ 0.632290] virtqueue elements = 128, max_segments = 126 (1 queues) [ 0.683526] vdb: vdb1 vdb2 < vdb5 > C...
2011 Jun 01
6
[PATCH 1/1] [virt] virtio-blk: Use ida to allocate disk index
...virtio_blk /* The disk structure for the kernel. */ struct gendisk *disk; + u32 index; /* Request tracking. */ struct list_head reqs; @@ -343,12 +348,26 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) struct request_queue *q; int err; u64 cap; - u32 v, blk_size, sg_elems, opt_io_size; + u32 v, blk_size, sg_elems, opt_io_size, index; u16 min_io_size; u8 physical_block_exp, alignment_offset; - if (index_to_minor(index) >= 1 << MINORBITS) - return -ENOSPC; + do { + if (!ida_pre_get(&vd_index_ida, GFP_KERNEL)) + return err; + + spin_lock(&v...
2011 Jun 01
6
[PATCH 1/1] [virt] virtio-blk: Use ida to allocate disk index
...virtio_blk /* The disk structure for the kernel. */ struct gendisk *disk; + u32 index; /* Request tracking. */ struct list_head reqs; @@ -343,12 +348,26 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) struct request_queue *q; int err; u64 cap; - u32 v, blk_size, sg_elems, opt_io_size; + u32 v, blk_size, sg_elems, opt_io_size, index; u16 min_io_size; u8 physical_block_exp, alignment_offset; - if (index_to_minor(index) >= 1 << MINORBITS) - return -ENOSPC; + do { + if (!ida_pre_get(&vd_index_ida, GFP_KERNEL)) + return err; + + spin_lock(&v...
2014 Oct 07
2
BUG_ON in virtio-ring.c
Hi, I'm hitting this bug with both ext4 and btrfs. Here's an example of the backtrace: https://gist.github.com/vzctl/e888a821333979120932 I tried raising this BUG only for direct ring and it solved the problem: - BUG_ON(total_sg > vq->vring.num); + BUG_ON(total_sg > vq->vring.num && !vq->indirect); Shall I submit the patch or is a more elaborate fix
2014 Oct 07
2
BUG_ON in virtio-ring.c
Hi, I'm hitting this bug with both ext4 and btrfs. Here's an example of the backtrace: https://gist.github.com/vzctl/e888a821333979120932 I tried raising this BUG only for direct ring and it solved the problem: - BUG_ON(total_sg > vq->vring.num); + BUG_ON(total_sg > vq->vring.num && !vq->indirect); Shall I submit the patch or is a more elaborate fix
2017 Jan 26
1
[PATCH v2 2/2] virtio_scsi: Implement fc_host
...(shost) = FC_PORTTYPE_NPORT; > + fc_host_port_state(shost) = FC_PORTSTATE_ONLINE; > +} > + > static int virtscsi_probe(struct virtio_device *vdev) > { > - struct Scsi_Host *shost; > + struct Scsi_Host *shost = NULL; > struct virtio_scsi *vscsi; > int err; > u32 sg_elems, num_targets; > u32 cmd_per_lun; > u32 num_queues; > struct scsi_host_template *hostt; > + bool fc_host_enabled; > > if (!vdev->config->get) { > dev_err(&vdev->dev, "%s failure: config access disabled\n", > @@ -987,6 +1024,9 @@ static int...
2017 Jan 26
1
[PATCH v2 2/2] virtio_scsi: Implement fc_host
...(shost) = FC_PORTTYPE_NPORT; > + fc_host_port_state(shost) = FC_PORTSTATE_ONLINE; > +} > + > static int virtscsi_probe(struct virtio_device *vdev) > { > - struct Scsi_Host *shost; > + struct Scsi_Host *shost = NULL; > struct virtio_scsi *vscsi; > int err; > u32 sg_elems, num_targets; > u32 cmd_per_lun; > u32 num_queues; > struct scsi_host_template *hostt; > + bool fc_host_enabled; > > if (!vdev->config->get) { > dev_err(&vdev->dev, "%s failure: config access disabled\n", > @@ -987,6 +1024,9 @@ static int...
2020 Apr 28
2
[PATCH v2] virtio-blk: handle block_device_operations callbacks after hot unplug
...struct work_struct config_work; + /* + * Tracks references from block_device_operations open/release and + * virtio_driver probe/remove so this object can be freed once no + * longer in use. + */ + refcount_t refs; + /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -53,6 +60,9 @@ struct virtio_blk { /* num of vqs */ int num_vqs; struct virtio_blk_vq *vqs; + + /* Provides mutual exclusion with virtblk_remove(). */ + struct mutex remove_mutex; }; struct virtblk_req { @@ -295,10 +305,54 @@ static int virtblk_get_id(struct gendisk *disk, char *id...
2020 Apr 28
2
[PATCH v2] virtio-blk: handle block_device_operations callbacks after hot unplug
...struct work_struct config_work; + /* + * Tracks references from block_device_operations open/release and + * virtio_driver probe/remove so this object can be freed once no + * longer in use. + */ + refcount_t refs; + /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -53,6 +60,9 @@ struct virtio_blk { /* num of vqs */ int num_vqs; struct virtio_blk_vq *vqs; + + /* Provides mutual exclusion with virtblk_remove(). */ + struct mutex remove_mutex; }; struct virtblk_req { @@ -295,10 +305,54 @@ static int virtblk_get_id(struct gendisk *disk, char *id...
2012 May 21
6
[RFC PATCH 1/5] block: Introduce q->abort_queue_fn()
When user hot-unplug a disk which is busy serving I/O, __blk_run_queue might be unable to drain all the requests. As a result, the blk_drain_queue() would loop forever and blk_cleanup_queue would not return. So hot-unplug will fail. This patch adds a callback in blk_drain_queue() for low lever driver to abort requests. Currently, this is useful for virtio-blk to do cleanup in hot-unplug. Cc:
2012 May 21
6
[RFC PATCH 1/5] block: Introduce q->abort_queue_fn()
When user hot-unplug a disk which is busy serving I/O, __blk_run_queue might be unable to drain all the requests. As a result, the blk_drain_queue() would loop forever and blk_cleanup_queue would not return. So hot-unplug will fail. This patch adds a callback in blk_drain_queue() for low lever driver to abort requests. Currently, this is useful for virtio-blk to do cleanup in hot-unplug. Cc:
2012 Mar 30
4
[PATCH] virtio_blk: Drop unused request tracking list
...- list_add_tail(&vbr->list, &vblk->reqs); return true; } @@ -408,7 +402,6 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) goto out_free_index; } - INIT_LIST_HEAD(&vblk->reqs); spin_lock_init(&vblk->lock); vblk->vdev = vdev; vblk->sg_elems = sg_elems; @@ -571,9 +564,6 @@ static void __devexit virtblk_remove(struct virtio_device *vdev) vblk->config_enable = false; mutex_unlock(&vblk->config_lock); - /* Nothing should be pending. */ - BUG_ON(!list_empty(&vblk->reqs)); - /* Stop all the virtqueues. */ vdev-&g...