archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] selftests: add a new test driver for sysfs
@ 2021-07-02  5:05 Luis Chamberlain
  2021-07-02  5:05 ` [PATCH 1/4] selftests: add tests_sysfs module Luis Chamberlain
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Luis Chamberlain @ 2021-07-02  5:05 UTC (permalink / raw)
  To: gregkh, tj, shuah, akpm, rafael, davem, kuba, ast, andriin,
	daniel, atenart, alobakin, weiwan, ap420073
  Cc: jeyu, ngupta,, minchan, mcgrof, axboe,
	mbenes, jpoimboe, tglx, keescook, jikos, rostedt, peterz,
	linux-block, netdev, linux-kselftest, linux-kernel

I had posted a patch to fix a theoretical race with sysfs and device
removal [0].  While the issue is no longer present with the patch
present, the zram driver has already a lot of enhancements, so much so,
that the race alone is very difficult to reproduce. Likewise, the zram
driver had a series of other races on module removal which I recently
posted fixes for [1], and it makes it unclear if these paper over the
possible theoretical sysfs race. Although we even have gdb output
from an actual race where this issue presented itself, there are
other races which could happen before that and so what we realy need
is a clean separate driver where we can experiment and try to reproduce
unusual races.

This adds such a driver, a new sysfs_test driver, along with a set of
new tests for it. We take hint of observed issues with the sysfs on the
zram driver, and build sandbox based where wher can try to poke holes at
the kernel with.

There are two main races we're after trying to reproduce:

  1) proving the deadlock is real
  2) allowing for enough slack for us to try to see if we can
     reproduce the syfs / device removal race

In order to tackle the second race, we need a bit of help from kernefs,
given that the race is difficult to reproduce. So we add fault injection
support to kernfs, which allows us to trigger all possible races on

This should be enough evidence for us to drop the suggested patch for
sysfs for the second race. The first race however which leads to a
deadlock is clearly explained now and I hope this shows how we need a
generic solution.


Luis Chamberlain (4):
  selftests: add tests_sysfs module
  kernfs: add initial failure injection support
  test_sysfs: add support to use kernfs failure injection
  test_sysfs: demonstrate deadlock fix

 .../fault-injection/fault-injection.rst       |   22 +
 MAINTAINERS                                   |    9 +-
 fs/kernfs/Makefile                            |    1 +
 fs/kernfs/failure-injection.c                 |   82 +
 fs/kernfs/file.c                              |   13 +
 fs/kernfs/kernfs-internal.h                   |   73 +
 include/linux/kernfs.h                        |    5 +
 lib/Kconfig.debug                             |   23 +
 lib/Makefile                                  |    1 +
 lib/test_sysfs.c                              | 1037 +++++++++++++
 tools/testing/selftests/sysfs/Makefile        |   12 +
 tools/testing/selftests/sysfs/config          |    5 +
 tools/testing/selftests/sysfs/        | 1376 +++++++++++++++++
 13 files changed, 2658 insertions(+), 1 deletion(-)
 create mode 100644 fs/kernfs/failure-injection.c
 create mode 100644 lib/test_sysfs.c
 create mode 100644 tools/testing/selftests/sysfs/Makefile
 create mode 100644 tools/testing/selftests/sysfs/config
 create mode 100755 tools/testing/selftests/sysfs/


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-07-04 20:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-02  5:05 [PATCH 0/4] selftests: add a new test driver for sysfs Luis Chamberlain
2021-07-02  5:05 ` [PATCH 1/4] selftests: add tests_sysfs module Luis Chamberlain
2021-07-02  5:21   ` Greg KH
2021-07-02 19:02     ` Luis Chamberlain
2021-07-03  4:46       ` Greg KH
2021-07-03 15:52         ` Luis Chamberlain
2021-07-04 20:26           ` Richard Fontana
2021-07-02  5:05 ` [PATCH 2/4] kernfs: add initial failure injection support Luis Chamberlain
2021-07-02  5:05 ` [PATCH 3/4] test_sysfs: add support to use kernfs failure injection Luis Chamberlain
2021-07-02  5:05 ` [PATCH 4/4] test_sysfs: demonstrate deadlock fix Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).