diff mbox series

[v3,23/47] xen/sched: switch sched_move_irqs() to take sched_unit as parameter

Message ID 20190914085251.18816-24-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series xen: add core scheduling support | expand

Commit Message

Jürgen Groß Sept. 14, 2019, 8:52 a.m. UTC
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 <jgross@suse.com>
---
 xen/common/schedule.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

Comments

Jan Beulich Sept. 20, 2019, 2:34 p.m. UTC | #1
On 14.09.2019 10:52, Juergen Gross wrote:
> --- a/xen/common/schedule.c
> +++ b/xen/common/schedule.c
> @@ -474,12 +474,20 @@ int sched_init_vcpu(struct vcpu *v)
>      return 0;
>  }
>  
> -static void sched_move_irqs(struct vcpu *v)
> +static void vcpu_move_irqs(struct vcpu *v)
>  {
>      arch_move_irqs(v);
>      evtchn_move_pirqs(v);
>  }
>  
> +static void sched_move_irqs(struct sched_unit *unit)

I think the parameter could be constified.

> @@ -1736,7 +1744,7 @@ static void schedule(void)
>      stop_timer(&prev->vcpu_list->periodic_timer);
>  
>      if ( next_slice.migrated )
> -        sched_move_irqs(next->vcpu_list);
> +        vcpu_move_irqs(next->vcpu_list);

Why is this not also sched_move_irqs(), at which point there wouldn't
be a need for a separate vcpu_move_irqs() afaict?

Jan
Jürgen Groß Sept. 24, 2019, 11:55 a.m. UTC | #2
On 20.09.19 16:34, Jan Beulich wrote:
> On 14.09.2019 10:52, Juergen Gross wrote:
>> --- a/xen/common/schedule.c
>> +++ b/xen/common/schedule.c
>> @@ -474,12 +474,20 @@ int sched_init_vcpu(struct vcpu *v)
>>       return 0;
>>   }
>>   
>> -static void sched_move_irqs(struct vcpu *v)
>> +static void vcpu_move_irqs(struct vcpu *v)
>>   {
>>       arch_move_irqs(v);
>>       evtchn_move_pirqs(v);
>>   }
>>   
>> +static void sched_move_irqs(struct sched_unit *unit)
> 
> I think the parameter could be constified.

Yes.

> 
>> @@ -1736,7 +1744,7 @@ static void schedule(void)
>>       stop_timer(&prev->vcpu_list->periodic_timer);
>>   
>>       if ( next_slice.migrated )
>> -        sched_move_irqs(next->vcpu_list);
>> +        vcpu_move_irqs(next->vcpu_list);
> 
> Why is this not also sched_move_irqs(), at which point there wouldn't
> be a need for a separate vcpu_move_irqs() afaict?

This is the place where a single vcpu is scheduled on a new cpu.
The places where sched_move_irqs() is being used is where a unit has
been forced to other cpu(s).

At the end of the series this is much more clear.


Juergen
Dario Faggioli Sept. 24, 2019, 8:43 p.m. UTC | #3
On Sat, 2019-09-14 at 10:52 +0200, Juergen Gross wrote:
> 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 <jgross@suse.com>
>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>

(Stands with parameter constified as suggested.)

Regards
diff mbox series

Patch

diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 2272192d49..9c41b2dd4d 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -474,12 +474,20 @@  int sched_init_vcpu(struct vcpu *v)
     return 0;
 }
 
-static void sched_move_irqs(struct vcpu *v)
+static void vcpu_move_irqs(struct vcpu *v)
 {
     arch_move_irqs(v);
     evtchn_move_pirqs(v);
 }
 
+static void sched_move_irqs(struct sched_unit *unit)
+{
+    struct vcpu *v;
+
+    for_each_sched_unit_vcpu ( unit, v )
+        vcpu_move_irqs(v);
+}
+
 int sched_move_domain(struct domain *d, struct cpupool *c)
 {
     struct vcpu *v;
@@ -559,7 +567,7 @@  int sched_move_domain(struct domain *d, struct cpupool *c)
 
         v->sched_unit->priv = vcpu_priv[v->vcpu_id];
         if ( !d->is_dying )
-            sched_move_irqs(v);
+            sched_move_irqs(v->sched_unit);
 
         new_p = cpumask_cycle(new_p, c->cpu_valid);
 
@@ -852,7 +860,7 @@  static void vcpu_migrate_finish(struct vcpu *v)
     sched_spin_unlock_double(old_lock, new_lock, flags);
 
     if ( old_cpu != new_cpu )
-        sched_move_irqs(v);
+        sched_move_irqs(v->sched_unit);
 
     /* Wake on new CPU. */
     vcpu_wake(v);
@@ -917,7 +925,7 @@  void restore_vcpu_affinity(struct domain *d)
         spin_unlock_irq(lock);
 
         if ( old_cpu != v->processor )
-            sched_move_irqs(v);
+            sched_move_irqs(v->sched_unit);
     }
 
     domain_update_node_affinity(d);
@@ -1736,7 +1744,7 @@  static void schedule(void)
     stop_timer(&prev->vcpu_list->periodic_timer);
 
     if ( next_slice.migrated )
-        sched_move_irqs(next->vcpu_list);
+        vcpu_move_irqs(next->vcpu_list);
 
     vcpu_periodic_timer_work(next->vcpu_list);