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

Re: [PATCH RFC] xen/sched: Optimise when only one scheduler is compiled in



On 03.03.22 01:40, Andrew Cooper wrote:
When only one scheduler is compiled in, function pointers can be optimised to
direct calls, and the hooks hardened against controlflow hijacking.

RFC for several reasons.

1) There's an almost beautiful way of not introducing MAYBE_SCHED() and hiding
    the magic in REGISTER_SCHEDULER(), except it falls over
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91765 which has no comment or
    resolution at all.

2) A different alternative which almost works is to remove the indirection in
    .data.schedulers, but the singleton scheduler object can't be both there
    and in .init.rodata.cf_clobber.

3) I can't think of a way of build time check to enforce that new schedulers
    get added to the preprocessor magic.

And the blocker:
4) This isn't compatible with how sched_idle_ops get used for granularity > 1.

Correct. Either you have core scheduling or you can optimize the
indirect calls to direct ones.

Suggestions very welcome.

Dynamic code generation for replacing the function vector with scheduler
id based if/switch statements.

Something like the attached patch for generating the code (won't build
right now as the related scheduler code adaptions are missing, but the
header is created).

The code generation script could share quite some code with my hypercall
series, and expansion for other function vectors should be rather easy.


Juergen

Attachment: 0001-xen-sched-generate-code-for-calling-scheduler-callba.patch
Description: Text Data

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.