Re: module: fix module_refcount() return when running in a module exit routine

2015-01-23 Thread Rusty Russell
James Bottomley james.bottom...@hansenpartnership.com writes: On Fri, 2015-01-23 at 05:17 -0800, Christoph Hellwig wrote: On Fri, Jan 23, 2015 at 01:24:15PM +1030, Rusty Russell wrote: The correct fix is to turn try_module_get() into __module_get(), and always do the module_put

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-22 Thread Rusty Russell
but then used module_refcount() to detect the failure and not do a put. Yep, I've put that patch in my fixes queue now. Thanks, Rusty. From: Rusty Russell ru...@rustcorp.com.au Subject: scsi: always increment reference count James reported: After e513cc1 module: Remove stop_machine from module

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-21 Thread Rusty Russell
James Bottomley james.bottom...@hansenpartnership.com writes: Actually, I don't think this is enough. Some Australian once came up with a guide to APIs, and lectured on it at length, one of which was that the name should be the obvious use and it is unexpected that a refcount would go

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-19 Thread Rusty Russell
James Bottomley james.bottom...@hansenpartnership.com writes: On Mon, 2015-01-19 at 16:21 +1030, Rusty Russell wrote: Masami Hiramatsu masami.hiramatsu...@hitachi.com writes: (2015/01/19 1:55), James Bottomley wrote: From: James Bottomley jbottom...@parallels.com After e513cc1 module

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-18 Thread Rusty Russell
Masami Hiramatsu masami.hiramatsu...@hitachi.com writes: (2015/01/19 1:55), James Bottomley wrote: From: James Bottomley jbottom...@parallels.com After e513cc1 module: Remove stop_machine from module unloading, module_refcount() is returning (unsigned long)-1 when called from within a

Re: module: fix module_refcount() return when running in a module exit routine

2015-01-18 Thread Rusty Russell
James Bottomley james.bottom...@hansenpartnership.com writes: From: James Bottomley jbottom...@parallels.com After e513cc1 module: Remove stop_machine from module unloading, module_refcount() is returning (unsigned long)-1 when called from within a routine that runs in module_exit. This is

Re: [PATCH v4 04/25] virtio: defer config changed notifications

2014-10-14 Thread Rusty Russell
Michael S. Tsirkin m...@redhat.com writes: Defer config changed notifications that arrive during probe/scan/freeze/restore. This will allow drivers to set DRIVER_OK earlier, without worrying about racing with config change interrupts. This change will also benefit old hypervisors (before

Re: [PATCH v3 10/25] virtio: add API to enable VQs early

2014-10-13 Thread Rusty Russell
Michael S. Tsirkin m...@redhat.com writes: virtio spec 0.9.X requires DRIVER_OK to be set before VQs are used, but some drivers use VQs before probe function returns. Since DRIVER_OK is set after probe, this violates the spec. Even though under virtio 1.0 transitional devices support this

Re: [PATCH 5/6] scsi: use 64-bit value for 'max_luns'

2014-07-08 Thread Rusty Russell
, kstrtouint); STANDARD_PARAM_DEF(long, long, %li, kstrtol); STANDARD_PARAM_DEF(ulong, unsigned long, %lu, kstrtoul); +STANDARD_PARAM_DEF(ullong, unsigned long long, %llu, kstrtoull); Thanks Christoph! Acked-by: Rusty Russell ru...@rustcorp.com.au Cheers, Rusty. -- To unsubscribe from this list

Re: [PATCH-v2 1/6] virtio-scsi.h: Add virtio_scsi_cmd_req_pi + VIRTIO_SCSI_F_T10_PI bits

2014-05-22 Thread Rusty Russell
for signaling when protection information buffers are expected to preceed the data buffers. Cc rusty. Rusty could you please Ack merging this through Nicholas' tree together with the vhost changes? Acked-by: Rusty Russell ru...@rustcorp.com.au Thanks, Rusty. -- To unsubscribe from this list: send

[PATCH] virtio_scsi: don't call virtqueue_add_sgs(... GFP_NOIO) holding spinlock.

2014-05-19 Thread Rusty Russell
-by: Rusty Russell ru...@rustcorp.com.au diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index db3b494e5926..62757afd93bb 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -433,11 +433,10 @@ static void virtscsi_event_done(struct virtqueue *vq) * @cmd

