Re: [PATCH 4/5] KVM: MMU: store generation-number into mmio spte

2013-03-18 Thread Paolo Bonzini
Il 15/03/2013 16:29, Xiao Guangrong ha scritto: > +/* > + * spte bits of bit 3 ~ bit 11 are used as low 9 bits of > + * generation, the bits of bits 52 ~ bit 61 are used as > + * high 12 bits of generation. > + */ High 10 bits. How often does the generation number change? Especially with Takuya'

Re: [PATCH V5 1/5] virtio-scsi: redo allocation of target data

2013-03-19 Thread Paolo Bonzini
Il 19/03/2013 12:32, James Bottomley ha scritto: > On Tue, 2013-03-19 at 17:57 +0800, Wanlong Gao wrote: >> From: Paolo Bonzini >> >> virtio_scsi_target_state is now empty. We will find new uses for it in >> the next few patches, so this patch does not drop it com

[PATCH] x86: correctly initialize the CS base on reset

2013-03-19 Thread Paolo Bonzini
The CS base was initialized to 0 on VMX (wrong, but usually overridden by userspace before starting) or 0xf on SVM. The correct value is 0x, and VMX is able to emulate it now, so use it. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/svm.c | 8 +--- arch/x86/kvm/vmx.c | 1 + 2

[PATCH] x86: let userspace inject interrupts into the local APIC

2013-03-19 Thread Paolo Bonzini
ntain APIC_DEST_SELF, which has a double effect: first, the ICR2 register is not used and the 32-bit field of KVM_INTERRUPT is enough; second, it ensures that the valid range of the irq field is distinct in the userspace-APIC and kernel-APIC cases. Signed-off-by: Paolo Bonzini --- Documentation/virtua

Re: [PATCH] x86: let userspace inject interrupts into the local APIC

2013-03-19 Thread Paolo Bonzini
Il 19/03/2013 19:13, Gleb Natapov ha scritto: >> > There is no way for userspace to inject interrupts into a VCPU's >> > local APIC, which is important in order to inject INITs coming from >> > the chipset. KVM_INTERRUPT is currently disabled when the in-kernel >> > local APIC is used, so we can r

Re: [PATCH] x86: let userspace inject interrupts into the local APIC

2013-03-19 Thread Paolo Bonzini
Il 19/03/2013 19:50, Gleb Natapov ha scritto: > On Tue, Mar 19, 2013 at 07:39:24PM +0100, Paolo Bonzini wrote: >> Il 19/03/2013 19:13, Gleb Natapov ha scritto: >>>>> There is no way for userspace to inject interrupts into a VCPU's >>>>> local APIC,

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

2013-03-20 Thread Paolo Bonzini
Il 20/03/2013 02:46, Venkatesh Srinivas ha scritto: > This looks pretty good! > > I rather like the (lack of) locking in I/O completion (around the req > count vs. target/queue binding). It is unfortunate that you need to hold > the per-target lock in virtscsi_pick_vq() though; have any idea > how

[PATCH v2 00/14] Corrections and customization of the SG_IO command whitelist (CVE-2012-4542)

2013-02-06 Thread Paolo Bonzini
Removed the large #if 0'd list of commands that the kernel does not pass though. Marked blk_set_cmd_filter_defaults as __init. Paolo Bonzini (14): sg_io: pass request_queue to blk_verify_command sg_io: reorganize list of allowed commands sg_io: use different defaul

[PATCH v2 01/14] sg_io: pass request_queue to blk_verify_command

2013-02-06 Thread Paolo Bonzini
Adjust the blk_verify_command function to let it look at per-queue data. This will be done in the next patch. Acked-by: Tejun Heo Cc: FUJITA Tomonori Cc: Doug Gilbert Cc: "James E.J. Bottomley" Cc: linux-s...@vger.kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- b

[PATCH v2 04/14] sg_io: resolve conflicts between commands assigned to multiple classes (CVE-2012-4542)

2013-02-06 Thread Paolo Bonzini
ne read-write for the other device classes. Cc: "James E.J. Bottomley" Cc: linux-s...@vger.kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- block/scsi_ioctl.c | 12 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/block/scsi_ioctl.c b/block/scsi

[PATCH v2 09/14] sg_io: whitelist a few more commands for disks

2013-02-06 Thread Paolo Bonzini
* REASSIGN BLOCKS */ sgio_bitmap_set(0x2C, D|R|O , write); /* ERASE(10) */ sgio_bitmap_set(0x8B, D , write); /* ORWRITE */ Cc: "James E.J. Bottomley" Cc: linux-s...@vger.kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini

[PATCH v2 11/14] sg_io: mark blk_set_cmd_filter_defaults as __init

2013-02-06 Thread Paolo Bonzini
Cc: "James E.J. Bottomley" Cc: linux-s...@vger.kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- block/scsi_ioctl.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 4942314..3830faf 100644 --- a/block/sc

[PATCH v2 14/14] sg_io: use unpriv_sgio to disable whitelisting for scanners

2013-02-06 Thread Paolo Bonzini
Scanners allow all commands because vendor-specific commands are common. The queue flag we just added lets us keep this behavior by default, while making it possible to disable it. Cc: "James E.J. Bottomley" Cc: linux-s...@vger.kernel.org Cc: Jens Axboe Signed-off-by: Pao

[PATCH v2 12/14] sg_io: remove remnants of sysfs SG_IO filters

2013-02-06 Thread Paolo Bonzini
Some defines and structs remained when support was removed for SG_IO filters in sysfs. Remove them. Cc: "James E.J. Bottomley" Cc: linux-s...@vger.kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- include/linux/genhd.h |9 - 1 files changed, 0 insertions(+), 9

[PATCH v2 13/14] sg_io: introduce unpriv_sgio queue flag

2013-02-06 Thread Paolo Bonzini
permissions. Cc: "James E.J. Bottomley" Cc: linux-s...@vger.kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- Documentation/block/queue-sysfs.txt |8 block/blk-sysfs.c | 33 + block/scsi_ioctl.c

[PATCH v2 03/14] sg_io: use different default filters for each device class

2013-02-06 Thread Paolo Bonzini
nel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- block/scsi_ioctl.c | 14 +- drivers/scsi/scsi_scan.c |2 ++ include/linux/blkdev.h |2 +- include/scsi/scsi.h |1 + 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/block/scsi_ioctl

[PATCH v2 05/14] sg_io: whitelist a few more commands for rare & obsolete device types

2013-02-06 Thread Paolo Bonzini
ger.kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- v1->v2: added more scanner commands, list taken from SANE block/scsi_ioctl.c | 83 +++- 1 files changed, 75 insertions(+), 8 deletions(-) diff --git a/block/scs

[PATCH v2 10/14] sg_io: whitelist a few obsolete commands

2013-02-06 Thread Paolo Bonzini
These are added to their own section of the table, together with SEEK(10) which has always been permitted. Cc: "James E.J. Bottomley" Cc: linux-s...@vger.kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- block/scsi_ioctl.c | 22 +- 1 files changed, 21

[PATCH v2 08/14] sg_io: whitelist a few more commands for tapes

2013-02-06 Thread Paolo Bonzini
: "James E.J. Bottomley" Cc: linux-s...@vger.kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- block/scsi_ioctl.c | 30 +- 1 files changed, 25 insertions(+), 5 deletions(-) diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 8cda426..a9c2

[PATCH v2 07/14] sg_io: whitelist a few more commands for media changers

2013-02-06 Thread Paolo Bonzini
DDRESS". A few changer-specific commands were already enabled by chance because they overlapped commands that are valid for other classes: "EXCHANGE MEDIUM" and "SEND VOLUME TAG", "INITIALIZE ELEMENT STATUS WITH RANGE". Cc: "James E.J. Bottomley" Cc: lin

[PATCH v2 06/14] sg_io: whitelist another command for multimedia devices

2013-02-06 Thread Paolo Bonzini
Three MMC commands were never included: PLAY AUDIO(12), SERVICE ACTION IN(12), MECHANISM STATUS. Add MECHANISM STATUS, the only one that has not been obsoleted in recent versions of the standard. Cc: "James E.J. Bottomley" Cc: linux-s...@vger.kernel.org Cc: Jens Axboe Signed-off

[PATCH v2 02/14] sg_io: reorganize list of allowed commands

2013-02-06 Thread Paolo Bonzini
ned-off-by: Paolo Bonzini --- v1->v2: do not use C++ commands, add definitions for missing types in include/scsi/scsi.h block/scsi_ioctl.c | 210 --- include/scsi/scsi.h |2 + 2 files changed, 133 insertions(+),

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

2013-02-06 Thread Paolo Bonzini
Il 16/01/2013 04:55, Wanlong Gao ha scritto: >>> >> 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. >> > >>

[RFC PATCH 0/8] virtio: new API for addition of buffers, scatterlist changes

2013-02-07 Thread Paolo Bonzini
y sure how important that is and how to fix that---except by making the fields void*. Paolo Paolo Bonzini (8): virtio: add functions for piecewise addition of buffers virtio-blk: reorganize virtblk_add_req virtio-blk: use virtqueue_start_buf on bio path virtio-blk: use virtqueue_start_buf o

[RFC PATCH 8/8] virtio: reimplement virtqueue_add_buf using new functions

2013-02-07 Thread Paolo Bonzini
Eliminate the code duplication between virtqueue_add_buf and virtqueue_add_sg. That's safe to do now that no devices will pass scatterlists with a termination marker in the middle. Signed-off-by: Paolo Bonzini --- drivers/virtio/virtio_ring.c |

[RFC PATCH 4/8] virtio-blk: use virtqueue_start_buf on req path

2013-02-07 Thread Paolo Bonzini
to build SCSI command requests. Signed-off-by: Paolo Bonzini --- drivers/block/virtio_blk.c | 73 +++- 1 files changed, 38 insertions(+), 35 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 538cc40..5896b4d 1006

[RFC PATCH 5/8] scatterlist: introduce sg_unmark_end

2013-02-07 Thread Paolo Bonzini
This is useful in places that recycle the same scatterlist multiple times, and do not want to incur the cost of sg_init_table every time in hot paths. Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- Jens, could you give your Acked-by for this patch? block/blk-integrity.c |2

[RFC PATCH 7/8] virtio-scsi: use virtqueue_start_buf

2013-02-07 Thread Paolo Bonzini
. And it will be particularly useful when adding multiqueue supoprt, because it keeps the tgt_lock critical sections very slim while avoiding a proliferation of locks. Signed-off-by: Wanlong Gao Signed-off-by: Paolo Bonzini --- drivers/scsi/virtio_scsi.c | 103

[RFC PATCH 6/8] virtio-net: unmark scatterlist ending after virtqueue_add_buf

2013-02-07 Thread Paolo Bonzini
Prepare for when virtqueue_add_buf will use sg_next instead of ignoring ending markers. Note that for_each_sg (and thus virtqueue_add_buf) allows you to pass a "truncated" scatterlist that does not have a marker on the last item. We rely on this in add_recvbuf_mergeable. Signed-off

[RFC PATCH 2/8] virtio-blk: reorganize virtblk_add_req

2013-02-07 Thread Paolo Bonzini
Right now, both virtblk_add_req and virtblk_add_req_wait call virtqueue_add_buf. To prepare for the next patches, abstract the call to virtqueue_add_buf into a new function __virtblk_add_req, and include the waiting logic directly in virtblk_add_req. Signed-off-by: Paolo Bonzini --- drivers

[RFC PATCH 3/8] virtio-blk: use virtqueue_start_buf on bio path

2013-02-07 Thread Paolo Bonzini
tio functions ignoring the end markers in a scatterlist. Signed-off-by: Paolo Bonzini --- drivers/block/virtio_blk.c | 75 +++- 1 files changed, 46 insertions(+), 29 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index fd8a

[RFC PATCH 1/8] virtio: add functions for piecewise addition of buffers

2013-02-07 Thread Paolo Bonzini
scatterlist from the blk_map_rq_sg call and it has an ending marker set. When virtqueue_add_buf starts using sg_next, virtio-blk cannot simply hand the resulting scatterlist to virtqueue_add_buf; however it can use the piecewise API to pass the request and response headers separately. Signed-off-by: Paolo

Re: [RFC PATCH 0/8] virtio: new API for addition of buffers, scatterlist changes

2013-02-07 Thread Paolo Bonzini
and how to fix that---except by making the >> fields void*. > > Hide the whole structure as part of vring struct, the problem will go > away. Yes, that's the other possibility. Will do for the next submission. Paolo >> Paolo >> Paolo Bonzini (8): >> virtio: a

Re: [RFC PATCH 0/8] virtio: new API for addition of buffers, scatterlist changes

2013-02-07 Thread Paolo Bonzini
Il 07/02/2013 14:23, Michael S. Tsirkin ha scritto: > On Thu, Feb 07, 2013 at 02:14:24PM +0100, Paolo Bonzini wrote: >> Il 07/02/2013 14:09, Michael S. Tsirkin ha scritto: >>>> One major difference between virtqueue_add_buf and virtqueue_add_sg >>>> is that the

Re: [RFC PATCH 0/8] virtio: new API for addition of buffers, scatterlist changes

2013-02-07 Thread Paolo Bonzini
Il 07/02/2013 14:31, Michael S. Tsirkin ha scritto: > > Single means *this piece* (for example a request header) is single. It > > could still end up in an indirect buffer because QEMU does not support > > mixed direct/indirect buffers. > > Yes but why is the optimization worth it? > It makes sen

Re: [RFC PATCH 0/8] virtio: new API for addition of buffers, scatterlist changes

2013-02-07 Thread Paolo Bonzini
Il 08/02/2013 05:05, Rusty Russell ha scritto: > Paolo Bonzini 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 scatterlists: the buffer

[PATCH 0/9] virtio: new API for addition of buffers, scatterlist changes

2013-02-12 Thread Paolo Bonzini
efan Hajnoczi. And of course the patch is now well tested (including virtio-serial, all three virtio-net receive paths, and virtio-blk SG_IO which I hadn't checked for the RFC); anyway this did not bring in new code changes. Ok for 3.9? Paolo Paolo Bonzini (9): virtio: add functions for

[PATCH 3/9] virtio-blk: use virtqueue_start_buf on bio path

2013-02-12 Thread Paolo Bonzini
on the virtio functions ignoring the end markers in a scatterlist. The next patch will do the same for the other path. Signed-off-by: Paolo Bonzini --- drivers/block/virtio_blk.c | 74 ++- 1 files changed, 45 insertions(+), 29 deletions(-) diff --gi

[PATCH 4/9] virtio-blk: use virtqueue_start_buf on req path

2013-02-12 Thread Paolo Bonzini
to build SCSI command requests. Signed-off-by: Paolo Bonzini --- drivers/block/virtio_blk.c | 74 ++- 1 files changed, 38 insertions(+), 36 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 4a31fcc..22deb65 1006

[PATCH 7/9] virtio-scsi: use virtqueue_start_buf

2013-02-12 Thread Paolo Bonzini
. And it will be particularly useful when adding multiqueue supoprt, because it keeps the tgt_lock critical sections very slim while avoiding a proliferation of locks. Signed-off-by: Wanlong Gao Signed-off-by: Paolo Bonzini --- drivers/scsi/virtio_scsi.c | 102

[PATCH 8/9] virtio: introduce and use virtqueue_add_buf_single

2013-02-12 Thread Paolo Bonzini
Adding a single direct buffer is a very common case. Introduce an optimized function for that. Signed-off-by: Paolo Bonzini --- drivers/char/hw_random/virtio-rng.c |2 +- drivers/char/virtio_console.c |4 +- drivers/net/virtio_net.c|2 +- drivers/rpmsg

[PATCH 9/9] virtio: reimplement virtqueue_add_buf using new functions

2013-02-12 Thread Paolo Bonzini
Eliminate the code duplication between virtqueue_add_buf and virtqueue_add_sg. That's safe to do now that no devices will pass scatterlists with a termination marker in the middle. Signed-off-by: Paolo Bonzini --- drivers/virtio/virtio_ring.c |

[PATCH 6/9] virtio-net: unmark scatterlist ending after virtqueue_add_buf

2013-02-12 Thread Paolo Bonzini
Prepare for when virtqueue_add_buf will use sg_next instead of ignoring ending markers. Note that for_each_sg (and thus virtqueue_add_sg) allows you to pass a "truncated" scatterlist that does not have a marker on the last item. We rely on this in add_recvbuf_mergeable. Signed-off

[PATCH 1/9] virtio: add functions for piecewise addition of buffers

2013-02-12 Thread Paolo Bonzini
header, for the write buffer (if present), for the response header, and finally for the read buffer (again if present). It saves the copying and the related locking. Signed-off-by: Paolo Bonzini --- drivers/virtio/virtio_ring.c | 211 ++ include/linux

[PATCH 5/9] scatterlist: introduce sg_unmark_end

2013-02-12 Thread Paolo Bonzini
This is useful in places that recycle the same scatterlist multiple times, and do not want to incur the cost of sg_init_table every time in hot paths. Acked-by: Jens Axboe Signed-off-by: Paolo Bonzini --- block/blk-integrity.c |2 +- block/blk-merge.c |2 +- include

[PATCH 2/9] virtio-blk: reorganize virtblk_add_req

2013-02-12 Thread Paolo Bonzini
Right now, both virtblk_add_req and virtblk_add_req_wait call virtqueue_add_buf. To prepare for the next patches, abstract the call to virtqueue_add_buf into a new function __virtblk_add_req, and include the waiting logic directly in virtblk_add_req. Signed-off-by: Paolo Bonzini --- drivers

[PATCH v3 1/5] virtio-scsi: redo allocation of target data

2013-02-12 Thread Paolo Bonzini
array member at the end of struct virtio_scsi, because we will place the virtqueues there in the next patches. Cc: linux-s...@vger.kernel.org Signed-off-by: Paolo Bonzini --- drivers/scsi/virtio_scsi.c | 39 --- 1 files changed, 12 insertions(+), 27 deletions

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

2013-02-12 Thread Paolo Bonzini
This will be needed soon in order to retrieve the per-target struct. Cc: linux-s...@vger.kernel.org Signed-off-by: Paolo Bonzini --- drivers/scsi/virtio_scsi.c | 17 + 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi

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

2013-02-12 Thread Paolo Bonzini
sent a request. This is less appealing because we do not set the affinity directly---we only provide a hint to the irqbalanced running in userspace. Dynamically changing the affinity only works if the userspace applies the hint fast enough. Cc: linux-s...@vger.kernel.org Signed-off-by: Wanlong Gao

[PATCH v3 3/5] virtio-scsi: push vq lock/unlock into virtscsi_vq_done

2013-02-12 Thread Paolo Bonzini
Avoid duplicated code in all of the callers. Cc: linux-s...@vger.kernel.org Signed-off-by: Paolo Bonzini --- drivers/scsi/virtio_scsi.c | 22 +- 1 files changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index

[PATCH v3 5/5] virtio-scsi: reset virtqueue affinity when doing cpu hotplug

2013-02-12 Thread Paolo Bonzini
From: Wanlong Gao Add hot cpu notifier to reset the request virtqueue affinity when doing cpu hotplug. Cc: linux-s...@vger.kernel.org Signed-off-by: Wanlong Gao [ The version that doesn't get/put_online_cpus is now called __virtscsi_set_affinity - Paolo ] Signed-off-by: Paolo Bo

[PATCH v3 0/5] virtio-scsi multiqueue

2013-02-12 Thread Paolo Bonzini
PU hotplug patches Ok for 3.9? It would probably be easier to get it in via Rusty's tree because of the prerequisites. James, can I get your Acked-by? Paolo Paolo Bonzini (4): virtio-scsi: redo allocation of target data virtio-scsi: pass struct virtio_scsi to virtqueue completion function

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

2013-02-12 Thread Paolo Bonzini
Il 12/02/2013 15:56, Michael S. Tsirkin ha scritto: >> > +/** >> > + * virtqueue_start_buf - start building buffer for the other end >> > + * @vq: the struct virtqueue we're talking about. >> > + * @data: the token identifying the buffer. >> > + * @nents: the number of buffers that will be added >

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

2013-02-12 Thread Paolo Bonzini
Il 12/02/2013 16:43, Michael S. Tsirkin ha scritto: > On Tue, Feb 12, 2013 at 04:32:27PM +0100, Paolo Bonzini wrote: >> Il 12/02/2013 15:56, Michael S. Tsirkin ha scritto: >>>>> +/** >>>>> + * virtqueue_start_buf - start building buffer for the other end &g

[PATCH 0/3] NBD fixes for caching and block device flags

2013-02-12 Thread Paolo Bonzini
27;s page cache when an NBD device is disconnected from the server. The third reports read-only devices properly in sysfs. Ok for 3.9? I saw the last NBD patches were applied by Andrew Morton, so I'm CCing him; Paul, please ack them if they are okay. Paolo Alex Bligh (1): nbd: support F

[PATCH 1/3] nbd: support FLUSH requests

2013-02-12 Thread Paolo Bonzini
NBD_CMD_FLUSH command. Cc: Cc: Paul Clements Cc: Andrew Morton Signed-off-by: Alex Bligh [ Removed FUA support for reasons similar to those outlined in https://lkml.org/lkml/2010/8/17/234 for virtio - Paolo ] Signed-off-by: Paolo Bonzini --- drivers/block/nbd.c | 22

[PATCH 3/3] nbd: show read-only state in sysfs

2013-02-12 Thread Paolo Bonzini
Pass the read-only flag to set_device_ro, so that it will be visible to the block layer and in sysfs. Cc: Cc: Paul Clements Cc: Andrew Morton Signed-off-by: Paolo Bonzini --- drivers/block/nbd.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/block/nbd.c b

[PATCH 2/3] nbd: fsync and kill block device on shutdown

2013-02-12 Thread Paolo Bonzini
: # file -s /dev/sda /dev/sda: x86 boot sector; etc. Cc: Cc: Cc: Paul Clements Cc: Andrew Morton Signed-off-by: Paolo Bonzini --- drivers/block/nbd.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 5603765

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

2013-02-12 Thread Paolo Bonzini
Il 12/02/2013 17:13, Michael S. Tsirkin ha scritto: >>> + * @nsg: the number of sg lists that will be added > This means number of calls to add_sg ? Not sure why this matters. > How about we pass in in_num/out_num - that is total # of sg, > same as add_buf? It is used to c

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

2013-02-12 Thread Paolo Bonzini
Il 12/02/2013 17:35, Michael S. Tsirkin ha scritto: > On Tue, Feb 12, 2013 at 05:17:47PM +0100, Paolo Bonzini wrote: >> Il 12/02/2013 17:13, Michael S. Tsirkin ha scritto: >>>>>>>>> + * @nsg: the number of sg lists that will be added >>>>>>>

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

2013-02-12 Thread Paolo Bonzini
header, for the write buffer (if present), for the response header, and finally for the read buffer (again if present). It saves the copying and the related locking. Signed-off-by: Paolo Bonzini --- drivers/virtio/virtio_ring.c | 211 ++ include/linux

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

2013-02-12 Thread Paolo Bonzini
Il 12/02/2013 18:34, Michael S. Tsirkin ha scritto: > On Tue, Feb 12, 2013 at 05:57:55PM +0100, Paolo Bonzini wrote: >> Il 12/02/2013 17:35, Michael S. Tsirkin ha scritto: >>> On Tue, Feb 12, 2013 at 05:17:47PM +0100, Paolo Bonzini wrote: >>>> Il 12/02/2013 17:13,

Re: [PATCH 1/3] nbd: support FLUSH requests

2013-02-12 Thread Paolo Bonzini
Il 12/02/2013 18:37, Alex Bligh ha scritto: > For my education, why remove the FUA stuff? Because I had no way to test it. >>> > > Hmmm... the underlying storage could be md/dm RAIDs in which case FUA >>> > > should be cheaper than FLUSH. >> > >> > If someone ever wrote a virtio-blk backend that

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

2013-02-12 Thread Paolo Bonzini
Il 12/02/2013 19:23, Michael S. Tsirkin ha scritto: > On Tue, Feb 12, 2013 at 07:04:27PM +0100, Paolo Bonzini wrote: >>>> Perhaps, but 3 or 4 arguments (in/out/nsg or in/out/nsg_in/nsg_out) just >>>> for this are definitely too many and make the API harder to use. &

PING^3 Re: [PATCH v2 00/14] Corrections and customization of the SG_IO command whitelist (CVE-2012-4542)

2013-04-04 Thread Paolo Bonzini
Il 22/03/2013 23:30, Paolo Bonzini ha scritto: > Il 20/02/2013 17:12, Paolo Bonzini ha scritto: >> Il 06/02/2013 16:15, Paolo Bonzini ha scritto: >>> This series regards the whitelist that is used for the SG_IO ioctl. This >>> whitelist has three problems: >>>

Re: [PATCH] kvm: fix MMIO/PIO collision misdetection

2013-04-05 Thread Paolo Bonzini
Michael S. Tsirkin Reviewed-by: Paolo Bonzini > --- > virt/kvm/eventfd.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c > index adb17f2..93e5b05 100644 > --- a/virt/kvm/eventfd.c > +++ b/virt/kvm/eventfd

Re: [PATCH v17] pvpanic: pvpanic device driver

2013-04-05 Thread Paolo Bonzini
Il 05/04/2013 09:10, Hu Tao ha scritto: > pvpanic device is a qemu simulated device through which guest panic > event is sent to host. > > Signed-off-by: Hu Tao Reviewed-by: Paolo Bonzini Matthew, it would be nice to include this in 3.10. The implementation of the device in Q

[PATCH 01/13] sg_io: pass request_queue to blk_verify_command

2013-01-24 Thread Paolo Bonzini
Adjust the blk_verify_command function to let it look at per-queue data. This will be done in the next patch. Cc: FUJITA Tomonori Cc: Doug Gilbert Cc: "James E.J. Bottomley" Cc: linux-s...@kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- block/bsg.c|2

[PATCH 03/13] sg_io: use different default filters for each device class

2013-01-24 Thread Paolo Bonzini
g Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- block/scsi_ioctl.c | 14 +- drivers/scsi/scsi_scan.c |2 ++ include/linux/blkdev.h |2 +- include/scsi/scsi.h |1 + 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/block/scsi_ioctl.c b/block/sc

[PATCH 06/13] sg_io: whitelist a few more commands for multimedia devices

2013-01-24 Thread Paolo Bonzini
Strangely, a couple of MMC commands were never included. Add them too. Cc: "James E.J. Bottomley" Cc: linux-s...@kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- block/scsi_ioctl.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/block/scsi_ioctl

[PATCH 09/13] sg_io: whitelist a few more commands for disks

2013-01-24 Thread Paolo Bonzini
really agree with that and it's probably an artifact of when /dev/cdrom had r--r--r-- permissions, but I'm not trying to change that. Cc: "James E.J. Bottomley" Cc: linux-s...@kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- block/scsi_ioctl.c | 23

[PATCH 11/13] sg_io: add list of commands that were in the consulted list but are disabled

2013-01-24 Thread Paolo Bonzini
To aid future modifications of the list, add a list of commands that were in the version of the SCSI commands list I consulted, but I considered too dangerous to enable by default for unprivileged users. Cc: "James E.J. Bottomley" Cc: linux-s...@kernel.org Cc: Jens Axboe Signed-off

[PATCH 12/13] sg_io: remove remnants of sysfs SG_IO filters

2013-01-24 Thread Paolo Bonzini
Some defines and structs remained when support was removed for SG_IO filters in sysfs. Remove them. Cc: "James E.J. Bottomley" Cc: linux-s...@kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- include/linux/genhd.h |9 - 1 files changed, 0 insertions(+), 9

[PATCH 13/13] sg_io: introduce unpriv_sgio queue flag

2013-01-24 Thread Paolo Bonzini
permissions. Cc: "James E.J. Bottomley" Cc: linux-s...@kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- Documentation/block/queue-sysfs.txt |8 block/blk-sysfs.c | 33 + block/scsi_ioctl.c

[PATCH 10/13] sg_io: whitelist a few obsolete commands

2013-01-24 Thread Paolo Bonzini
These are added to their own section of the table, together with SEEK(10) which has always been permitted. Cc: "James E.J. Bottomley" Cc: linux-s...@kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- block/scsi_ioctl.c | 22 +- 1 files changed, 21

[PATCH 07/13] sg_io: whitelist a few more commands for media changers

2013-01-24 Thread Paolo Bonzini
DDRESS". A few changer-specific commands were already enabled by chance because they overlapped commands that are valid for other classes: "EXCHANGE MEDIUM" and "SEND VOLUME TAG", "INITIALIZE ELEMENT STATUS WITH RANGE". Cc: "James E.J. Bottomley" Cc

[PATCH 02/13] sg_io: reorganize list of allowed commands

2013-01-24 Thread Paolo Bonzini
ned-off-by: Paolo Bonzini --- block/scsi_ioctl.c | 209 1 files changed, 130 insertions(+), 79 deletions(-) diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index a737562..75533bd 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c

[PATCH 00/13] Corrections and customization of the SG_IO command whitelist (CVE-2012-4542)

2013-01-24 Thread Paolo Bonzini
ing of the command table. I know about this, and ensured that there are no errors in the rest of the code. Ok for the next merge window? Paolo Bonzini (13): sg_io: pass request_queue to blk_verify_command sg_io: reorganize list of allowed commands sg_io: use different default filters for each de

[PATCH 05/13] sg_io: whitelist a few more commands for rare & obsolete device types

2013-01-24 Thread Paolo Bonzini
g Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- block/scsi_ioctl.c | 49 - 1 files changed, 40 insertions(+), 9 deletions(-) diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index c266546..084b943 100644 --- a/block/scsi_ioctl.c +++ b/bloc

[PATCH 04/13] sg_io: resolve conflicts between commands assigned to multiple classes (CVE-2012-4542)

2013-01-24 Thread Paolo Bonzini
ne read-write for the other device classes. Cc: "James E.J. Bottomley" Cc: linux-s...@kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- block/scsi_ioctl.c | 12 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl

[PATCH 08/13] sg_io: whitelist a few more commands for tapes

2013-01-24 Thread Paolo Bonzini
: "James E.J. Bottomley" Cc: linux-s...@kernel.org Cc: Jens Axboe Signed-off-by: Paolo Bonzini --- block/scsi_ioctl.c | 28 1 files changed, 24 insertions(+), 4 deletions(-) diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 6af330a..49cd98a 10

Re: [PATCH 06/13] sg_io: whitelist a few more commands for multimedia devices

2013-01-25 Thread Paolo Bonzini
Il 24/01/2013 23:55, Tejun Heo ha scritto: > On Thu, Jan 24, 2013 at 04:00:42PM +0100, Paolo Bonzini wrote: >> Strangely, a couple of MMC commands were never included. Add them too. > > What are the justifications for adding these commands to the filter? > Are there users re

Re: [PATCH 02/13] sg_io: reorganize list of allowed commands

2013-01-25 Thread Paolo Bonzini
Il 24/01/2013 23:58, Tejun Heo ha scritto: > >> +#define sgio_bitmap_set(cmd, mask, rw) \ >> +if ((mask) != 0) __set_bit((cmd), filter->rw##_ok) >> + >> +#define D (1u << TYPE_DISK) /* Direct Access Block Device (SBC-3) >> */ >> +#define T (1u << TYPE_TAPE) /* Sequential A

Re: [PATCH 06/13] sg_io: whitelist a few more commands for multimedia devices

2013-01-25 Thread Paolo Bonzini
Il 25/01/2013 18:04, Tejun Heo ha scritto: >> > >> > I think it's the other way round. What's the justification for leaving >> > them out, if they are in the standard? Since we're touching the >> > commands for other standards, it's better to be complete for MMC as well. > Maybe my experience wi

Re: [PATCH 02/13] sg_io: reorganize list of allowed commands

2013-01-25 Thread Paolo Bonzini
Il 25/01/2013 18:13, Tejun Heo ha scritto: > Hello, Paolo. > > On Fri, Jan 25, 2013 at 11:01:38AM +0100, Paolo Bonzini wrote: >> First, because the table is based on >> http://www.t10.org/lists/op-num.txt. Entries in that file look like this: >> >>

Re: [PATCH 06/13] sg_io: whitelist a few more commands for multimedia devices

2013-01-25 Thread Paolo Bonzini
Il 25/01/2013 18:28, Tejun Heo ha scritto: > On Fri, Jan 25, 2013 at 06:16:04PM +0100, Paolo Bonzini wrote: >> > Well, you can find broken devices for pretty much every command in the >> > list. Anyhow, the other two commands are obsolete so I'm okay with >> >

Re: [PATCH 06/13] sg_io: whitelist a few more commands for multimedia devices

2013-01-25 Thread Paolo Bonzini
Il 25/01/2013 19:13, Tejun Heo ha scritto: > I'm not sure how well I can explain this but something being in the > spec and something in wide use are two different things, and people, > including the ones in hw vendors, tend not to pay too much attention / > resources to stuff which aren't used wid

Re: [PATCH 06/13] sg_io: whitelist a few more commands for multimedia devices

2013-01-25 Thread Paolo Bonzini
Il 25/01/2013 20:01, Tejun Heo ha scritto: > Some did that at least in ATA. It was mapping some command to > firmware write. Given how many USB devices implement SCSI these days, > I wouldn't be too firm with "that doesn't happen". How can such > all-covering statement be asserted? Of course it

Re: [PATCH 06/13] sg_io: whitelist a few more commands for multimedia devices

2013-01-25 Thread Paolo Bonzini
Il 25/01/2013 23:41, Tejun Heo ha scritto: > Hello, Paolo. > > On Fri, Jan 25, 2013 at 11:32:42PM +0100, Paolo Bonzini wrote: >> All you can do is use common sense, which says that if a command has >> been in a standard, someone has likely used it. Of course someone >&

Re: [PATCH 06/13] sg_io: whitelist a few more commands for multimedia devices

2013-01-26 Thread Paolo Bonzini
Il 26/01/2013 00:47, Tejun Heo ha scritto: >> > If I make a whitelist with all the commands that Linux sends, I'll have >> > many new commands in the whitelist and no old commands. The new >> > commands didn't exist when old drives were sold, so they are "dangerous" >> > in your opinion. At that

Re: [PATCH 02/16] virtio_ring: virtqueue_add_sgs, to add multiple sgs.

2013-02-25 Thread Paolo Bonzini
Il 24/02/2013 23:12, Michael S. Tsirkin ha scritto: > On Tue, Feb 19, 2013 at 06:26:20PM +1030, Rusty Russell wrote: >> virtio_scsi can really use this, to avoid the current hack of copying >> the whole sg array. Some other things get slightly neater, too. >> >> Signed-off-by: Rusty Russell > >

Re: [GIT PULL] Load keys from signed PE binaries

2013-02-27 Thread Paolo Bonzini
Il 27/02/2013 18:36, Chris Friesen ha scritto: > On 02/27/2013 09:24 AM, Theodore Ts'o wrote: >> On Tue, Feb 26, 2013 at 11:54:51AM -0500, Peter Jones wrote: >>> No, no, no. Quit saying nobody knows. We've got a pretty good idea - >>> we've got a contract with them, and it says they provide the s

Re: [GIT PULL] Load keys from signed PE binaries

2013-02-27 Thread Paolo Bonzini
Il 28/02/2013 07:27, Geert Uytterhoeven ha scritto: > I thought it was about market segmentation? Charge $$$ for the model with VT > enabled. No, there's the Atom that doesn't come with virtualization extensions at all. But things like Bluepill are the reason why you have to enable VT manually.

Re: [PATCH 02/16] virtio_ring: virtqueue_add_sgs, to add multiple sgs.

2013-02-28 Thread Paolo Bonzini
Il 27/02/2013 12:21, Rusty Russell ha scritto: >>> >> Baseline (before add_sgs): >>> >> 2.84-3.04(2.927292)user >>> >> >>> >> After add_sgs: >>> >> 2.97-3.15(3.053750)user >>> >> >>> >> After simplifying add_buf a little: >>> >> 2.95-3.21(3.081458)u

Re: [PATCH 0/9] virtio: new API for addition of buffers, scatterlist changes

2013-02-19 Thread Paolo Bonzini
Il 19/02/2013 08:49, Rusty Russell ha scritto: > > But modulo devastating benchmarks, this wins. Because the three-part > API is really, really ugly. It *looks* like a generic "start - work > ... work - end" API, but it's not. Because you need to declare exactly > what you're doing in virtqueue

Re: [PATCH 00/16] virtio ring rework.

2013-02-19 Thread Paolo Bonzini
Il 19/02/2013 08:56, Rusty Russell ha scritto: > OK, this is (ab)uses some of Paolo's patches. The first 7 are > candidates for this merge window (maybe), the rest I'm not so sure > about. Cool, thanks. > Thanks, > Rusty. > > Paolo Bonzini (3): > sc

Re: [PATCH 17/16 V2] virtio-scsi: use virtqueue_add_sgs for command buffers

2013-02-20 Thread Paolo Bonzini
Il 20/02/2013 10:47, Wanlong Gao ha scritto: > Using the new virtqueue_add_sgs function lets us simplify the queueing > path. In particular, all data protected by the tgt_lock is just gone > (multiqueue will find a new use for the lock). > > Signed-off-by: Paolo Bonzini > Sign

Re: [PATCH v2 00/14] Corrections and customization of the SG_IO command whitelist (CVE-2012-4542)

2013-02-20 Thread Paolo Bonzini
Il 06/02/2013 16:15, Paolo Bonzini ha scritto: > This series regards the whitelist that is used for the SG_IO ioctl. This > whitelist has three problems: > > * the bitmap of allowed commands is designed for MMC devices (roughly, > "play/burn CDs without requiring roo

Re: New copyfile system call - discuss before LSF?

2013-02-21 Thread Paolo Bonzini
Il 21/02/2013 15:57, Ric Wheeler ha scritto: >>> >> sendfile64() pretty much already has the right arguments for a >> "copyfile", however it would be nice to add a 'flags' parameter: the >> NFSv4.2 version would use that to specify whether or not to copy file >> metadata. > > That would seem to be

Re: New copyfile system call - discuss before LSF?

2013-02-22 Thread Paolo Bonzini
Il 21/02/2013 23:24, Zach Brown ha scritto: > You could make it work with some locking and out_fd seeking to set the > write offset before calling sendfile64()+flags, but ugh. > > ssize_t sendfile(int out_fd, int in_fd, off_t in_offset, off_t > out_offset, size_t count, int flag

  1   2   3   4   5   6   7   8   9   10   >