-
Notifications
You must be signed in to change notification settings - Fork 114
rootBusPath: create rootBusPath dynamically. #860
Conversation
Codecov Report
@@ Coverage Diff @@
## master #860 +/- ##
==========================================
+ Coverage 57.72% 57.81% +0.08%
==========================================
Files 17 19 +2
Lines 2370 2375 +5
==========================================
+ Hits 1368 1373 +5
Misses 840 840
Partials 162 162 |
cc @jschintag |
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.
I think this is a good idea. ppc64 doesn't need this just yet, but at some point it will need the ability to handle multiple PCI roots, and this gets us a little closer to doing that.
/test |
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 @jongwu
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.
Hi @jongwu - thanks for raising. I've added some comments so blocking PR for now...
device_arm64.go
Outdated
fmt.Errorf("Error reading %s: %s", sysStartRootBusPath, err) | ||
} | ||
|
||
// find out the director end with ".pcie" |
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.
Is this a typo ("directory" rather than "director")?
device_arm64.go
Outdated
|
||
// find out the director end with ".pcie" | ||
for _, file := range files { | ||
if strings.HasSuffix(file.Name(), ".pcie") { |
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.
If the comment above has a typo, shouldn't this also test that file.IsDir() == true
?
device_arm64.go
Outdated
} | ||
} | ||
|
||
return "" |
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.
What does returning ""
mean? Is that a valid scenario or should this function actually return (string, error)
?
device_arm64.go
Outdated
sysStartRootBusPath := filepath.Join(sysfsDir, startRootBusPath) | ||
files, err := ioutil.ReadDir(sysStartRootBusPath) | ||
if err != nil { | ||
fmt.Errorf("Error reading %s: %s", sysStartRootBusPath, err) |
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.
This suggests the function should be returning an error
to me...?
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 @jongwu.
lgtm
/test |
@jongwu - Travis is failing - looks like you need to update the tests for the latest changes. |
thanks @jodh-intel , I have fixed it. now could you please retrigger ci again? |
/test |
hello @jodh-intel -, I can't see ARM CI, could please trigger it? |
/test-arm @jongwu - I've added you to the runtime + agent repos so you should be able to trigger builds yourself from now on. Also, are you planning to port this to the new 2.0 rust agent? |
/test-arm |
Dont see an ARM CI. |
hmm, yeah, it seems that arm CI has not been enabled for this repo. @jongwu could you help adding it? let me know if you need help. |
/test-arm |
/test |
1 similar comment
/test |
Currently, rootBusPath is set as a constant value. Bus this pcie bus path is not alway static, eg. the rootBus on arm64 is "/devices/platform/4010000000.pcie/pci0000:00". The address part of "4010000000.pcie" may vary with the maxMem in qemu so it should not be a fixed value. For exmaple: HIGH PCIE address reserved in qemu on virt is from 0 to 512G. The lower part of address may be allocated to normal memory. In general, normal memory is largely less than 256G, so the base address of HIGH PCIE can be 256G. But, in case the maxmem is large enough, like around 256G, the base address of HIGH PCIE must be increase, eg. 300G. In the current implementation of kata-runtime, the maxmem in qemu is the host memory size. So if the host memory size is large enough, the prefix of the pci device path name will be different from rootBusPath set in kata-agent which can lead to failure on device hotplug. This patch offer a mechanism to create rootBusPath dynamically but only give implemention for arm64 and return the default value of rootBusPath for other arch. Fixes: kata-containers#859 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
/test |
port kata-containers/agent#860 here. Fixes: kata-containers#1059 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
Thanks @jodh-intel -, I have composed the rust version of this patch, see rust. It's not easy for me to write rust code. |
Thanks @jongwu! No problem - we can help if necessary 😄 |
port kata-containers/agent#860 here. Fixes: kata-containers#1059 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
thanks @jodh-intel . |
port kata-containers/agent#860 here. Fixes: kata-containers#1059 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
port kata-containers/agent#860 here. Fixes: kata-containers#1059 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
port kata-containers/agent#860 here. Fixes: kata-containers#1059 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
port kata-containers/agent#860 here. Fixes: kata-containers#1059 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
port kata-containers/agent#860 here. Fixes: kata-containers#1059 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
port kata-containers/agent#860 here. Fixes: kata-containers#1059 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
Hello @jodh-intel @chavafg, all tests pass. isn't time to merge this? |
Currently, rootBusPath is set as a constant value. Bus this pcie bus path
is not alway static, eg. the rootBus on arm64 is
"/devices/platform/4010000000.pcie/pci0000:00". The address part of
"4010000000.pcie" may vary with the maxMem in qemu so it should not be a
fixed value.
For exmaple:
HIGH PCIE address reserved in qemu on virt is from 0 to 512G. The lower
part of address may be allocated to normal memory. In general, normal memory
is largely less than 256G, so the base address of HIGH PCIE can be 256G.
But, in case the maxmem is large enough, like around 256G, the base address
of HIGH PCIE must be increase, eg. 300G.
In the current implementation of kata-runtime, the maxmem in qemu is the host
memory size. So if the host memory size is large enough, the prefix of the
pci device path name will be different from rootBusPath set in kata-agent which
can lead to failure on device hotplug.
This patch offer a mechanism to create rootBusPath dynamically but only give
implemention for arm64 and return the default value of rootBusPath for other arch.
Fixes: #859
Signed-off-by: Jianyong Wu jianyong.wu@arm.com
@jodh-intel @devimc