Commit Graph

53 Commits

Author SHA1 Message Date
Mikko Ylinen
ad8bbcea21 qat: rework bus-device-function handling
The code was stripping out "0000:" (bus) and then adding
it back in several places.

That's not necessary so this change simplifies QAT VF addr
handling by operating using full BDF IDs.

Moveover, simplify function calls: use getDpdkDevice() once
for each VF device.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2020-12-08 07:37:16 +02:00
Kevin Putnam
1d149ffee6 Documentation: Fixes broken links and standardizes headers.
Signed-off-by: Kevin Putnam <kevin.putnam@intel.com>
2020-09-22 08:32:21 -07:00
Dmitry Rozhkov
1b82ab9df6 sync README.md files with the current state of the code
Closes #356
2020-09-16 10:54:39 +03:00
Dmitry Rozhkov
be713f1c8b lint: enable errcheck 2020-08-28 16:14:14 +03:00
Dmitry Rozhkov
7ff08ee874 linter: enable staticcheck 2020-08-25 09:54:59 +03:00
Mikko Ylinen
1cfb849eef qat: update QAT software stack
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2020-08-12 23:08:59 +03:00
Dmitry Rozhkov
73aea0aa1b linter: enable gosec check 2020-06-11 17:56:24 +03:00
Dmitry Rozhkov
70f862f2aa add golangci linter
In this initial commit the following checks are disabled due to
excessive amount of changes required:
- dupl (duplicate code)
- funlen (function length)
- goerr113 (errors handling expressions)
- gomnd (magic numbers)
- gosec (security)
- nakedret (naked returns)
- wsl (forces to use empty lines)
- errcheck (checking for unchecked errors)
- staticcheck (static analysis)
2020-06-08 14:01:13 +03:00
Dmitry Rozhkov
8fc187f4d8 move to k8s v1.18.2 release
Also fix the plugins and e2e tests
2020-04-17 12:40:18 +03:00
Mikko Ylinen
e4a57899d2 qat: fix UIO mounts
DPDK uses /sys/class/uio/uioX/device/[control|resource*] and we
had special mounts for the individual uioX paths. However, it turned
out this wasn't working as expected: host's /sys/class/uio/uioX/device/
was mounted to container's /sys/class/uio and DPDK failed to find
uioX/device/[control|resource*] files. Moreover, workloads requesting
more than one QAT resource, still saw only one path.

While cri-o/containerd give sysfs read-only mounts, DPDK needs
device/config RW. Therefore, we need to mount host /sys/class/uio/uioX
to container /sys/class/uio/uioX for each requested device.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2020-04-01 09:08:55 +03:00
Mikko Ylinen
a6bf48f8db dpdkdrv: improve unit test coverage
Add NewDevicePlugin() tests to improve test coverage. This also
contributes to "input validation" (part of #321) that wasn't done
properly before.

Fixes: #325

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2020-03-24 08:23:44 +02:00
Mikko Ylinen
15d4b10715
Merge pull request #329 from grahamwhaley/20200312_klog
klog: Add klog logging to framework and qat plugins
2020-03-19 16:59:44 +02:00
Graham Whaley
f8dbc896a1 devicemanager: qat: use klog for logging and debug
Move the framework, and the qat driver, to use `klog`
for logging and debug.

This has a some noticeable effects:

1) Our default log output gains a bunch of annotation:
From:
    QAT device plugin started in 'dpdk' mode
To:
    I0312 11:51:02.057728    6053 qat_plugin.go:64] QAT device plugin started in 'dpdk' mode

(there is now a command line option to drop those annotations if
necessary).

2) We gain a bunch of command line parameters from klog for controlling log
levels and output. We go from 5 arguments to 17:

---
Usage of ./cmd/qat_plugin/qat_plugin:
  -add_dir_header
        If true, adds the file directory to the header
  -alsologtostderr
        log to standard error as well as files
  -debug
        enable debug output
  -dpdk-driver string
        DPDK Device driver for configuring the QAT device (default "vfio-pci")
  -kernel-vf-drivers string
        Comma separated VF Device Driver of the QuickAssist Devices in the system. Devices supported: DH895xCC,C62x,C3xxx and D15xx (default "dh895xccvf,c6xxvf,c3xxxvf,d15xxvf")
  -log_backtrace_at value
        when logging hits line file:N, emit a stack trace
  -log_dir string
        If non-empty, write log files in this directory
  -log_file string
        If non-empty, use this log file
  -log_file_max_size uint
        Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
  -logtostderr
        log to standard error instead of files (default true)
  -max-num-devices int
        maximum number of QAT devices to be provided to the QuickAssist device plugin (default 32)
  -mode string
        plugin mode which can be either dpdk (default) or kernel (default "dpdk")
  -skip_headers
        If true, avoid header prefixes in the log messages
  -skip_log_headers
        If true, avoid headers when opening log files
  -stderrthreshold value
        logs at or above this threshold go to stderr (default 2)
  -v value
        number for the log level verbosity
  -vmodule value
        comma-separated list of pattern=N settings for file-filtered logging
---

