lkml.org 
[lkml]   [2015]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 4/5] hv: kvp: use wrappers to propaigate state
Date


> -----Original Message-----
> From: Olaf Hering [mailto:olaf@aepfle.de]
> Sent: Monday, September 21, 2015 3:18 AM
> To: KY Srinivasan <kys@microsoft.com>; Greg KH
> <gregkh@linuxfoundation.org>
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> apw@canonical.com; vkuznets@redhat.com; jasowang@redhat.com
> Subject: Re: [PATCH 4/5] hv: kvp: use wrappers to propaigate state
>
> On Sun, Sep 20, Greg KH wrote:
>
> > On Tue, Sep 15, 2015 at 05:37:53PM -0700, K. Y. Srinivasan wrote:
> > > @@ -122,8 +125,8 @@ static void kvp_timeout_func(struct work_struct
> *dummy)
>
> > > + if (kvp_get_state() > HVUTIL_READY)
> > > + kvp_set_state(HVUTIL_READY);
>
> > And what if the state changed the line after this? Oops, your code is
> > hosed. See, you need a lock, do this correctly.
>
> KY, can this happen?

No - the state has to be > HVUTIL_READY. Also, if the timeout fires,
it wins since other contexts will attempt to first cancel the timeout before
proceeding further.

K. Y
>
> Olaf
\
 
 \ /
  Last update: 2015-09-21 18:41    [W:0.093 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site