ldomctl: Fix init-system with multiple PCIe root complexes

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ldomctl: Fix init-system with multiple PCIe root complexes

Klemens Nanni-2
Opposed to all other (single CPU) machines I have encountered so far,
the T4-2 has two instead of one PCIe root complexes.

ldomctl already accounts for this and iterates over them but lacks a
simple skip condition when iterating over subdevices to avoid linking
devices in one root complex to those in another.

This fixes `init-system' on my T4-2 where I have been using a lame
work-around so far, but the recent report on bugs@ reminded me to look
into it more closely this time.

Thanks to tracey for quickly providing details about his hardware for
quick comparison.

OK?


Index: config.c
===================================================================
RCS file: /cvs/src/usr.sbin/ldomctl/config.c,v
retrieving revision 1.40
diff -u -p -r1.40 config.c
--- config.c 24 May 2020 22:08:54 -0000 1.40
+++ config.c 19 Jun 2020 22:31:55 -0000
@@ -1142,6 +1142,8 @@ hvmd_finalize_pcie_device(struct md *md,
  md_link_node(md, node, parent);
 
  TAILQ_FOREACH(subdevice, &device->guest->subdevice_list, link) {
+ if (strncmp(path, subdevice->path, strlen(path)) != 0)
+ continue;
  TAILQ_FOREACH(component, &components, link) {
  if (strcmp(subdevice->path, component->path) == 0)
  md_link_node(md, parent, component->hv_node);

Reply | Threaded
Open this post in threaded view
|

Re: ldomctl: Fix init-system with multiple PCIe root complexes

Klemens Nanni-2
On Sat, Jun 20, 2020 at 01:05:22AM +0200, Klemens Nanni wrote:

> Opposed to all other (single CPU) machines I have encountered so far,
> the T4-2 has two instead of one PCIe root complexes.
>
> ldomctl already accounts for this and iterates over them but lacks a
> simple skip condition when iterating over subdevices to avoid linking
> devices in one root complex to those in another.
>
> This fixes `init-system' on my T4-2 where I have been using a lame
> work-around so far, but the recent report on bugs@ reminded me to look
> into it more closely this time.
>
> Thanks to tracey for quickly providing details about his hardware for
> quick comparison.
Has anyone tried this (on machines other than T4-2)?  Koakuma on bugs@
reported that this fixes ldomctl on their T4-2 just like expected.

I'd like to commit this soon.
Feedback? OK?


Index: config.c
===================================================================
RCS file: /cvs/src/usr.sbin/ldomctl/config.c,v
retrieving revision 1.40
diff -u -p -r1.40 config.c
--- config.c 24 May 2020 22:08:54 -0000 1.40
+++ config.c 27 Jun 2020 23:35:38 -0000
@@ -1142,6 +1142,8 @@ hvmd_finalize_pcie_device(struct md *md,
  md_link_node(md, node, parent);
 
  TAILQ_FOREACH(subdevice, &device->guest->subdevice_list, link) {
+ if (strncmp(path, subdevice->path, strlen(path)) != 0)
+ continue;
  TAILQ_FOREACH(component, &components, link) {
  if (strcmp(subdevice->path, component->path) == 0)
  md_link_node(md, parent, component->hv_node);