All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Jan Beulich" <JBeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
	"Dario Faggioli" <dfaggioli@suse.com>
Subject: Re: [PATCH RFC] xen/sched: Optimise when only one scheduler is compiled in
Date: Thu, 3 Mar 2022 11:14:51 +0100	[thread overview]
Message-ID: <78e6dc12-9406-743c-1fe2-4214483f08fb@suse.com> (raw)
In-Reply-To: <4270d03c-50a9-b1aa-dc2e-53e998153a6b@suse.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1634 bytes --]

On 03.03.22 09:33, Juergen Gross wrote:
> 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.
>>
>> Suggestions very welcome.
> 
> Did you consider to generate the needed code dynamically instead?
> 
> I guess this could even be extended to avoid function pointers
> completely using the same technique as in my hypercall series.
> 
> In order to avoid the need for a central table the per-scheduler
> hooks could use standard names (as most of them do already).
> 
> I think I could come up with a patch in a few hours if you like
> that approach.

BTW, in theory this approach could be generalized for other function
vectors in the hypervisor, too (maybe even all?).


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3151 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

  parent reply	other threads:[~2022-03-03 10:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03  0:40 [PATCH RFC] xen/sched: Optimise when only one scheduler is compiled in Andrew Cooper
2022-03-03  8:24 ` Jan Beulich
2022-03-03  8:33 ` Juergen Gross
2022-03-03 10:06   ` Juergen Gross
2022-03-03 10:14   ` Juergen Gross [this message]
2022-03-04  5:21 ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=78e6dc12-9406-743c-1fe2-4214483f08fb@suse.com \
    --to=jgross@suse.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dfaggioli@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.