Re: Question on dirty sync before kvm memslot removal

2020-04-02 Thread Peter Xu
On Thu, Apr 02, 2020 at 04:47:58PM -0400, Peter Xu wrote: > On Wed, Apr 01, 2020 at 07:09:28PM -0400, Peter Xu wrote: > > On Wed, Apr 01, 2020 at 01:12:04AM +0200, Paolo Bonzini wrote: > > > On 31/03/20 18:51, Peter Xu wrote: > > > > On Tue, Mar 31, 2020 at 05:34:43PM +0200, Paolo Bonzini wrote: >

Re: Question on dirty sync before kvm memslot removal

2020-04-02 Thread Peter Xu
On Wed, Apr 01, 2020 at 07:09:28PM -0400, Peter Xu wrote: > On Wed, Apr 01, 2020 at 01:12:04AM +0200, Paolo Bonzini wrote: > > On 31/03/20 18:51, Peter Xu wrote: > > > On Tue, Mar 31, 2020 at 05:34:43PM +0200, Paolo Bonzini wrote: > > >> On 31/03/20 17:23, Peter Xu wrote: > > Or

Re: Question on dirty sync before kvm memslot removal

2020-04-01 Thread Peter Xu
On Wed, Apr 01, 2020 at 01:12:04AM +0200, Paolo Bonzini wrote: > On 31/03/20 18:51, Peter Xu wrote: > > On Tue, Mar 31, 2020 at 05:34:43PM +0200, Paolo Bonzini wrote: > >> On 31/03/20 17:23, Peter Xu wrote: > Or KVM_MEM_READONLY. > >>> Yeah, I used a new flag because I thought READONLY was a

Re: Question on dirty sync before kvm memslot removal

2020-03-31 Thread Paolo Bonzini
On 31/03/20 18:51, Peter Xu wrote: > On Tue, Mar 31, 2020 at 05:34:43PM +0200, Paolo Bonzini wrote: >> On 31/03/20 17:23, Peter Xu wrote: Or KVM_MEM_READONLY. >>> Yeah, I used a new flag because I thought READONLY was a bit tricky to >>> be used directly here. The thing is IIUC if guest

Re: Question on dirty sync before kvm memslot removal

2020-03-31 Thread Peter Xu
On Tue, Mar 31, 2020 at 05:34:43PM +0200, Paolo Bonzini wrote: > On 31/03/20 17:23, Peter Xu wrote: > >> Or KVM_MEM_READONLY. > > Yeah, I used a new flag because I thought READONLY was a bit tricky to > > be used directly here. The thing is IIUC if guest writes to a > > READONLY slot then KVM

Re: Question on dirty sync before kvm memslot removal

2020-03-31 Thread Paolo Bonzini
On 31/03/20 17:23, Peter Xu wrote: >> Or KVM_MEM_READONLY. > Yeah, I used a new flag because I thought READONLY was a bit tricky to > be used directly here. The thing is IIUC if guest writes to a > READONLY slot then KVM should either ignore the write or trigger an > error which I didn't check,

Re: Question on dirty sync before kvm memslot removal

2020-03-31 Thread Peter Xu
On Mon, Mar 30, 2020 at 03:11:53PM +0200, Paolo Bonzini wrote: > On 27/03/20 16:04, Peter Xu wrote: > > That makes perfect sense to me, however... What if the vcpu generates > > dirty bits _after_ we do KVM_GET_DIRTY_LOG but _before_ we send > > KVM_SET_USER_MEMORY_REGION to remove the memslot?

Re: Question on dirty sync before kvm memslot removal

2020-03-30 Thread Paolo Bonzini
On 27/03/20 16:04, Peter Xu wrote: > That makes perfect sense to me, however... What if the vcpu generates > dirty bits _after_ we do KVM_GET_DIRTY_LOG but _before_ we send > KVM_SET_USER_MEMORY_REGION to remove the memslot? If the vcpu is in > the userspace I think it's fine because BQL is

Question on dirty sync before kvm memslot removal

2020-03-27 Thread Peter Xu
Hi, Paolo & all, I noticed something tricky in dirty logging when we want to remove a kvm memslot: kvm_set_phys_mem() will sync dirty log before the slot is removed to make sure dirty bits won't get lost. IIUC that's majorly for system resets, because that's where the path should trigger very