3) Our `-debug` flag is now replaced by the `klog` `-v n` flag.

*NOTE:* This is potentially a minor breaking change. Applying
this debug overlay to any previous (pre-klog edit) images will
cause the container to fail to launch, as it will not recognise
the new `-v` arguments.

We also update the kustomize deployment to move from using
DEBUG env vars to adding a VERBOSITY var that controls both
the log verbosity and now the debug mode enabling.

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2020-03-19 11:20:48 +00:00
Mikko Ylinen
b021152eb8 qat: kerneldrv: fix device registration when run in VMs
Kerneldrv checks for available devices based on adf_ctl output.
We only accepted two cases: PFs if IOMMU is off and VFs if IOMMU
is on.

The right check is to only skip PFs if IOMMU is on and allow other
cases. This fixes two scenarios: when run in VMs, we accept VFs
regardless of (v)IOMMU presence.

Moreover, do not hard code domain '0000:' because it is not the
case always.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2020-03-16 20:17:57 +02:00
Mikko Ylinen
f145541caf READMEs: use git clone to get the code
go get'ing does not work due to our k8s.io/kubernetes dependency
so guide users to use git clone to get the code.

Fixes: #290

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2020-02-20 08:04:07 +02:00
Ed Bartosh
1f4928790f Implement function for DeviceInfo creation
- Made DeviceInfo fields private
- Implement NewDeviceInfo constructor
2020-02-07 15:26:37 +02:00
Mikko Ylinen
f036b72cff
Merge pull request #286 from askervin/kustomize
qat_plugin: add kustomizations
2020-02-06 13:53:08 +02:00
Antti Kervinen
ec8eef6daa qat_plugin: add kustomizations
- Default deployment: `kubectl apply -k deployments/qat_plugin`
- Debug variant: `kubectl apply -k deployments/qat_plugin/overlays/debug`
- Single-resource `yaml` naming convention:
  applying x-y-z.yaml configures k8s resource named x-y-z.
- QAT plugin README updated.

Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
2020-02-05 15:48:57 +02:00
Mikko Ylinen
28a89a2820 qat: README: clarify crypto-perf usage
crypto-perf instructions were outdated and hand implicit
assumptions about the environment. More specifically:

Clear Linux builds DPDK libraries as shared so for the
compress and crypto test applications to run, the memory and
QAT PMD libraries must be explicitly preloaded using '-d' parameter.

Also, the test-crypto1 and test-compress1 deployments expect the
cluster is configured with CPU Manager's static policy.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2020-02-04 13:32:10 +02:00
Graham Whaley
1ca19696e0 qat: docs: Update the README
Update the QAT README. Add some descriptions. Add information about
the command line and config options.

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2020-01-27 16:51:00 +00:00
Dmitry Rozhkov
814e2e1a50 bump k8s dependencies up to v1.17.0 2020-01-09 11:19:58 +02:00
Mikko Ylinen
fd631fc31c deployments/gpu_plugin: limit host mounts
The default deployment gives rather wide host mounts. We can limit
the mounts only to the subdirectories the plugin needs and mount
them read-only.

Also, add notes that both QAT and GPU plugins can be run as non-root
user.

Fixes: #228

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2019-12-11 12:54:36 +02:00
Mikko Ylinen
832e4aaf3c crypto-perf: add kustomization and move to deployments
We plan to use crypto-perf for simple QAT testing. This commit adds
kustomization to make the deployment easier. The original .yaml is
also moved to deployments/ with some changes.

