This repository has been archived by the owner on May 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 113
Handle PCI paths consistently and more generally #855
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dgibson
added
do-not-merge
PR has problems or depends on another
needs-forward-port
Changes need to be applied to a newer branch / repository
no-backport-needed
Changed do not need to be applied to an older branch / repository
labels
Oct 7, 2020
/test-vfio |
2 similar comments
/test-vfio |
/test-vfio |
c3d
approved these changes
Oct 7, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Two questions, just to educate myself.
dgibson
added
the
wip
Work in Progress (PR incomplete - needs more work or rework)
label
Oct 7, 2020
/test-vfio |
2 similar comments
/test-vfio |
/test-vfio |
dgibson
changed the title
Handle PCI paths consistently
Handle PCI paths consistently and more generally
Oct 7, 2020
/test-vfio |
1 similar comment
/test-vfio |
dgibson
added
wip
Work in Progress (PR incomplete - needs more work or rework)
and removed
do-not-merge
PR has problems or depends on another
wip
Work in Progress (PR incomplete - needs more work or rework)
labels
Oct 7, 2020
/test-vfio |
thanks @dgibson - lgtm but travis is failing
|
/retest-vfio |
now a different error 🤓
|
getDevicePCIAddress() has pretty confusing semantics. Both its input and output are in other parts of the code described as a "PCI address", but neither is *actually* a PCI address (in the standard DDDD:BB:DD.F format). What it's really about is resolving a "PCI path" - that is way to locate a PCI device by using it's slot number and the slot number of the bridge leading to it - into a sysfs path. Rename the function, and change a bunch of variable names to make those semantics clearer. Signed-off-by: David Gibson <[email protected]>
/test-vfio |
pciPathToSysfs takes a PCI path, with a particular format. A number of places implicitly need strings in that format, many of them repeat the description. To make things safer and briefer create a newtype wrapper for strings in this format, and just describe the internals at the type definition. Then, update variable names and comments throughout to call things in this format "PCI path", rather than "PCI identifier", which is vague or "PCI address" which is just plain wrong. Likewise we change names and comments which incorrectly refer to sysfs paths as a "PCI address". This changes the grpc proto definitions, but because it's just changing the name of a field without changing the field number, it shouldn't change the actual protocol. It also trivially changes the copyright notice, because Travis whinges otherwise. Signed-off-by: David Gibson <[email protected]>
This does some general reorganization of TestPciPathToSysfs. It tests the same things (plus a few trivial extras), but is set out in a way that will be easier to extend when we broaden the allowed pciPath values we accept. It also removes some intermediate variables that seemed to make things harder rather than easier to follow. Signed-off-by: David Gibson <[email protected]>
Currently pciPathToSysfsImpl, which translates PCI paths into sysfs paths accepts only pci paths with exactly 2 components; which represents PCI devices separated from the root bus by exactly one PCI to PCI bridge (which could be a virtual P2P bridge, such as a PCI-E root port). There are cases we might reasonably want to support which have devices either plugged directly into the root bus (zero bridges), or under multiple layers of P2P bridge (a PCI-E switch would require at least 2 layers). So, generalize pciPathToSysfs to support any number of components in the PCI path. We need to adjust some tests to match, not only because of the intended change in behaviour, but also because the new version probes sysfs a bit differently, so we need to mock things to match. fixes #854 Signed-off-by: David Gibson <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #855 +/- ##
==========================================
- Coverage 57.85% 57.80% -0.06%
==========================================
Files 17 17
Lines 2373 2370 -3
==========================================
- Hits 1373 1370 -3
Misses 839 839
Partials 161 161 |
/test-vfio |
dgibson
removed
the
wip
Work in Progress (PR incomplete - needs more work or rework)
label
Oct 8, 2020
/test |
Restarted Debian CI which timed out. Also restarted the CentOS one but I think we may have seen this issue before @GabyCT?
|
devimc
approved these changes
Oct 8, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @dgibson
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
needs-forward-port
Changes need to be applied to a newer branch / repository
no-backport-needed
Changed do not need to be applied to an older branch / repository
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This series is designed to change the agent to handle PCI paths more consistently, see issue #854 for more information.