Re: [PATCH 1/6] KVM: x86: Move check_processor_compatibility from init ops to runtime ops

From: Sean Christopherson
Date: Wed Jan 12 2022 - 12:59:56 EST


On Tue, Jan 11, 2022, Chao Gao wrote:
> On Mon, Jan 10, 2022 at 11:27:09PM +0000, Sean Christopherson wrote:
> >On Mon, Dec 27, 2021, Chao Gao wrote:
> >> so that KVM can do compatibility checks on hotplugged CPUs. Drop __init
> >> from check_processor_compatibility() and its callees.
> >
> >Losing the __init annotation on all these helpers makes me a bit sad, more from a
> >documentation perspective than a "but we could shave a few bytes" perspective.
>
> This makes sense.
>
> >More than once I've wondered why some bit of code isn't __init, only to realize
> >its used for hotplug.
>
> Same problem to some global data structures which can be __initdata if hotplug
> isn't supported.
>
> >
> >What if we added an __init_or_hotplug annotation that is a nop if HOTPLUG_CPU=y?
>
> Personally __init_or_hotplug is a little long as an annotation. How about
> __hotplug?
>
> One concern is: is it acceptable to introduce a new annotation and use it in
> new code but not fix all places that should use it in existing code.
>
> I think the right process is
> 1. introduce a new annotation
> 2. fix existing code to use this annotation
> 3. add new code.
>
> There is no doubt that #2 would take great effort. I'm not sure if it is really
> worth it.
>
> >At a glance, KVM could use that if the guts of kvm_online_cpu() were #idef'd out
> >on !CONFIG_HOTPLUG_CPU. That also give us a bit of test coverage for bots that
> >build with SMP=n.
>
> Will do with your suggested-by.

I don't think you should try to add a new annotation in this series. My question
really was just that, a question to others if there would be value in adding an
annotation to identify symbols that are !__init only because of hotplug. Such new
functionality is certainly not required for fixing KVM's mishandling of hotplug,
and trying to cram it in here will bloat and slow down this series.