- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit8e293e6
aio: Make AIO more compatible with valgrind
In some edge cases valgrind flags issues with the memory referenced byIOs. All of the cases addressed in this change are false positives.Most of the false positives are caused by UnpinBuffer[NoOwner] marking bufferdata as inaccessible. This happens even though the AIO subsystem still holds apin. That's good, there shouldn't be accesses to the buffer outside of AIOrelated code until it is pinned by "user" code again. But it requires someexplicit work - if the buffer is not pinned by the current backend, we need toexplicitly mark the buffer data accessible/inaccessible while executingcompletion callbacks.That however causes a cascading issue in IO workers: After the completioncallbacks for a buffer is executed, the page is marked as inaccessible. Ifsubsequently the same worker is executing IO targeting the same buffer, wewould get an error, as the memory is still marked inaccessible. To avoid that,we need to explicitly mark the memory as accessible in IO workers.Another issue is that IO executed in workers or via io_uring will not markmemory as DEFINED. In the case of workers that is because valgrind does nottrack memory definedness across processes. For io_uring that is becausevalgrind does not understand io_uring, and therefore its IOs never mark memoryas defined, whether the completions are processed in the defining process orin another context. It's not entirely clear how to best solve that. Thecurrent user of AIO is not affected, as it explicitly marks buffers as DEFINED& NOACCESS anyway. Defer solving this issue until we have a user withdifferent needs.Per buildfarm animal skink.Reviewed-by: Noah Misch <noah@leadboat.com>Co-authored-by: Noah Misch <noah@leadboat.com>Discussion:https://postgr.es/m/3pd4322mogfmdd5nln3zphdwhtmq3rzdldqjwb2sfqzcgs22lf@ok2gletdaoe61 parent8ab4241 commit8e293e6
File tree
5 files changed
+64
-0
lines changed- src
- backend/storage
- aio
- buffer
- smgr
- include/storage
5 files changed
+64
-0
lines changedLines changed: 23 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
210 | 210 |
| |
211 | 211 |
| |
212 | 212 |
| |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + |
Lines changed: 19 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
| 45 | + | |
45 | 46 |
| |
46 | 47 |
| |
47 | 48 |
| |
| |||
529 | 530 |
| |
530 | 531 |
| |
531 | 532 |
| |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
532 | 551 |
| |
533 | 552 |
| |
534 | 553 |
| |
|
Lines changed: 19 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6881 | 6881 |
| |
6882 | 6882 |
| |
6883 | 6883 |
| |
| 6884 | + | |
| 6885 | + | |
| 6886 | + | |
| 6887 | + | |
| 6888 | + | |
| 6889 | + | |
| 6890 | + | |
| 6891 | + | |
| 6892 | + | |
| 6893 | + | |
| 6894 | + | |
| 6895 | + | |
| 6896 | + | |
6884 | 6897 |
| |
6885 | 6898 |
| |
6886 | 6899 |
| |
| |||
6899 | 6912 |
| |
6900 | 6913 |
| |
6901 | 6914 |
| |
| 6915 | + | |
| 6916 | + | |
| 6917 | + | |
| 6918 | + | |
| 6919 | + | |
| 6920 | + | |
6902 | 6921 |
| |
6903 | 6922 |
| |
6904 | 6923 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
746 | 746 |
| |
747 | 747 |
| |
748 | 748 |
| |
| 749 | + | |
| 750 | + | |
749 | 751 |
| |
750 | 752 |
| |
751 | 753 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
344 | 344 |
| |
345 | 345 |
| |
346 | 346 |
| |
| 347 | + | |
347 | 348 |
| |
348 | 349 |
| |
349 | 350 |
| |
|
0 commit comments
Comments
(0)