Repository navigation
Commit d783e0b
nvme: avoid cqe corruption when update at the same time as read
Make sure the CQE phase (validity) is read before the rest of the
structure. The phase bit is the highest address and the CQE
read will happen on most platforms from lower to upper addresses
and will be done by multiple non-atomic loads. If the structure
is updated by PCI during the reads from the processor, the
processor may get a corrupted copy.
The addition of the new nvme_cqe_valid function that verifies
the validity bit also allows refactoring of the other CQE read
sequences.
Signed-off-by: Marta Rybczynska <marta.rybczynska@kalray.eu>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>1 parent aaf2559 commit d783e0b
1 file changed
Lines changed: 13 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
723 | 723 | | |
724 | 724 | | |
725 | 725 | | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
726 | 733 | | |
727 | 734 | | |
728 | 735 | | |
729 | 736 | | |
730 | 737 | | |
731 | 738 | | |
732 | 739 | | |
733 | | - | |
| 740 | + | |
734 | 741 | | |
735 | | - | |
736 | 742 | | |
737 | 743 | | |
738 | | - | |
739 | | - | |
740 | 744 | | |
741 | 745 | | |
742 | 746 | | |
| |||
767 | 771 | | |
768 | 772 | | |
769 | 773 | | |
770 | | - | |
| 774 | + | |
771 | 775 | | |
772 | 776 | | |
773 | 777 | | |
| |||
808 | 812 | | |
809 | 813 | | |
810 | 814 | | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
815 | 818 | | |
816 | 819 | | |
817 | 820 | | |
818 | 821 | | |
819 | 822 | | |
820 | 823 | | |
821 | | - | |
822 | | - | |
| 824 | + | |
823 | 825 | | |
824 | 826 | | |
825 | 827 | | |
| |||
0 commit comments