[igt-dev] [PATCH] tests: Add a new test for driver/device hot remove

Petri Latvala petri.latvala at intel.com
Fri Mar 29 10:47:32 UTC 2019


On Thu, Mar 28, 2019 at 05:47:19PM +0100, Janusz Krzysztofik wrote:
> Run a dummy load in background to put some workload on a device, then try
> to either remove (unplug) the device from its bus, or unbind the device's
> driver from it, depending on which subtest has been selected.
> 
> The driver hot unbind / device hot unplug operation is expected to succeed
> in a reasonable time, however long timeouts are used to allow kernel
> level timeouts pop up first if any.
> 
> Please note that if running both subtests consecutively, the second one
> is always skipped as the device is no longer available as soon as the
> first subtest is completed.  The most reliable way to run another subtest
> is to reboot the system first, then select next subtest to be run.

This is a requirement that won't fly for CI use. Is the
rebinding/whatever of the device not possible to do? By the test?

Does it also apply to running other test binaries after running the
first subtest? As in, is it just a timing issue?


> +	igt_subtest("unplug") {
> +		igt_spin_t *spin;
> +
> +		/* Verify if a suitable DRM device/driver exists */
> +		igt_skip_on(device < 0);
> +
> +		/* Run background workload */
> +		spin = igt_spin_batch_new(device, .flags = IGT_SPIN_POLL_RUN);


igt_spin_batch_new requires DRIVER_INTEL, doesn't it?


> +		igt_spin_busywait_until_running(spin);
> +
> +		/* Make the device disappear */
> +		igt_set_timeout(60, "Device unplug timeout!");
> +		device_unplug(device);
> +		igt_reset_timeout();
> +
> +		close(device);
> +		device = -1;
> +	}
> +
> +	igt_subtest("unbind") {
> +		igt_spin_t *spin;
> +
> +		/* Verify if a suitable DRM device/driver exists */
> +		igt_skip_on(device < 0);


Ah, I see. The skip if running consecutively is because the previous
subtest closed the fd.

Another fixture before this subtest, get the device plugged back,
reopen driver?



-- 
Petri Latvala


More information about the igt-dev mailing list