Skip to content
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

source/pci: add iommu_group/type attribute #705

Merged

Conversation

marquiz
Copy link
Contributor

@marquiz marquiz commented Dec 21, 2021

Add iommu_group/type to the list of PCI device attributes that are
discovered. The value is the raw value from sysfs (i.e DMA, DMA-FQ or
identity).

No built-in (automatic) labels are generated based on this, but, the
attribute is available for custom label rules to use. Examples of custom
rules:

  - name: "iommu enabled rule"
    labels:
      iommu.enabled: "true"
    matchFeatures:
      - feature: pci.device
        matchExpressions:
          "iommu_group/type": {op: NotIn, value: ["unknown"]}
  - name: "iommu passthrough rule"
    labels:
      iommu.passthrough: "true"
    matchFeatures:
      - feature: pci.device
        matchExpressions:
          "iommu_group/type": {op: In, value: ["identity"]}

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 21, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: marquiz

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

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 21, 2021
@marquiz
Copy link
Contributor Author

marquiz commented Dec 21, 2021

Depends on #677
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 21, 2021
@marquiz
Copy link
Contributor Author

marquiz commented Dec 21, 2021

/assign zvonkok
ping @mythi

@marquiz marquiz added this to the v0.10.0 milestone Dec 22, 2021
@mythi
Copy link
Contributor

mythi commented Jan 7, 2022

"iommu_group/type": {op: Exists}

I have a VM without an IOMMU and it gives iommu_group/type as well.

matchFeatures:
      - feature: pci.device

does it mean there's also net.device with the same function after this PR?

Might be useful to have more capabilities supported too, e.g., amd vs intel IOMMU and IOMMU version

@marquiz
Copy link
Contributor Author

marquiz commented Jan 7, 2022

I have a VM without an IOMMU and it gives iommu_group/type as well.

Hmm, interesting 🧐 Want to take a closer look at that, what is the value of the type then?

does it mean there's also net.device with the same function after this PR?

Yup, those will have the same property.

Might be useful to have more capabilities supported too, e.g., amd vs intel IOMMU and IOMMU version

We could add e.g. iommu/intel-iommu/version to address that. Do we have a use case for that, WDYT? I have no experience (or hw) on amd.

@marquiz
Copy link
Contributor Author

marquiz commented Jan 7, 2022

Maybe it the instructions to see if iommu is enabled should then be

  - name: "iommu enabled rule"
    labels:
      iommu.enabled: "true"
    matchFeatures:
      - feature: pci.device
        matchExpressions:
          "iommu_group/type": {op: NotIn, value: ["unknown"]}

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 7, 2022
@marquiz
Copy link
Contributor Author

marquiz commented Jan 7, 2022

Rebased. Changed the instructions in the first commit message

@marquiz
Copy link
Contributor Author

marquiz commented Jan 7, 2022

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 7, 2022
@marquiz
Copy link
Contributor Author

marquiz commented Jan 10, 2022

@mythi any comments to the above?

ping @zvonkok, any feedback?

This is virtually the last open bit for v0.10.0 😊

@ArangoGutierrez
Copy link
Contributor

/test all

@ArangoGutierrez
Copy link
Contributor

tested with quay.io/eduardoarango/node-feature-discovery:705

