Re: [PATCH] KVM: vmx: speed up MSR bitmap merge

From: Paolo Bonzini
Date: Mon Dec 18 2017 - 11:03:08 EST



> > - memset(msr_bitmap_l0, 0xff, PAGE_SIZE);
> > + msr_bitmap_l1 = (unsigned long *)kmap(page);
>
> Wouldn't it be easier to simply set everything to 0xff as before and
> then only handle the one special case where you don't do that? e.g. the
> complete else part would be gone.

It can change from one vmentry to the next, so I'm not sure how you'd
do that.

> > + nested_vmx_disable_intercept_for_msr(
> > + msr_bitmap_l1, msr_bitmap_l0,
> > + APIC_BASE_MSR + (APIC_TASKPRI >> 4),
> > + MSR_TYPE_W);
>
> I'd vote for indenting the parameters properly (even though we exceed 80
> chars by 1 then :) )

Ok, will do. Regarding the WARN, I'm undecided. I like the idea of not
calling a function that works on MSR bitmaps unless you have one...

Paolo