Date: Fri, 18 Dec 2015 14:52:12 +0000 (UTC) From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= <royger@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292438 - stable/10/sys/dev/hyperv/utilities Message-ID: <201512181452.tBIEqC5N014951@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: royger Date: Fri Dec 18 14:52:12 2015 New Revision: 292438 URL: https://svnweb.freebsd.org/changeset/base/292438 Log: MFC r292258: hyperv/kvp: wake up the daemon if it's sleeping due to poll() Submitted by: Dexuan Cui <decui@microsoft.com> Sponsored by: Microsoft OSTC Modified: stable/10/sys/dev/hyperv/utilities/hv_kvp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_kvp.c Fri Dec 18 14:35:27 2015 (r292437) +++ stable/10/sys/dev/hyperv/utilities/hv_kvp.c Fri Dec 18 14:52:12 2015 (r292438) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include <sys/reboot.h> #include <sys/lock.h> #include <sys/taskqueue.h> +#include <sys/selinfo.h> #include <sys/sysctl.h> #include <sys/poll.h> #include <sys/proc.h> @@ -114,6 +115,8 @@ static struct cdev *hv_kvp_dev; static struct hv_kvp_msg *hv_kvp_dev_buf; struct proc *daemon_task; +static struct selinfo hv_kvp_selinfo; + /* * Global state to track and synchronize multiple * KVP transaction requests from the host. @@ -628,6 +631,9 @@ hv_kvp_send_msg_to_daemon(void) /* Send the msg to user via function deamon_read - setting sema */ sema_post(&kvp_globals.dev_sema); + + /* We should wake up the daemon, in case it's doing poll() */ + selwakeup(&hv_kvp_selinfo); } @@ -940,7 +946,7 @@ hv_kvp_dev_daemon_write(struct cdev *dev * for daemon to read. */ static int -hv_kvp_dev_daemon_poll(struct cdev *dev __unused, int events, struct thread *td __unused) +hv_kvp_dev_daemon_poll(struct cdev *dev __unused, int events, struct thread *td) { int revents = 0; @@ -953,6 +959,9 @@ hv_kvp_dev_daemon_poll(struct cdev *dev */ if (kvp_globals.daemon_busy == true) revents = POLLIN; + else + selrecord(td, &hv_kvp_selinfo); + mtx_unlock(&kvp_globals.pending_mutex); return (revents);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512181452.tBIEqC5N014951>