Commit dcd79ed
KVM: arm64: Use standard seq_file iterator for idregs debugfs
The current implementation uses `idreg_debugfs_iter` in `struct
kvm_arch` to track the sequence position. This effectively makes the
iterator shared across all open file descriptors for the VM.
This approach has significant drawbacks:
- It enforces mutual exclusion, preventing concurrent reads of the
debugfs file (returning -EBUSY).
- It relies on storing transient iterator state in the long-lived VM
structure (`kvm_arch`).
- The use of `u8` for the iterator index imposes an implicit limit of
255 registers. While not currently exceeded, this is fragile against
future architectural growth. Switching to `loff_t` eliminates this
overflow risk.
Refactor the implementation to use the standard `seq_file` iterator.
Instead of storing state in `kvm_arch`, rely on the `pos` argument
passed to the `start` and `next` callbacks, which tracks the logical
index specific to the file descriptor.
This change enables concurrent access and eliminates the
`idreg_debugfs_iter` field from `struct kvm_arch`.
Signed-off-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20260202085721.3954942-2-tabba@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>1 parent 9ace475 commit dcd79ed
2 files changed
Lines changed: 8 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | 376 | | |
380 | 377 | | |
381 | 378 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4992 | 4992 | | |
4993 | 4993 | | |
4994 | 4994 | | |
4995 | | - | |
| 4995 | + | |
4996 | 4996 | | |
4997 | 4997 | | |
4998 | 4998 | | |
| |||
5002 | 5002 | | |
5003 | 5003 | | |
5004 | 5004 | | |
5005 | | - | |
| 5005 | + | |
5006 | 5006 | | |
5007 | | - | |
5008 | | - | |
5009 | 5007 | | |
5010 | 5008 | | |
5011 | 5009 | | |
| |||
5014 | 5012 | | |
5015 | 5013 | | |
5016 | 5014 | | |
5017 | | - | |
5018 | | - | |
5019 | | - | |
5020 | | - | |
5021 | | - | |
5022 | | - | |
5023 | | - | |
5024 | | - | |
5025 | | - | |
5026 | | - | |
5027 | | - | |
5028 | | - | |
5029 | | - | |
5030 | 5015 | | |
5031 | | - | |
| 5016 | + | |
| 5017 | + | |
5032 | 5018 | | |
5033 | | - | |
| 5019 | + | |
5034 | 5020 | | |
5035 | 5021 | | |
5036 | 5022 | | |
| |||
5039 | 5025 | | |
5040 | 5026 | | |
5041 | 5027 | | |
5042 | | - | |
5043 | | - | |
5044 | | - | |
5045 | | - | |
5046 | | - | |
5047 | | - | |
5048 | | - | |
| 5028 | + | |
5049 | 5029 | | |
5050 | 5030 | | |
5051 | 5031 | | |
5052 | 5032 | | |
5053 | | - | |
5054 | | - | |
5055 | | - | |
5056 | | - | |
5057 | | - | |
5058 | | - | |
5059 | | - | |
5060 | | - | |
5061 | | - | |
5062 | | - | |
5063 | 5033 | | |
5064 | 5034 | | |
5065 | 5035 | | |
5066 | 5036 | | |
5067 | | - | |
| 5037 | + | |
5068 | 5038 | | |
5069 | 5039 | | |
5070 | | - | |
5071 | | - | |
5072 | | - | |
| 5040 | + | |
5073 | 5041 | | |
5074 | 5042 | | |
5075 | 5043 | | |
| |||
5089 | 5057 | | |
5090 | 5058 | | |
5091 | 5059 | | |
5092 | | - | |
5093 | | - | |
5094 | 5060 | | |
5095 | 5061 | | |
5096 | 5062 | | |
| |||
0 commit comments