public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] debugfs: Add simple min/max "files" to debugfs to fix sched debug code.
@ 2023-05-30 19:40 chris hyser
  2023-05-30 19:40 ` [PATCH 1/4] debugfs: return EINVAL if write to unsigned simple files exceed storage chris hyser
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: chris hyser @ 2023-05-30 19:40 UTC (permalink / raw)
  To: chris.hyser, linux-kernel, peterz, gregkh, Rafael J. Wysocki

v2:
Apologies. I sent this the first time without including lkml.

v1:
This originally started as an attempt to solve a divide by zero issue in sched
debug code that was introduced when a sysctl value with non-zero checking was
moved to a simple u32 debugfs file. In looking at ways to solve this, it was
mentioned I should look at providing general debugfs files with min/max
checking. 

One problem was that a check for greater than zero for say a u8 succeeds for a
number like 256 (but stores a zero anyway) as the upper bits that don't fit into
storage are silently dropped. Therefore values greater than the storage capacity
must also fail. Getting an error when what the user wrote is not what was
actually stored, seems like a useful requirement for the other simple files and
so I moved the check into there.

To enable easy testing, a test module and test script are provided which can
validate the new functions as well as check the new limits on the older
functions. This was stuck under selftests, but it is not currently tied into the
testing infrastructure.

 Documentation/filesystems/debugfs.rst          |  47 +++++++++++++++--
 fs/debugfs/file.c                              | 195 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/debugfs.h                        |  60 +++++++++++++++++++++
 kernel/sched/debug.c                           |   9 +++-
 tools/testing/selftests/debugfs/Makefile       |  15 ++++++
 tools/testing/selftests/debugfs/minmax_test.c  | 140 +++++++++++++++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/debugfs/test_minmax.sh | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 609 insertions(+), 4 deletions(-)




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

end of thread, other threads:[~2023-05-30 22:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-30 19:40 [PATCH v2 0/4] debugfs: Add simple min/max "files" to debugfs to fix sched debug code chris hyser
2023-05-30 19:40 ` [PATCH 1/4] debugfs: return EINVAL if write to unsigned simple files exceed storage chris hyser
2023-05-30 20:14   ` Greg KH
2023-05-30 21:20     ` chris hyser
2023-05-30 19:40 ` [PATCH 2/4] debugfs: Provide min/max checking for simple u8, u16, u32, u64 debugfs files chris hyser
2023-05-30 19:40 ` [PATCH 3/4] debugfs: provide testing for the min/max simple debug files chris hyser
2023-05-30 19:40 ` [PATCH 4/4] sched/numa: Fix divide by zero for sysctl_numa_balancing_scan_size chris hyser
2023-05-30 20:18 ` [PATCH v2 0/4] debugfs: Add simple min/max "files" to debugfs to fix sched debug code Greg KH
2023-05-30 21:41   ` chris hyser
2023-05-30 22:24     ` chris hyser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox