[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOLK0pz6K90+QOMV2Vmhd3vC2t5+15vmUo0E=2rwax7cGDfxjw@mail.gmail.com>
Date: Thu, 10 Jan 2019 17:06:25 +0800
From: Tianyu Lan <lantianyu1986@...il.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: Lan Tianyu <Tianyu.Lan@...rosoft.com>, christoffer.dall@....com,
marc.zyngier@....com, linux@...linux.org.uk,
catalin.marinas@....com, will.deacon@....com, jhogan@...nel.org,
ralf@...ux-mips.org, paul.burton@...s.com, paulus@...abs.org,
benh@...nel.crashing.org, mpe@...erman.id.au,
Radim Krcmar <rkrcmar@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, bp@...en8.de,
"H. Peter Anvin" <hpa@...or.com>,
"the arch/x86 maintainers" <x86@...nel.org>,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
"linux-kernel@...r kernel org" <linux-kernel@...r.kernel.org>,
linux-mips@...r.kernel.org, kvm-ppc@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, kvm <kvm@...r.kernel.org>,
michael.h.kelley@...rosoft.com, kys@...rosoft.com,
vkuznets@...hat.com
Subject: Re: [PATCH 9/11] KVM/MMU: Flush tlb in the kvm_mmu_write_protect_pt_masked()
On Tue, Jan 8, 2019 at 12:26 AM Paolo Bonzini <pbonzini@...hat.com> wrote:
>
> On 04/01/19 09:54, lantianyu1986@...il.com wrote:
> > rmap_head = __gfn_to_rmap(slot->base_gfn + gfn_offset + __ffs(mask),
> > PT_PAGE_TABLE_LEVEL, slot);
> > - __rmap_write_protect(kvm, rmap_head, false);
> > + flush |= __rmap_write_protect(kvm, rmap_head, false);
> >
> > /* clear the first set bit */
> > mask &= mask - 1;
> > }
> > +
> > + if (flush && kvm_available_flush_tlb_with_range()) {
> > + kvm_flush_remote_tlbs_with_address(kvm,
> > + slot->base_gfn + gfn_offset,
> > + hweight_long(mask));
>
> Mask is zero here, so this probably won't work.
>
> In addition, I suspect calling the hypercall once for every 64 pages is
> not very efficient. Passing a flush list into
> kvm_mmu_write_protect_pt_masked, and flushing in
> kvm_arch_mmu_enable_log_dirty_pt_masked, isn't efficient either because
> kvm_arch_mmu_enable_log_dirty_pt_masked is also called once per word.
>
Yes, this is not efficient.
> I don't have any good ideas, except for moving the whole
> kvm_clear_dirty_log_protect loop into architecture-specific code (which
> is not the direction we want---architectures should share more code, not
> less).
kvm_vm_ioctl_clear_dirty_log/get_dirty_log() is to get/clear dirty log with
memslot as unit. We may just flush tlbs of the affected memslot instead of
entire page table's when range flush is available.
>
> Paolo
>
> > + flush = false;
> > + }
> > +
>
--
Best regards
Tianyu Lan
Powered by blists - more mailing lists