kselftests: introduce new epoll60 testcase for catching lost wakeups
authorRoman Penyaev <rpenyaev@suse.de>
Fri, 8 May 2020 01:36:13 +0000 (18:36 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 May 2020 02:27:21 +0000 (19:27 -0700)
commit474328c06e3ee75bb6b92826fec90fdc8ef3c573
tree76282d78ae14c5384232bc28e9af8299d4b2d636
parent28307d938fb2e4056ed4c982c06d1503d7719813
kselftests: introduce new epoll60 testcase for catching lost wakeups

This test case catches lost wake up introduced by commit 339ddb53d373
("fs/epoll: remove unnecessary wakeups of nested epoll")

The test is simple: we have 10 threads and 10 event fds.  Each thread
can harvest only 1 event.  1 producer fires all 10 events at once and
waits that all 10 events will be observed by 10 threads.

In case of lost wakeup epoll_wait() will timeout and 0 will be returned.

Test case catches two sort of problems: forgotten wakeup on event, which
hits the ->ovflist list, this problem was fixed by:

  5a2513239750 ("eventpoll: fix missing wakeup for ovflist in ep_poll_callback")

the other problem is when several sequential events hit the same waiting
thread, thus other waiters get no wakeups.  Problem is fixed in the
following patch.

Signed-off-by: Roman Penyaev <rpenyaev@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Khazhismel Kumykov <khazhy@google.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Heiher <r@hev.cc>
Cc: Jason Baron <jbaron@akamai.com>
Link: http://lkml.kernel.org/r/20200430130326.1368509-1-rpenyaev@suse.de
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c