Commit Graph

26 Commits

Author SHA1 Message Date
Sergi Blanch Torne ea33e44ce4 ci/crosvm: clean crosvm socket
When the 'vm stop' command fails because the crosvm instance
that would be listening to it is already dead, remove the
socket file to avoid crosvm complaining and refusing to boot

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16963>
2022-06-15 14:03:42 +00:00
Emma Anholt f5e714cbf9 ci/crosvm: Terminate the previous crosvm after a deqp-runner timeout.
When deqp-runner times out, it kills the deqp process, which in our case
is the previous invocation of our shell script, so the crosvm and socat
cleanup never happened.  crosvm has a way to cleanly shut down a previous
crosvm invocation, so let's just use that and do our cleanup when we need
to.

Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16485>
2022-05-18 22:49:20 +00:00
Emma Anholt b82f920384 ci/crosvm: Rename VSOCK_TEMP_DIR -> VM_TEMP_DIR.
It doesn't contain anything about the vsocks, just files shared between
the host and the guest.

Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16485>
2022-05-18 22:49:20 +00:00
Emma Anholt b836cd937c ci/crosvm: Simplify the CID setup.
Now that deqp-runner tells us which thread we are, we don't need to go
probing for a spare directory to use.

Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16485>
2022-05-18 22:49:20 +00:00
Cristian Ciocaltea 8726ea34d3 ci: Dynamically adjust LIBGL_ALWAYS_SOFTWARE for crosvm
For an increased flexibility in operation, do not set
'CROSVM_LIBGL_ALWAYS_SOFTWARE=true' when *not* using llvmpipe
Gallium driver.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15208>
2022-03-22 17:01:09 +00:00
Cristian Ciocaltea f4cea722a6 ci: Use script relative paths in crosvm-runner
For an increased portability, do not rely on 'CI_PROJECT_DIR' to
reference script relative resources and, instead, compute their
paths based on the crosvm-runner.sh invocation file path as
indicated by $0.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15208>
2022-03-22 17:01:09 +00:00
Cristian Ciocaltea fdc55725a0 ci: Make kernel image available in LAVA for KVM use cases
In order to run a VM (e.g. crosvm) through HWCI_TEST_SCRIPT on a LAVA
target, it's necessary to download a kernel image on the target device.

When HWCI_KVM is set to 'true', we can safely assume HWCI_TEST_SCRIPT
contains a command or the path to a script which expects the kernel
image to be available under /lava-files/${KERNEL_IMAGE_NAME}.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15208>
2022-03-22 17:01:09 +00:00
Cristian Ciocaltea e8882f0ef8 ci: Improve interrupt signal handling in crosvm-runner.sh
Run crosvm as a background process in order to allow intercepting
interrupt signals (INT, TERM) and properly release/cleanup any allocated
resources.

This is particularly helpful when one or more crosvm tasks hang, which
will eventually prevent subsequent instances to be started - currently
we can handle up to 128 concurrent crosvm instances per runner.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15238>
2022-03-08 12:52:54 +02:00
Cristian Ciocaltea 1f0a0839eb ci: Increase limit of concurrent crosvm instances per runner
Ensure we can handle up to 128 concurrent crosvm instances per runner
with the current CID generator. This is a safety margin for the new
64-core runners.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15238>
2022-03-08 12:52:54 +02:00
Cristian Ciocaltea 9ef8af357d virgl/ci: Setup virtio-vsock based IPC
The mechanism currently used to pass data from the dEQP child process
executed in a crosvm guest environment towards the deqp-runner wrapper
script that starts the crosvm instance is based on creating, writing
and reading regular files.

In addition to the main drawback of using the storage, this approach
is potentially unreliable because the data cannot be transferred in
real-time and there is no control on ending the transmission. It also
requires a forced sleep for syncing the content, while the minimum
amount of time necessary to wait cannot be easily and safely
determined.

Replace this with an IPC based on the virtio transport for virtual
sockets (virtio-vsock).

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14995>
2022-02-17 06:32:30 +00:00
Guilherme Gallo 2d75fd1e0a virgl/ci: make crosvm-runner pass variables in a secure way
crosvm-runner.sh was using `export -p` to create an environment script
for the virtualized system, but this command will dump every declared
environment variable in the system, which includes Gitlab's CI variables
with sensitive data, such as passwords and auth tokens.

Replacing `export -p` to `generate-env.sh`, which only exports the
necessary variables for Mesa CI jobs.

Extra changes:

* Stop changing ${PWD} variable programmatically in scripts. ${PWD} is a
variable used by most prolific coreutils and bash commands, such as `cd`
and `pwd`, besides it is set by subshells [1]; changing this variable
may lead to complex situations.
As drop-in replacement for ${PWD}, use ${DEQP_BIN_DIR} to flag that
there is a special folder where dEQP should be run.
* Double quote path and array variables. See: https://github.com/koalaman/shellcheck/wiki/SC2086
* Do not export variables directly from commands output. See: https://github.com/koalaman/shellcheck/wiki/SC2155

[1]
```
$ cd /tmp
$ export PWD=test; bash -c 'echo $PWD'
/tmp
```

v2:
- Revert $DEQP_BIN_DIR quoting in crosvm-runner.sh and crosvm-init.sh
- Log all the passed variables to stdout, to help with debugging when
  new variable are needed to be put in `generate-env.sh`

v3:
- Revert $DEQP_BIN_DIR quoting leftovers

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14626>
2022-01-27 18:28:48 +00:00
Cristian Ciocaltea 9f0be629cd virgl/ci: Fix identification of dEQP binary paths
In some cases the file paths passed to crosvm for execution do not point
to dEQP binaries, but can be wrapper scripts, like deqp-runner.sh.

Detect such cases and skip changing the working directory.

