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

Re: [Xen-devel] [PATCH v5 07/19] xen/sched: add fall back to idle vcpu when scheduling unit



On Mon, 2019-09-30 at 07:21 +0200, Juergen Gross wrote:
> When scheduling an unit with multiple vcpus there is no guarantee all
> vcpus are available (e.g. above maxvcpus or vcpu offline). Fall back
> to
> idle vcpu of the current cpu in that case. This requires to store the
> correct schedule_unit pointer in the idle vcpu as long as it used as
> fallback vcpu.
> 
> In order to modify the runstates of the correct vcpus when switching
> schedule units merge sched_unit_runstate_change() into
> sched_switch_units() and loop over the affected physical cpus instead
> of the unit's vcpus. This in turn requires an access function to the
> current variable of other cpus.
> 
> Today context_saved() is called in case previous and next vcpus
> differ
> when doing a context switch. With an idle vcpu being capable to be a
> substitute for an offline vcpu this is problematic when switching to
> an idle scheduling unit. An idle previous vcpu leaves us in doubt
> which
> schedule unit was active previously, so save the previous unit
> pointer
> in the per-schedule resource area. If it is NULL the unit has not
> changed and we don't have to set the previous unit to be not running.
> 
> When running an idle vcpu in a non-idle scheduling unit use a
> specific
> guest idle loop not performing any non-softirq tasklets and
> livepatching in order to avoid populating the cpu caches with memory
> used by other domains (as far as possible). Softirqs are considered
> to
> be save.
> 
> In order to avoid livepatching when going to guest idle another
> variant of reset_stack_and_jump() not calling
> check_for_livepatch_work
> is needed.
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> Acked-by: Julien Grall <julien.grall@xxxxxxx>
> Reviewed-by: Dario Faggioli <dfaggioli@xxxxxxxx>
> ---
> RFC V2:
> - new patch (Andrew Cooper)
> 
> V1:
> - use urgent_count to select correct idle routine (Jan Beulich)
> 
> V2:
> - set vcpu->is_running in context_saved()
> - introduce reset_stack_and_jump_nolp() (Jan Beulich)
> - readd scrubbing (Jan Beulich, Andrew Cooper)
> - get_cpu_current() _NOT_ moved to include/asm-x86/current.h as the
>   needed reference of stack_base[] results in a #include hell
> 
> V3:
> - split context_saved() into unit_context_saved() and
> vcpu_context_saved()
> 
> V4:
> - rename sd -> sr (Jan Beulich)
> - use unsigned int for cpu (Jan Beulich)
> - add comment in sched_context_switch() (Jan Beulich)
> - add comment before definition of get_cpu_current() (Jan Beulich)
> 
> V5:
> - add comment (Dario Faggioli)
>
Saw it, and it's great.

Thanks for doing this!

Regards
-- 
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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