Re: [PATCH v5 04/13] KVM: Introduce a new guest mapping API

2019-01-30 Thread Paolo Bonzini
On 23/01/19 18:50, Konrad Rzeszutek Wilk wrote: >> +if (dirty) >> +kvm_release_pfn_dirty(map->pfn); >> +else >> +kvm_release_pfn_clean(map->pfn); >> +map->hva = NULL; > I keep on having this gnawing feeling that we MUST set map->page to > NULL. > > That is I

Re: [PATCH v5 04/13] KVM: Introduce a new guest mapping API

2019-01-25 Thread Raslan, KarimAllah
On Wed, 2019-01-23 at 12:50 -0500, Konrad Rzeszutek Wilk wrote: > > > > + if (dirty) > > + kvm_release_pfn_dirty(map->pfn); > > + else > > + kvm_release_pfn_clean(map->pfn); > > + map->hva = NULL; > > I keep on having this gnawing feeling that we MUST set map->page to >

Re: [PATCH v5 04/13] KVM: Introduce a new guest mapping API

2019-01-25 Thread Raslan, KarimAllah
On Thu, 2019-01-10 at 14:07 +0100, David Hildenbrand wrote: > On 09.01.19 10:42, KarimAllah Ahmed wrote: > > > > In KVM, specially for nested guests, there is a dominant pattern of: > > > > => map guest memory -> do_something -> unmap guest memory > > > > In addition to all this

Re: [PATCH v5 04/13] KVM: Introduce a new guest mapping API

2019-01-23 Thread Konrad Rzeszutek Wilk
> + if (dirty) > + kvm_release_pfn_dirty(map->pfn); > + else > + kvm_release_pfn_clean(map->pfn); > + map->hva = NULL; I keep on having this gnawing feeling that we MUST set map->page to NULL. That is I can see how it is not needed if you are using 'map' and

Re: [PATCH v5 04/13] KVM: Introduce a new guest mapping API

2019-01-23 Thread Konrad Rzeszutek Wilk
On Wed, Jan 09, 2019 at 10:42:04AM +0100, KarimAllah Ahmed wrote: > In KVM, specially for nested guests, there is a dominant pattern of: > > => map guest memory -> do_something -> unmap guest memory > > In addition to all this unnecessarily noise in the code due to boiler plate > code,

Re: [PATCH v5 04/13] KVM: Introduce a new guest mapping API

2019-01-10 Thread David Hildenbrand
On 09.01.19 10:42, KarimAllah Ahmed wrote: > In KVM, specially for nested guests, there is a dominant pattern of: > > => map guest memory -> do_something -> unmap guest memory > > In addition to all this unnecessarily noise in the code due to boiler plate > code, most of the time the

[PATCH v5 04/13] KVM: Introduce a new guest mapping API

2019-01-09 Thread KarimAllah Ahmed
In KVM, specially for nested guests, there is a dominant pattern of: => map guest memory -> do_something -> unmap guest memory In addition to all this unnecessarily noise in the code due to boiler plate code, most of the time the mapping function does not properly handle memory that is