Additionally, use the POSIX compliant command substitution syntax
instead of the obsolete variant based on backquotes.

Fixes: 81f25d8f27 ("virgl/ci: Run each dEQP instance in its own VM")

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14413>
2022-01-18 18:42:05 +00:00
Cristian Ciocaltea aec7eaf3e3 virgl/ci: Do not hide crosvm output messages
In some corner cases like the kernel oops, we do not get the relevant
log messages from crosvm process to help with debugging.

Note there is currently a double redirection of its stdout stream, but
the content eventually ends up in /dev/null.

Let's fix this by redirecting both stdout and stderr streams to a
dedicated file, to avoid clobbering the output from the script/program
running inside crosvm. This is particularly required for the scenario
that involves deqp-runner starting crosvm via a *.toml suite.

Additionally, drop the unnecessary usage of 'stdbuf' and set the 'quiet'
kernel command-line parameter to get rid of the noise generated during
crosvm boot process.

Although not directly related, do some cleanup by removing the
temporary folder on script exit.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14413>
2022-01-18 18:42:05 +00:00
Cristian Ciocaltea 8d1ed9b753 virgl/ci: Force crosvm error when exit code file is missing
crosvm-runner.sh doesn't correctly report the script execution status
if the exit code file is missing.

Fix this by returning 1 when there is no exit code available from the
script that was executed.

Fixes: 81f25d8f27 ("virgl/ci: Run each dEQP instance in its own VM")

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14413>
2022-01-18 18:42:05 +00:00
Juan A. Suarez Romero f77ccdfb4a nir: add NIR_DEBUG envvar
Move all the NIR related debug environmental variables in a single
NIR_DEBUG one.

Use NIR_DEBUG=help to print all the available options.

v2:
 - Use a macro to simplify (Marcin, Jason)
 - Remove wrong changes (Marcin)

v3 (Marcin):
 - Remove rendundant NIR mentioning in option descriptions.
 - Unwrap option descriptions.
 - Ensure the constant is unsigned.
 - Use extern array to remove switch.

v4:
 - Add missing kernel shader (Jason).
 - Add unlikely() (Marcin).

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13840>
2021-12-03 11:15:29 +00:00
Guilherme Gallo dabc068e6c ci: Use ci-fairy minio login via token file
For every CI job, put JWT content into a file and unset CI_JOB_JWT
environment var
=======

* virgl jobs:
	- Share JWT token file to crosvm instance
	- Keep using `export -p` due to high complexity in the scripts
	  of these jobs. At least, the CI_JOB_JWT will not be leaked,
	  since it is being unset at the `before_script` phase of each
	  Mesa CI job.

* iris jobs: Update lava_job_submitter to take token file as argument
	- generate-env with CI_JOB_JWT_TOKEN_FILE
	- create token file during baremetal init stage

* baremetal jobs: Copy token file to bare-metal NFS

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14004>
2021-12-02 18:01:29 +00:00
Tomeu Vizoso d63cd245e1 ci: Uprev Crosvm
And use my fork while we upstream some improvements to Crosvm that make
it more appropriate for using in CI.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12828>
2021-11-18 13:36:24 +00:00
Tomeu Vizoso 81f25d8f27 virgl/ci: Run each dEQP instance in its own VM
Currently we run deqp-runner inside a single VM, which makes very poor
use of the available CPUs because Virgl has a bottleneck in the VMM that
serializes everything.

With this change, we can run several Crosvm instances in a runner and
make full use of the CPUs. Getting the same coverage with 3 runners
instead of 6.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12828>
2021-11-18 13:36:24 +00:00
Tomeu Vizoso 4bfcbe3f69 ci: Remove syslogd
Crosvm doesn't need it any more.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12828>
2021-11-18 13:36:24 +00:00
Tomeu Vizoso 4b88de7338 virgl/ci: Set NIR_VALIDATE=0 on the host
As we aren't testing LLVMPipe in these jobs, and shader compilation is
currrently the bottleneck.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12196>
2021-08-10 09:49:39 +02:00
Tomeu Vizoso 716ba29056 virgl/ci: Rebalance concurrency
Crosvm deals with virtio-gpu commands sequentially, so parallelization
in the host doesn't help much.

Also, too much parallelization in the guest causes some tests to time
out.

So reduce the number of dEQP instances being run concurrently, make sure
we dont limit the number of CPUs being used in the host and schedule
more jobs in CI to keep the times below 10 minutes.

Closes: #5172
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12196>
2021-08-10 09:49:23 +02:00
Corentin Noël 06edc6adc8 ci: Use crosvm to run dEQP tests for virgl
Allows to use virtio-gpu to actually test the virgl driver.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11320>
2021-08-03 14:24:08 +00:00
Corentin Noël 481e7508be ci: Increase crosvm version
Also require newer dependencies.

This makes it easier to debug possible crosvm issues as a big refactor occured since the
previous commit included in the CI.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11320>
2021-08-03 14:24:08 +00:00
Corentin Noël 33d9954bc1 ci: Disable llvmpipe optimizations when running virgl CI
We are only using the result once so we spend more time optimizing it than
actually using it.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11320>
2021-08-03 14:24:08 +00:00
Corentin Noël 18fa820506 ci: actually run piglit tests with virgl
Make sure that the host is using llvmpipe while the guest is using virgl as driver.

Note that the neverball/neverball.trace trace actually regressed in a way that the
foreground is missing.

Fixes: f1b952fa ("ci: Run tests inside Crosvm")

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11986>
2021-07-21 09:36:10 +02:00
Tomeu Vizoso f1b952fa73 ci: Run tests inside Crosvm
Allow running tests within Crosvm for testing the virtio-gpu winsys in
Virgl, tested with Piglit only for now.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10862>
2021-06-09 19:14:00 +00:00