public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: Ky Srinivasan <ksrinivasan@novell.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>,
	"'devel@driverdev.osuosl.org'" <devel@driverdev.osuosl.org>,
	"'virtualization@lists.osdl.org'" <virtualization@lists.osdl.org>,
	"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] staging: hv: Fix race condition on IC channel initialization
Date: Fri, 21 May 2010 13:55:27 -0700	[thread overview]
Message-ID: <20100521205527.GB9594@suse.de> (raw)
In-Reply-To: <4BF696FA0200003000085968@sinclair.provo.novell.com>

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@suse.de>, Greg KH
> <gregkh@suse.de> wrote: 
> > On Fri, May 21, 2010 at 07:58:26PM +0000, Haiyang Zhang wrote:
> >> From: Haiyang Zhang <haiyangz@microsoft.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

  reply	other threads:[~2010-05-21 20:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-21 19:58 [PATCH 1/1] staging: hv: Fix race condition on IC channel initialization Haiyang Zhang
2010-05-21 20:12 ` Greg KH
2010-05-21 20:21   ` Ky Srinivasan
2010-05-21 20:55     ` Greg KH [this message]
2010-05-22 15:10       ` Ky Srinivasan
2010-05-21 22:07   ` Haiyang Zhang
2010-05-21 22:22     ` Greg KH
2010-05-22 15:21     ` Ky Srinivasan
2010-05-25 23:14       ` Haiyang Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100521205527.GB9594@suse.de \
    --to=gregkh@suse.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=haiyangz@microsoft.com \
    --cc=ksrinivasan@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox