[pve-devel] [RFC PATCH common] SysFSTools: mdev: retrieve Nvidia vGPU description from nvidia-smi

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Oct 30 13:08:28 CET 2024


higher level comment, so CCing also Dominik:

Is pve-common, and possibly even SysFSTools the right place for this?
As in from a quick look this has nothing to do with sysfs directly, and
from recent development it seems like placing such things into a more
specific package, and probably also (binary) package might be better.

Don't get me wrong, I'm fine with the code living in pve-common, while
I'm a fan of having more modular packages, at least for bigger projects
like PVE, this does correlates with the amount of git repos I'd like
to manage.

As pve-common, and lots of its perl modules, are pretty overloaded already
I'd like to avoid expanding this further.

In the long term, i.e. not a requirement for this series, I'd like to
have not only the perl module split up (*stares at PVE::Tools*), but also
then leverage that and provide more binary packages so that we can better
reuse specific things without pulling so many dependencies transitively.
We sometimes just copy over common helpers to avoid that, e.g. for some
non-PVE (infra) tooling, so the pain *is* real.

So while you certainly do not need to fix all of that just to get your
changes here in, it would be OTOH great if we could not make this tech
debt worse; so lets create a new package and possibly also finer-grained
modules for this.

The hard thing is to carve out what belongs together, and lets not be
strictly limited by existing module layout, method from those can be
split and merged.

Some rough/unfinished ideas/proposal from top of my head:

- possible package names:
  - libpve-device-common (or host-device / hw-device as slight alternations)
  - libpve-sysfs-common (if sysfs is really only what this does, which then
    should not need any external tools or compiled programs)
  - libpve-hw-passthrough-common

- modules: The basename might depend a bit on the package named chosen, could
  be e.g. "PVE::Device" or "PVE::SysFS"
  - $basename::USB
  - $basename::PCI
  - $basename::PCI::NVIDIA

In general, it can be also fine to have a very generic (micro) package with
just sysfs helpers, or keep that in existing pve-common, and then depend
on that in a more specific package that provides passthrough related stuff
on top of that, mixing sysfs query/writing with some potential calling of
external tools.

As said, the direction should be that, and great if some parts of pve-common
can be improved "for free" w.r.t. not being huge modules in a huge package,
but there's no need to rework all of pve-common now already just for this.




More information about the pve-devel mailing list