Re: [PATCH PROTOTYPE 3/6] vfio: Implement support for sparse RAM memory regions

2020-11-18 Thread David Hildenbrand
So it's about the malicious guests. I agree with you that we can try to limit above from happening, e.g. by teaching vfio_get_xlat_addr() to fail when it's going to map some unplugged range of virtio-mem device. Exactly. Or... imho, we may not even need to worry too much on those misuses of

Re: [PATCH PROTOTYPE 3/6] vfio: Implement support for sparse RAM memory regions

2020-11-18 Thread Peter Xu
On Wed, Nov 18, 2020 at 06:37:42PM +0100, David Hildenbrand wrote: > > > a) Unplugging plugged virtio-mem blocks while they are mapped via an > > > IOMMU > > > > > > 1. Guest: map memory location X located on a virtio-mem device inside a > > > plugged block into the IOMMU > > > -> QEMU

Re: [PATCH PROTOTYPE 3/6] vfio: Implement support for sparse RAM memory regions

2020-11-18 Thread David Hildenbrand
virtio-mem + vfio + iommu seems to work. More testing to be done. However, malicious guests can play nasty tricks like a) Unplugging plugged virtio-mem blocks while they are mapped via an IOMMU 1. Guest: map memory location X located on a virtio-mem device inside a plugged block into th

Re: [PATCH PROTOTYPE 3/6] vfio: Implement support for sparse RAM memory regions

2020-11-18 Thread Peter Xu
On Wed, Nov 18, 2020 at 05:14:22PM +0100, David Hildenbrand wrote: > That did the trick! Thanks!!! Great! At the meantime, I've a few questions majorly about memory unplugging below, which could be naive - I know little on that, please bare with me.. :) > > virtio-mem + vfio + iommu seems to wo

Re: [PATCH PROTOTYPE 3/6] vfio: Implement support for sparse RAM memory regions

2020-11-18 Thread David Hildenbrand
On 18.11.20 16:23, Peter Xu wrote: David, On Wed, Nov 18, 2020 at 02:04:00PM +0100, David Hildenbrand wrote: On 20.10.20 22:44, Peter Xu wrote: On Tue, Oct 20, 2020 at 10:01:12PM +0200, David Hildenbrand wrote: Thanks ... but I have an AMD system. Will try to find out how to get that running

Re: [PATCH PROTOTYPE 3/6] vfio: Implement support for sparse RAM memory regions

2020-11-18 Thread Peter Xu
David, On Wed, Nov 18, 2020 at 02:04:00PM +0100, David Hildenbrand wrote: > On 20.10.20 22:44, Peter Xu wrote: > > On Tue, Oct 20, 2020 at 10:01:12PM +0200, David Hildenbrand wrote: > >> Thanks ... but I have an AMD system. Will try to find out how to get > >> that running with AMD :) > > > > May

Re: [PATCH PROTOTYPE 3/6] vfio: Implement support for sparse RAM memory regions

2020-11-18 Thread David Hildenbrand
On 20.10.20 22:44, Peter Xu wrote: > On Tue, Oct 20, 2020 at 10:01:12PM +0200, David Hildenbrand wrote: >> Thanks ... but I have an AMD system. Will try to find out how to get >> that running with AMD :) > > May still start with trying intel-iommu first. :) I think it should work for > amd hosts t

Re: [PATCH PROTOTYPE 3/6] vfio: Implement support for sparse RAM memory regions

2020-11-12 Thread David Hildenbrand
On 20.10.20 22:44, Peter Xu wrote: > On Tue, Oct 20, 2020 at 10:01:12PM +0200, David Hildenbrand wrote: >> Thanks ... but I have an AMD system. Will try to find out how to get >> that running with AMD :) I just did some more testing with the oldish GPU I have for that purpose. Seems to work, at le

Re: [PATCH PROTOTYPE 3/6] vfio: Implement support for sparse RAM memory regions

2020-10-20 Thread Peter Xu
On Tue, Oct 20, 2020 at 10:01:12PM +0200, David Hildenbrand wrote: > Thanks ... but I have an AMD system. Will try to find out how to get > that running with AMD :) May still start with trying intel-iommu first. :) I think it should work for amd hosts too. Just another FYI - Wei is working on amd

Re: [PATCH PROTOTYPE 3/6] vfio: Implement support for sparse RAM memory regions

2020-10-20 Thread David Hildenbrand
On 20.10.20 21:44, Peter Xu wrote: > On Thu, Sep 24, 2020 at 06:04:20PM +0200, David Hildenbrand wrote: >> Implement support for sparse RAM, to be used by virtio-mem. Handling >> is somewhat-similar to memory_region_is_iommu() handling, which also >> notifies on changes. >> >> Instead of mapping th

Re: [PATCH PROTOTYPE 3/6] vfio: Implement support for sparse RAM memory regions

2020-10-20 Thread Peter Xu
On Thu, Sep 24, 2020 at 06:04:20PM +0200, David Hildenbrand wrote: > Implement support for sparse RAM, to be used by virtio-mem. Handling > is somewhat-similar to memory_region_is_iommu() handling, which also > notifies on changes. > > Instead of mapping the whole region, we only map selected piec

[PATCH PROTOTYPE 3/6] vfio: Implement support for sparse RAM memory regions

2020-09-24 Thread David Hildenbrand
Implement support for sparse RAM, to be used by virtio-mem. Handling is somewhat-similar to memory_region_is_iommu() handling, which also notifies on changes. Instead of mapping the whole region, we only map selected pieces (and unmap previously selected pieces) when notified by the SparseRAMHandl