go test ./cmd/... ./pkg/... ./source/...
?       sigs.k8s.io/node-feature-discovery/cmd/nfd-master       [no test files]
ok      sigs.k8s.io/node-feature-discovery/cmd/nfd-topology-updater     0.010s
ok      sigs.k8s.io/node-feature-discovery/cmd/nfd-worker       0.009s
?       sigs.k8s.io/node-feature-discovery/pkg/api/feature      [no test files]
?       sigs.k8s.io/node-feature-discovery/pkg/apihelper        [no test files]
ok      sigs.k8s.io/node-feature-discovery/pkg/apis/nfd/v1alpha1        0.009s
?       sigs.k8s.io/node-feature-discovery/pkg/cpuid    [no test files]
?       sigs.k8s.io/node-feature-discovery/pkg/generated/clientset/versioned    [no test files]
?       sigs.k8s.io/node-feature-discovery/pkg/generated/clientset/versioned/fake       [no test files]
?       sigs.k8s.io/node-feature-discovery/pkg/generated/clientset/versioned/scheme     [no test files]
?       sigs.k8s.io/node-feature-discovery/pkg/generated/clientset/versioned/typed/nfd/v1alpha1 [no test files]
?       sigs.k8s.io/node-feature-discovery/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/fake    [no test files]
?       sigs.k8s.io/node-feature-discovery/pkg/generated/informers/externalversions     [no test files]
?       sigs.k8s.io/node-feature-discovery/pkg/generated/informers/externalversions/internalinterfaces  [no test files]
?       sigs.k8s.io/node-feature-discovery/pkg/generated/informers/externalversions/nfd [no test files]
?       sigs.k8s.io/node-feature-discovery/pkg/generated/informers/externalversions/nfd/v1alpha1        [no test files]
?       sigs.k8s.io/node-feature-discovery/pkg/generated/listers/nfd/v1alpha1   [no test files]
ok      sigs.k8s.io/node-feature-discovery/pkg/kubeconf 0.015s
?       sigs.k8s.io/node-feature-discovery/pkg/labeler  [no test files]
?       sigs.k8s.io/node-feature-discovery/pkg/nfd-client       [no test files]
ok      sigs.k8s.io/node-feature-discovery/pkg/nfd-client/topology-updater      0.020s
ok      sigs.k8s.io/node-feature-discovery/pkg/nfd-client/worker        3.105s
ok      sigs.k8s.io/node-feature-discovery/pkg/nfd-master       0.021s
?       sigs.k8s.io/node-feature-discovery/pkg/podres   [no test files]
ok      sigs.k8s.io/node-feature-discovery/pkg/resourcemonitor  0.027s
?       sigs.k8s.io/node-feature-discovery/pkg/topologypolicy   [no test files]
?       sigs.k8s.io/node-feature-discovery/pkg/topologyupdater  [no test files]
ok      sigs.k8s.io/node-feature-discovery/pkg/utils    0.022s
?       sigs.k8s.io/node-feature-discovery/pkg/version  [no test files]
ok      sigs.k8s.io/node-feature-discovery/source       0.017s
ok      sigs.k8s.io/node-feature-discovery/source/cpu   0.009s
?       sigs.k8s.io/node-feature-discovery/source/custom        [no test files]
?       sigs.k8s.io/node-feature-discovery/source/custom/rules  [no test files]
?       sigs.k8s.io/node-feature-discovery/source/fake  [no test files]
?       sigs.k8s.io/node-feature-discovery/source/iommu [no test files]
ok      sigs.k8s.io/node-feature-discovery/source/kernel        0.005s
ok      sigs.k8s.io/node-feature-discovery/source/local 0.011s
ok      sigs.k8s.io/node-feature-discovery/source/memory        0.024s
ok      sigs.k8s.io/node-feature-discovery/source/network       0.045s
ok      sigs.k8s.io/node-feature-discovery/source/pci   0.020s
ok      sigs.k8s.io/node-feature-discovery/source/storage       0.020s
ok      sigs.k8s.io/node-feature-discovery/source/system        0.006s
ok      sigs.k8s.io/node-feature-discovery/source/usb   0.012s

-/-

Ran 3 of 230 Specs in 26.624 seconds
SUCCESS! -- 3 Passed | 0 Failed | 0 Pending | 227 Skipped
--- PASS: TestE2E (26.64s)
PASS
ok      sigs.k8s.io/node-feature-discovery/test/e2e     26.677s

Add "iommu_group/type" to the list of PCI device attributes that are
discovered. The value is the raw value from sysfs (i.e DMA, DMA-FQ or
identity).

No built-in (automatic) labels are generated based on this, but, the
attribute is available for custom label rules to use. Examples of custom
rules:

  - name: "iommu enabled rule"
    labels:
      iommu.enabled: "true"
    matchFeatures:
      - feature: pci.device
        matchExpressions:
          "iommu_group/type": {op: NotIn, value: ["unknown"]}

  - name: "iommu passthrough rule"
    labels:
      iommu.passthrough: "true"
    matchFeatures:
      - feature: pci.device
        matchExpressions:
          "iommu_group/type": {op: In, value: ["identity"]}
@marquiz
Copy link
Contributor Author

marquiz commented Jan 11, 2022

Rebased, updated docs

@mythi
Copy link
Contributor

mythi commented Jan 11, 2022

source/pci is OK but I feel source/network is unnecessary. with source/network today it's not possible to say to which device the attribute is linked. therefore, for better usability checking "PCI is a NIC and PCI has IOMMU" sounds more reasonable?

@marquiz
Copy link
Contributor Author

marquiz commented Jan 11, 2022

I feel source/network is unnecessary. with source/network today it's not possible to say to which device the attribute is linked. therefore, for better usability checking "PCI is a NIC and PCI has IOMMU" sounds more reasonable?

This is a fair question to which I don't have an answer 🧐 I guess why I added this to network, too, was just following sr-iov. The sriov attributes are available for both pci and network devices. network can be easily dropped from this pr. Any thoughts @zvonkok ?

@marquiz
Copy link
Contributor Author

marquiz commented Jan 11, 2022

Dropped the patch for source/network. Now only concerns source/pci.

/retitle source/pci: add iommu_group/type attribute

@k8s-ci-robot k8s-ci-robot changed the title Add iommu_group/type attribute to pci and network device features source/pci: add iommu_group/type attribute Jan 11, 2022
@marquiz
Copy link
Contributor Author

marquiz commented Jan 11, 2022

Network part now submitted separately in #717

@mythi
Copy link
Contributor

mythi commented Jan 11, 2022

/lgtm

thanks!

@k8s-ci-robot
Copy link
Contributor

@mythi: changing LGTM is restricted to collaborators

In response to this:

/lgtm

thanks!

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/test-infra repository.

@ArangoGutierrez
Copy link
Contributor

/lgtm

thanks!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 11, 2022
@k8s-ci-robot k8s-ci-robot merged commit a1cb431 into kubernetes-sigs:master Jan 11, 2022
@marquiz marquiz deleted the devel/iommu-dev-attributes branch January 11, 2022 13:27
@marquiz marquiz mentioned this pull request Jan 11, 2022
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants