RE: [PATCH 1/1] staging: hv: Fix race condition on IC channel initialization

From: Haiyang Zhang
Date: Tue May 25 2010 - 19:14:56 EST


> From: Ky Srinivasan [mailto:ksrinivasan@xxxxxxxxxx]
> You would need to protect the increment, if interrupts are going to
> come in on any cpu and update the counter. While in your current
> implementation interrupts are only delivered on cpu0, it is still
> probably good to deal with the more general case and protect the
> counter.
>
> On a slightly different note, why don't you make the synchronization
> more explicit than what you currently have: Rather than polling the
> variable in a loop, why don't you put that context to sleep and the
> interrupt context that updates the count would be responsible for
> issuing the wakeup when the conditions are appropriate - when all
> channels are initialized.

Thank you for the suggestion. I will keep the counter atomic to handle
more general case potentially. To ensure channels are ready before
vmbus_init() returns, I used an event waiting mechanism instead of
polling the variable periodically. A modified patch will be submitted
soon.

Thanks,

- Haiyang

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/