Commit dcb73cb
Bartosz Golaszewski
gpio: cdev: use raw notifier for line state events
We use a notifier to implement the mechanism of informing the user-space
about changes in GPIO line status. We register with the notifier when
the GPIO character device file is opened and unregister when the last
reference to the associated file descriptor is dropped.
Since commit fcc8b63 ("gpiolib: switch the line state notifier to
atomic") we use the atomic notifier variant. Atomic notifiers call
rcu_synchronize in atomic_notifier_chain_unregister() which caused a
significant performance regression in some circumstances, observed by
user-space when calling close() on the GPIO device file descriptor.
Replace the atomic notifier with the raw variant and provide
synchronization with a read-write spinlock.
Fixes: fcc8b63 ("gpiolib: switch the line state notifier to atomic")
Reported-by: David Jander <david@protonic.nl>
Closes: https://lore.kernel.org/all/20250311110034.53959031@erd003.prtnl/
Tested-by: David Jander <david@protonic.nl>
Tested-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20250311-gpiolib-line-state-raw-notifier-v2-1-138374581e1e@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>1 parent 0102fbf commit dcb73cb
3 files changed
+18
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2729 | 2729 | | |
2730 | 2730 | | |
2731 | 2731 | | |
2732 | | - | |
2733 | | - | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
2734 | 2735 | | |
2735 | 2736 | | |
2736 | 2737 | | |
| |||
2754 | 2755 | | |
2755 | 2756 | | |
2756 | 2757 | | |
2757 | | - | |
2758 | | - | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
2759 | 2761 | | |
2760 | 2762 | | |
2761 | 2763 | | |
| |||
2779 | 2781 | | |
2780 | 2782 | | |
2781 | 2783 | | |
2782 | | - | |
2783 | | - | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
2784 | 2787 | | |
2785 | 2788 | | |
2786 | 2789 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1025 | 1025 | | |
1026 | 1026 | | |
1027 | 1027 | | |
1028 | | - | |
| 1028 | + | |
| 1029 | + | |
1029 | 1030 | | |
1030 | 1031 | | |
1031 | 1032 | | |
| |||
4188 | 4189 | | |
4189 | 4190 | | |
4190 | 4191 | | |
4191 | | - | |
4192 | | - | |
| 4192 | + | |
| 4193 | + | |
| 4194 | + | |
4193 | 4195 | | |
4194 | 4196 | | |
4195 | 4197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
75 | | - | |
| 77 | + | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| |||
0 commit comments