On 24/02/2022 11:25, Jan Beulich wrote:
> On 13.01.2022 14:17, Jan Beulich wrote:
>> Except in the "clocksource=tsc" case we can replace the indirect calls
>> involved in accessing the platform timers by direct ones, as they get
>> established once and never changed. To also cover the "tsc" case, invoke
>> what read_tsc() resolves to directly. In turn read_tsc() then becomes
>> unreachable and hence can move to .init.*.
>>
>> Signed-off-by: Jan Beulich <[email protected]>
> As this actually amends the IBT work, I would have hoped for it to be
> viewed as useful.
Sorry - it fell through the cracks. Definitely useful.
> Of course if accepted in general, it would now want
> to have __initconst_cf_clobber annotation addition included. Albeit
> there's a slight complication: Some of the structures are written to,
> so those couldn't really be "const".
The .init.cf_clobber section needs to container a pointer to every
target function. For the current ops structures, we just put the whole
ops structure in.
For individual functions, the best plan I could come up with was a macro
which emits:
.pushsection .init.cf_clobber, a, @progbits
.quad fn
.popsection
wrapped up in #define cf_clobber(fn), so the end code result ought to
look like:
static void foo(param *bar)
{
...
}
cf_clobber(foo);
similar to command line parameters.
That said, in this case, can't we cf_clobber each platform_timesource ?
It would require altcall()ing the resume hook too. (the init hook won't
matter either way.)
~Andrew