Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-30 Thread Paolo Bonzini
On 29/03/2017 23:28, Michael S. Tsirkin wrote: >> Something like this? >> >> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c >> index 03592c5..73e69ac 100644 >> --- a/hw/virtio/virtio.c >> +++ b/hw/virtio/virtio.c >> @@ -176,6 +176,10 @@ err_used: >> address_space_cache_destroy(&new->de

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Jason Wang
On 2017年03月29日 19:39, Cornelia Huck wrote: On Wed, 29 Mar 2017 17:18:00 +0800 Jason Wang wrote: On 2017年03月29日 16:45, Cornelia Huck wrote: On Wed, 29 Mar 2017 10:09:10 +0200 Paolo Bonzini wrote: On 29/03/2017 10:00, Jason Wang wrote: 1) vtd was reset first 2) during the reset of virtio

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Michael S. Tsirkin
On Wed, Mar 29, 2017 at 04:16:30PM +0800, Peter Xu wrote: > On Wed, Mar 29, 2017 at 04:00:37PM +0800, Jason Wang wrote: > > Hi: > > > > I meet an issue when doing reboot for a guest with two virtio-net-pci cards > > when iommu is enabled. What happens is: > > > > > > 1) vtd was reset first > >

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Michael S. Tsirkin
On Wed, Mar 29, 2017 at 05:24:18PM +0800, Jason Wang wrote: > > > On 2017年03月29日 17:11, Paolo Bonzini wrote: > > > > On 29/03/2017 11:09, Jason Wang wrote: > > > > > This looks a good fix but may not solve this issue completely. Depends > > > > > on the iova that guest uses, address_space_cache_

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Michael S. Tsirkin
On Wed, Mar 29, 2017 at 10:09:10AM +0200, Paolo Bonzini wrote: > > > On 29/03/2017 10:00, Jason Wang wrote: > > > > > > 1) vtd was reset first > > > > 2) during the reset of virtio-net-pci #1, deletion of msix subregion > > will cause a commit of all memory listeners > > > > 3) virito-net-pci

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Cornelia Huck
On Wed, 29 Mar 2017 17:18:00 +0800 Jason Wang wrote: > On 2017年03月29日 16:45, Cornelia Huck wrote: > > On Wed, 29 Mar 2017 10:09:10 +0200 > > Paolo Bonzini wrote: > > > >> On 29/03/2017 10:00, Jason Wang wrote: > >>> > >>> 1) vtd was reset first > >>> > >>> 2) during the reset of virtio-net-pci #

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Jason Wang
On 2017年03月29日 17:11, Paolo Bonzini wrote: On 29/03/2017 11:09, Jason Wang wrote: This looks a good fix but may not solve this issue completely. Depends on the iova that guest uses, address_space_cache_init() may succeed even in this case since vtd does a passthrough translation in this case.

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Jason Wang
On 2017年03月29日 16:45, Cornelia Huck wrote: On Wed, 29 Mar 2017 10:09:10 +0200 Paolo Bonzini wrote: On 29/03/2017 10:00, Jason Wang wrote: 1) vtd was reset first 2) during the reset of virtio-net-pci #1, deletion of msix subregion will cause a commit of all memory listeners 3) virito-net-

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Paolo Bonzini
On 29/03/2017 11:09, Jason Wang wrote: >>> This looks a good fix but may not solve this issue completely. Depends >>> on the iova that guest uses, address_space_cache_init() may succeed even >>> in this case since vtd does a passthrough translation in this case. >> Can you explain this more?

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Jason Wang
On 2017年03月29日 16:41, Paolo Bonzini wrote: On 29/03/2017 10:37, Jason Wang wrote: diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 03592c5..73e69ac 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -176,6 +176,10 @@ err_used: address_space_cache_destroy(&new->desc);

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Cornelia Huck
On Wed, 29 Mar 2017 10:09:10 +0200 Paolo Bonzini wrote: > On 29/03/2017 10:00, Jason Wang wrote: > > > > > > 1) vtd was reset first > > > > 2) during the reset of virtio-net-pci #1, deletion of msix subregion > > will cause a commit of all memory listeners > > > > 3) virito-net-pci #2's regio

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Paolo Bonzini
On 29/03/2017 10:37, Jason Wang wrote: >> >> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c >> index 03592c5..73e69ac 100644 >> --- a/hw/virtio/virtio.c >> +++ b/hw/virtio/virtio.c >> @@ -176,6 +176,10 @@ err_used: >> address_space_cache_destroy(&new->desc); >> err_desc: >> g_

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Jason Wang
On 2017年03月29日 16:09, Paolo Bonzini wrote: On 29/03/2017 10:00, Jason Wang wrote: 1) vtd was reset first 2) during the reset of virtio-net-pci #1, deletion of msix subregion will cause a commit of all memory listeners 3) virito-net-pci #2's region cache will be update, but since vtd has al

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Peter Xu
On Wed, Mar 29, 2017 at 04:00:37PM +0800, Jason Wang wrote: > Hi: > > I meet an issue when doing reboot for a guest with two virtio-net-pci cards > when iommu is enabled. What happens is: > > > 1) vtd was reset first I'll add an extra question: Currently with Q35 and VT-d, our system qtree loo

Re: [Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Paolo Bonzini
On 29/03/2017 10:00, Jason Wang wrote: > > > 1) vtd was reset first > > 2) during the reset of virtio-net-pci #1, deletion of msix subregion > will cause a commit of all memory listeners > > 3) virito-net-pci #2's region cache will be update, but since vtd has > already been reset, it can't g

[Qemu-devel] issues of region cache and iommu reset

2017-03-29 Thread Jason Wang
Hi: I meet an issue when doing reboot for a guest with two virtio-net-pci cards when iommu is enabled. What happens is: 1) vtd was reset first 2) during the reset of virtio-net-pci #1, deletion of msix subregion will cause a commit of all memory listeners 3) virito-net-pci #2's region cac