* [PATCH] Drivers: hv: hv_fcopy: fix a race condition for SMP guest
@ 2014-07-16 7:00 Dexuan Cui
2014-07-16 13:12 ` KY Srinivasan
0 siblings, 1 reply; 2+ messages in thread
From: Dexuan Cui @ 2014-07-16 7:00 UTC (permalink / raw)
To: gregkh, linux-kernel, driverdev-devel, olaf, apw, jasowang; +Cc: kys, haiyangz
We should schedule the 5s "timer work" before starting the data transfer,
otherwise, the data transfer code may finish so fast on another
virtual cpu that when the code(fcopy_write()) trying to cancel the 5s
"timer work" can occasionally fail because the "timer work" may haven't
been scheduled yet and as a result the fcopy process will be aborted
wrongly by fcopy_work_func() in 5s.
Thank Liz Zhang <lizzha@microsoft.com> for the initial investigation
on the bug.
This addresses https://bugzilla.redhat.com/show_bug.cgi?id=1118123
Tested-by: Liz Zhang <lizzha@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
drivers/hv/hv_fcopy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c
index eaaa3d8..23b2ce2 100644
--- a/drivers/hv/hv_fcopy.c
+++ b/drivers/hv/hv_fcopy.c
@@ -246,8 +246,8 @@ void hv_fcopy_onchannelcallback(void *context)
/*
* Send the information to the user-level daemon.
*/
- fcopy_send_data();
schedule_delayed_work(&fcopy_work, 5*HZ);
+ fcopy_send_data();
return;
}
icmsghdr->icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] Drivers: hv: hv_fcopy: fix a race condition for SMP guest
2014-07-16 7:00 [PATCH] Drivers: hv: hv_fcopy: fix a race condition for SMP guest Dexuan Cui
@ 2014-07-16 13:12 ` KY Srinivasan
0 siblings, 0 replies; 2+ messages in thread
From: KY Srinivasan @ 2014-07-16 13:12 UTC (permalink / raw)
To: Dexuan Cui, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org,
driverdev-devel@linuxdriverproject.org, olaf@aepfle.de,
apw@canonical.com, jasowang@redhat.com
Cc: Haiyang Zhang
> -----Original Message-----
> From: Dexuan Cui [mailto:decui@microsoft.com]
> Sent: Wednesday, July 16, 2014 12:01 AM
> To: gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org; driverdev-
> devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com;
> jasowang@redhat.com
> Cc: KY Srinivasan; Haiyang Zhang
> Subject: [PATCH] Drivers: hv: hv_fcopy: fix a race condition for SMP guest
>
> We should schedule the 5s "timer work" before starting the data transfer,
> otherwise, the data transfer code may finish so fast on another virtual cpu
> that when the code(fcopy_write()) trying to cancel the 5s "timer work" can
> occasionally fail because the "timer work" may haven't been scheduled yet
> and as a result the fcopy process will be aborted wrongly by
> fcopy_work_func() in 5s.
>
> Thank Liz Zhang <lizzha@microsoft.com> for the initial investigation on the
> bug.
>
> This addresses https://bugzilla.redhat.com/show_bug.cgi?id=1118123
>
> Tested-by: Liz Zhang <lizzha@microsoft.com>
> Cc: K. Y. Srinivasan <kys@microsoft.com>
> Cc: Haiyang Zhang <haiyangz@microsoft.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
Thanks Dexuan.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
K. Y
> ---
> drivers/hv/hv_fcopy.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c index
> eaaa3d8..23b2ce2 100644
> --- a/drivers/hv/hv_fcopy.c
> +++ b/drivers/hv/hv_fcopy.c
> @@ -246,8 +246,8 @@ void hv_fcopy_onchannelcallback(void *context)
> /*
> * Send the information to the user-level daemon.
> */
> - fcopy_send_data();
> schedule_delayed_work(&fcopy_work, 5*HZ);
> + fcopy_send_data();
> return;
> }
> icmsghdr->icflags = ICMSGHDRFLAG_TRANSACTION |
> ICMSGHDRFLAG_RESPONSE;
> --
> 1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-16 13:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-16 7:00 [PATCH] Drivers: hv: hv_fcopy: fix a race condition for SMP guest Dexuan Cui
2014-07-16 13:12 ` KY Srinivasan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox