-
Notifications
You must be signed in to change notification settings - Fork 10
feat: Hot-swap support added. #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
❌ Build devlib2 1.0.24 failed (commit 14a35d4855 by @jerzyjamroz) |
|
❌ Build devlib2 1.0.25 failed (commit 992c159c72 by @jerzyjamroz) |
|
Introduced global function pointer |
|
❌ Build devlib2 1.0.26 failed (commit 308ff99de5 by @jerzyjamroz) |
|
@jerzyjamroz Do you understand what the UIO driver is doing about the mapped register ranges when a device is removed? Since this PR is not (I think) calling |
|
In terms of API design. Unless the new hot plug callback gets a new/re-enumerated PCI device handle, there is an assumption that the swapped device is actually the exact same card. |
|
... and I think this new callback would need to be per-device. eg. how could a global function pointer work in a situation where one IOC process handles two PCI devices? |
|
Wouldn’t any access to the mmap‘ed device address space cause a bus error when the device is swapped out? |
|
It has been a decade since I looked into the situation in detail. When I last checked, I came to the conclusion that it was not possible to handle PCI hot swap for a UIO device with complete safety. (even getting this right in kernel seemed difficult) I was left with many unanswered questions about the Linux kernel APIs. eg. is a UIO driver allowed to block the remove handler to wait for user space interaction? Can process VM mappings be modified directly without blocking (or at least without syscalls)? Still, if "complete safety" remains out of reach, then maybe the only practical paths forward are do nothing, or depending on what are likely unintended behaviors and documenting with lots of caveats. |
I had this same question, but was not able to find a clear answer. I suspect that at least for classic PCI, the answer is platform (CPU and/or PCI bridge) specific. I would hope that PCIe made this more uniform, but that is only a hope. |
|
I hope it works for the same card type, I mean that I can replace e.g. EVR (not only power cycle it). I will do that test soon. |
Good point, I haven't noticed that and haven't tested this scenario. It can be solved by adding |
|
❌ Build devlib2 1.0.27 failed (commit 62c570679a by @jerzyjamroz) |
Well, I wrote the proposal that works for the scenario written above. I realised now that for EVR (not EVM) it would require triggering |
|
❌ Build devlib2 1.0.28 failed (commit 123ea3acc5 by @jerzyjamroz) |
|
❌ Build devlib2 1.0.29 failed (commit 97c6cb5c3b by @jerzyjamroz) |
|
❌ Build devlib2 1.0.30 failed (commit 4b15c8bd54 by @jerzyjamroz) |
|
❌ Build devlib2 1.0.31 failed (commit 19cff351ba by @jerzyjamroz) |
|
❌ Build devlib2 1.0.32 failed (commit 363a29a0f2 by @jerzyjamroz) |
|
❌ Build devlib2 1.0.33 failed (commit a307eb82ba by @jerzyjamroz) |
|
❌ Build devlib2 1.0.34 failed (commit 564b3ec5a0 by @jerzyjamroz) |
I did the full test (see here), In summary:
|
So the whole structure is exposed, and becomes part of a public API, to allow access to one data member? |
Has autosaved learned some notion of "driver" or "device" for filtering of records? Or are you assuming one device per IOC? |
Was this an IOC with only a single EVR device? I think a more comprehensive testing scenario would have an IOC with at least two EVR/EVM devices, and some other driver as well. eg. some unrelated driver which also makes use of autosave. |
It allows the designer of the |
Good point, I was assuming one device IOC. And, it is a question of how to recover the configuration of EVR. The good thing is that one does not need to do that for the EVM. |
1 x EVM + 1 x EVR
Yes, It would be also good if more people would test it, I think @dirk-zimoch plans to do tests as well. |
|
❌ Build devlib2 1.0.42 failed (commit f05486a20b by @jerzyjamroz) |
|
@mdavidsaver , @dirk-zimoch - do you have any comments on that? I do not see any drawbacks there. The module gains this minimalistic recovery capability (so this pseudo hot-swap). |
|
I disagree with installing |
As previously stated, I think it is unwise to depend on this incompletely specified behavior. |
|
As devlib2 is essentially Michael‘s work, I abstain from any opinion. |
|
@jerzyjamroz I hope you are not discouraged by my earlier comments. Supporting PCI/PCIe hot plugging would certainly be a useful feature. At present this PR seems like a useful tool to study the problems which would be involved, but is far from a finished product. If you have continued interested, I would encourage you to answer some of the following questions. What exactly happens when you pull the ejector tab on a uTCA card? Which Linux driver handles notification to effected PCI devices? In what context are these notifications delivered? (task?, ISR?) What can be safely done in such a callback? Can it block for further events? Interact with userspace processes? What happens to concurrent PCI operations? |
|
@mdavidsaver , OK I will change this PR as draft for eventual future analysis. |
@mdavidsaver , The feature was tested with:
EVMand mrfioc2 IOC – everything works fine. One can power down and up the EVM card, and the IOC does not require any reboot. It just works.EVRand mrfioc2 IOC - it works almost ok except it reports errors for:Pll-Stsand the timestampingTimeValid-Sts. In order to recover the IOC fully, the IOC reboot is required (probably because the EVR settings are gone).