summaryrefslogtreecommitdiff
path: root/lib/igt_aux.c
AgeCommit message (Collapse)AuthorFilesLines
2024-05-07lib: use poll.h in includesReagan Bohan1-1/+1
sys/poll.h is non-standard and including it on musl produces a warning. Signed-off-by: Reagan Bohan <reagan@ourmail.work> Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
2024-05-06lib/igt_aux: Name function according to sysfs fileLucas De Marchi1-5/+10
Let's follow the sysfs filename that is being written/read so it's not misinterpreted as something else: at first I thought it was dealing with /sys/power/state, which it's not. Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://lore.kernel.org/r/20240503224745.14890-2-lucas.demarchi@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
2024-02-14lib: include limits.h to fix build with musl libcStefano Ragni1-0/+1
Original patch was added to void-linux: https://github.com/void-linux/void-packages/commit/ddfc1f66a0c571b420303c33aed29fd38ace4fc7 Bug report with request to split the original patch into some functional changes: Link: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138 Signed-off-by: Stefano Ragni <st3r4g@protonmail.com> Signed-off-by: Bernd Kuhls <bernd@kuhls.net> [Bernd: alphabetically sorted includes, removed includes not needed anymore] Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
2023-07-21lib: Make igt_while_interruptible() thread-safeChris Wilson1-1/+1
We have the ability to replace the ioctl() call by a wrapper that performs signal injection (triggering the ioctl to return -EINTR). This uses a global for handling the signal, which is broken if the test tries to mixing SIGINT injection and threads. Switch to a thread-local sigaction. Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Signed-off-by: Chris Wilson <chris.p.wilson@linux.intel.com> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2023-07-13lib/igt_sysfs: add asserting helpers for read/write operationsLukasz Laguna1-1/+1
Prefix names of existing, non-asserting helpers with "__": - igt_sysfs_get_u32 -> __igt_sysfs_get_u32 - igt_sysfs_set_u32 -> __igt_sysfs_set_u32 - igt_sysfs_get_u64 -> __igt_sysfs_get_u64 - igt_sysfs_set_u64 -> __igt_sysfs_set_u64 - igt_sysfs_get_boolean -> __igt_sysfs_get_boolean - igt_sysfs_set_boolean -> __igt_sysfs_set_boolean Replace calls to don't introduce any functional changes in the existing code. Additionally, reimplement non-asserting get helpers to return boolean result of the read operation and store the read value via pointer passed as function parameter. In previous implementation, it wasn't possible to distinguish if returned zero was a read value or failure on a read attempt. On the occasion, fixed a typo in modified debug message. Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com> Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
2023-07-13lib/igt_aux: use proper directory for "pm_debug_messages" readLukasz Laguna1-1/+1
Wrong variable containing directory fd was passed to igt_sysfs_get_boolean() function. Fixed that. Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com> Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
2023-06-30lib/igt_aux: Enable PM Suspend dbg messagesAnshuman Gupta1-7/+28
Enabling PM Suspend dbg messages by turning on /sys/power/pm_debug_messages switch also adding an exit handler provision to restore the pm_debug_messages state. v2: - Fixed sysfs_fd leak. [Badal] v3: - Added igt_aux_enable_pm_suspend_dbg() function doc. [Kmail] v4: - Fixed some nits. [Ashutosh] Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com> Reviewed-by: Badal Nilawar <badal.nilawar@intel.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
2023-06-30lib/igt_aux: Disable console suspend for suspend testAnshuman Gupta1-0/+44
We need no_console_suspend to be enable in order to dump the suspend logs over serial console before attempting the suspend during CI Execution. Therefore disable the console_suspend using printk module parameters while executing suspend test. v2: - Keep console_suspend restore only in exit handler. [Ashutosh] - Don't skip the test on open error, while opening printk parameters, instead print warning. [Kmail] v3: - Fixed cosmetics and return value comment. [Ashutosh] v4: - Added igt_aux_enable_pm_suspend_dbg() function doc. [Kmail] Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com> Reviewed-by: Badal Nilawar <badal.nilawar@intel.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
2023-06-07lib: Don't assert if fd path is unreachableChris Wilson1-5/+8
Processes come and go, access to the /proc/$tid/fd/ is unreliable. Don't assert when dumping the debug info of what the process has open if that process is already destroyed. Cc: Sai Gowtham Ch <sai.gowtham.ch@intel.com> Signed-off-by: Chris Wilson <chris.p.wilson@intel.com> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com> Reviewed-by: Sai Gowtham Ch <sai.gowtham.ch@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2023-05-31lib/igt_aux: unify procps processingKamil Konieczny1-217/+137
Create common interface for processing proc info, thus making its useage more striteforward and located in one place. This should make it easier to read and modify. v2: fixed errors on old libproc code path Suggested-by: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com> Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-05-31Use the new procps library libproc2Craig Small1-42/+204
Added support for new libproc2. [Corrected some errors pointed by checkpatch.pl, add linux includes in #ifdef __linux__ section] v2: changed to igt_fork_helper and added error print [Kamil] v3: removed include <limits.h> pointed by Mauro [Kamil] Signed-off-by: Craig Small <csmall@dropbear.xyz> Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-02-20lib: Add helper to wait and close fence fdRob Clark1-0/+11
Get rid of some copy/pasta and open coding of a common pattern, waiting for GPU commands to complete. Signed-off-by: Rob Clark <robdclark@chromium.org>
2022-10-04Replaced setpgrp() with setpgid() for standardization in BSD systemsJake Freeland1-2/+2
The BSD and GNU versions of setpgrp() differ in their parameter conventions. To avoid this convolution, setpgrp() can be safely replaced with setpgid() which is standard in both BSD and GNU libc. Signed-off-by: Jake Freeland <jfree@freebsd.org> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-08-15lib/igt_aux : Skip SUSPEND_STATE_S3 if mem_sleep deep state is not supportedRiana Tauro1-0/+19
Forcing s3 by setting mem_sleep to deep fails if s3 is not supported by platform Skip the test by checking if s3 is not one of the supported mem_sleep states Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6531 Signed-off-by: Riana Tauro <riana.tauro@intel.com> Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2022-08-03test/i915/i915_suspend: Use SUSPEND_STATE_S3 to enforce S3.Rodrigo Vivi1-11/+3
Now that we have the ability to enforce the S3, let's use it and avoid the extra check in the test. Cc: Riana Tauro <riana.tauro@intel.com> Cc: Anshuman Gupta <anshuman.gupta@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
2022-08-03lib/igt_aux: Introduce the ability to force S3 suspend state.Rodrigo Vivi1-47/+71
Testing both Suspend-to-Idle and Suspend-to-RAM is critical. So far our test suite are relying on the system's default for the "suspend-to-mem", what reduces our ability to cover multiple scenarios or requires manual intervention. This also brings confusions in some debugging scenarios. For the Suspend-to-Idle it is easy. The FREEZE state already enforces it. However, there's only one way to enforce the Suspend-to-RAM (aka S3) which is using MEM state with mem_sleep at "deep". However, let's not break the whole world overnight. Let's first introduce the ability to force the Suspend-to-RAM. Then convert the tests as needed. So, the SUSPEND_STATE_MEM will continue to exist and do exactly what is expected when you set "mem" to /sys/power/state, which is respect whatever is in the /sys/power/mem_sleep. Let's introduce a new SUSPEND_STATE_S3 state aiming to force the Suspend-to-RAM, by changing both /sys/power/state and /sys/power/mem_sleep. Cc: Riana Tauro <riana.tauro@intel.com> Cc: Anshuman Gupta <anshuman.gupta@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
2022-08-03lib/igt_aux: Check suspend state support directly.Rodrigo Vivi1-18/+10
Let's simplify the suspend state check directly by using its name instead of using a mask style. This will allow us to introduce a new state cleanly. v2: remove accidental fprintf Cc: Anshuman Gupta <anshuman.gupta@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
2022-08-03lib/igt_aux: Let's use the official mem_sleep namesRodrigo Vivi1-4/+4
Mixing the names with the state names can cause confusion. Let's stick with the official names. Cc: Riana Tauro <riana.tauro@intel.com> Cc: Anshuman Gupta <anshuman.gupta@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
2022-07-25lib/igt_aux: do not complain about dead processesAndrzej Hajda1-0/+2
During process lookup some processes can be dead already, in such case opendir(proc_path) can fail with ENOENT. It is fine, we do not need to abort test. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6042 Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6054 Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6361 Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com> Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
2022-05-31igt: Promote/rename OS helpersRob Clark1-1/+1
Promote intel_os.c helpers to igt_os.c, so that I can re-use them for some additional msm tests. Just big churny rename, no functional change. Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-05-25lib/igt_aux: fix kselftest module unloadMauro Carvalho Chehab1-4/+6
Most of the time, i915 module unload happens inside a subtest. So, using igt_fork() is OK. However, on i915_selftest, this is called earlier, at igt_kselftest_begin. This causes an error on IGT: forking is only allowed in subtests or igt_simple_main please refer to lib/igt_core documentation As igt_fork() can only be used inside subtests. So, use igt_fork_helper() instead. Reviewed-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-18lib/igt_aux: get rid of passing pipewire-pulse pid on functionsMauro Carvalho Chehab1-12/+12
The logic already stores pw-reserve PID on a static var. Store also the pipewire-pulse pid, in order to keep passing the arguments on all functions. Suggested-by: Andi Shyti <andi.shyti@linux.intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-18lib/igt_kmod: properly handle pipewire-pulseMauro Carvalho Chehab1-22/+153
Newer distributions like Fedora and openSUSE thumbweed are now coming with pipewire-pulse instead of pulseaudio - either as default or as an optional audio stack. That adds a new requirement when unloading sound drivers, which, in turn, is needed when the DRM driver is bound into it. Add the needed logic to work properly in case pipewire-pulse is detected. Tested on ADL-N with Fedora 35 and wireplumber: IGT-Version: 1.26-g982672f3 (x86_64) (Linux: 5.18.0-rc7-drm-ad75b5b819c9+ x86_64) Starting subtest: unbind-rebind process 585 (alsactl) is using audio device. Should be terminated. process 11932 (pipewire) is using audio device. Should be terminated. process 11937 (pipewire-pulse) is using audio device. Should be requested to stop using them. Preventing pipewire-pulse to use the audio drivers Device Audio0 can not be acquired: Success reserve acquired Unloaded audio driver snd_hda_intel Realoading snd_hda_intel Subtest unbind-rebind: SUCCESS (2.603s) Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-18lib/igt_kmod: always fill who when unloading audio driverMauro Carvalho Chehab1-1/+1
As we'll use this information at core_hotunplug to announce when an audio module is unloaded, fill it even if return code is zero. Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-18tests/core_hotunplug: properly finish processes using audio devicesMauro Carvalho Chehab1-0/+157
Before unloading or unbinding an audio driver, all processes that are using it must be terminated. The current logic seeks only for alsactl, but ignore other processes, including pulseaudio. Make the logic more general, extending it to any processes that could have an open device under /dev/snd. It should be noticed that some distros like Fedora and openSUSE are now migrating from pulseaudio into pipewire-pulse. Right now, there's no standard distribution-agnostic way to request pipewire-pulse to stop using audio devices, but there's a new patch upstream that will make things easier: https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/6ad6300ec657c88322a8cd6f3548261d3dc05359 Which should be available for pipewire-pulse versions 0.3.50 and upper. Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-16lib/igt_aux: add library function to read current selected state of mem_sleepRiana Tauro1-0/+52
Add a library function to read the current state of mem_sleep Used by suspend tests without i915 to skip s3 cycle, if platform has default state as s2idle. Reduces CI Execution time v2: Addressed cosmetic review comments (Anshuman) Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
2022-01-18tests/i915/i915_hangman: Add uevent test & fix detectorJohn Harrison1-0/+7
Some of the IGT framework relies on receving a uevent when a hang occurs. So add a test that this actually works. While testing this, noticed that hangs could sometimes be missed because the uevent was (presumably) still in flight by the time the handler was de-registered. So add an extra delay during cleanup to give the uevent chance to arrive. Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com>
2021-12-13lib/igt_aux: Rename igt_debug_manual_check and assert check if all is suppliedJeevan B1-3/+6
rename igt_debug_manual_check and patch the igt function igt_debug_wait_for_keypress() to assert if "all" is supplied. v2: calling igt_debug_wait_for_keypress() with "all" will assert. v3: Change igt_assert to igt_assert_f for adding clear log message. v4: Rebase only. Signed-off-by: Jeevan B <jeevan.b@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2021-10-18lib: Introduce igt_memdup()Ville Syrjälä1-0/+11
Provide a helper to do the malloc()+memcpy() in one swift blow. Reviewed-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2021-01-30meson: Turn on -WerrorAshutosh Dixit1-4/+4
We can choose which compile warnings to enable, but once they are enabled treat all warnings as error. This enforces stricter checks against compile warnings creeping in. v2: Fix redefinition warning errors from i915/gem_userptr_blits v3: Fix the even more pedantic clang compilation v4: Do not alter whitespace in lib/tests/igt_describe! Note: clang does not build assembler/ Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2020-05-08lib/params: start renaming functions igt_params_*Juha-Pekka Heikkila1-2/+1
Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-05-08lib/params: add igt_params.c for module parameter accessJani Nikula1-142/+1
We have generic helpers for sysfs access in igt_sysfs.c, but we also have a number of module parameter access specific helpers scattered here and there. Start gathering the latter into a file of its own. For i915, the long-term goal is to migrate from module parameters to device specific debugfs parameters. With all igt module param access centralized in one place, we can make the transition much easier. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-04-06i915/i915_hangman: Drop last reference to bygone 'i915_error_state'Chris Wilson1-1/+0
The test is looking at sysfs/error so dumping the old debugfs/i915_error_state looks quite silly. The only dilemma is whether it is worth replacing with a line-by-line dump. I propose we make that a future problem -- and leave it to whoever has to debug it next time. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Andi Shyti <andi.shyti@intel.com>
2019-12-03lib: remove igt_skip_on_simulationSwati Sharma1-7/+0
Removing igt_skip_on_simulation() from lib since this feature is not supported anymore. Func() defination hasn't been removed since it can be used by some other drivers (currently amd is using this function). v2: Rebase Signed-off-by: Swati Sharma <swati2.sharma@intel.com> Signed-off-by: Karthik B S <karthik.b.s@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-11-28lib/aux: Ensure swap space prior to suspend to diskDon Hiatt1-0/+4
Suspending to disk requires swap space, make sure it exists before attempting to suspend to disk. v2: Use igt_skip() [Thanks, Chris!] v3: Use igt_skip_on_f() Cc: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Don Hiatt <don.hiatt@intel.com> Reviewed-by: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
2019-05-09lib/aux: Call setgroups() in igt_drop_root() before setgid()Lyude Paul1-0/+3
While igt isn't really security sensitive, forgetting to call setgroups() before calling setgid() causes rpmlint on Fedora to complain: igt-gpu-tools.x86_64: E: missing-call-to-setgroups-before-setuid /usr/lib64/libigt.so.0 ... missing-call-to-setgroups-before-setuid: This executable is calling setuid and setgid without setgroups or initgroups. There is a high probability this means it didn't relinquish all groups, and this would be a potential security issue to be fixed. Seek POS36-C on the web for details about the problem. Since it's likely other package maintainers for other distros will have to deal with similar issues eventually, and I can't see any harm in it, let's do the right thing and call setgroups() first. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Lyude Paul <lyude@redhat.com>
2019-05-09lib/aux: Use igt_assert_eq() in igt_drop_root()Lyude Paul1-5/+5
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Lyude Paul <lyude@redhat.com>
2019-04-26lib: consolidate duplicated define of vfs_file_max(void)Caz Yokoyama1-0/+24
Remove it from intel_os.c and gem_exec_reuse.c and globally define in igt_aux.c. v3: update comment in the code and commit message. Signed-off-by: Caz Yokoyama <caz.yokoyama@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2019-04-25tests/kms_chamelium: add dp-audio testSimon Ser1-0/+31
This new test ensures DisplayPort audio works by using the Chamelium. It enables the DisplayPort output and sends an audio signal containing a set of frequencies we choose to all HDMI/DisplayPort audio devices. It starts recording audio on the Chamelium device and uses the stream server to retrieve captured audio pages. It then checks that the capture audio signal contains the frequencies we sent, and only those, by computing a FFT. A new library has been added to libigt to communicate with the stream server. It implements a simple custom TCP protocol. In case the test fails, a WAV file with the captured data is saved on disk. Right now the test has a few limitations: - Only the first channel is checked - IGT only generates audio with a single sampling rate (48 KHz) - Audio data is not captured in real-time These limitations will be lifted in future patches. PulseAudio must not run during the tests since ALSA is used directly. To ensure this, edit /etc/pulse/client.conf and add `autospawn=no`. Then run `pulseaudio --kill`. This commit deletes the existing audio tests. They weren't run and required an exotic configuration (HDMI audio splitter, dummy HDMI sink and a line-in port on the DUT). This patch also changes lib/igt_audio to use uint16_t instead of short. The rationale is: - The standard says a short is at least 16 bit wide, but a short can be larger (in practice it won't happen, but better use types correctly) - It makes it clearer that the audio format is S16_LE, since "16" is in the type name. This patch depends on the following Chameleon bugs: - https://crbug.com/948060 - https://crbug.com/950857 Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-04-10lib: Reset errno to 0 after isattyArkadiusz Hiler1-3/+9
Since igt_assert family of functions logs last errno we get a lot of those: "Last errno: 25, Inappropriate ioctl for device" isatty() seems to be the biggest offender in that area, so this patch should limit amount of confusing messages significantly. Cc: Martin Peres <martin.peres@linux.intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2019-04-09lib: Use nr_open not file-max for setting fd rlimitChris Wilson1-1/+1
Petri pointed out that the maximum allowed number of files per process is nr_open, not the system cap of file-max. Suggested-by: Petri Latvala <petri.latvala@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110351 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2019-04-05lib: add igt_allow_unlimited_files()Lucas De Marchi1-0/+21
Share the implementation to tweak the maximum number of open files. The version in tests/i915/gem_exec_reuse.c was a little bit different, but I don't think it needs to be because it would still return a failure if any of the calls to setrlimit() fail. So I'm using the other one. Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-03-08lib/aux: Plug memory leak in get_suspend_testPetri Latvala1-2/+3
Free test_line in all paths out of the function. v2: Avoid freeing too soon (Chris) Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-03-08lib/aux: Plug memory leak in __igt_lsof_fdsPetri Latvala1-0/+2
Add a missing closedir call. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-01-28igt_aux: Handle empty pm_test file gracefullyPetri Latvala1-0/+3
Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Imre Deak <imre.deak@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-01-22lib: Include the size in the error message for mlockChris Wilson1-2/+2
Knowing how much we tried to allocate would be useful if one should need to debug why it failed. References: https://bugs.freedesktop.org/show_bug.cgi?id=109439 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
2018-07-19lib: Move trash_bos to their only userChris Wilson1-57/+0
Only pm_rpm still uses the igt_trash_aperture() and so we can remove it from the lib and in the process convert it over from the legacy libdrm_intel. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
2018-07-11Avoid truncate string in __igt_lsof_fdsRodrigo Siqueira1-1/+1
Note that 'proc_path' parameter in __igt_lsof_fds receives a string which was initialized with the size of PATH_MAX and the local variable 'path' has the same size, but it also have to append: '/', '\0', and the directory name. This situation caused the warning described below. warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 0 and 4095 [-Wformat-truncation=] snprintf(path, sizeof(path), "%s/%s", proc_path, d->d_name); note: ‘snprintf’ output between 2 and 4352 bytes into a destination of size 4096 [..] This commit fixes this problem by changing the string size passed by __igt_lsoft to __igt_lsof_fds. The max size for the string is strlen("/proc/%d/cwd")+1 where "%d" can be estimated with CEILING(LOG_10(INT_MAX)), in this sense, it is safe to define a path size of 30 characters. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-06-21Account for NULL character when using strncpyRodrigo Siqueira1-1/+1
This patch fix the following gcc warning: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation] strncpy(data->name, name, PARAM_NAME_MAX_SZ); This error happens due to the '\0' character appended by strncpy. Notice that reduces by one in the total of bytes to be copied, in this case, is harmless because the strings received in the parameter already have '\0'. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-05-06lib: Show the kernel stack when reporting a GPU hangChris Wilson1-0/+19
In a few tests (like gem_exec_await, gem_exec_schedule) we use the GPU hang to break a deadlock hit during test setup. In these case we would like to see where in kernel the process is stuck (if at all). References: https://bugs.freedesktop.org/show_bug.cgi?id=105900 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Antonio Argenziano <antonio.argenziano@intel.com>