On 06/05/2019 10:37, Jan Beulich wrote:
>>>> On 06.05.19 at 08:56, <[email protected]> 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.

I agree.


Juergen

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

Reply via email to