From: Peter Dinda Date: Sun, 4 Aug 2013 22:16:02 +0000 (-0500) Subject: Polling changes in host devices and keyed stream X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=5c40a15de52c320b70c94331e482b25fdcf768c4 Polling changes in host devices and keyed stream --- diff --git a/linux_module/iface-host-dev.c b/linux_module/iface-host-dev.c index 86b0e0c..b9d754d 100644 --- a/linux_module/iface-host-dev.c +++ b/linux_module/iface-host-dev.c @@ -301,6 +301,10 @@ static unsigned int host_dev_poll(struct file * filp, palacios_spinlock_lock_irqsave(&(dev->lock),f); + + // register ourselves on the user wait queue + poll_wait(filp, &(dev->user_wait_queue), poll_tb); + if (dev->waiting) { // Yes, we have a request if you want it! palacios_spinlock_unlock_irqrestore(&(dev->lock),f); @@ -310,9 +314,6 @@ static unsigned int host_dev_poll(struct file * filp, // No request yet, so we need to wait for one to show up. - // register ourselves on the user wait queue - poll_wait(filp, &(dev->user_wait_queue), poll_tb); - palacios_spinlock_unlock_irqrestore(&(dev->lock),f); DEEP_DEBUG_PRINT("palacios: hostdev: poll delayed\n"); diff --git a/linux_module/iface-keyed-stream.c b/linux_module/iface-keyed-stream.c index 3fa8ebe..3b36d6a 100644 --- a/linux_module/iface-keyed-stream.c +++ b/linux_module/iface-keyed-stream.c @@ -1759,12 +1759,12 @@ static unsigned int keyed_stream_poll_user(struct file *filp, poll_table *wait) palacios_spinlock_lock_irqsave(&(s->lock), flags); + poll_wait(filp, &(s->user_wait_queue), wait); + if (s->waiting) { palacios_spinlock_unlock_irqrestore(&(s->lock), flags); return POLLIN | POLLRDNORM; } - - poll_wait(filp, &(s->user_wait_queue), wait); palacios_spinlock_unlock_irqrestore(&(s->lock), flags);