Re: [PATCH] KVM: x86/mmu: x86: Don't overflow lpage_info when checking attributes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2024-03-13 at 12:55 -0700, Sean Christopherson wrote:
> Nit, it's the head page, not the tail page.  Strictly speaking, it's
> probably both
> (or neither, if you're a half glass empty person), but the buggy code
> that is
> processing regions is specifically dealing with what it calls the
> head page.

Yes, the buggy logic happens only when it is a head and a tail page.
Even though the end part is the overflow. I'll update the verbiage.


[snip]
> > Also rename hugepage_has_attrs() to __slot_hugepage_has_attrs()
> > because it
> > is a delicate function that should not be widely used, and only is
> > valid
> > for ranges covered by the passed slot.
> 
> Eh, I vote to drop the rename.  It's (a) a local static, (b) guarded
> by
> CONFIG_KVM_GENERIC_MEMORY_ATTRIBUTES=y, (c) pretty obvious from the
> @slot
> param that it works on a single slot, (d) the double underscores
> suggests
> there is an outer wrapper with the same name, which there is not, and
> (e) the
> rename adds noise to a diff that's destined for stable@.

Ok, I'll drop that part.

As for non-stable bound cleanup I was also noticing:
1. lpage_info indices should be kvmallocs() as multiple page aligned
vmallocs are wasteful for small memslots, and even normal sized ones at
the 1GB level.
2. lpage_info doesn't need to keep track of unaligned heads and tails
because the unaligned part can never be huge. lpage_info_slot() can
skip checking the array based on the slot, GFN and page size which it
already has. Allocating kvm_lpage_info's for those and then carefully
making sure they are always disabled adds complexity (especially with
KVM_LPAGE_MIXED_FLAG in the mix) and uses extra memory. Whether it's a
tiny bit faster that a conditional in a helper, I don't know.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux