Skip to content

kubevirtci: Add fake SR-IOV vGPU kernel module for testing - #16717

Closed
oshoval wants to merge 1 commit into
kubevirt:mainfrom
oshoval:fake-sriov-vgpu-driver
Closed

oshoval wants to merge 1 commit into
kubevirt:mainfrom
oshoval:fake-sriov-vgpu-driver

Conversation

@oshoval

@oshoval oshoval commented Feb 2, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

Add a kernel module that creates fake PCI devices in /sys/bus/pci/devices/ to simulate NVIDIA SR-IOV Virtual Functions with vGPU profiles assigned.

This enables testing of PR #16710's vGPU VF discovery logic without requiring real GPU hardware. The module:
Note: didn't test e2d, just device creation.

  • Creates a virtual PCI bus at domain 0001
  • Registers fake PCI devices with NVIDIA Tesla T4 vendor/device IDs
  • Provides nvidia/current_vgpu_type sysfs attribute for vGPU profile detection
  • Devices appear as real PCI devices visible to virt-handler

Usage:
cd kubevirtci/cluster-up/cluster/kind-1.33-vgpu/fake-sriov-vgpu make # or use container build sudo ./setup-fake-sriov.sh setup

Devices will appear at /sys/bus/pci/devices/0001:00:XX.X with:

  • vendor: 0x10de (NVIDIA)
  • device: 0x1eb8 (Tesla T4)
  • nvidia/current_vgpu_type: configurable vGPU profile

References

Why we need it and why it was done in this way

The following tradeoffs were made:

The following alternatives were considered:

Links to places where the discussion took place:

Special notes for your reviewer

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

Release note

None

Add a kernel module that creates fake PCI devices in /sys/bus/pci/devices/
to simulate NVIDIA SR-IOV Virtual Functions with vGPU profiles assigned.

This enables testing of PR kubevirt#16710's vGPU VF discovery logic without
requiring real GPU hardware. The module:

- Creates a virtual PCI bus at domain 0001
- Registers fake PCI devices with NVIDIA Tesla T4 vendor/device IDs
- Provides nvidia/current_vgpu_type sysfs attribute for vGPU profile detection
- Devices appear as real PCI devices visible to virt-handler

Usage:
  cd kubevirtci/cluster-up/cluster/kind-1.33-vgpu/fake-sriov-vgpu
  make  # or use container build
  sudo ./setup-fake-sriov.sh setup

Devices will appear at /sys/bus/pci/devices/0001:00:XX.X with:
- vendor: 0x10de (NVIDIA)
- device: 0x1eb8 (Tesla T4)
- nvidia/current_vgpu_type: configurable vGPU profile

Signed-off-by: oshoval <[email protected]>
Co-authored-by: Cursor <[email protected]>
@kubevirt-bot

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kubevirt-bot kubevirt-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. sig/buildsystem Denotes an issue or PR that relates to changes in the build system. size/XXL labels Feb 2, 2026
@kubevirt-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign brianmcarey for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@oshoval

oshoval commented Feb 2, 2026

Copy link
Copy Markdown
Contributor Author
$ sudo ./setup-fake-sriov.sh setup
[INFO] Loading fake-sriov-vgpu module...
[INFO] Module loaded successfully
[INFO] Creating 4 fake VF devices...
[INFO] Created VF: slot=0 func=0 (vgpu_type=256)
[INFO] Created VF: slot=1 func=0 (vgpu_type=256)
[INFO] Created VF: slot=2 func=0 (vgpu_type=256)
[INFO] Created VF: slot=3 func=0 (vgpu_type=256)
[INFO] Created 4 VF devices

[INFO] === Fake SR-IOV vGPU Status ===

Loaded modules:
fake_sriov_vgpu        24576  0

Created VFs:
0001:00:00.0 vgpu_type=256
0001:00:01.0 vgpu_type=256
0001:00:02.0 vgpu_type=256
0001:00:03.0 vgpu_type=256

PCI devices (fake domain 0001):
lrwxrwxrwx. 1 root root 0 Feb  2 10:15 0001:00:00.0 -> ../../../devices/pci0001:00/0001:00:00.0
lrwxrwxrwx. 1 root root 0 Feb  2 10:15 0001:00:01.0 -> ../../../devices/pci0001:00/0001:00:01.0
lrwxrwxrwx. 1 root root 0 Feb  2 10:15 0001:00:02.0 -> ../../../devices/pci0001:00/0001:00:02.0
lrwxrwxrwx. 1 root root 0 Feb  2 10:15 0001:00:03.0 -> ../../../devices/pci0001:00/0001:00:03.0

Example VF: /sys/bus/pci/devices/0001:00:00.0
  vendor: 0x10de
  device: 0x1eb8
  nvidia/current_vgpu_type: 256

@kubevirt-bot

Copy link
Copy Markdown
Contributor

@oshoval: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubevirt-e2e-k8s-1.35-sig-compute-migrations 229cde7 link true /test pull-kubevirt-e2e-k8s-1.35-sig-compute-migrations
Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@oshoval

oshoval commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor Author

closing for now,
since there arent enough reviewers + need to be brave to use the kernel module,
it is off the table atm

will be glad if desired to open it in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. sig/buildsystem Denotes an issue or PR that relates to changes in the build system. size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants