[PATCH 3/3] virtio-scsi: support online resizing of disks

2012-10-02 Thread Paolo Bonzini
capacity change from 22548578304 to 23622320128 Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- drivers/scsi/virtio_scsi.c | 31 ++- include/linux/virtio_scsi.h |2 ++ 2 files changed, 32 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b

[PATCH 2/3] virtio-scsi: fix LUNs greater than 255

2012-10-02 Thread Paolo Bonzini
with the flat format. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- drivers/scsi/virtio_scsi.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 7554d78..a7cf726 100644 --- a/drivers/scsi/virtio_scsi.c +++ b

Re: [PATCH 0/2] virtio-scsi fixes for 3.6

2012-10-01 Thread Paolo Bonzini
Il 26/07/2012 15:28, Paolo Bonzini ha scritto: James, patch 1 fixes scanning of LUNs whose number is greater than 255. QEMU passes a max_lun of 16383 (because it uses SAM numbering) but in Linux it must become 32768 (because LUNs above 255 are relocated to 16640). Patch 2 is a resubmission

Re: [PATCH] [SCSI] virtio-scsi: Initialize scatterlist structure.

2012-10-01 Thread Paolo Bonzini
Il 20/08/2012 16:05, Paolo Bonzini ha scritto: Il 20/08/2012 16:04, Richard W.M. Jones ha scritto: From: Richard W.M. Jones rjo...@redhat.com The sg struct is used without being initialized. https://bugzilla.redhat.com/show_bug.cgi?id=847548 Signed-off-by: Richard W.M. Jones rjo

Re: [PATCH] [SCSI] virtio-scsi: Initialize scatterlist structure.

2012-10-01 Thread Paolo Bonzini
Il 01/10/2012 15:18, Richard W.M. Jones ha scritto: On Mon, Oct 01, 2012 at 03:13:01PM +0200, Paolo Bonzini wrote: Il 20/08/2012 16:05, Paolo Bonzini ha scritto: Il 20/08/2012 16:04, Richard W.M. Jones ha scritto: From: Richard W.M. Jones rjo...@redhat.com The sg struct is used without being

[PATCH v2 2/3] scsi: create an all-zero filter for scanners

2012-09-25 Thread Paolo Bonzini
Using /dev/sg for scanners is blocked from unprivileged users. Reimplement this using customizable command filters, so that the sysfs knobs will work in this case too. Cc: linux-scsi@vger.kernel.org Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- v1-v2: OOM check [Alan Cox

Re: [PATCH] sg_io: allow UNMAP and WRITE SAME without CAP_SYS_RAWIO

2012-09-12 Thread Paolo Bonzini
Il 12/09/2012 10:05, James Bottomley ha scritto: This is why the whole filter thing was mutable via sysfs. That way the admin could set this up per device. It sounds like this is what you want to fix, rather than opening up more holes in an already leaky security apparatus. It is, thanks

[PATCH 0/3] block: add queue-private command filter, editable via sysfs

2012-09-12 Thread Paolo Bonzini
. In the meanwhile, this patch series provides the sysfs knob. It is a tweaked revert of commit 018e044 (block: get rid of queue-private command filter, 2009-06-26). Paolo Bonzini (3): block: add back queue-private command filter scsi: create an all-zero filter for scanners block: add back command filter

[PATCH 1/3] block: add back queue-private command filter

2012-09-12 Thread Paolo Bonzini
filtering is desired. This is a partial (and massaged) revert of commit 018e044 (block: get rid of queue-private command filter, 2009-06-26). Cc: linux-scsi@vger.kernel.org Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- block/blk-sysfs.c |2 ++ block/bsg.c|2 +- block

[PATCH 2/3] scsi: create an all-zero filter for scanners

2012-09-12 Thread Paolo Bonzini
Using /dev/sg for scanners is blocked from unprivileged users. Reimplement this using customizable command filters, so that the sysfs knobs will work in this case too. Cc: linux-scsi@vger.kernel.org Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- drivers/scsi/scsi_scan.c |6

[PATCH 3/3] block: add back command filter modification via sysfs

2012-09-12 Thread Paolo Bonzini
anyway never really enabled, the different API is not a problem. Cc: linux-scsi@vger.kernel.org Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- Documentation/block/queue-sysfs.txt | 16 ++ block/Kconfig | 10 block/blk-sysfs.c | 41

Re: [PATCH 3/3] block: add back command filter modification via sysfs

2012-09-12 Thread Paolo Bonzini
Il 12/09/2012 14:41, Alan Cox ha scritto: + if (!q-cmd_filter) { + q-cmd_filter = kmalloc(sizeof(struct blk_cmd_filter), + GFP_KERNEL); + blk_set_cmd_filter_defaults(q-cmd_filter); + } + This also needs CAP_SYS_RAWIO otherwise you

Re: [PATCH] sg_io: allow UNMAP and WRITE SAME without CAP_SYS_RAWIO

2012-09-11 Thread Paolo Bonzini
Il 11/09/2012 18:59, Tejun Heo ha scritto: FWIW, I don't think this is the right way to expose functionality which needs management in terms of access control, interpretation (stacking drivers) and serving concurrent users. SG_IO filtering was mostly for cd/dvd burning and other removeable

Re: [PATCH] sg_io: allow UNMAP and WRITE SAME without CAP_SYS_RAWIO

2012-09-11 Thread Paolo Bonzini
Il 11/09/2012 20:29, Tejun Heo ha scritto: Hello, Paolo. On Tue, Sep 11, 2012 at 07:56:53PM +0200, Paolo Bonzini wrote: Understood; unfortunately, there is another major user of it (virtualization). If you are passing raw LUNs down to a virtual machine, there's no possibility at all to use

Re: [PATCH] sg_io: allow UNMAP and WRITE SAME without CAP_SYS_RAWIO

2012-09-11 Thread Paolo Bonzini
Il 11/09/2012 21:13, Tejun Heo ha scritto: Hello, Paolo. On Tue, Sep 11, 2012 at 08:54:03PM +0200, Paolo Bonzini wrote: On Tue, Sep 11, 2012 at 07:56:53PM +0200, Paolo Bonzini wrote: Understood; unfortunately, there is another major user of it (virtualization). If you are passing raw LUNs

Re: [PATCH] sg_io: allow UNMAP and WRITE SAME without CAP_SYS_RAWIO

2012-09-11 Thread Paolo Bonzini
[Al: you can jump down to One problem:] Il 11/09/2012 22:01, Tejun Heo ha scritto: Hello, Paolo. On Tue, Sep 11, 2012 at 09:24:32PM +0200, Paolo Bonzini wrote: Couldn't it intercept some of them - e.g. RWs and discards? What's the benifit / use case of doing pure bypass? Basically, using

Re: [PATCH] sg_io: allow UNMAP and WRITE SAME without CAP_SYS_RAWIO

2012-09-11 Thread Paolo Bonzini
Il 12/09/2012 00:02, Tejun Heo ha scritto: SG_IO itself is a bypassing interface. It bypasses most of block layer and the kernel doesn't have any idea (apart from the adhoc filtering) about what's going on. That's very much the point. The guest must have free reins. You asked Could being

Re: [Ping^3] Re: [PATCH] sg_io: allow UNMAP and WRITE SAME without CAP_SYS_RAWIO

2012-09-06 Thread Paolo Bonzini
Il 05/09/2012 22:18, Ric Wheeler ha scritto: Hi Paolo, Both of these commands are destructive. WRITE_SAME (if done without the discard bits set) can also take a very long time to be destructive and tie up the storage. FORMAT_UNIT has the same characteristics and yet it is allowed (btw, I

Re: [Ping^3] Re: [PATCH] sg_io: allow UNMAP and WRITE SAME without CAP_SYS_RAWIO

2012-09-06 Thread Paolo Bonzini
Il 06/09/2012 13:31, Ric Wheeler ha scritto: Both of these commands are destructive. WRITE_SAME (if done without the discard bits set) can also take a very long time to be destructive and tie up the storage. FORMAT_UNIT has the same characteristics and yet it is allowed (btw, I don't think

Re: [PATCH 5/5] virtio-scsi: introduce multiqueue support

2012-09-05 Thread Paolo Bonzini
Il 04/09/2012 22:11, Nicholas A. Bellinger ha scritto: As tgt-tgt_lock is taken in virtscsi_queuecommand_multi() before the atomic_inc_return(tgt-reqs) check, it seems like using atomic_dec() w/o smp_mb__after_atomic_dec or tgt_lock access here is not using atomic.h accessors properly, no..?

[Ping^3] Re: [PATCH] sg_io: allow UNMAP and WRITE SAME without CAP_SYS_RAWIO

2012-09-05 Thread Paolo Bonzini
Il 28/08/2012 13:04, Paolo Bonzini ha scritto: Il 01/08/2012 17:53, Paolo Bonzini ha scritto: Il 20/07/2012 18:30, Paolo Bonzini ha scritto: These commands cannot be issued right now without giving CAP_SYS_RAWIO to the process who wishes to send them. These commands can be useful also to non

Re: [PATCH 5/5] virtio-scsi: introduce multiqueue support

2012-09-04 Thread Paolo Bonzini
Il 04/09/2012 04:21, Nicholas A. Bellinger ha scritto: @@ -112,6 +118,9 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf) struct virtio_scsi_cmd *cmd = buf; struct scsi_cmnd *sc = cmd-sc; struct virtio_scsi_cmd_resp *resp = cmd-resp.cmd; +struct

Re: [PATCH 5/5] virtio-scsi: introduce multiqueue support

2012-09-04 Thread Paolo Bonzini
Il 04/09/2012 10:46, Michael S. Tsirkin ha scritto: +static int virtscsi_queuecommand_multi(struct Scsi_Host *sh, + struct scsi_cmnd *sc) +{ + struct virtio_scsi *vscsi = shost_priv(sh); + struct virtio_scsi_target_state *tgt = vscsi-tgt[sc-device-id]; +

Re: [PATCH 5/5] virtio-scsi: introduce multiqueue support

2012-09-04 Thread Paolo Bonzini
Il 04/09/2012 13:09, Michael S. Tsirkin ha scritto: queuecommand on CPU #0 queuecommand #2 on CPU #1 -- atomic_inc_return(...) == 1 atomic_inc_return(...) == 2

Re: [PATCH 5/5] virtio-scsi: introduce multiqueue support

2012-09-04 Thread Paolo Bonzini
Il 04/09/2012 15:35, Michael S. Tsirkin ha scritto: I see. I guess you can rewrite this as: atomic_inc if (atomic_read() == 1) which is a bit cheaper, and make the fact that you do not need increment and return to be atomic, explicit. It seems more complicated to me for hardly any reason.

Re: [PATCH 5/5] virtio-scsi: introduce multiqueue support

2012-09-04 Thread Paolo Bonzini
affinity is set to the CPU that owns the queue). Signed-off-by: Paolo Bonzini pbonz...@redhat.com I guess an alternative is a per-target vq. Is the reason you avoid this that you expect more targets than cpus? If yes this is something you might want to mention in the log. One reason

Re: [PATCH 5/5] virtio-scsi: introduce multiqueue support

2012-09-04 Thread Paolo Bonzini
Il 04/09/2012 16:19, Michael S. Tsirkin ha scritto: Also - some kind of comment explaining why a similar race can not happen with this lock in place would be nice: I see why this specific race can not trigger but since lock is dropped later before you submit command, I have hard time

Re: [PATCH 5/5] virtio-scsi: introduce multiqueue support

2012-09-04 Thread Paolo Bonzini
Il 04/09/2012 16:21, Michael S. Tsirkin ha scritto: One reason is that, even though in practice I expect roughly the same number of targets and VCPUs, hotplug means the number of targets is difficult to predict and is usually fixed to 256. The other reason is that per-target vq didn't

Re: [PATCH 0/5] Multiqueue virtio-scsi

2012-08-30 Thread Paolo Bonzini
Il 30/08/2012 16:53, Michael S. Tsirkin ha scritto: this series adds multiqueue support to the virtio-scsi driver, based on Jason Wang's work on virtio-net. It uses a simple queue steering algorithm that expects one queue per CPU. LUNs in the same target always use the same queue (so

[PATCH for 3.6 1/3] virtio-scsi: fix copying of sg_list in the presence of of HighMem pages

2012-08-29 Thread Paolo Bonzini
() is copied too when the last entry of the source sg_list is copied to the the last entry in destination list. Cc: Stable kernel sta...@vger.kernel.org # 3.4: 4fe74b1: [SCSI] virtio-scsi: SCSI driver Signed-off-by: Wang Sen senw...@linux.vnet.ibm.com Signed-off-by: Paolo Bonzini pbonz

[PATCH for 3.6 3/3] virtio-scsi: fix LUNs greater than 255

2012-08-29 Thread Paolo Bonzini
with the flat format. Cc: Stable kernel sta...@vger.kernel.org # 3.4: 4fe74b1: [SCSI] virtio-scsi: SCSI driver Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- drivers/scsi/virtio_scsi.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers

Re: [PATCH] sg_io: allow UNMAP and WRITE SAME without CAP_SYS_RAWIO

2012-08-28 Thread Paolo Bonzini
Il 01/08/2012 17:53, Paolo Bonzini ha scritto: Il 20/07/2012 18:30, Paolo Bonzini ha scritto: These commands cannot be issued right now without giving CAP_SYS_RAWIO to the process who wishes to send them. These commands can be useful also to non-privileged programs who have access

[PATCH 0/5] Multiqueue virtio-scsi

2012-08-28 Thread Paolo Bonzini
?id=37. Alternatively you can just set the affinity manually in /proc. Rusty, can you please give your Acked-by to the first two patches? Jason Wang (2): virtio-ring: move queue_index to vring_virtqueue virtio: introduce an API to set affinity for a virtqueue Paolo Bonzini (3): virtio-scsi

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

2012-08-28 Thread Paolo Bonzini
jasow...@redhat.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- I fixed the problems in Jason's v5 (posted at http://permalink.gmane.org/gmane.linux.kernel.virtualization/15910) and switched from virtio_set_queue_index to a new argument of vring_new_virtqueue

[PATCH 3/5] virtio-scsi: allocate target pointers in a separate memory block

2012-08-28 Thread Paolo Bonzini
paths. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- drivers/scsi/virtio_scsi.c | 23 +++ 1 files changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 595af1a..62fec04 100644 --- a/drivers/scsi/virtio_scsi.c

[PATCH 4/5] virtio-scsi: pass struct virtio_scsi to virtqueue completion function

2012-08-28 Thread Paolo Bonzini
This will be needed soon in order to retrieve the per-target struct. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- drivers/scsi/virtio_scsi.c | 17 + 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c

[PATCH 5/5] virtio-scsi: introduce multiqueue support

2012-08-28 Thread Paolo Bonzini
, so the driver expects the number of request queues to be equal to the number of VCPUs. This makes it easy and fast to select the queue, and also lets the driver optimize the IRQ affinity for the virtqueues (each virtqueue's affinity is set to the CPU that owns the queue). Signed-off-by: Paolo

[PATCH for 3.6 0/3] urgent virtio-scsi fixes

2012-08-28 Thread Paolo Bonzini
James, here are three important bugfixes for virtio-scsi. All three have been on the list for a while, I'm grouping them in this post to ease your processing. Two of them are also marked for stable branches. Paolo Paolo Bonzini (1): virtio-scsi: fix LUNs greater than 255 Richard W.M. Jones

[PATCH for 3.6 2/3] virtio-scsi: initialize scatterlist structure for events

2012-08-28 Thread Paolo Bonzini
-by: Paolo Bonzini pbonz...@redhat.com --- drivers/scsi/virtio_scsi.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 3e79a2f..7554d78 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c

Re: [PATCH 3/5] virtio-scsi: allocate target pointers in a separate memory block

2012-08-28 Thread Paolo Bonzini
Il 28/08/2012 16:07, Sasha Levin ha scritto: - num_targets = sh-max_id; - for (i = 0; i num_targets; i++) { - kfree(vscsi-tgt[i]); - vscsi-tgt[i] = NULL; + if (vscsi-tgt) { + num_targets = sh-max_id; + for (i = 0; i num_targets; i++) { +

Re: [PATCH] [SCSI] virtio-scsi: Initialize scatterlist structure.

2012-08-20 Thread Paolo Bonzini
, struct scatterlist sg; unsigned long flags; - sg_set_buf(sg, event_node-event, sizeof(struct virtio_scsi_event)); + sg_init_one(sg, event_node-event, sizeof(struct virtio_scsi_event)); spin_lock_irqsave(vscsi-event_vq.vq_lock, flags); Acked-by: Paolo

Re: [RFC-v5] tcm_vhost: Initial merge for vhost level target fabric driver

2012-08-01 Thread Paolo Bonzini
Il 31/07/2012 22:52, Eric Northup ha scritto: It seems to me like this is not the way that virtio devices are supposed to behave - if a guest splits a virtio_scsi_cmd_req or _resp across a page boundary, then this code won't work. Buffers can cover several pages. Of course, data buffers have

Re: [PATCH] sg_io: allow UNMAP and WRITE SAME without CAP_SYS_RAWIO

2012-08-01 Thread Paolo Bonzini
Il 20/07/2012 18:30, Paolo Bonzini ha scritto: These commands cannot be issued right now without giving CAP_SYS_RAWIO to the process who wishes to send them. These commands can be useful also to non-privileged programs who have access to the block devices. For example a virtual machine

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-30 Thread Paolo Bonzini
Il 30/07/2012 01:50, Rusty Russell ha scritto: Also, being the first user of chained scatterlist doesn't exactly give me warm fuzzies. We're far from the first user: they've been in the kernel for well over 7 years. They were introduced for the block layer, but they tended to ignore

Re: [PATCH v3] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list

2012-07-30 Thread Paolo Bonzini
Sen senw...@linux.vnet.ibm.com Acked-by: Paolo Bonzini pbonz...@redhat.com -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list

2012-07-27 Thread Paolo Bonzini
Il 27/07/2012 05:12, Wang Sen ha scritto: No this code is correct, though you will need to make sure to properly terminate the destination sg_list. Yes, the terminate marker in the destination list is set when initialization. sg_set_page would not break this marker because it saved both the

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 Paolo Bonzini
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, + struct scatterlist *sg_in, + unsigned int in, +

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-26 Thread Paolo Bonzini
Il 25/07/2012 23:04, Boaz Harrosh ha scritto: That not all architectures have ARCH_HAS_SG_CHAIN (though all those I care about do). So I need to go through all architectures and make sure they use for_each_sg, or at least to change ARCH_HAS_SG_CHAIN to a Kconfig define so that dependencies

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-26 Thread Paolo Bonzini
Il 26/07/2012 09:56, Boaz Harrosh ha scritto: In the meanwhile, we still have a bug to fix, and we need to choose between Sen Wang's v1 (sg_set_page) or v2 (value assignment). I'm still leaning more towards v2, if only because I already tested that one myself. It's your call, you know

Re: [PATCH 1/2] virtio-scsi: fix parsing of hotplug/hot-unplug LUN number

2012-07-26 Thread Paolo Bonzini
Il 26/07/2012 10:52, James Bottomley ha scritto: +static unsigned int virtscsi_get_lun(u8 *lun_bytes) +{ + unsigned int lun = (lun_bytes[2] 8) | lun_bytes[3]; + return lun 16383; +} + Why are you rolling your own incomplete version of scsilun_to_int here? Because scsilun_to_int

Re: [PATCH 1/2] virtio-scsi: fix parsing of hotplug/hot-unplug LUN number

2012-07-26 Thread Paolo Bonzini
Il 26/07/2012 11:21, James Bottomley ha scritto: Because scsilun_to_int does not do the AND, so it would have exactly the same bug I'm fixing. It's not a bug ... it's the encoding. All the other devices use this too. Ideally we should have switched to 64 bit lun numbers for the encoding

Re: [PATCH 1/2] virtio-scsi: fix parsing of hotplug/hot-unplug LUN number

2012-07-26 Thread Paolo Bonzini
Il 26/07/2012 11:41, James Bottomley ha scritto: On Thu, 2012-07-26 at 11:27 +0200, Paolo Bonzini wrote: Il 26/07/2012 11:21, James Bottomley ha scritto: Because scsilun_to_int does not do the AND, so it would have exactly the same bug I'm fixing. It's not a bug ... it's the encoding. All

Re: [PATCH 1/2] virtio-scsi: fix parsing of hotplug/hot-unplug LUN number

2012-07-26 Thread Paolo Bonzini
Il 26/07/2012 12:33, James Bottomley ha scritto: Has it already been considered to modify scsilun_to_int() such that LUN numbers start at zero even for addressing method 1 ? This is what e.g. the function scst_unpack_lun() already does. See also

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-26 Thread Paolo Bonzini
Il 26/07/2012 09:58, Paolo Bonzini ha scritto: Please CC me on the convert to sg copy-less patches, It looks interesting Sure. Well, here is the gist of it (note it won't apply on any public tree, hence no SoB yet). It should be split in multiple changesets and you can make more

[PATCH 0/2] virtio-scsi fixes for 3.6

2012-07-26 Thread Paolo Bonzini
, which needs to be rebased. LUNs above 255 now work for all of scanning, hotplug, hotunplug and resize. Thanks, Paolo Paolo Bonzini (2): virtio-scsi: fix LUNs greater than 255 virtio-scsi: support online resizing of disks drivers/scsi/virtio_scsi.c | 37

[PATCH 2/2] virtio-scsi: support online resizing of disks

2012-07-26 Thread Paolo Bonzini
capacity change from 22548578304 to 23622320128 Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- drivers/scsi/virtio_scsi.c | 31 ++- include/linux/virtio_scsi.h |2 ++ 2 files changed, 32 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b

[PATCH 1/2] virtio-scsi: fix LUNs greater than 255

2012-07-26 Thread Paolo Bonzini
with the flat format. Cc: sta...@vger.kernel.org Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- drivers/scsi/virtio_scsi.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index c7030fb..8b6b927 100644 --- a/drivers

Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list

2012-07-25 Thread Paolo Bonzini
Il 25/07/2012 10:29, Wang Sen ha scritto: When using the commands below to write some data to a virtio-scsi LUN of the QEMU guest(32-bit) with 1G physical memory(qemu -m 1024), the qemu will crash. # sudo mkfs.ext4 /dev/sdb (/dev/sdb is the virtio-scsi LUN.) # sudo mount

Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list

2012-07-25 Thread Paolo Bonzini
Il 25/07/2012 11:22, Boaz Harrosh ha scritto: for_each_sg(table-sgl, sg_elem, table-nents, i) -sg_set_buf(sg[idx++], sg_virt(sg_elem), sg_elem-length); +sg_set_page(sg[idx++], sg_page(sg_elem), sg_elem-length, +

Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list

2012-07-25 Thread Paolo Bonzini
Il 25/07/2012 14:34, Boaz Harrosh ha scritto: for_each_sg(table-sgl, sg_elem, table-nents, i) - sg_set_buf(sg[idx++], sg_virt(sg_elem), sg_elem-length); + sg_set_page(sg[idx++], sg_page(sg_elem), sg_elem-length, + sg_elem-offset);

Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list

2012-07-25 Thread Paolo Bonzini
Il 25/07/2012 15:26, Boaz Harrosh ha scritto: On 07/25/2012 03:49 PM, Paolo Bonzini wrote: Except here the destination array has to be given to virtio, which doesn't (yet) understand chaining. I'm using for_each_sg rather than a simple memcpy exactly because I want to flatten the input

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-25 Thread Paolo Bonzini
Il 25/07/2012 15:26, Boaz Harrosh ha scritto: In SCSI land most LLDs should support chaining just by virtu of using the for_each_sg macro. That all it takes. Your code above does support it. Yes, it supports it but still has to undo them before passing to virtio. What my LLD does is add a

performance improvements for the sglist API (Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list)

2012-07-25 Thread Paolo Bonzini
Il 25/07/2012 16:36, Boaz Harrosh ha scritto: I did test the patch with value-assignment. Still you should use the sg_set_page()!! 1. It is not allowed to directly manipulate sg entries. One should always use the proper accessor. Even if open coding does work and is not a bug

Re: performance improvements for the sglist API (Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list)

2012-07-25 Thread Paolo Bonzini
Il 25/07/2012 17:09, Paolo Bonzini ha scritto: Il 25/07/2012 16:36, Boaz Harrosh ha scritto: I did test the patch with value-assignment. Still you should use the sg_set_page()!! 1. It is not allowed to directly manipulate sg entries. One should always use the proper accessor. Even

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-25 Thread Paolo Bonzini
Il 25/07/2012 17:28, Boaz Harrosh ha scritto: 1) what I get is a scsi_cmnd which contains an N-element scatterlist. 2) virtio-scsi has to build the packet that is passed to the hardware (it does not matter that the hardware is virtual). This packet (per virtio-scsi spec) has an N+1-element

[PATCH] sg_io: allow UNMAP and WRITE SAME without CAP_SYS_RAWIO

2012-07-20 Thread Paolo Bonzini
. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- block/scsi_ioctl.c |3 ++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 260fa80..dd71f18 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -168,13 +168,16 @@ static

Re: [RFC-v2 0/4] tcm_vhost+cmwq fabric driver code for-3.6

2012-07-19 Thread Paolo Bonzini
Il 19/07/2012 09:28, James Bottomley ha scritto: INQUIRY responses (at least vendor/product/type) should not change. INQUIRY responses often change for arrays because a firmware upgrade enables new features and new features have to declare themselves, usually in the INQUIRY data. What you

Re: [RFC-v2 0/4] tcm_vhost+cmwq fabric driver code for-3.6

2012-07-18 Thread Paolo Bonzini
Il 18/07/2012 15:42, Anthony Liguori ha scritto: If you add support for a new command, you need to provide userspace a way to disable this command. If you change what gets reported for VPD, you need to provide userspace a way to make VPD look like what it did in a previous version. The QEMU

Re: [PATCH] sd: do not set changed flag on all unit attention conditions

2012-07-17 Thread Paolo Bonzini
Il 17/07/2012 09:45, James Bottomley ha scritto: On Mon, 2012-07-16 at 19:20 +0200, Paolo Bonzini wrote: Il 16/07/2012 18:18, James Bottomley ha scritto: diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index b583277..6d8ca08 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers

Re: [PATCH] sd: do not set changed flag on all unit attention conditions

2012-07-17 Thread Paolo Bonzini
Il 17/07/2012 10:40, James Bottomley ha scritto: It's not specific to virtio-scsi, in fact I expect that virtio-scsi will be almost always used with non-removable disks. However, QEMU's SCSI target is not used just for virtio-scsi (for example it can be used for USB storage), and it

Re: [PATCH] sd: do not set changed flag on all unit attention conditions

2012-07-17 Thread Paolo Bonzini
Il 17/07/2012 11:11, James Bottomley ha scritto: We don't do stuff just because the standards allows it; just the opposite: we try to use the smallest implementations from the standards we can get away with just because the more things we do, the more exceptions and broken devices we come

Re: [PATCH] sd: do not set changed flag on all unit attention conditions

2012-07-17 Thread Paolo Bonzini
Il 17/07/2012 18:36, Christoph Hellwig ha scritto: There's no such thing in the market today as a removable disk that's resizeable. Removable disks are for things like backup cartridges and ageing jazz drives. Worse: most removeable devices today are USB card readers whose standards

Re: [PATCH] sd: do not set changed flag on all unit attention conditions

2012-07-17 Thread Paolo Bonzini
Il 17/07/2012 20:49, Mike Christie ha scritto: Not sure if we are talking about the same thing. So can virtio-scsi send a UA with asc/ascq that indicates the lun changed size? Other drivers do this. I updated Hannes's patches the other day to support UAs like those in userspace. I

[PATCH 0/2] virtio-scsi event changes for 3.6

2012-07-16 Thread Paolo Bonzini
code via unit attention. This will be discarded by the high-level driver for non-removable units. I sent a separate patch to deal with it for removable units. Paolo Paolo Bonzini (2): virtio-scsi: fix parsing of hotplug/hot-unplug LUN number virtio-scsi: support online resizing of disks

[PATCH 2/2] virtio-scsi: support online resizing of disks

2012-07-16 Thread Paolo Bonzini
capacity change from 22548578304 to 23622320128 Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- drivers/scsi/virtio_scsi.c | 31 ++- include/linux/virtio_scsi.h |2 ++ 2 files changed, 32 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b

[PATCH] sd: do not set changed flag on all unit attention conditions

2012-07-16 Thread Paolo Bonzini
to report at least one of No medium and/or a Medium may have changed, so restrict our attention to those. This patch fixes resizing a removable medium with virtio-scsi. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- drivers/scsi/scsi_lib.c |7 +-- 1 files changed, 5 insertions(+), 2

Re: [PATCH-v2] virtio-scsi: Add vdrv-scan for post VIRTIO_CONFIG_S_DRIVER_OK LUN scanning

2012-07-12 Thread Paolo Bonzini
Il 12/07/2012 09:23, James Bottomley ha scritto: Cc: Paolo Bonzini pbonz...@redhat.com Cc: Stefan Hajnoczi stefa...@linux.vnet.ibm.com Cc: Zhi Yong Wu wu...@cn.ibm.com Cc: Christoph Hellwig h...@lst.de Cc: Hannes Reinecke h...@suse.de Cc: James Bottomley jbottom...@parallels.com

Why are DID_ABORT and TASK_ABORTED handled differently?

2012-07-12 Thread Paolo Bonzini
Currently, DID_ABORT relays the failure to the upper layer, while TASK ABORTED (after the suggestion at http://marc.info/?l=linux-scsim=121932916906009w=2 was implemented) retries the command. Is it correct that when TAS=0 an aborted task (from TMF, persistent reservation or anything else) can

<    1   2   3   4