From owner-svn-src-stable@freebsd.org Fri Dec 18 14:52:13 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF8FDA4B521; Fri, 18 Dec 2015 14:52:13 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 778071CE1; Fri, 18 Dec 2015 14:52:13 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBIEqCXn014952; Fri, 18 Dec 2015 14:52:12 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBIEqC5N014951; Fri, 18 Dec 2015 14:52:12 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201512181452.tBIEqC5N014951@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Fri, 18 Dec 2015 14:52:12 +0000 (UTC) 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 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Dec 2015 14:52:13 -0000 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 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 #include #include +#include #include #include #include @@ -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);