Re: [Xen-devel] potential integer overflow in xenbus_file_write()

2012-10-16 Thread Jan Beulich
>>> On 15.10.12 at 12:25, Ian Campbell wrote: > On Thu, 2012-09-13 at 19:00 +0300, Dan Carpenter wrote: >> Hi, > > Thanks Dan. I'm not sure anyone from Xen-land really monitors > virtualization@. Adding xen-devel and Konrad. > >> >> I was reading some code and had a question in xenbus_file_writ

Re: [Xen-devel] memory corruption in HYPERVISOR_physdev_op()

2012-10-16 Thread Jan Beulich
>>> On 15.10.12 at 12:27, Ian Campbell wrote: >> My static analyzer complains about potential memory corruption in >> HYPERVISOR_physdev_op() >> >> arch/x86/include/asm/xen/hypercall.h >>389 static inline int >>390 HYPERVISOR_physdev_op(int cmd, void *arg) >>391 { >>392

Re: [Xen-devel] memory corruption in HYPERVISOR_physdev_op()

2012-10-16 Thread Jan Beulich
>>> On 16.10.12 at 11:07, "Jan Beulich" wrote: On 15.10.12 at 12:27, Ian Campbell wrote: >>> My static analyzer complains about potential memory corruption in >>> HYPERVISOR_physdev_op() >>> >>> arch/x86/include/asm/xen/hypercall.h >>>389 static inline int >>>390 HYPERVISOR_physde

Re: Using PCI config space to indicate config location

2012-10-16 Thread Rusty Russell
"Michael S. Tsirkin" writes: > On Fri, Oct 12, 2012 at 08:21:50PM +1030, Rusty Russell wrote: >> "Michael S. Tsirkin" writes: >> > On Fri, Oct 12, 2012 at 08:59:36AM +1030, Rusty Russell wrote: >> >> >> For writes, the standard seems to be a commit latch. We could abuse >> >> >> the >> >> >> ge

Re: Using PCI config space to indicate config location

2012-10-16 Thread Michael S. Tsirkin
On Tue, Oct 16, 2012 at 11:45:41PM +1030, Rusty Russell wrote: > "Michael S. Tsirkin" writes: > > On Fri, Oct 12, 2012 at 08:21:50PM +1030, Rusty Russell wrote: > >> "Michael S. Tsirkin" writes: > >> > On Fri, Oct 12, 2012 at 08:59:36AM +1030, Rusty Russell wrote: > >> >> >> For writes, the stand

[PATCH 2/5] virtio-net: remove unused skb_vnet_hdr->num_sg field

2012-10-16 Thread Rusty Russell
From: "Michael S. Tsirkin" [Split from "correct capacity math on ring full" -- Rusty] Signed-off-by: Michael S. Tsirkin Signed-off-by: Rusty Russell --- drivers/net/virtio_net.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net

[PATCH 4/5] virtio_net: don't rely on virtqueue_add_buf() returning capacity.

2012-10-16 Thread Rusty Russell
Now we can easily use vq->num_free to determine if there are descriptors left in the queue, we're about to change virtqueue_add_buf() to return 0 on success. The virtio_net driver is the only one which actually uses the return value, so change that. Signed-off-by: Rusty Russell --- drivers/net/

[PATCH 1/5] virtio: move queue_index and num_free fields into core struct virtqueue.

2012-10-16 Thread Rusty Russell
They're generic concepts, so hoist them. This also avoids accessor functions. This goes even further than Jason Wang's 17bb6d4088 patch ("virtio-ring: move queue_index to vring_virtqueue") which moved the queue_index from the specific transport. Signed-off-by: Rusty Russell --- drivers/virtio/

[PATCH 5/5] virtio: make virtqueue_add_buf() returning 0 on success, not capacity.

2012-10-16 Thread Rusty Russell
Now noone relies on this behavior, we simplify virtqueue_add_buf() so it return 0 or -errno. Signed-off-by: Rusty Russell --- drivers/virtio/virtio_ring.c |7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c ind

[PATCH 3/5] virtio-net: correct capacity math on ring full

2012-10-16 Thread Rusty Russell
From: "Michael S. Tsirkin" Capacity math on ring full is wrong: we are looking at num_sg but that might be optimistic because of indirect buffer use. The implementation also penalizes fast path with extra memory accesses for the benefit of ring full condition handling which is slow path. It's e

Re: [PATCH 4/5] virtio_net: don't rely on virtqueue_add_buf() returning capacity.

2012-10-16 Thread Michael S. Tsirkin
On Wed, Oct 17, 2012 at 12:00:51AM +1030, Rusty Russell wrote: > Now we can easily use vq->num_free to determine if there are descriptors > left in the queue, we're about to change virtqueue_add_buf() to return 0 > on success. The virtio_net driver is the only one which actually uses > the return

Re: [PATCH 1/5] virtio: move queue_index and num_free fields into core struct virtqueue.

2012-10-16 Thread Michael S. Tsirkin
On Wed, Oct 17, 2012 at 12:00:48AM +1030, Rusty Russell wrote: > They're generic concepts, so hoist them. This also avoids accessor > functions. > > This goes even further than Jason Wang's 17bb6d4088 patch > ("virtio-ring: move queue_index to vring_virtqueue") which moved the > queue_index from

Re: [PATCH 5/5] virtio: make virtqueue_add_buf() returning 0 on success, not capacity.

2012-10-16 Thread Rusty Russell
Note: I also have minor cleanups to virtio drivers to change (ret >= 0) to (ret == 0) where it would otherwise be confusing for new readers, but I didn't clutter the list with them. See my virtio-wip tree for the gory details. Cheers, Rusty. ___ Virtual

Re: Using PCI config space to indicate config location

2012-10-16 Thread Rusty Russell
"Michael S. Tsirkin" writes: > On Tue, Oct 16, 2012 at 11:45:41PM +1030, Rusty Russell wrote: >> "Michael S. Tsirkin" writes: >> I was assuming the implementation would keep two complete copies of the >> config space: writes go to the scratch version, which gets copied to the >> master version up

Re: [PATCH 1/5] virtio: move queue_index and num_free fields into core struct virtqueue.

2012-10-16 Thread Rusty Russell
"Michael S. Tsirkin" writes: > On Wed, Oct 17, 2012 at 12:00:48AM +1030, Rusty Russell wrote: >> * @priv: a pointer for the virtqueue implementation to use. >> + * @index: the zero-based ordinal number for this queue. >> + * @num_free: number of buffers we expect to be able to fit. > > Only it's

Re: [PATCH 1/5] virtio: move queue_index and num_free fields into core struct virtqueue.

2012-10-16 Thread Michael S. Tsirkin
On Wed, Oct 17, 2012 at 12:00:48AM +1030, Rusty Russell wrote: > They're generic concepts, so hoist them. This also avoids accessor > functions. > > This goes even further than Jason Wang's 17bb6d4088 patch > ("virtio-ring: move queue_index to vring_virtqueue") which moved the > queue_index from

[PATCH] xen/xenbus: silence GCC warning

2012-10-16 Thread Paul Bolle
Compiling xenbus_xs.o triggers this GCC warning: drivers/xen/xenbus/xenbus_xs.c:628:13: warning: function declaration isn’t a prototype [-Wstrict-prototypes] Add the obvious and trivial fix. While we're touching this function add some equally obvious and trivial whitespace fixes. Signed-off