Commit 5ab2496
KVM: arm64: Reimplement vgic-debug XArray iteration
The vgic-debug interface implementation uses XArray marks
(`LPI_XA_MARK_DEBUG_ITER`) to "snapshot" LPIs at the start of iteration.
This modifies global state for a read-only operation and complicates
reference counting, leading to leaks if iteration is aborted or fails.
Reimplement the iterator to use dynamic iteration logic:
- Remove `lpi_idx` from `struct vgic_state_iter`.
- Replace the XArray marking mechanism with dynamic iteration using
`xa_find_after(..., XA_PRESENT)`.
- Wrap XArray traversals in `rcu_read_lock()`/`rcu_read_unlock()` to
ensure safety against concurrent modifications (e.g., LPI unmapping).
- Handle potential races where an LPI is removed during iteration by
gracefully skipping it in `show()`, rather than warning.
- Remove the unused `LPI_XA_MARK_DEBUG_ITER` definition.
This simplifies the lifecycle management of the iterator and prevents
resource leaks associated with the marking mechanism, and paves the way
for using a standard seq_file iterator.
Signed-off-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20260202085721.3954942-3-tabba@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>1 parent dcd79ed commit 5ab2496
2 files changed
Lines changed: 20 additions & 49 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | | - | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
| |||
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | 67 | | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 71 | + | |
| 72 | + | |
78 | 73 | | |
79 | | - | |
80 | | - | |
81 | | - | |
| 74 | + | |
82 | 75 | | |
83 | 76 | | |
84 | 77 | | |
85 | 78 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | 79 | | |
103 | 80 | | |
104 | 81 | | |
| |||
108 | 85 | | |
109 | 86 | | |
110 | 87 | | |
111 | | - | |
112 | | - | |
113 | 88 | | |
114 | 89 | | |
115 | 90 | | |
| |||
121 | 96 | | |
122 | 97 | | |
123 | 98 | | |
124 | | - | |
| 99 | + | |
125 | 100 | | |
126 | 101 | | |
127 | 102 | | |
| |||
178 | 153 | | |
179 | 154 | | |
180 | 155 | | |
181 | | - | |
182 | 156 | | |
183 | 157 | | |
184 | 158 | | |
| |||
188 | 162 | | |
189 | 163 | | |
190 | 164 | | |
| 165 | + | |
191 | 166 | | |
192 | 167 | | |
193 | 168 | | |
194 | 169 | | |
195 | 170 | | |
196 | 171 | | |
197 | | - | |
| 172 | + | |
198 | 173 | | |
199 | 174 | | |
200 | 175 | | |
| |||
291 | 266 | | |
292 | 267 | | |
293 | 268 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | 269 | | |
299 | 270 | | |
300 | 271 | | |
301 | 272 | | |
302 | | - | |
303 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
304 | 276 | | |
305 | 277 | | |
306 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
304 | 303 | | |
305 | 304 | | |
306 | 305 | | |
| |||
0 commit comments