[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100521205527.GB9594@suse.de>
Date: Fri, 21 May 2010 13:55:27 -0700
From: Greg KH <gregkh@...e.de>
To: Ky Srinivasan <ksrinivasan@...ell.com>
Cc: Haiyang Zhang <haiyangz@...rosoft.com>,
"'devel@...verdev.osuosl.org'" <devel@...verdev.osuosl.org>,
"'virtualization@...ts.osdl.org'" <virtualization@...ts.osdl.org>,
"'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] staging: hv: Fix race condition on IC channel
initialization
On Fri, May 21, 2010 at 02:21:46PM -0600, Ky Srinivasan wrote:
>
>
> >>> On 5/21/2010 at 4:12 PM, in message <20100521201228.GA6712@...e.de>, Greg KH
> <gregkh@...e.de> wrote:
> > On Fri, May 21, 2010 at 07:58:26PM +0000, Haiyang Zhang wrote:
> >> From: Haiyang Zhang <haiyangz@...rosoft.com>
> >>
> >> Subject: staging: hv: Fix race condition on IC channel initialization
> >> There is a possible race condition when hv_utils starts to load immediately
> >> after hv_vmbus is loading - null pointer error could happen.
> >> This patch added an atomic counter to ensure all channels are ready before
> >> vmbus_init() returns. So another module won't have any uninitialized
> > channel.
> >
> > Better, but not quite ready...
> >
> >> +/* Counter of IC channels initialized */
> >> +atomic_t hv_utils_initcnt = ATOMIC_INIT(0);
> >
> > This doesn't need to be an atomic variable, does it really?
> >
> > Why not have a simple bool variable "vmbus_initialized" or something.
> > It starts out as false, and then turns true when you are up and ready.
> > Then provide a function that tests it:
> > bool hv_vmbus_ready(void)
> > {
> > return vmbus_initialized
> > }
> > EXPORT_SYMBOL_GPL(hv_vmbus_ready);
> I agree with Greg; I would go a step further and deal with this issue
> as part of loading the bus driver. After all, we already have
> dependencies established for various LIC drivers on the bus driver.
> The fact that even after the bus driver is loaded we cannot reliably
> load other drivers implies that there is an additional dependency that
> is not currently being handled. Why can't we ensure that the bus
> driver is fully initialized before we are done with loading the bus
> driver.
Um, I think that is what this patch fixes :)
It just doesn't do it in a way that I think is very good...
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists