Skip to contentSkip to conversation

xen/sched: add fall back to idle vcpu when scheduling item

RFC PATCH Juergen Gross 1 participant 1 message May 17, 2019

lore
Share & tools
lore
#0 lore raw
Quoted 25 lines · Jan Beulich
Quoted 25 lines
Quoted 1 line
Quoted 1 line · On 17.05.19 at 09:48, <[email protected]> wrote:
Quoted 22 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 17.05.19 at 07:13, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 16.05.19 at 15:51, <[email protected]> wrote:

As with core scheduling we can be sure the other thread is active (otherwise we would schedule the idle item) and hoping for saving power by using mwait is moot.

Saving power may be indirect, by the CPU re-arranging resource assignment between threads when one goes idle. I have no idea whether they do this when entering C1, or only when entering deeper C states.

Quoted 5 lines

SDM Vol. 3 chapter 8.10.1 "HLT instruction":

"Here shared resources that were being used by the halted logical processor become available to active logical processors, allowing them to execute at greater efficiency."

To be honest, this is to broad/generic a statement to fully trust it, judging from other areas of the SDM. And then, as per above, what about the socket granularity case? Putting entirely idle cores to sleep is surely worthwhile?

Quoted 8 lines
Quoted 3 lines

Yes, I assume it is. OTOH this might affect context switches badly as the reaction time for the coordinated switch will rise. Maybe a good reason for another sub-option?

While I agree that fine grained control is useful, I'm seeing an increasing risk of there going to be too many controls to actually be certain in the end that all possible combinations work correctly.

Okay, I think I'll leave it as is for the moment and do some performance tests later. Depending on the results we can then decide how to proceed.

Quoted 27 lines
Quoted 23 lines
Quoted 12 lines
Quoted 6 lines
Quoted 3 lines

And anyway - I'm still none the wiser as to the v->is_urgent relationship.

With v->is_urgent set today's idle loop will drop into default_idle(). I can remove this sentence in case it is just confusing.

I'd prefer if the connection would become more obvious. One needs to go from ->is_urgent via ->urgent_count to sched_has_urgent_vcpu() to find where the described behavior really lives.

Quoted 10 lines

What's worse though: This won't work as intended on AMD at all. I don't think it's correct to fall back to default_idle() in this case. Instead sched_has_urgent_vcpu() returning true should amount to the same effect as max_cstate being set to 1. There's
(a) no reason not to use MWAIT on Intel CPUs in this case, if MWAIT can enter C1, and
(b) a strong need to use MWAIT on (at least) AMD Fam17, or else it won't be C1 that gets entered.
I'll see about making a patch in due course.

Quoted 3 lines

Thanks. Would you mind doing it in a way that the caller can specify max_cstate? This would remove the need to call sched_has_urgent_vcpu() deep down the idle handling and I could re-use it for my purpose.

Quoted 7 lines

Hmm, to be honest I'm not fancying giving a parameter to default_idle(), pm_idle(), and friends. Conceptually it is not the business of the callers to control the C states to be used.

What about the opposite: You simply mark idle (v)CPUs in question as "urgent", thus achieving the intended effect as well.

I can do that, of course. IMO letting the caller specify how he wants idle to behave is cleaner than burying such an implicit dependency deep down the code, but you are the maintainer of that part.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel