Re: [Xen-devel] [PATCH v2 22/48] xen/sched: switch schedule() from vcpus to sched_units

2019-09-12 Thread Juergen Gross
On 09.09.19 16:35, Jan Beulich wrote: On 09.08.2019 16:58, Juergen Gross wrote: --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -248,6 +248,20 @@ static inline void vcpu_runstate_change( v->runstate.state = new_state; } +static inline void sched_unit_runstate_change(str

Re: [Xen-devel] [PATCH v2 24/48] xen: switch from for_each_vcpu() to for_each_sched_unit()

2019-09-12 Thread Juergen Gross
On 09.09.19 17:14, Jan Beulich wrote: On 09.08.2019 16:58, Juergen Gross wrote: @@ -504,22 +511,21 @@ int sched_move_domain(struct domain *d, struct cpupool *c) if ( IS_ERR(domdata) ) return PTR_ERR(domdata); -vcpu_priv = xzalloc_array(void *, d->max_vcpus); -

Re: [Xen-devel] [PATCH] public/xen.h: update the comment explaining 'Wallclock time'

2019-09-12 Thread Juergen Gross
On 12.09.19 16:05, Paul Durrant wrote: Since commit 0629adfd80e "Actually set a HVM domain's time offset when it sets the RTC", the comment in the public header has been misleading, since it claims that wallclock time is only updated by control software. Moreover, the comments stating that wc_sec

Re: [Xen-devel] [PATCH v2 24/48] xen: switch from for_each_vcpu() to for_each_sched_unit()

2019-09-12 Thread Juergen Gross
On 12.09.19 16:40, Jan Beulich wrote: On 12.09.2019 16:02, Juergen Gross wrote: On 09.09.19 17:14, Jan Beulich wrote: On 09.08.2019 16:58, Juergen Gross wrote: @@ -1002,17 +1032,17 @@ int cpu_disable_scheduler(unsigned int cpu) * * the scheduler will always find a suitable

[Xen-devel] [PATCH] xen: fix arm build with debugtrace configured

2019-09-12 Thread Juergen Gross
Add missing #includes. Signed-off-by: Juergen Gross --- xen/common/debugtrace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/common/debugtrace.c b/xen/common/debugtrace.c index 5d22d431ad..7313e89389 100644 --- a/xen/common/debugtrace.c +++ b/xen/common/debugtrace.c @@ -11,7 +11,9

Re: [Xen-devel] [PATCH v2 26/48] xen/sched: rework and rename vcpu_force_reschedule()

2019-09-13 Thread Juergen Gross
On 10.09.19 16:06, Jan Beulich wrote: On 09.08.2019 16:58, Juergen Gross wrote: vcpu_force_reschedule() is only used for modifying the periodic timer of a vcpu. I don't think this is true prior to this patch, or else ... @@ -419,8 +419,6 @@ int pv_shim_shutdown(uint8_t r

Re: [Xen-devel] [PATCH v5 5/5] xen: add function name to lock profiling data

2019-09-13 Thread Juergen Gross
On 13.09.19 11:53, Jan Beulich wrote: On 12.09.2019 15:28, Juergen Gross wrote: --- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -348,6 +348,7 @@ static s_time_t lock_profile_start; static struct lock_profile_anc *lock_profile_ancs; static struct lock_profile_qhead

[Xen-devel] [PATCH] xen/sched: rework and rename vcpu_force_reschedule()

2019-09-13 Thread Juergen Gross
concurrent timer activation via a per-vcpu lock it is even no longer required to bother the target vcpu at all for updating its timer. Rename the function to vcpu_set_periodic_timer() as this now reflects the functionality. Signed-off-by: Juergen Gross --- - Carved out from my core scheduling series

Re: [Xen-devel] [PATCH v2 27/48] xen/sched: Change vcpu_migrate_*() to operate on schedule unit

2019-09-13 Thread Juergen Gross
On 10.09.19 17:11, Jan Beulich wrote: On 09.08.2019 16:58, Juergen Gross wrote: --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -733,35 +733,40 @@ void vcpu_unblock(struct vcpu *v) } /* - * Do the actual movement of a vcpu from old to new CPU. Locks for *both* + * Do the

Re: [Xen-devel] [PATCH v2 28/48] xen/sched: move struct task_slice into struct sched_unit

2019-09-13 Thread Juergen Gross
On 10.09.19 17:18, Jan Beulich wrote: On 09.08.2019 16:58, Juergen Gross wrote: In order to prepare for multiple vcpus per schedule unit move struct task_slice in schedule() from the local stack into struct sched_unit of the currently running unit. The change looks mechanical enough to be

Re: [Xen-devel] [PATCH v2 29/48] xen/sched: add code to sync scheduling of all vcpus of a sched unit

2019-09-13 Thread Juergen Gross
On 10.09.19 17:36, Jan Beulich wrote: On 09.08.2019 16:58, Juergen Gross wrote: +static bool sched_tasklet_check(unsigned int cpu) +{ +bool tasklet_work_scheduled = false; +const cpumask_t *mask = get_sched_res(cpu)->cpus; +int cpu_iter; unsigned int ? Yes. +static v

Re: [Xen-devel] [PATCH v2 30/48] xen/sched: introduce unit_runnable_state()

2019-09-13 Thread Juergen Gross
On 11.09.19 12:30, Jan Beulich wrote: On 09.08.2019 16:58, Juergen Gross wrote: --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -266,7 +266,7 @@ static inline void sched_unit_runstate_change(struct sched_unit *unit, struct vcpu *v = unit->vcpu_list; if ( runn

Re: [Xen-devel] [PATCH v2 30/48] xen/sched: introduce unit_runnable_state()

2019-09-13 Thread Juergen Gross
On 12.09.19 12:24, Dario Faggioli wrote: On Fri, 2019-08-09 at 16:58 +0200, Juergen Gross wrote: Today the vcpu runstate of a new scheduled vcpu is always set to "running" even if at that time vcpu_runnable() is already returning false due to a race (e.g. with pausing the vcpu).

Re: [Xen-devel] [PATCH] xen/sched: rework and rename vcpu_force_reschedule()

2019-09-13 Thread Juergen Gross
On 13.09.19 16:42, Jan Beulich wrote: On 13.09.2019 14:14, Juergen Gross wrote: --- - Carved out from my core scheduling series - Reworked to avoid deadlock when 2 vcpus are trying to modify each others periodic timers, leading to address all comments by Jan Beulich. Oh, indeed - a

Re: [Xen-devel] [PATCH v2 31/48] xen/sched: add support for multiple vcpus per sched unit where missing

2019-09-13 Thread Juergen Gross
On 11.09.19 12:43, Jan Beulich wrote: On 09.08.2019 16:58, Juergen Gross wrote: V1: - add special handling for idle unit in unit_runnable() and unit_runnable_state() Why was this done? Isn't vcpu_runnable() going to always return true for idle vCPU-s? The problem i

Re: [Xen-devel] [PATCH v2 30/48] xen/sched: introduce unit_runnable_state()

2019-09-13 Thread Juergen Gross
On 13.09.19 16:44, Jan Beulich wrote: On 13.09.2019 16:07, Juergen Gross wrote: On 11.09.19 12:30, Jan Beulich wrote: On 09.08.2019 16:58, Juergen Gross wrote: --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -174,6 +174,7 @@ struct vcpu XEN_GUEST_HANDLE

Re: [Xen-devel] [PATCH v3 2/4] xen/sched: remove cpu from pool0 before removing it

2019-09-13 Thread Juergen Gross
On 13.09.19 19:27, Dario Faggioli wrote: On Mon, 2019-09-09 at 11:33 +0200, Juergen Gross wrote: Today a cpu which is removed from the system is taken directly from Pool0 to the offline state. This will conflict with the new idle scheduler, so remove it from Pool0 first. Additionally accept

[Xen-devel] [PATCH v4 3/4] xen/sched: add minimalistic idle scheduler for free cpus

2019-09-13 Thread Juergen Gross
don't register it as an official scheduler, but just include it in schedule.c. Signed-off-by: Juergen Gross Acked-by: Dario Faggioli --- V3: - use ZERO_BLOCK_PTR instead of (void *)1 (Jan Beulich, Andrew Cooper) --- xen/common/sched_credit.c | 9 --- xen/common/sched_null.c | 7 --- x

[Xen-devel] [PATCH v4 0/4] xen/sched: use new idle scheduler for free cpus

2019-09-13 Thread Juergen Gross
longer happen, as parking the not to be started threads is done before. Changes in V4: - fix a bug when unassigning a cpu not in a cpupool (patch 2) Changes in V3: - use ZERO_BLOCK_PTR (Patch 3) - add patch 4 Changes in V2: - commit messages updated - renamed functions (Patch 2) Juergen Gross (4

[Xen-devel] [PATCH v4 4/4] xen/sched: switch to debugtrace in cpupool handling

2019-09-13 Thread Juergen Gross
Instead of having a cpupool_dprintk() define just use debugtrace. Signed-off-by: Juergen Gross Acked-by: Dario Faggioli --- xen/common/cpupool.c | 48 +++- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/xen/common/cpupool.c b/xen

[Xen-devel] [PATCH v4 2/4] xen/sched: remove cpu from pool0 before removing it

2019-09-13 Thread Juergen Gross
so we need to switch from spinlock_irq to spinlock_irqsave. Signed-off-by: Juergen Gross --- V2: rename cpupool_unassign_cpu_[epi|pro]logue() (Dario Faggioli) V4: fix bug when unassigning cpu not in pool --- xen/common/cpupool.c | 182 +++-- xen/common

[Xen-devel] [PATCH v4 1/4] xen/sched: populate cpupool0 only after all cpus are up

2019-09-13 Thread Juergen Gross
online cpus at that time in order to be able to add the cpu notifier late, too. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- V1: new patch --- xen/common/cpupool.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/xen/common/cpupool.c b/xen

[Xen-devel] [PATCH v2] xen/sched: rework and rename vcpu_force_reschedule()

2019-09-13 Thread Juergen Gross
concurrent timer activation via a per-vcpu lock it is even no longer required to bother the target vcpu at all for updating its timer. Rename the function to vcpu_set_periodic_timer() as this now reflects the functionality. Signed-off-by: Juergen Gross --- - Carved out from my core scheduling series

[Xen-devel] [PATCH v3 09/47] xen/sched: move some per-vcpu items to struct sched_unit

2019-09-14 Thread Juergen Gross
flag must be kept per vcpu as it is related to guest actions on specific vcpus. When support of multiple vcpus per sched_unit is being added, a unit is regarded as being subject to "broken affinity" when any of its vcpus has the affinity_broken flag set. Signed-off-by: Juergen Gross ---

[Xen-devel] [PATCH v3 00/47] xen: add core scheduling support

2019-09-14 Thread Juergen Gross
re working now - idling will always be done with idle_vcpu active - other small changes see individual patches Juergen Gross (47): xen/sched: use new sched_unit instead of vcpu in scheduler interfaces xen/sched: move per-vcpu scheduler private data pointer to sched_unit xen/sched: build a link

[Xen-devel] [PATCH v3 01/47] xen/sched: use new sched_unit instead of vcpu in scheduler interfaces

2019-09-14 Thread Juergen Gross
rename local functions switched to sched_unit, too. For now this new struct will contain a domain, a vcpu pointer and a unit_id only and is allocated at vcpu creation time. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- RFC V2: - move definition of struct sched_unit to sched.h

[Xen-devel] [PATCH v3 24/47] xen: switch from for_each_vcpu() to for_each_sched_unit()

2019-09-14 Thread Juergen Gross
Where appropriate switch from for_each_vcpu() to for_each_sched_unit() in order to prepare core scheduling. As it is beneficial once here and for sure in future add a unit_scheduler() helper and let vcpu_scheduler() use it. Signed-off-by: Juergen Gross --- V2: - handle affinity_broken correctly

[Xen-devel] [PATCH v3 04/47] xen/sched: introduce struct sched_resource

2019-09-14 Thread Juergen Gross
core or socket only. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- V1: - add accessor functions - use DEFINE_PER_CPU_READ_MOSTLY (Dario Faggioli) V3: - don't pre-define struct sched_resource in sched.h (Jan Beulich) - rename res->processor to res->master_cpu (Jan Beulic

[Xen-devel] [PATCH v3 20/47] xen: let vcpu_create() select processor

2019-09-14 Thread Juergen Gross
affinity before calling XEN_DOMCTL_max_vcpus. To be able to use const struct domain * make cpupool_domain_cpumask() take a const domain pointer, too. Signed-off-by: Juergen Gross Acked-by: Andrew Cooper Acked-by: Julien Grall --- RFC V2: - add ASSERT(), modify error message (Andrew Cooper) V1: - co

[Xen-devel] [PATCH v3 05/47] xen/sched: let pick_cpu return a scheduler resource

2019-09-14 Thread Juergen Gross
Instead of returning a physical cpu number let pick_cpu() return a scheduler resource instead. Rename pick_cpu() to pick_resource() to reflect that change. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- V3: - style fix (Jan Beulich) --- xen/common/sched_arinc653.c | 13

[Xen-devel] [PATCH v3 08/47] xen/sched: switch vcpu_schedule_lock to unit_schedule_lock

2019-09-14 Thread Juergen Gross
Rename vcpu_schedule_[un]lock[_irq]() to unit_schedule_[un]lock[_irq]() and let it take a sched_unit pointer instead of a vcpu pointer as parameter. Signed-off-by: Juergen Gross --- xen/common/sched_credit.c | 17 + xen/common/sched_credit2.c | 40

[Xen-devel] [PATCH v3 26/47] xen/sched: Change vcpu_migrate_*() to operate on schedule unit

2019-09-14 Thread Juergen Gross
vcpu_sync_execstate() for each vcpu of the unit when changing processors. vcpu_move_locked() is switched to schedule unit, too. Signed-off-by: Juergen Gross --- V3: - move tested invariant condition out of loop (Jan Beulich) - add comment regarding call of vcpu_sync_execstate() (Jan Beulich

[Xen-devel] [PATCH v3 10/47] xen/sched: add scheduler helpers hiding vcpu

2019-09-14 Thread Juergen Gross
pause_flags of all vcpus of the unit) - sched_idle_unit() to get the sched_unit pointer of the idle vcpu of a specific physical cpu Signed-off-by: Juergen Gross --- V3: - make unit parameter of sched_unit_cpu() const --- xen/common/sched_credit.c | 3 +-- xen/common/schedule.c | 21

[Xen-devel] [PATCH v3 19/47] xen: add sched_unit_pause_nosync() and sched_unit_unpause()

2019-09-14 Thread Juergen Gross
The credit scheduler calls vcpu_pause_nosync() and vcpu_unpause() today. Add sched_unit_pause_nosync() and sched_unit_unpause() to perform the same operations on scheduler units instead. Signed-off-by: Juergen Gross --- xen/common/sched_credit.c | 6 +++--- xen/include/xen/sched-if.h | 10

[Xen-devel] [PATCH v3 02/47] xen/sched: move per-vcpu scheduler private data pointer to sched_unit

2019-09-14 Thread Juergen Gross
This prepares making the different schedulers vcpu agnostic. Note that some scheduler specific accessor function are misnamed after this patch. This will be corrected in later patches. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- xen/common/sched_arinc653.c | 4 ++-- xen

[Xen-devel] [PATCH v3 21/47] xen/sched: use sched_resource cpu instead smp_processor_id in schedulers

2019-09-14 Thread Juergen Gross
instead. Add a helper to get that sched_resource master_cpu and modify the schedulers to use it in a correct way. Signed-off-by: Juergen Gross --- V3: - style correction (Jan Beulich) - rename cpu to cur_cpu when introducing sched_cpu in same function (Jan Beulich) - undo change in

[Xen-devel] [PATCH v3 12/47] xen/sched: switch struct task_slice from vcpu to sched_unit

2019-09-14 Thread Juergen Gross
Let the schedulers put a sched_unit pointer into struct task_slice instead of a vcpu pointer. Signed-off-by: Juergen Gross --- xen/common/sched_arinc653.c | 8 xen/common/sched_credit.c | 4 ++-- xen/common/sched_credit2.c | 4 ++-- xen/common/sched_null.c | 12

[Xen-devel] [PATCH v3 07/47] xen/sched: move per cpu scheduler private data into struct sched_resource

2019-09-14 Thread Juergen Gross
make it a plain percpu variable. Signed-off-by: Juergen Gross --- V1: - move sched_has_urgent_vcpu() V2: - make sched_has_urgent_vcpu() return bool (Jan Beulich) V3: - split out removing sched-if.h include in some C files (Jan Beulich) - make urgent_count a plain percpu variable (Jan Beulich

[Xen-devel] [PATCH v3 03/47] xen/sched: build a linked list of struct sched_unit

2019-09-14 Thread Juergen Gross
for_each_sched_unit_vcpu() which will iterate over all vcpus of a sched_unit (right now only one). This will be needed later for larger scheduling granularity (e.g. cores). Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- V2: - add comment (Dario Faggioli) --- xen/common/schedule.c

[Xen-devel] [PATCH v3 27/47] xen/sched: move struct task_slice into struct sched_unit

2019-09-14 Thread Juergen Gross
. Signed-off-by: Juergen Gross --- V3: - readd accidentally dropped call of continue_running() (Dario Faggioli) --- xen/common/sched_arinc653.c | 20 +++- xen/common/sched_credit.c | 25 +++-- xen/common/sched_credit2.c | 21 + xen/common

[Xen-devel] [PATCH v3 38/47] xen/sched: move per-cpu variable cpupool to struct sched_resource

2019-09-14 Thread Juergen Gross
Having a pointer to struct cpupool in struct sched_resource instead of per cpu is enough. Signed-off-by: Juergen Gross --- V1: new patch --- xen/common/cpupool.c | 4 +--- xen/common/sched_credit.c | 2 +- xen/common/sched_rt.c | 2 +- xen/common/schedule.c | 8 xen

[Xen-devel] [PATCH v3 13/47] xen/sched: add is_running indicator to struct sched_unit

2019-09-14 Thread Juergen Gross
pdated whenever the is_running indicator is changed. Use that new field in the schedulers instead of the similar vcpu field. Signed-off-by: Juergen Gross --- RFC V2: - fix arm build, don't drop v->is_running V3: - avoid holes in structures (Jan Beulich) --- xen/common/sched_credit.c | 12 +++

[Xen-devel] [PATCH v3 18/47] xen/sched: make arinc653 scheduler vcpu agnostic.

2019-09-14 Thread Juergen Gross
Switch arinc653 scheduler completely from vcpu to sched_unit usage. Signed-off-by: Juergen Gross --- xen/common/sched_arinc653.c | 208 +--- 1 file changed, 101 insertions(+), 107 deletions(-) diff --git a/xen/common/sched_arinc653.c b/xen/common

[Xen-devel] [PATCH v3 15/47] xen/sched: make rt scheduler vcpu agnostic.

2019-09-14 Thread Juergen Gross
Switch rt scheduler completely from vcpu to sched_unit usage. Signed-off-by: Juergen Gross --- xen/common/sched_rt.c | 356 -- 1 file changed, 174 insertions(+), 182 deletions(-) diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c index

[Xen-devel] [PATCH v3 31/47] xen/sched: modify cpupool_domain_cpumask() to be an unit mask

2019-09-14 Thread Juergen Gross
cpupool_domain_cpumask() is used by scheduling to select cpus or to iterate over cpus. In order to support scheduling units spanning multiple cpus let cpupool_domain_cpumask() return a cpumask with only one bit set per scheduling resource. Signed-off-by: Juergen Gross --- xen/common/cpupool.c

[Xen-devel] [PATCH v3 06/47] xen/sched: switch schedule_data.curr to point at sched_unit

2019-09-14 Thread Juergen Gross
In preparation of core scheduling let the percpu pointer schedule_data.curr point to a strct sched_unit instead of the related vcpu. At the same time rename the per-vcpu scheduler specific structs to per-unit ones. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- V3: - remove no

[Xen-devel] [PATCH v3 30/47] xen/sched: add support for multiple vcpus per sched unit where missing

2019-09-14 Thread Juergen Gross
In several places there is support for multiple vcpus per sched unit missing. Add that missing support (with the exception of initial allocation) and missing helpers for that. Signed-off-by: Juergen Gross --- RFC V2: - fix vcpu_runstate_helper() V1: - add special handling for idle unit in

[Xen-devel] [PATCH v3 35/47] xen/sched: make vcpu_wake() and vcpu_sleep() core scheduling aware

2019-09-14 Thread Juergen Gross
priority than a normal schedule event. Use the same mechanism when waking up a vcpu of a currently active unit. While at it make vcpu_sleep_nosync_locked() static as it is used in schedule.c only. Signed-off-by: Juergen Gross --- RFC V2: add vcpu_sleep() handling and force_context_switch flag V2: fix

[Xen-devel] [PATCH v3 28/47] xen/sched: add code to sync scheduling of all vcpus of a sched unit

2019-09-14 Thread Juergen Gross
selecting the vcpu to switch to, as we already know which vcpu we want to run. This has the other advantage not to loose any other concurrent SCHEDULE_SOFTIRQ events. Signed-off-by: Juergen Gross --- RFC V2: - move syncing after context_switch() to schedule.c V2: - don't run tasklets directly

[Xen-devel] [PATCH v3 43/47] xen/sched: support multiple cpus per scheduling resource

2019-09-14 Thread Juergen Gross
Prepare supporting multiple cpus per scheduling resource by allocating the cpumask per resource dynamically. Modify sched_res_mask to have only one bit per scheduling resource set. Signed-off-by: Juergen Gross --- V1: new patch (carved out from other patch) --- xen/common/schedule.c | 16

[Xen-devel] [PATCH v3 29/47] xen/sched: introduce unit_runnable_state()

2019-09-14 Thread Juergen Gross
pu struct. Signed-off-by: Juergen Gross --- RFC V2: - new patch V3: - add vcpu loop to unit_runnable_state() right now instead of doing so in next patch (Jan Beulich, Dario Faggioli) - make new_state unsigned int (Jan Beulich) --- xen/common/domain.c | 1 + xen/common/sched_arinc

[Xen-devel] [PATCH v3 23/47] xen/sched: switch sched_move_irqs() to take sched_unit as parameter

2019-09-14 Thread Juergen Gross
sched_move_irqs() should work on a sched_unit as that is the unit moved between cpus. Rename the current function to vcpu_move_irqs() as it is still needed in schedule(). Signed-off-by: Juergen Gross --- xen/common/schedule.c | 18 +- 1 file changed, 13 insertions(+), 5

[Xen-devel] [PATCH v3 37/47] xen/sched: move per-cpu variable scheduler to struct sched_resource

2019-09-14 Thread Juergen Gross
Having a pointer to struct scheduler in struct sched_resource instead of per cpu is enough. Signed-off-by: Juergen Gross --- V1: new patch --- xen/common/sched_credit.c | 18 +++--- xen/common/sched_credit2.c | 3 ++- xen/common/schedule.c | 15 +++ xen/include

[Xen-devel] [PATCH v3 22/47] xen/sched: switch schedule() from vcpus to sched_units

2019-09-14 Thread Juergen Gross
Use sched_units instead of vcpus in schedule(). This includes the introduction of sched_unit_runstate_change() as a replacement of vcpu_runstate_change() in schedule(). Signed-off-by: Juergen Gross --- Note that sched_unit_runstate_change() will be subsumed by another rework in a later patch

[Xen-devel] [PATCH v3 16/47] xen/sched: make credit scheduler vcpu agnostic.

2019-09-14 Thread Juergen Gross
Switch credit scheduler completely from vcpu to sched_unit usage. Signed-off-by: Juergen Gross --- xen/common/sched_credit.c | 503 +++--- 1 file changed, 250 insertions(+), 253 deletions(-) diff --git a/xen/common/sched_credit.c b/xen/common

[Xen-devel] [PATCH v3 25/47] xen/sched: add runstate counters to struct sched_unit

2019-09-14 Thread Juergen Gross
Add counters to struct sched_unit summing up runstates of associated vcpus. This allows doing quick checks whether a unit has any vcpu running or whether only a single vcpu of a unit is running. Signed-off-by: Juergen Gross --- RFC V2: add counters for each possible runstate --- xen/common

[Xen-devel] [PATCH v3 39/47] xen/sched: reject switching smt on/off with core scheduling active

2019-09-14 Thread Juergen Gross
When core or socket scheduling are active enabling or disabling smt is not possible as that would require a major host reconfiguration. Add a bool sched_disable_smt_switching which will be set for core or socket scheduling. Signed-off-by: Juergen Gross Acked-by: Jan Beulich --- V1: - new patch

[Xen-devel] [PATCH v3 46/47] xen/sched: disable scheduling when entering ACPI deep sleep states

2019-09-14 Thread Juergen Gross
softirq handler with a dummy scheduling routine only enabling tasklets to run. Signed-off-by: Juergen Gross --- V2: new patch --- xen/arch/x86/acpi/power.c | 4 xen/common/schedule.c | 31 +-- xen/include/xen/sched.h | 2 ++ 3 files changed, 35 insertions

[Xen-devel] [PATCH v3 36/47] xen/sched: carve out freeing sched_unit memory into dedicated function

2019-09-14 Thread Juergen Gross
We'll need a way to free a sched_unit structure without side effects in a later patch. Signed-off-by: Juergen Gross --- RFC V2: new patch, carved out from RFC V1 patch 49 --- xen/common/schedule.c | 38 +- 1 file changed, 21 insertions(+), 17 dele

[Xen-devel] [PATCH v3 14/47] xen/sched: make null scheduler vcpu agnostic.

2019-09-14 Thread Juergen Gross
Switch null scheduler completely from vcpu to sched_unit usage. Signed-off-by: Juergen Gross --- xen/common/sched_null.c | 333 1 file changed, 165 insertions(+), 168 deletions(-) diff --git a/xen/common/sched_null.c b/xen/common/sched_null.c

[Xen-devel] [PATCH v3 33/47] xen/sched: add a percpu resource index

2019-09-14 Thread Juergen Gross
-off-by: Juergen Gross --- RFC V2: new patch (carved out from RFC V1 patch 49) --- xen/common/schedule.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 5e34008ca8..246ad38c7d 100644 --- a/xen/common/schedule.c

[Xen-devel] [PATCH v3 41/47] xen/sched: split schedule_cpu_switch()

2019-09-14 Thread Juergen Gross
Instead of letting schedule_cpu_switch() handle moving cpus from and to cpupools, split it into schedule_cpu_add() and schedule_cpu_rm(). This will allow us to drop allocating/freeing scheduler data for free cpus as the idle scheduler doesn't need such data. Signed-off-by: Juergen Gross -

[Xen-devel] [PATCH v3 34/47] xen/sched: add fall back to idle vcpu when scheduling unit

2019-09-14 Thread Juergen Gross
is needed. Signed-off-by: Juergen Gross Acked-by: Julien Grall --- 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

[Xen-devel] [PATCH v3 42/47] xen/sched: protect scheduling resource via rcu

2019-09-14 Thread Juergen Gross
duling resource relation. In order to be able to free unused resources protect struct sched_resource via RCU. This ensures there are no users left when freeing such a resource. Signed-off-by: Juergen Gross --- V1: new patch --- xen/common/cpupool.c | 4 + xen/common/schedule.c

[Xen-devel] [PATCH v3 40/47] xen/sched: prepare per-cpupool scheduling granularity

2019-09-14 Thread Juergen Gross
populating the cpupool with cpus. This will make on- and offlining of cpus much easier and avoids writing code which would needed to be thrown away later. Signed-off-by: Juergen Gross --- V1: new patch --- xen/common/cpupool.c | 2 ++ xen/common/schedule.c | 27

[Xen-devel] [PATCH v3 47/47] xen/sched: add scheduling granularity enum

2019-09-14 Thread Juergen Gross
larity sched_granularity is set after all cpus are online. A test is added for all sched resources holding the same number of cpus. Fall back to core- or cpu-scheduling in that case. Signed-off-by: Juergen Gross --- RFC V2: - fixed freeing of sched_res when merging cpus - rename parameter to "s

[Xen-devel] [PATCH v3 11/47] xen/sched: rename scheduler related perf counters

2019-09-14 Thread Juergen Gross
Rename the scheduler related perf counters from vcpu* to unit* where appropriate. Signed-off-by: Juergen Gross --- xen/common/sched_credit.c| 32 xen/common/sched_credit2.c | 18 +- xen/common/sched_null.c | 18 +- xen

[Xen-devel] [PATCH v3 32/47] xen/sched: support allocating multiple vcpus into one sched unit

2019-09-14 Thread Juergen Gross
f the domain's vcpu linked list, which isn't the case. Signed-off-by: Juergen Gross --- xen/common/schedule.c | 86 ++- 1 file changed, 65 insertions(+), 21 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 87660c6

[Xen-devel] [PATCH v3 45/47] xen/sched: support core scheduling for moving cpus to/from cpupools

2019-09-14 Thread Juergen Gross
With core scheduling active it is necessary to move multiple cpus at the same time to or from a cpupool in order to avoid split scheduling resources in between. Signed-off-by: Juergen Gross --- V1: new patch --- xen/common/cpupool.c | 100 + xen

[Xen-devel] [PATCH v3 44/47] xen/sched: support differing granularity in schedule_cpu_[add/rm]()

2019-09-14 Thread Juergen Gross
pdata and vdata and loop over those where appropriate. Additionally the scheduling resource(s) must either be merged or split. Signed-off-by: Juergen Gross --- xen/common/cpupool.c | 18 ++-- xen/common/schedule.c | 226 +++--- 2 files changed, 204

[Xen-devel] [PATCH v3 17/47] xen/sched: make credit2 scheduler vcpu agnostic.

2019-09-14 Thread Juergen Gross
Switch credit2 scheduler completely from vcpu to sched_unit usage. As we are touching lots of lines remove some white space at the end of the line, too. Signed-off-by: Juergen Gross --- xen/common/sched_credit2.c | 820 ++--- 1 file changed, 403

Re: [Xen-devel] [PATCH v2] xen/sched: rework and rename vcpu_force_reschedule()

2019-09-16 Thread Juergen Gross
On 16.09.19 11:20, Jan Beulich wrote: On 14.09.2019 08:42, Juergen Gross wrote: vcpu_force_reschedule() is only used for modifying the periodic timer of a vcpu. Forcing a vcpu to give up the physical cpu for that purpose is kind of brutal. So instead of doing the reschedule dance just operate

Re: [Xen-devel] [PATCH v2] xen/sched: rework and rename vcpu_force_reschedule()

2019-09-16 Thread Juergen Gross
On 16.09.19 16:39, Jan Beulich wrote: On 16.09.2019 14:49, Juergen Gross wrote: On 16.09.19 11:20, Jan Beulich wrote: On 14.09.2019 08:42, Juergen Gross wrote: vcpu_force_reschedule() is only used for modifying the periodic timer of a vcpu. Forcing a vcpu to give up the physical cpu for that

Re: [Xen-devel] dom/xen heap and boot allocator (WAS Re: [xen-unstable-smoke test] 141333: regressions - FAIL)

2019-09-17 Thread Juergen Gross
On 17.09.19 14:31, Julien Grall wrote: (+ Juergen) Hi, On 9/16/19 9:51 AM, Jan Beulich wrote: On 15.09.2019 19:51, Julien Grall wrote: Hi, On 9/15/19 3:09 PM, osstest service owner wrote: flight 141333 xen-unstable-smoke real [real] http://logs.test-lab.xenproject.org/osstest/logs/141333/

Re: [Xen-devel] [PATCH 0/2] x86emul: vendor specific treatment adjustments

2019-09-17 Thread Juergen Gross
tively mis-emulating MOVSXD on modern Intel hardware for quite some time, so it getting delayed until after 4.13 (and then possible be backported) wouldn't be overly bad. 1: treat Hygon guests like AMD ones 2: adjust MOVSXD source operand handling For the series: Release-acked-by: Juergen G

[Xen-devel] [PATCH] xen/sched: don't let XEN_RUNSTATE_UPDATE leak into vcpu_runstate_get()

2019-09-24 Thread Juergen Gross
vcpu_runstate_get() should never return a state entry time with XEN_RUNSTATE_UPDATE set. To avoid this let update_runstate_area() operate on a local runstate copy. This problem was introduced with commit 2529c850ea48f036 ("add update indicator to vcpu_runstate_info"). Signed-off-b

[Xen-devel] [PATCH v2] xen/sched: don't let XEN_RUNSTATE_UPDATE leak into vcpu_runstate_get()

2019-09-24 Thread Juergen Gross
rew Cooper Signed-off-by: Juergen Gross --- V2: add handling on ARM, too (Jan Beulich) --- xen/arch/arm/domain.c | 13 - xen/arch/x86/domain.c | 17 ++--- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index

[Xen-devel] [PATCH 0/2] xen/sched: fix freeing of per-vcpu data

2019-09-25 Thread Juergen Gross
Fix two latent bugs discovered in review of my core scheduling series. For the series: Release-acked-by: Juergen Gross Juergen Gross (2): xen/sched: fix locking in a653sched_free_vdata() xen/sched: fix freeing per-vcpu data in sched_move_domain() xen/common/sched_arinc653.c | 6

[Xen-devel] [PATCH 2/2] xen/sched: fix freeing per-vcpu data in sched_move_domain()

2019-09-25 Thread Juergen Gross
the sched_free_vdata() hook. Signed-off-by: Juergen Gross --- xen/common/schedule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 13b5ffc7cf..13c17fe944 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c

[Xen-devel] [PATCH 1/2] xen/sched: fix locking in a653sched_free_vdata()

2019-09-25 Thread Juergen Gross
The arinc653 scheduler's free_vdata() function is missing proper locking: as it is modifying the scheduler's private vcpu list it needs to take the scheduler lock during that operation. Signed-off-by: Juergen Gross --- xen/common/sched_arinc653.c | 6 ++ 1 file changed, 6

[Xen-devel] [GIT PULL] xen: features for 5.4-rc1

2019-09-26 Thread Juergen Gross
Linus, Please git pull the following tag: git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip.git for-linus-5.4-rc1-tag xen: features for 5.4-rc1 It contains only two small patches this time: - a small cleanup for swiotlb-xen - a fix for PCI initialization for some platforms Thanks. Juerg

[Xen-devel] [PATCH v3] xen/sched: don't let XEN_RUNSTATE_UPDATE leak into vcpu_runstate_get()

2019-09-26 Thread Juergen Gross
Signed-off-by: Juergen Gross --- V2: add handling on ARM, too (Jan Beulich) --- xen/arch/arm/domain.c | 13 - xen/arch/x86/domain.c | 17 ++--- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 61d35cd120..

[Xen-devel] [PATCH] xen/debugtrace: fix buffer allocation

2019-09-26 Thread Juergen Gross
is always shown as empty as those entries are printed in the global buffer's dump already. Fix that. Signed-off-by: Juergen Gross --- xen/common/debugtrace.c | 1 - 1 file changed, 1 deletion(-) diff --git a/xen/common/debugtrace.c b/xen/common/debugtrace.c index 7313e89389..a788e55b4c 100

[Xen-devel] [PATCH v4 12/46] xen/sched: switch struct task_slice from vcpu to sched_unit

2019-09-27 Thread Juergen Gross
Let the schedulers put a sched_unit pointer into struct task_slice instead of a vcpu pointer. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- xen/common/sched_arinc653.c | 8 xen/common/sched_credit.c | 4 ++-- xen/common/sched_credit2.c | 4 ++-- xen/common

[Xen-devel] [PATCH v4 05/46] xen/sched: let pick_cpu return a scheduler resource

2019-09-27 Thread Juergen Gross
Instead of returning a physical cpu number let pick_cpu() return a scheduler resource instead. Rename pick_cpu() to pick_resource() to reflect that change. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- V3: - style fix (Jan Beulich) --- xen/common/sched_arinc653.c | 13

[Xen-devel] [PATCH v4 00/46] xen: add core scheduling support

2019-09-27 Thread Juergen Gross
-/offlining support) - all review comments addressed - some minor changes (see individual patches) Changes in RFC V2: - ARM is building now - HVM domains are working now - idling will always be done with idle_vcpu active - other small changes see individual patches Juergen Gross (46): xen/sched: use

[Xen-devel] [PATCH v4 07/46] xen/sched: move per cpu scheduler private data into struct sched_resource

2019-09-27 Thread Juergen Gross
make it a plain percpu variable. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Reviewed-by: Dario Faggioli --- V1: - move sched_has_urgent_vcpu() V2: - make sched_has_urgent_vcpu() return bool (Jan Beulich) V3: - split out removing sched-if.h include in some C files (Jan Beulich) - make

[Xen-devel] [PATCH v4 08/46] xen/sched: switch vcpu_schedule_lock to unit_schedule_lock

2019-09-27 Thread Juergen Gross
Rename vcpu_schedule_[un]lock[_irq]() to unit_schedule_[un]lock[_irq]() and let it take a sched_unit pointer instead of a vcpu pointer as parameter. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- xen/common/sched_credit.c | 17 + xen/common/sched_credit2.c | 40

[Xen-devel] [PATCH v4 11/46] xen/sched: rename scheduler related perf counters

2019-09-27 Thread Juergen Gross
Rename the scheduler related perf counters from vcpu* to unit* where appropriate. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- xen/common/sched_credit.c| 32 xen/common/sched_credit2.c | 18 +- xen/common/sched_null.c

[Xen-devel] [PATCH v4 16/46] xen/sched: make credit scheduler vcpu agnostic.

2019-09-27 Thread Juergen Gross
Switch credit scheduler completely from vcpu to sched_unit usage. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- xen/common/sched_credit.c | 503 +++--- 1 file changed, 250 insertions(+), 253 deletions(-) diff --git a/xen/common

[Xen-devel] [PATCH v4 03/46] xen/sched: build a linked list of struct sched_unit

2019-09-27 Thread Juergen Gross
for_each_sched_unit_vcpu() which will iterate over all vcpus of a sched_unit (right now only one). This will be needed later for larger scheduling granularity (e.g. cores). Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- V2: - add comment (Dario Faggioli) V4: - rename iterator macro

[Xen-devel] [PATCH v4 14/46] xen/sched: make null scheduler vcpu agnostic.

2019-09-27 Thread Juergen Gross
Switch null scheduler completely from vcpu to sched_unit usage. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- V4: - Item -> unit (Dario Faggioli) --- xen/common/sched_null.c | 333 1 file changed, 165 insertions(+), 168 deleti

[Xen-devel] [PATCH v4 02/46] xen/sched: move per-vcpu scheduler private data pointer to sched_unit

2019-09-27 Thread Juergen Gross
This prepares making the different schedulers vcpu agnostic. Note that some scheduler specific accessor function are misnamed after this patch. This will be corrected in later patches. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- xen/common/sched_arinc653.c | 4 ++-- xen

[Xen-devel] [PATCH v4 04/46] xen/sched: introduce struct sched_resource

2019-09-27 Thread Juergen Gross
core or socket only. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- V1: - add accessor functions - use DEFINE_PER_CPU_READ_MOSTLY (Dario Faggioli) V3: - don't pre-define struct sched_resource in sched.h (Jan Beulich) - rename res->processor to res->master_cpu (Jan Beulic

[Xen-devel] [PATCH v4 23/46] xen/sched: switch sched_move_irqs() to take sched_unit as parameter

2019-09-27 Thread Juergen Gross
sched_move_irqs() should work on a sched_unit as that is the unit moved between cpus. Rename the current function to vcpu_move_irqs() as it is still needed in schedule(). Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- V4: - make parameter const (Jan Beulich) --- xen/common

[Xen-devel] [PATCH v4 09/46] xen/sched: move some per-vcpu items to struct sched_unit

2019-09-27 Thread Juergen Gross
flag must be kept per vcpu as it is related to guest actions on specific vcpus. When support of multiple vcpus per sched_unit is being added, a unit is regarded as being subject to "broken affinity" when any of its vcpus has the affinity_broken flag set. Signed-off-by: Juergen Gross Ack

[Xen-devel] [PATCH v4 06/46] xen/sched: switch schedule_data.curr to point at sched_unit

2019-09-27 Thread Juergen Gross
In preparation of core scheduling let the percpu pointer schedule_data.curr point to a strct sched_unit instead of the related vcpu. At the same time rename the per-vcpu scheduler specific structs to per-unit ones. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- V3: - remove no

[Xen-devel] [PATCH v4 13/46] xen/sched: add is_running indicator to struct sched_unit

2019-09-27 Thread Juergen Gross
pdated whenever the is_running indicator is changed. Use that new field in the schedulers instead of the similar vcpu field. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- RFC V2: - fix arm build, don't drop v->is_running V3: - avoid holes in structures (Jan Beulich) V4: - assign

[Xen-devel] [PATCH v4 30/46] xen/sched: add support for multiple vcpus per sched unit where missing

2019-09-27 Thread Juergen Gross
In several places there is support for multiple vcpus per sched unit missing. Add that missing support (with the exception of initial allocation) and missing helpers for that. Signed-off-by: Juergen Gross --- RFC V2: - fix vcpu_runstate_helper() V1: - add special handling for idle unit in

[Xen-devel] [PATCH v4 10/46] xen/sched: add scheduler helpers hiding vcpu

2019-09-27 Thread Juergen Gross
pause_flags of all vcpus of the unit) - sched_idle_unit() to get the sched_unit pointer of the idle vcpu of a specific physical cpu Signed-off-by: Juergen Gross --- V3: - make unit parameter of sched_unit_cpu() const V4: - loop over vcpus in helpers where appropriate (Jan Beulich) - add some

<    1   2   3   4   5   6   7   8   9   10   >