Re: [Qemu-devel] [PATCH 1/6] virtio: introduce virtio_map

2015-10-28 Thread Igor Mammedov
On Tue, 27 Oct 2015 10:47:56 +0200 "Michael S. Tsirkin" wrote: > virtio_map_sg currently fails if one of the entries it's mapping is > contigious in GPA but not HVA address space. Introduce virtio_map which > handles this by splitting sg entries. > > This new API generally turns out to be a goo

Re: [Qemu-devel] [PATCH 1/6] virtio: introduce virtio_map

2015-10-28 Thread Igor Mammedov
On Tue, 27 Oct 2015 10:47:56 +0200 "Michael S. Tsirkin" wrote: > virtio_map_sg currently fails if one of the entries it's mapping is > contigious in GPA but not HVA address space. Introduce virtio_map which > handles this by splitting sg entries. > > This new API generally turns out to be a goo

Re: [Qemu-devel] [PATCH 1/6] virtio: introduce virtio_map

2015-10-28 Thread Stefan Hajnoczi
On Tue, Oct 27, 2015 at 08:34:32PM +0200, Michael S. Tsirkin wrote: > On Tue, Oct 27, 2015 at 04:19:54PM +, Stefan Hajnoczi wrote: > > On Tue, Oct 27, 2015 at 10:47:56AM +0200, Michael S. Tsirkin wrote: > > > This will still fail if there's no space left in the sg, but luckily max > > > queue s

Re: [Qemu-devel] [PATCH 1/6] virtio: introduce virtio_map

2015-10-27 Thread Michael S. Tsirkin
On Tue, Oct 27, 2015 at 04:13:12PM +, Stefan Hajnoczi wrote: > On Tue, Oct 27, 2015 at 10:47:56AM +0200, Michael S. Tsirkin wrote: > > +for (i = 0; i < *num_sg; i++) { > > len = sg[i].iov_len; > > sg[i].iov_base = cpu_physical_memory_map(addr[i], &len, is_write); > > -

Re: [Qemu-devel] [PATCH 1/6] virtio: introduce virtio_map

2015-10-27 Thread Michael S. Tsirkin
On Tue, Oct 27, 2015 at 04:19:54PM +, Stefan Hajnoczi wrote: > On Tue, Oct 27, 2015 at 10:47:56AM +0200, Michael S. Tsirkin wrote: > > This will still fail if there's no space left in the sg, but luckily max > > queue size in use is currently 256, while max sg size is 1024, so we > > should be

Re: [Qemu-devel] [PATCH 1/6] virtio: introduce virtio_map

2015-10-27 Thread Stefan Hajnoczi
On Tue, Oct 27, 2015 at 10:47:56AM +0200, Michael S. Tsirkin wrote: > This will still fail if there's no space left in the sg, but luckily max > queue size in use is currently 256, while max sg size is 1024, so we > should be OK even is all entries happen to cross a single DIMM boundary. Don't for

Re: [Qemu-devel] [PATCH 1/6] virtio: introduce virtio_map

2015-10-27 Thread Stefan Hajnoczi
On Tue, Oct 27, 2015 at 10:47:56AM +0200, Michael S. Tsirkin wrote: > +for (i = 0; i < *num_sg; i++) { > len = sg[i].iov_len; > sg[i].iov_base = cpu_physical_memory_map(addr[i], &len, is_write); > -if (sg[i].iov_base == NULL || len != sg[i].iov_len) { > +if (!s

[Qemu-devel] [PATCH 1/6] virtio: introduce virtio_map

2015-10-27 Thread Michael S. Tsirkin
virtio_map_sg currently fails if one of the entries it's mapping is contigious in GPA but not HVA address space. Introduce virtio_map which handles this by splitting sg entries. This new API generally turns out to be a good idea since it's harder to misuse: at least in one case the existing one w