summaryrefslogtreecommitdiffstats
path: root/drivers/vhost
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-01-30 20:58:07 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-01-30 20:58:07 -0500
commit168fe32a072a4b8dc81a3aebf0e5e588d38e2955 (patch)
tree297f0f6192256785979f5ebfb92797f81754548d /drivers/vhost
parent13ddd1667e7f01071cdf120132238ffca004a88e (diff)
parentc71d227fc4133f949dae620ed5e3a250b43f2415 (diff)
Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull poll annotations from Al Viro: "This introduces a __bitwise type for POLL### bitmap, and propagates the annotations through the tree. Most of that stuff is as simple as 'make ->poll() instances return __poll_t and do the same to local variables used to hold the future return value'. Some of the obvious brainos found in process are fixed (e.g. POLLIN misspelled as POLL_IN). At that point the amount of sparse warnings is low and most of them are for genuine bugs - e.g. ->poll() instance deciding to return -EINVAL instead of a bitmap. I hadn't touched those in this series - it's large enough as it is. Another problem it has caught was eventpoll() ABI mess; select.c and eventpoll.c assumed that corresponding POLL### and EPOLL### were equal. That's true for some, but not all of them - EPOLL### are arch-independent, but POLL### are not. The last commit in this series separates userland POLL### values from the (now arch-independent) kernel-side ones, converting between them in the few places where they are copied to/from userland. AFAICS, this is the least disruptive fix preserving poll(2) ABI and making epoll() work on all architectures. As it is, it's simply broken on sparc - try to give it EPOLLWRNORM and it will trigger only on what would've triggered EPOLLWRBAND on other architectures. EPOLLWRBAND and EPOLLRDHUP, OTOH, are never triggered at all on sparc. With this patch they should work consistently on all architectures" * 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (37 commits) make kernel-side POLL... arch-independent eventpoll: no need to mask the result of epi_item_poll() again eventpoll: constify struct epoll_event pointers debugging printk in sg_poll() uses %x to print POLL... bitmap annotate poll(2) guts 9p: untangle ->poll() mess ->si_band gets POLL... bitmap stored into a user-visible long field ring_buffer_poll_wait() return value used as return value of ->poll() the rest of drivers/*: annotate ->poll() instances media: annotate ->poll() instances fs: annotate ->poll() instances ipc, kernel, mm: annotate ->poll() instances net: annotate ->poll() instances apparmor: annotate ->poll() instances tomoyo: annotate ->poll() instances sound: annotate ->poll() instances acpi: annotate ->poll() instances crypto: annotate ->poll() instances block: annotate ->poll() instances x86: annotate ->poll() instances ...
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/net.c2
-rw-r--r--drivers/vhost/vhost.c12
-rw-r--r--drivers/vhost/vhost.h6
3 files changed, 10 insertions, 10 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index c7bdeb655646..9524ee16878a 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -1353,7 +1353,7 @@ static ssize_t vhost_net_chr_write_iter(struct kiocb *iocb,
1353 return vhost_chr_write_iter(dev, from); 1353 return vhost_chr_write_iter(dev, from);
1354} 1354}
1355 1355
1356static unsigned int vhost_net_chr_poll(struct file *file, poll_table *wait) 1356static __poll_t vhost_net_chr_poll(struct file *file, poll_table *wait)
1357{ 1357{
1358 struct vhost_net *n = file->private_data; 1358 struct vhost_net *n = file->private_data;
1359 struct vhost_dev *dev = &n->dev; 1359 struct vhost_dev *dev = &n->dev;
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index e6bb0946d6e9..8d4374606756 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -170,7 +170,7 @@ static int vhost_poll_wakeup(wait_queue_entry_t *wait, unsigned mode, int sync,
170{ 170{
171 struct vhost_poll *poll = container_of(wait, struct vhost_poll, wait); 171 struct vhost_poll *poll = container_of(wait, struct vhost_poll, wait);
172 172
173 if (!((unsigned long)key & poll->mask)) 173 if (!(key_to_poll(key) & poll->mask))
174 return 0; 174 return 0;
175 175
176 vhost_poll_queue(poll); 176 vhost_poll_queue(poll);
@@ -187,7 +187,7 @@ EXPORT_SYMBOL_GPL(vhost_work_init);
187 187
188/* Init poll structure */ 188/* Init poll structure */
189void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn, 189void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
190 unsigned long mask, struct vhost_dev *dev) 190 __poll_t mask, struct vhost_dev *dev)
191{ 191{
192 init_waitqueue_func_entry(&poll->wait, vhost_poll_wakeup); 192 init_waitqueue_func_entry(&poll->wait, vhost_poll_wakeup);
193 init_poll_funcptr(&poll->table, vhost_poll_func); 193 init_poll_funcptr(&poll->table, vhost_poll_func);
@@ -203,7 +203,7 @@ EXPORT_SYMBOL_GPL(vhost_poll_init);
203 * keep a reference to a file until after vhost_poll_stop is called. */ 203 * keep a reference to a file until after vhost_poll_stop is called. */
204int vhost_poll_start(struct vhost_poll *poll, struct file *file) 204int vhost_poll_start(struct vhost_poll *poll, struct file *file)
205{ 205{
206 unsigned long mask; 206 __poll_t mask;
207 int ret = 0; 207 int ret = 0;
208 208
209 if (poll->wqh) 209 if (poll->wqh)
@@ -211,7 +211,7 @@ int vhost_poll_start(struct vhost_poll *poll, struct file *file)
211 211
212 mask = file->f_op->poll(file, &poll->table); 212 mask = file->f_op->poll(file, &poll->table);
213 if (mask) 213 if (mask)
214 vhost_poll_wakeup(&poll->wait, 0, 0, (void *)mask); 214 vhost_poll_wakeup(&poll->wait, 0, 0, poll_to_key(mask));
215 if (mask & POLLERR) { 215 if (mask & POLLERR) {
216 if (poll->wqh) 216 if (poll->wqh)
217 remove_wait_queue(poll->wqh, &poll->wait); 217 remove_wait_queue(poll->wqh, &poll->wait);
@@ -1061,10 +1061,10 @@ done:
1061} 1061}
1062EXPORT_SYMBOL(vhost_chr_write_iter); 1062EXPORT_SYMBOL(vhost_chr_write_iter);
1063 1063
1064unsigned int vhost_chr_poll(struct file *file, struct vhost_dev *dev, 1064__poll_t vhost_chr_poll(struct file *file, struct vhost_dev *dev,
1065 poll_table *wait) 1065 poll_table *wait)
1066{ 1066{
1067 unsigned int mask = 0; 1067 __poll_t mask = 0;
1068 1068
1069 poll_wait(file, &dev->wait, wait); 1069 poll_wait(file, &dev->wait, wait);
1070 1070
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 79c6e7a60a5e..7876a3d7d1b3 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -34,7 +34,7 @@ struct vhost_poll {
34 wait_queue_head_t *wqh; 34 wait_queue_head_t *wqh;
35 wait_queue_entry_t wait; 35 wait_queue_entry_t wait;
36 struct vhost_work work; 36 struct vhost_work work;
37 unsigned long mask; 37 __poll_t mask;
38 struct vhost_dev *dev; 38 struct vhost_dev *dev;
39}; 39};
40 40
@@ -43,7 +43,7 @@ void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work);
43bool vhost_has_work(struct vhost_dev *dev); 43bool vhost_has_work(struct vhost_dev *dev);
44 44
45void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn, 45void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
46 unsigned long mask, struct vhost_dev *dev); 46 __poll_t mask, struct vhost_dev *dev);
47int vhost_poll_start(struct vhost_poll *poll, struct file *file); 47int vhost_poll_start(struct vhost_poll *poll, struct file *file);
48void vhost_poll_stop(struct vhost_poll *poll); 48void vhost_poll_stop(struct vhost_poll *poll);
49void vhost_poll_flush(struct vhost_poll *poll); 49void vhost_poll_flush(struct vhost_poll *poll);
@@ -217,7 +217,7 @@ void vhost_enqueue_msg(struct vhost_dev *dev,
217 struct vhost_msg_node *node); 217 struct vhost_msg_node *node);
218struct vhost_msg_node *vhost_dequeue_msg(struct vhost_dev *dev, 218struct vhost_msg_node *vhost_dequeue_msg(struct vhost_dev *dev,
219 struct list_head *head); 219 struct list_head *head);
220unsigned int vhost_chr_poll(struct file *file, struct vhost_dev *dev, 220__poll_t vhost_chr_poll(struct file *file, struct vhost_dev *dev,
221 poll_table *wait); 221 poll_table *wait);
222ssize_t vhost_chr_read_iter(struct vhost_dev *dev, struct iov_iter *to, 222ssize_t vhost_chr_read_iter(struct vhost_dev *dev, struct iov_iter *to,
223 int noblock); 223 int noblock);