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

Re: [Xen-devel] [PATCH ARM v8 1/4] mini-os: arm: time



On 27 October 2014 10:34, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
> On Sun, 2014-10-26 at 09:51 +0000, Thomas Leonard wrote:
>> On 21 October 2014 11:50, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
>> > On Fri, 2014-10-03 at 10:20 +0100, Thomas Leonard wrote:
>> >> Based on an initial patch by Karim Raslan.
>> >>
>> >> Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@xxxxxxxxx>
>> >> Signed-off-by: Thomas Leonard <talex5@xxxxxxxxx>
>> >
>> > Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
>> >
>> >> +/* Wall-clock time is not currently available on ARM, so this is always 
>> >> zero for now:
>> >> + * 
>> >> http://wiki.xenproject.org/wiki/Xen_ARM_TODO#Expose_Wallclock_time_to_guests
>> >
>> > I have some slightly hacky patches for this, I really should dust them
>> > off and submit them...
>> >
>> >> +void block_domain(s_time_t until)
>> >> +{
>> >> +    uint64_t until_count = ns_to_ticks(until) + cntvct_at_init;
>> >> +    ASSERT(irqs_disabled());
>> >> +    if (read_virtual_count() < until_count)
>> >> +    {
>> >> +        set_vtimer_compare(until_count);
>> >> +        __asm__ __volatile__("wfi");
>> >> +        unset_vtimer_compare();
>> >> +
>> >> +        /* Give the IRQ handler a chance to handle whatever woke us up. 
>> >> */
>> >> +        local_irq_enable();
>> >> +        local_irq_disable();
>> >> +    }
>> >
>> > Just wondering, is this not roughly equivalent to a wfi loop with
>> > interrupts enabled?
>>
>> I'm not quite sure what you mean.
>>
>> If we enable interrupts before the wfi then I think the following could 
>> occur:
>>
>> 1. Application checks for work, finds none and calls block_domain.
>> 2. block_domain enables interrupts.
>> 3. An interrupt occurs.
>> 4. The interrupt handler sets a flag indicating work to do.
>> 5. wfi is called, putting the domain to sleep, even though there is work to 
>> do.
>>
>> Enabling IRQs after block_domain ensures we can't sleep while we have
>> work to do.
>
> Ah, yes.

So, can this patch be applied as-is now?


-- 
Dr Thomas Leonard        http://0install.net/
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1
GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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