Re: [PATCH V2] virtio-scsi: Fix hotcpu_notifier use-after-free with virtscsi_freeze

2014-01-14 Thread Rusty Russell
Jason Wang jasow...@redhat.com writes: From: Asias He asias.he...@gmail.com vqs are freed in virtscsi_freeze but the hotcpu_notifier is not unregistered. We will have a use-after-free usage when the notifier callback is called after virtscsi_freeze. Fixes:

Re: [PATCH] virtio-scsi: Fix hotcpu_notifier use-after-free with virtscsi_freeze

2013-12-16 Thread Rusty Russell
Jason Wang jasow...@redhat.com writes: On 10/28/2013 04:01 PM, Asias He wrote: vqs are freed in virtscsi_freeze but the hotcpu_notifier is not unregistered. We will have a use-after-free usage when the notifier callback is called after virtscsi_freeze. Signed-off-by: Asias He

Re: [PATCH] virtio-scsi: Fix virtqueue affinity setup

2013-07-31 Thread Rusty Russell
Asias He as...@redhat.com writes: vscsi-num_queues counts the number of request virtqueue which does not include the control and event virtqueue. It is wrong to subtract VIRTIO_SCSI_VQ_BASE from vscsi-num_queues. This patch fixes the following panic. Applied. Thanks, Rusty. (qemu)

Re: [PATCH V7 0/5] virtio-scsi multiqueue

2013-04-08 Thread Rusty Russell
Asias He as...@redhat.com writes: On Sat, Apr 06, 2013 at 09:40:13AM +0100, James Bottomley wrote: Well, I haven't had time to look at anything other than the patch I commented on. I'm happy with your fix, so you can add my acked by to that one. Since it's going through the virtio tree,

Re: [PATCH 2/2] virtio-scsi: reset virtqueue affinity when doing cpu hotplug

2013-01-15 Thread Rusty Russell
Wanlong Gao gaowanl...@cn.fujitsu.com writes: Add hot cpu notifier to reset the request virtqueue affinity when doing cpu hotplug. You need to be careful to get_online_cpus() and put_online_cpus() here, so CPUs can't go up and down in the middle of operations. In particular,

Re: [PATCH v2 1/5] virtio: add functions for piecewise addition of buffers

2013-01-07 Thread Rusty Russell
Paolo Bonzini pbonz...@redhat.com writes: Il 07/01/2013 01:02, Rusty Russell ha scritto: Paolo Bonzini pbonz...@redhat.com writes: Il 02/01/2013 06:03, Rusty Russell ha scritto: Paolo Bonzini pbonz...@redhat.com writes: The virtqueue_add_buf function has two limitations: 1) it requires

Re: [PATCH v2 1/5] virtio: add functions for piecewise addition of buffers

2013-01-06 Thread Rusty Russell
Paolo Bonzini pbonz...@redhat.com writes: Il 02/01/2013 06:03, Rusty Russell ha scritto: Paolo Bonzini pbonz...@redhat.com writes: The virtqueue_add_buf function has two limitations: 1) it requires the caller to provide all the buffers in a single call; 2) it does not support chained

Re: [PATCH v2 1/5] virtio: add functions for piecewise addition of buffers

2013-01-01 Thread Rusty Russell
interface is pretty nasty; I think I'd prefer the chained scatterlists, if that's optimal for you. Cheers, Rusty. From: Rusty Russell ru...@rustcorp.com.au Subject: virtio: use chained scatterlists. Rather than handing a scatterlist[] and out and in numbers to virtqueue_add_buf(), hand two

Re: [PATCH 2/5] virtio: introduce an API to set affinity for a virtqueue

2012-09-05 Thread Rusty Russell
the affinity hint - if the virtqueues share MSI, make the affinity OR over all affinities requested Signed-off-by: Jason Wang jasow...@redhat.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com Applied, thanks. Acked-by: Rusty Russell ru...@rustcorp.com.au Cheers, Rusty. -- To unsubscribe from

Re: [PATCH 1/5] virtio-ring: move queue_index to vring_virtqueue

2012-09-05 Thread Rusty Russell
. But I've applied as-is, we can clean up that later if we want (probably by merging the two structures, I'll have to think harder on that). Acked-by: Rusty Russell ru...@rustcorp.com.au Cheers, Rusty. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord

Re: virtio(-scsi) vs. chained sg_lists (was Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list)

2012-07-29 Thread Rusty Russell
On Fri, 27 Jul 2012 10:11:26 +0200, Paolo Bonzini pbonz...@redhat.com wrote: Il 27/07/2012 08:27, Rusty Russell ha scritto: +int virtqueue_add_buf_sg(struct virtqueue *_vq, + struct scatterlist *sg_out, + unsigned int out

Re: virtio(-scsi) vs. chained sg_lists (was Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list)

2012-07-27 Thread Rusty Russell
. it booted!). From: Rusty Russell ru...@rustcorp.com.au Subject: virtio: use chained scatterlists. Rather than handing a scatterlist[] and out and in numbers to virtqueue_add_buf(), hand two separate ones which can be chained. I shall refrain from ranting about what a disgusting hack chained

Re: [PATCH 0/7] sg_ring: a ring of scatterlist arrays

2008-01-09 Thread Rusty Russell
On Thursday 10 January 2008 09:10:37 James Bottomley wrote: On Tue, 2008-01-08 at 11:39 +1100, Rusty Russell wrote: On Tuesday 08 January 2008 02:48:23 James Bottomley wrote: We're always open to new APIs (or more powerful and expanded old ones). The way we've been doing the sg_chain

Re: [PATCH 0/7] sg_ring: a ring of scatterlist arrays

2008-01-06 Thread Rusty Russell
On Sunday 06 January 2008 02:31:12 James Bottomley wrote: On Wed, 2007-12-19 at 17:31 +1100, Rusty Russell wrote: This patch series is the start of my attempt to simplify and make explicit the chained scatterlist logic. It's not complete: my SATA box boots and seems happy, but all

Re: [PATCH 0/7] sg_ring: a ring of scatterlist arrays

2008-01-06 Thread Rusty Russell
On Monday 07 January 2008 16:01:40 Tejun Heo wrote: But we hit the same problems: 1) sg_chain loses information. The clever chain packaging makes reading easy, but manipulation is severely limited. You can append to your own chains by padding, but not someone elses. This works for

[PATCH 1/3] scsi: Convert everyone to scsi_sglist and scsi_sg_count

2008-01-03 Thread Rusty Russell
, so that code had to be shuffled a little. Signed-off-by: Rusty Russell [EMAIL PROTECTED] --- drivers/scsi/NCR5380.c |6 +++--- drivers/scsi/NCR53C9x.c |6 +++--- drivers/scsi/aha1542.c | 14 +++--- drivers/scsi/atari_NCR5380.c |2 +- drivers/scsi/atp870u.c

[PATCH 2/3] usb_storage: usb_stor_bulk_transfer_sg cleanup

2008-01-03 Thread Rusty Russell
usb_stor_bulk_transfer_sg() assumes buf is a scatterlist array if use_sg is non-NULL. Change it to an explicit sg arg, instead, to allow the callers to change to scsi_sglist(). Signed-off-by: Rusty Russell [EMAIL PROTECTED] diff -r 09247461cfda drivers/usb/storage/freecom.c --- a/drivers/usb

[PATCH 3/3] scsi: convert core to sg_ring

2008-01-03 Thread Rusty Russell
(CONFIG_SCSI_SG_CHAIN). Signed-off-by: Rusty Russell [EMAIL PROTECTED] --- drivers/scsi/Kconfig|6 + drivers/scsi/scsi_error.c | 15 +-- drivers/scsi/scsi_lib.c | 219 +--- drivers/scsi/scsi_lib_dma.c | 27 ++--- drivers/scsi/scsi_tgt_lib.c | 17

Re: [PATCH 1/3] scsi: Convert everyone to scsi_sglist and scsi_sg_count

2008-01-03 Thread Rusty Russell
On Thursday 03 January 2008 20:26:13 Boaz Harrosh wrote: On Thu, Jan 03 2008 at 10:50 +0200, Rusty Russell [EMAIL PROTECTED] wrote: This patch simply converts direct uses of -use_sg and -request_buffer to use the wrapper macros. This removes the assumption that the sg list is overloaded

[PATCH 0/2] sg_ring: Gentler scsi merge

2008-01-02 Thread Rusty Russell
OK, after wading through many scsi drivers, I decided to change tack and try to provide a transition path. This is in two stages: 1) These two patches. sg_ring used underneath, but if any driver asks for scsi_sglist() they get a 2.6.24-style chained sg. No other patches are necessary. 2)

Re: [PATCH 0/5] sg_ring for scsi

2007-12-27 Thread Rusty Russell
On Thursday 27 December 2007 13:09:27 FUJITA Tomonori wrote: On Wed, 26 Dec 2007 11:27:40 +1100 Rusty Russell [EMAIL PROTECTED] wrote: There are many signs through the code that it needs a great deal of work: what is the purpose of sg_break? Why does the code check if kmap_atomic fails

Re: [PATCH 0/5] sg_ring for scsi

2007-12-25 Thread Rusty Russell
if you really want a simple increment. Various flaws in the driver have been maintained. Signed-off-by: Rusty Russell [EMAIL PROTECTED] diff -r 63176a8a6ce3 drivers/scsi/ips.c --- a/drivers/scsi/ips.cMon Dec 24 17:40:08 2007 +1100 +++ b/drivers/scsi/ips.cWed Dec 26 11:20:52 2007

Re: [PATCH 2/5] dma_map_sg_ring() helper

2007-12-20 Thread Rusty Russell
On Thursday 20 December 2007 18:42:44 David Miller wrote: From: FUJITA Tomonori [EMAIL PROTECTED] Date: Thu, 20 Dec 2007 16:06:31 +0900 On Thu, 20 Dec 2007 16:49:30 +1100 Rusty Russell [EMAIL PROTECTED] wrote: +/** + * dma_map_sg_ring - Map an entire sg ring + * @dev: Device

Re: [PATCH 0/5] sg_ring for scsi

2007-12-20 Thread Rusty Russell
On Thursday 20 December 2007 18:58:07 David Miller wrote: From: Rusty Russell [EMAIL PROTECTED] Date: Thu, 20 Dec 2007 18:53:48 +1100 Manipulating the magic chains is horrible; it looks simple to the places which simply want to iterate through it, but it's awful for code which wants

Re: [PATCH 2/5] dma_map_sg_ring() helper

2007-12-20 Thread Rusty Russell
On Friday 21 December 2007 11:00:27 FUJITA Tomonori wrote: We need to pass the whole sg entries to the IOMMUs at a time. Hi Fujita, OK, it's certainly possible to have an arch override. For which architecture is this BTW? Thanks, Rusty. - To unsubscribe from this list: send the line

Re: [PATCH 2/5] dma_map_sg_ring() helper

2007-12-20 Thread Rusty Russell
On Friday 21 December 2007 11:40:00 David Miller wrote: From: Rusty Russell [EMAIL PROTECTED] Date: Fri, 21 Dec 2007 11:35:12 +1100 On Friday 21 December 2007 11:00:27 FUJITA Tomonori wrote: We need to pass the whole sg entries to the IOMMUs at a time. Hi Fujita, OK, it's

Re: [PATCH 0/5] sg_ring for scsi

2007-12-20 Thread Rusty Russell
On Friday 21 December 2007 13:28:34 FUJITA Tomonori wrote: I'm not sure about chaining the headers (as your sg_ring and scsi_sgtable do) would simplify LLDs. Have you looked at ips or qla1280? Not yet, am working my way through the drivers, but I don't expect it will be a simplification to

[PATCH 0/5] sg_ring for scsi

2007-12-19 Thread Rusty Russell
OK, some fixes since last time, as I wade through more SCSI drivers. Some drivers use use_sg as a flag to know whether the request_buffer is a scatterlist: I don't need the counter, but I still need the flag, so I fixed that in a more intuitive way (an explicit -sg pointer in the cmd). Also,

[PATCH 1/5] sg_ring: sg_ring.h

2007-12-19 Thread Rusty Russell
it is easy to break down the ring into its constituent arrays. The sg_ring header also encodes the maximum number of entries, useful for routines which populate an sg. We need never hand around a number of elements any more. Signed-off-by: Rusty Russell [EMAIL PROTECTED] --- include/linux/sg_ring.h

[PATCH 2/5] dma_map_sg_ring() helper

2007-12-19 Thread Rusty Russell
Obvious counterpart to dma_map_sg. Note that this is arch-independent code; sg_rings are backwards compatible with simple sg arrays. Signed-off-by: Rusty Russell [EMAIL PROTECTED] --- drivers/base/dma-mapping.c | 13 + include/linux/dma-mapping.h |4 2 files changed, 17

[PATCH 3/5] blk_rq_map_sg_ring as a counterpart to blk_rq_map_sg.

2007-12-19 Thread Rusty Russell
Obvious counterpart to blk_rq_map_sg. Signed-off-by: Rusty Russell [EMAIL PROTECTED] diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c @@ -31,6 +31,7 @@ #include linux/blktrace_api.h #include linux/fault-inject.h #include linux/scatterlist.h

Strange code in initio.c?

2007-12-19 Thread Rusty Russell
Hi Alan, Was looking through initio.c to convert it to sg_ring, and noticed this code: initio_build_scb() around 2616: sg = cblk-sglist[0]; scsi_for_each_sg(cmnd, sglist, cblk-sglen, i) { sg-data =

[PATCH 1/7] sg_ring: introduce sg_ring: a ring of scatterlist arrays.

2007-12-18 Thread Rusty Russell
, useful for routines which populate an sg. We need never hand around a number of elements any more. Signed-off-by: Rusty Russell [EMAIL PROTECTED] --- include/linux/sg_ring.h | 74 1 files changed, 74 insertions(+), 0 deletions(-) create mode

[PATCH 3/7] sg_ring: blk_rq_map_sg_ring as a counterpart to blk_rq_map_sg.

2007-12-18 Thread Rusty Russell
blk_rq_map_sg_ring as a counterpart to blk_rq_map_sg. Obvious counterpart to blk_rq_map_sg. Signed-off-by: Rusty Russell [EMAIL PROTECTED] --- block/ll_rw_blk.c | 55 include/linux/blkdev.h |1 + 2 files changed, 56 insertions(+), 0

[PATCH 4/7] sg_ring: dma_map_sg_ring() helper

2007-12-18 Thread Rusty Russell
Obvious counterpart to dma_map_sg. Note that this is arch-independent code; sg_rings are backwards compatible with simple sg arrays. Signed-off-by: Rusty Russell [EMAIL PROTECTED] --- drivers/base/dma-mapping.c | 13 + include/linux/dma-mapping.h |4 2 files changed, 17

[PATCH 6/7] sg_ring: libata simplification

2007-12-18 Thread Rusty Russell
, and buf_virt pointer, and always initialize qc-nbytes in ata_sg_init(). It's possible that the ATA_QCFLAG_SG and ATA_QCFLAG_DMAMAP flags could be entirely removed, and we could use whether qc-__sg is NULL or not. Signed-off-by: Rusty Russell [EMAIL PROTECTED] diff -r 8b1075c7ad47 drivers/ata/libata

[PATCH 7/7] sg_ring: convert core ATA code to sg_ring.

2007-12-18 Thread Rusty Russell
simply append an sg_ring entry with the padding, and normal iterators can be used. I renamed qc-cursg to qc-cur_sg to catch all the users: they should now be referring to 'qc-cur_sg[qc-cursg_i]' wherever they were using 'qc-cursg'. Signed-off-by: Rusty Russell [EMAIL PROTECTED] diff -r a867138da3e0

[PATCH 2/7] sg_ring: use in virtio.

2007-12-18 Thread Rusty Russell
a scatterlist array and two numbers indicating the number of readable and writable elements respectively; now we can simply hand two sg_rings which is much clearer (each sg_ring contains its own length). Signed-off-by: Rusty Russell [EMAIL PROTECTED] --- drivers/block/virtio_blk.c| 33

[PATCH]scsi: BUG_ON() impossible condition.

2007-11-18 Thread Rusty Russell
If blk_rq_map_sg wrote more than was allocated in the scatterlist, BUG_ON() is probably the right thing to do. Signed-off-by: Rusty Russell [EMAIL PROTECTED] Acked-by: Jens Axboe [EMAIL PROTECTED] --- drivers/scsi/scsi_tgt_lib.c | 11 +++ 1 files changed, 3 insertions(+), 8 deletions