Skip to content

Commit 6169ec3

Browse files
committed
pci: document potential contention on PCI bus lock
We have a single lock for all devices on the PCI bus that serializes reads and writes on the devices' PCI configuration space and BARs. This should not be a problem at the moment. It should be out of any hot path and only up until we are setting up devices. However, add a comment that mentions the existence of the contention so that we keep it in mind for the futuer (and maybe perform some profiling). Signed-off-by: Babis Chalios <[email protected]>
1 parent 431d77e commit 6169ec3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/pci/src/bus.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ impl PciConfigIo {
161161
return 0xffff_ffff;
162162
}
163163

164+
// NOTE: Potential contention among vCPU threads on this lock. This should not
165+
// be a problem currently, since we mainly access this when we are setting up devices.
166+
// We might want to do some profiling to ensure this does not become a bottleneck.
164167
self.pci_bus
165168
.as_ref()
166169
.lock()
@@ -195,6 +198,9 @@ impl PciConfigIo {
195198
return None;
196199
}
197200

201+
// NOTE: Potential contention among vCPU threads on this lock. This should not
202+
// be a problem currently, since we mainly access this when we are setting up devices.
203+
// We might want to do some profiling to ensure this does not become a bottleneck.
198204
let pci_bus = self.pci_bus.as_ref().lock().unwrap();
199205
if let Some(d) = pci_bus.devices.get(&(device as u32)) {
200206
let mut device = d.lock().unwrap();

0 commit comments

Comments
 (0)