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

Re: [Xen-devel] [PATCH] Avoid race conditions in HPET initialization



>>> On 03.01.14 at 14:15, Frediano Ziglio <frediano.ziglio@xxxxxxxxxx> wrote:
> Avoid turning on legacy interrupts before hpet_event has been set up.
> Particularly, the spinlock can be uninitialised at the point at which
> the interrupt first arrives.

I suppose you actually saw this issue, but I currently fail to see how
it would occur:

        spin_lock_init(&hpet_events[i].lock);
        wmb();
        hpet_events[i].event_handler = handle_hpet_broadcast;

guarantees that the lock gets initialized before the handler gets set
(i.e. if anything you'd do a call through a NULL pointer). And this

    if ( !num_hpets_used )
        hpet_events->flags = HPET_EVT_LEGACY;

happens even later, yet hpet_legacy_irq_tick() checks that flag
before calling the handler (and hence before taking the lock).

Before applying the patch I'd like to understand what I'm
overlooking.

Jan


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