For instance, it turns out also vfio-pci mode with DPDK needs CAP_SYS_ADMIN
(See PR: #187 which states that only igb_uio would need it).

kustomize is available part of kubectl since kubernetes v1.14.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2019-08-20 22:01:44 +03:00
Dmitry Rozhkov
a2debf6fb4 qat: fix typo 2019-08-19 12:52:16 +03:00
Mikko Ylinen
d92b528ab6 qat: document kerneldrv mode and build instructions
-mode kerneldrv comes with no documentation. This patch adds few
notes about it and instructions how to get it build if a user chooses
to have it enabled.

Closes: #197

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2019-08-19 09:56:57 +03:00
Dmitry Rozhkov
8390388f89 qat: make users explicitly opt in to have kernel mode compiled in 2019-08-14 13:41:44 +03:00
Mikko Ylinen
08a079ead2 crypto-perf: use IPC_LOCK to ensure mmap() works
Change SYS_ADMIN to IPC_LOCK capability to ensure DPDK gets to mmap() hugepages.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2019-06-12 07:31:01 +03:00
Mikko Ylinen
4ba6af14b9 qat_plugin: kerneldrv: register VF devices when IOMMU is on
When IOMMU is on in the system, the physical function (PF)
devices cannot be used. This prevented using kerneldrv as it
was only written to work with PFs.

However, QAT bare metal functions can also be used when IOMMU
is enabled. In this case, they must be used via virtual functions
(VF).

This commit makes it possible to use kerneldrv when IOMMU is
on. The added side benefit is we can now slice the same QAT HW
for both "dpdk" and "kernel" usages simultaneously.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2019-05-29 22:10:26 +03:00
Mikko Ylinen
4a80aa83e2 qat_plugin: kerneldrv: get device.id from inst_id
In adf_ctl output, qat_devX is a sequence number that includes both
PF and VF devices:

qat_dev0 - type: c6xx,  inst_id: 0,  node_id: 1,  bsf: 84:00.0, #accel: 5 #engines: 10 state: up
qat_dev1 - type: c6xx,  inst_id: 1,  node_id: 1,  bsf: 85:00.0, #accel: 5 #engines: 10 state: up
qat_dev2 - type: c6xx,  inst_id: 2,  node_id: 1,  bsf: 86:00.0, #accel: 5 #engines: 10 state: up
qat_dev3 - type: c6xxvf,  inst_id: 0,  node_id: 1,  bsf: 84:01.0, #accel: 1 #engines: 1 state: up
qat_dev4 - type: c6xxvf,  inst_id: 1,  node_id: 1,  bsf: 84:01.1, #accel: 1 #engines: 1 state: up
...

X cannot be used as the config file identified because it does not match
the real id of the device. inst_id gives this so move to use that to find
the right config file.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2019-05-28 15:49:45 +03:00
Dmitry Rozhkov
da132f6584 qat: add kernel mode plugin 2019-04-25 14:15:32 +03:00
nolancon
52df9329e4 Re-order devices in scan loop
Fixes: #146

Removed whitespace
2019-01-23 13:41:22 +00:00
Dmitry Rozhkov
54332c5eea announce deviceplugin API public 2019-01-21 17:20:01 +02:00
Dmitry Rozhkov
7662cb9154 extend API to receive full specs instead of strings 2019-01-21 17:15:27 +02:00
Dmitry Rozhkov
58b62f579b qat: fix numbering of env vars
An `Allocate()` request can be used to allocate resources for many
containers thus `counter` needs to be reset for each container
response.
2018-12-12 13:42:05 +02:00
ssehgal
100ecf8340 Improving consumption of devices by updating the environment variable name based on number of devices requested in a container(e.g. QAT0, QAT1) 2018-12-05 15:11:23 +00:00
nolancon
1bb035cc64 PostAllocate implemented in QAT device plugin 2018-12-05 15:11:23 +00:00
ssehgal
eb6d48a512 QAT README update and crypto perf image tag correction 2018-12-03 14:03:55 +00:00
Mikko Ylinen
794b3077bd qat_plugin: readme: list all known VF devices
Not all QAT chips (e.g, 37c9) are available in pci.ids which makes
"grep QAT" to not show them.

Scan all known VF PCI ids in a loop to ensure all configured devices
are shown.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2018-11-28 10:32:31 +02:00
Mikko Ylinen
187f8040f0 qat_plugin: use vfio-pci as the default driver
vfio-pci uses IOMMU memory protection and is a safer default.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2018-11-28 10:32:31 +02:00
Mikko Ylinen
00bbe922de qat: deployment: set parameters via ConfigMap
For easier deployments, fetch plugin command line arguments from ConfigMap.
When using ConfigMaps, qat_plugin.yaml needs no changes and can always
be used as is.

qat_plugin_default_configmap.yaml uses built-in defaults.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2018-11-20 13:43:00 +02:00
ssehgal
6a23d5324a QAT Readme updates 2018-09-05 16:43:00 +01:00
ssehgal
8e37adfb42 Fixing minor bugs with QAT plugin
- To ensure that the device plugin continues to run in case a certain QAT device family is not detected on the node
- Updated the extended resource name to qat/generic in demo/crypto-perf-dpdk-pod-requesting-qat.yaml file
- Added explicit check for QAT device ID to avoid counting other DPDK bound devices as QAT devices
2018-09-03 14:27:27 +01:00
Dmitry Rozhkov
eccd70c600 replace glog with simpler home-grown debug logging 2018-08-16 17:40:16 +03:00
Dmitry Rozhkov
2ff6c5929a Use annotated errors for tracing 2018-08-16 17:31:19 +03:00
Ed Bartosh
a0b6651c1d QAT: fix spelling
Fixed misspell warning:
   Line 153: warning: "Unknwon" is a misspelling of "Unknown" (misspell)
2018-08-14 16:42:02 +03:00
MCamp859
68c099db99 Fixed typo.
Signed-off-by: MCamp859 <mary.camp@ptiglobal.net>
2018-08-02 10:28:30 -04:00
MCamp859
1fe88a9067 Updated with review comments.
Signed-off-by: MCamp859 <mary.camp@ptiglobal.net>
2018-08-02 10:10:14 -04:00
MCamp859
4d5046f860 QAT readme edits for format and text flow.
Signed-off-by: MCamp859 <mary.camp@ptiglobal.net>
2018-07-31 16:08:27 -04:00
MCamp859
6544d35ab1 QAT readme edits for format and text flow.
Signed-off-by: MCamp859 <mary.camp@ptiglobal.net>
2018-07-31 16:04:47 -04:00
Dmitry Rozhkov
b6894b8195 refactor QAT plugin 2018-07-30 15:29:33 +03:00