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

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



>>> On 06.05.19 at 08:56, <jgross@xxxxxxxx> wrote:
> --- a/xen/common/schedule.c
> +++ b/xen/common/schedule.c
> @@ -808,21 +808,24 @@ static void vcpu_migrate_finish(struct vcpu *v)
>  }
>  
>  /*
> - * Force a VCPU through a deschedule/reschedule path.
> - * For example, using this when setting the periodic timer period means that
> - * most periodic-timer state need only be touched from within the scheduler
> - * which can thus be done without need for synchronisation.
> + * Set the periodic timer of a vcpu.
>   */
> -void vcpu_force_reschedule(struct vcpu *v)
> +void vcpu_set_periodic_timer(struct vcpu *v, s_time_t value)
>  {
> -    spinlock_t *lock = item_schedule_lock_irq(v->sched_item);
> +    s_time_t now = NOW();
>  
> -    if ( v->sched_item->is_running )
> -        vcpu_migrate_start(v);
> +    if ( v != current )
> +        vcpu_pause(v);
> +    else
> +        stop_timer(&v->periodic_timer);
>  
> -    item_schedule_unlock_irq(lock, v->sched_item);
> +    v->periodic_period = value;
> +    v->periodic_last_event = now;

By the time you come here, NOW() may already be past now + value.
It's not clear to me whether that'll work correctly; I think it would be
better to latch NOW() only at this point.

Jan



_______________________________________________
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®.