On 02.02.2024 13:13, Andrew Cooper wrote:
> On 23/01/2024 11:00 am, Jan Beulich wrote:
>> While not performance critical, these hook invocations still want
>> converting: This way all pre-filled struct cpu_dev instances can become
>> __initconst_cf_clobber, thus allowing to eliminate further 8 ENDBR
>> during the 2nd phase of alternatives patching (besides moving previously
>> resident data to .init.*).
>>
>> Since all use sites need touching anyway, take the opportunity and also
>> address a Misra C:2012 Rule 5.5 violation: Rename the this_cpu static
>> variable.
>>
>> Signed-off-by: Jan Beulich <jbeul...@suse.com>
> 
> Acked-by: Andrew Cooper <andrew.coop...@citrix.com>

Thanks.

>> ---
>> With LTO it might end up necessary to tag as __used more than just
>> "default_cpu".
> 
> Why is it even needed here?
> 
> LTO can't rid early_cpu_init() of the default clause, so can't make
> default_cpu unreferenced, I don't think.

Even without LTO I've actually seen gcc eliminate default_cpu. The
use in early_cpu_init() simply was expanded to assignments, rather
then something memcpy()-like.

>> Perhaps __used would better be integrated into __initconst_cf_clobber,
>> to be independent of the compiler potentially eliding structure
>> instances.
> 
> Maybe.  I guess the issue here is that the tools really can't see the
> connection between being in the clobber section, and alternatives going
> and making a modification.

The const-ness is the issue, I expect. From that the compiler can
infer that it may transform use of the variable into something which
in the end doesn't require the variable anymore. And it can't know
that we use all contributions to that section for a second purpose.

Jan

Reply via email to