LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org, virtualization@lists.osdl.org
Subject: Re: [PATCH 2/3]: Staging: hv: Use native wait primitives
Date: Tue, 15 Feb 2011 10:20:37 +0100	[thread overview]
Message-ID: <4D5A4565.5030501@gmail.com> (raw)
In-Reply-To: <1297447183-21807-1-git-send-email-kys@microsoft.com>

On 02/11/2011 06:59 PM, K. Y. Srinivasan wrote:
> In preperation for getting rid of the osd layer; change
> the code to use native wait interfaces. As part of this,
> fixed the buggy implementation in the osd_wait_primitive
> where the condition was cleared potentially after the 
> condition was signalled.
...
> @@ -566,7 +567,11 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
>  
>  		}
>  	}
> -	osd_waitevent_wait(msginfo->waitevent);
> +	wait_event_timeout(msginfo->waitevent,
> +				msginfo->wait_condition,
> +				msecs_to_jiffies(1000));
> +	BUG_ON(msginfo->wait_condition == 0);

The added BUG_ONs all over the code look scary. These shouldn't be
BUG_ONs at all. You should maybe warn and bail out, but not kill the
whole machine.

And looking at the code, more appropriate would be completion instead of
wait events.

And msecs_to_jiffies(1000) == HZ.

> @@ -689,7 +693,8 @@ static void vmbus_ongpadl_torndown(
>  				memcpy(&msginfo->response.gpadl_torndown,
>  				       gpadl_torndown,
>  				       sizeof(struct vmbus_channel_gpadl_torndown));
> -				osd_waitevent_set(msginfo->waitevent);
> +				msginfo->wait_condition = 1;
> +				wake_up(&msginfo->waitevent);
>  				break;
>  			}
>  		}
> @@ -730,7 +735,8 @@ static void vmbus_onversion_response(
>  			memcpy(&msginfo->response.version_response,
>  			      version_response,
>  			      sizeof(struct vmbus_channel_version_response));
> -			osd_waitevent_set(msginfo->waitevent);
> +			msginfo->wait_condition = 1;
> +			wake_up(&msginfo->waitevent);
>  		}
>  	}
>  	spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);

regards,
-- 
js

  reply	other threads:[~2011-02-15  9:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-11 17:59 K. Y. Srinivasan
2011-02-15  9:20 ` Jiri Slaby [this message]
2011-02-15 13:35   ` KY Srinivasan
2011-02-15 14:03     ` Greg KH
2011-02-15 16:22       ` KY Srinivasan
2011-02-15 16:29         ` Greg KH
2011-02-15 17:52           ` KY Srinivasan
2011-02-15 18:44             ` Dmitry Torokhov

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=4D5A4565.5030501@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@suse.de \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.osdl.org \
    --subject='Re: [PATCH 2/3]: Staging: hv: Use native wait primitives' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).