[PATCH] KVM: ppc64: Enable ring-based dirty memory tracking

Kautuk Consul kconsul at linux.vnet.ibm.com
Mon Jul 17 15:09:14 AEST 2023

Hi Jordan,

On 2023-07-06 14:15:13, Jordan Niethe wrote:
> On 8/6/23 10:34 pm, Kautuk Consul wrote:
> Need at least a little context in the commit message itself:
> "Enable ring-based dirty memory tracking on ppc64:"
Sure will take this in the v2 patch.
> > - Enable CONFIG_HAVE_KVM_DIRTY_RING_ACQ_REL as ppc64 is weakly
> >    ordered.
> >    kvmppc_xive_native_set_attr is called in the context of an ioctl
> >    syscall and will call kvmppc_xive_native_eq_sync for setting the
> >    KVM_DEV_XIVE_EQ_SYNC attribute which will call mark_dirty_page()
> >    when there isn't a running vcpu. Implemented the
> >    kvm_arch_allow_write_without_running_vcpu to always return true
> >    to allow mark_page_dirty_in_slot to mark the page dirty in the
> >    memslot->dirty_bitmap in this case.
> Should kvm_arch_allow_write_without_running_vcpu() only return true in the
> context of kvmppc_xive_native_eq_sync()?
Not required. Reason is: kvm_arch_allow_write_without_running_vcpu() is
anyway used only for avoiding the WARN_ON_ONCE in
mark_page_dirty_in_slot(). The memslot->dirty_bitmap in mark_page_dirty_in_slot()
will be anyway used only when the KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP is
set and the vcpu returned by kvm_get_running_vcpu() is NULL which is
what happens only when kvmppc_xive_native_eq_sync is called via the
ioctl syscall I mentioned.

> > +		*ptep = __pte(pte_val(*ptep) & ~(_PAGE_WRITE));
> On rpt I think you'd need to use kvmppc_radix_update_pte()?
Sure. I'll add a check for radix_enabled() and call
kvmppc_radix_update_pte() or a similar function in the v2 patch for this.

More information about the Linuxppc-dev mailing list