Re: [PATCH v3 12/21] KVM: X86: Implement ring-based dirty memory tracking

From: Michael S. Tsirkin
Date: Wed Jan 15 2020 - 01:50:24 EST


On Tue, Jan 14, 2020 at 03:01:34PM -0500, Peter Xu wrote:
> On Thu, Jan 09, 2020 at 02:35:46PM -0500, Michael S. Tsirkin wrote:
> > ``void flush_dcache_page(struct page *page)``
> >
> > Any time the kernel writes to a page cache page, _OR_
> > the kernel is about to read from a page cache page and
> > user space shared/writable mappings of this page potentially
> > exist, this routine is called.
> >
> >
> > > Also, I believe this is the similar question that Jason has asked in
> > > V2. Sorry I should mention this earlier, but I didn't address that in
> > > this series because if we need to do so we probably need to do it
> > > kvm-wise, rather than only in this series.
> >
> > You need to document these things.
> >
> > > I feel like it's missing
> > > probably only because all existing KVM supported archs do not have
> > > virtual-tagged caches as you mentioned.
> >
> > But is that a fact? ARM has such a variety of CPUs,
> > I can't really tell. Did you research this to make sure?
> >
> > > If so, I would prefer if you
> > > can allow me to ignore that issue until KVM starts to support such an
> > > arch.
> >
> > Document limitations pls. Don't ignore them.
>
> Hi, Michael,
>
> I failed to find a good place to document about flush_dcache_page()
> for KVM. Could you give me a suggestion?

Maybe where the field is introduced. I posted the suggestions to the
relevant patch.

> And I don't know about whether there's any ARM hosts that requires
> flush_dcache_page(). I think not, because again I didn't see any
> caller of flush_dcache_page() in KVM code yet. Otherwise I think we
> should at least call it before the kernel reading kvm_run or after
> publishing data to kvm_run.

But is kvm run ever accessed while VCPU is running on another CPU?
I always assumed no but maybe I'm missing something?

> However I'm also CCing Drew for this.
>
> Thanks,
>
> --
> Peter Xu