11
0

Accepting request 1125411 from X11:XOrg

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/1125411
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/intel-gpu-tools?expand=0&rev=6
This commit is contained in:
2023-11-13 21:21:33 +00:00
committed by Git OBS Bridge
8 changed files with 65 additions and 522 deletions

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:93b9a4816ed22b5145bb61024314c8a65caeea991ce93027643f1d40723bf417
size 2321940

Binary file not shown.

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ffcbdf61bd495803d9ae9dfa83e2fe04b8f583a2296fe059c1d5dd135a8a3b15
size 2597284

Binary file not shown.

View File

@@ -1,491 +0,0 @@
Description: Link to libproc2
libproc2 is the new library for libprocps
Author: Craig Small <csmall@debian.org>
Bug-Debian: https://bugs.debian.org/1024221
Reviewed-by: Craig Small <csmall@debian.org>
Last-Update: 2022-12-22
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -52,8 +52,16 @@
#include <assert.h>
#include <grp.h>
+#ifdef HAVE_LIBPROCPS
#include <proc/readproc.h>
+#endif
+#ifdef HAVE_LIBPROC2
+#include <libproc2/pids.h>
+#endif
+
#include <libudev.h>
+#include <linux/limits.h>
+#include <dirent.h>
#include "drmtest.h"
#include "i915_drm.h"
@@ -1217,6 +1225,7 @@ void igt_unlock_mem(void)
*/
int igt_is_process_running(const char *comm)
{
+#if HAVE_LIBPROCPS
PROCTAB *proc;
proc_t *proc_info;
bool found = false;
@@ -1235,6 +1244,26 @@ int igt_is_process_running(const char *c
closeproc(proc);
return found;
+#endif
+#ifdef HAVE_LIBPROC2
+ enum pids_item Item[] = { PIDS_CMD };
+ struct pids_info *info = NULL;
+ struct pids_stack *stack;
+ char *pid_comm;
+ bool found = false;
+
+ if (procps_pids_new(&info, Item, 1) < 0)
+ return false;
+ while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
+ pid_comm = PIDS_VAL(0, str, stack, info);
+ if (!strncasecmp(pid_comm, comm, strlen(pid_comm))) {
+ found = true;
+ break;
+ }
+ }
+ procps_pids_unref(&info);
+ return found;
+#endif
}
/**
@@ -1251,6 +1280,7 @@ int igt_is_process_running(const char *c
*/
int igt_terminate_process(int sig, const char *comm)
{
+#ifdef HAVE_LIBPROCPS
PROCTAB *proc;
proc_t *proc_info;
int err = 0;
@@ -1272,6 +1302,29 @@ int igt_terminate_process(int sig, const
closeproc(proc);
return err;
+#endif
+#ifdef HAVE_LIBPROC2
+ enum pids_item Items[] = { PIDS_ID_PID, PIDS_CMD };
+ struct pids_info *info = NULL;
+ struct pids_stack *stack;
+ char *pid_comm;
+ int pid;
+ int err = 0;
+
+ if (procps_pids_new(&info, Items, 2) < 0)
+ return -errno;
+ while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
+ pid = PIDS_VAL(0, s_int, stack, info);
+ pid_comm = PIDS_VAL(1, str, stack, info);
+ if (!strncasecmp(pid_comm, comm, strlen(pid_comm))) {
+ if (kill(pid, sig) < 0)
+ err = -errno;
+ break;
+ }
+ }
+ procps_pids_unref(&info);
+ return err;
+#endif
}
struct pinfo {
@@ -1341,9 +1394,9 @@ igt_show_stat_header(void)
}
static void
-igt_show_stat(proc_t *info, int *state, const char *fn)
+igt_show_stat(const pid_t tid, const char *cmd, int *state, const char *fn)
{
- struct pinfo p = { .pid = info->tid, .comm = info->cmd, .fn = fn };
+ struct pinfo p = { .pid = tid, .comm = cmd, .fn = fn };
if (!*state)
igt_show_stat_header();
@@ -1353,7 +1406,7 @@ igt_show_stat(proc_t *info, int *state,
}
static void
-__igt_lsof_fds(proc_t *proc_info, int *state, char *proc_path, const char *dir)
+__igt_lsof_fds(const pid_t tid, const char *cmd, int *state, char *proc_path, const char *dir)
{
struct dirent *d;
struct stat st;
@@ -1400,7 +1453,7 @@ again:
dirn = dirname(copy_fd_lnk);
if (!strncmp(dir, dirn, strlen(dir)))
- igt_show_stat(proc_info, state, fd_lnk);
+ igt_show_stat(tid, cmd, state, fd_lnk);
free(copy_fd_lnk);
free(fd_lnk);
@@ -1416,13 +1469,14 @@ again:
static void
__igt_lsof(const char *dir)
{
- PROCTAB *proc;
- proc_t *proc_info;
-
char path[30];
char *name_lnk;
struct stat st;
int state = 0;
+#ifdef HAVE_LIBPROCPS
+ PROCTAB *proc;
+ proc_t *proc_info;
+
proc = openproc(PROC_FILLCOM | PROC_FILLSTAT | PROC_FILLARG);
igt_assert(proc != NULL);
@@ -1456,6 +1510,44 @@ __igt_lsof(const char *dir)
}
closeproc(proc);
+#endif
+#ifdef HAVE_LIBPROC2
+ enum pids_item Items[] = { PIDS_ID_PID, PIDS_CMD };
+ struct pids_info *info = NULL;
+ struct pids_stack *stack;
+
+ if (procps_pids_new(&info, Items, 2) < 0)
+ return;
+ while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
+ ssize_t read;
+ int tid = PIDS_VAL(0, s_int, stack, info);
+ char *pid_comm = PIDS_VAL(1, str, stack, info);
+
+ /* check current working directory */
+ memset(path, 0, sizeof(path));
+ snprintf(path, sizeof(path), "/proc/%d/cwd", tid);
+
+ if (stat(path, &st) == -1)
+ continue;
+
+ name_lnk = malloc(st.st_size + 1);
+
+ igt_assert((read = readlink(path, name_lnk, st.st_size + 1)));
+ name_lnk[read] = '\0';
+
+ if (!strncmp(dir, name_lnk, strlen(dir)))
+ igt_show_stat(tid, pid_comm, &state, name_lnk);
+
+ /* check also fd, seems that lsof(8) doesn't look here */
+ memset(path, 0, sizeof(path));
+ snprintf(path, sizeof(path), "/proc/%d/fd", tid);
+
+ __igt_lsof_fds(tid, pid_comm, &state, path, dir);
+
+ free(name_lnk);
+ }
+ procps_pids_unref(&info);
+#endif
}
/**
@@ -1490,7 +1582,7 @@ igt_lsof(const char *dpath)
free(sanitized);
}
-static void pulseaudio_unload_module(proc_t *proc_info)
+static void pulseaudio_unload_module(const uid_t euid, const gid_t egid)
{
struct igt_helper_process pa_proc = {};
char xdg_dir[PATH_MAX];
@@ -1498,14 +1590,14 @@ static void pulseaudio_unload_module(pro
struct passwd *pw;
igt_fork_helper(&pa_proc) {
- pw = getpwuid(proc_info->euid);
+ pw = getpwuid(euid);
homedir = pw->pw_dir;
- snprintf(xdg_dir, sizeof(xdg_dir), "/run/user/%d", proc_info->euid);
+ snprintf(xdg_dir, sizeof(xdg_dir), "/run/user/%d", euid);
igt_info("Request pulseaudio to stop using audio device\n");
- setgid(proc_info->egid);
- setuid(proc_info->euid);
+ setgid(egid);
+ setuid(euid);
clearenv();
setenv("HOME", homedir, 1);
setenv("XDG_RUNTIME_DIR",xdg_dir, 1);
@@ -1524,10 +1616,12 @@ static void pipewire_reserve_wait(void)
char xdg_dir[PATH_MAX];
const char *homedir;
struct passwd *pw;
- proc_t *proc_info;
- PROCTAB *proc;
+ int tid=0, euid, egid;
+#ifdef HAVE_LIBPROCPS
igt_fork_helper(&pw_reserve_proc) {
+ proc_t *proc_info;
+ PROCTAB *proc;
igt_info("Preventing pipewire-pulse to use the audio drivers\n");
proc = openproc(PROC_FILLCOM | PROC_FILLSTAT | PROC_FILLARG);
@@ -1539,21 +1633,44 @@ static void pipewire_reserve_wait(void)
freeproc(proc_info);
}
closeproc(proc);
+ tid = proc_info->tid;
+ euid = proc_info->euid;
+ egid = proc_info->egid;
+ freeproc(proc_info);
+#endif
+#ifdef HAVE_LIBPROC2
+ igt_fork(child, 1) {
+ enum pids_item Items[] = { PIDS_ID_PID, PIDS_ID_EUID, PIDS_ID_EGID };
+ enum rel_items { EU_PID, EU_EUID, EU_EGID };
+ struct pids_info *info = NULL;
+ struct pids_stack *stack;
+
+ igt_info("Preventing pipewire-pulse to use the audio drivers\n");
+
+ if (procps_pids_new(&info, Items, 3) < 0)
+ return;
+ while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
+ tid = PIDS_VAL(EU_PID, s_int, stack, info);
+ if (pipewire_pulse_pid == tid)
+ break;
+ }
+ euid = PIDS_VAL(EU_EUID, s_int, stack, info);
+ egid = PIDS_VAL(EU_EGID, s_int, stack, info);
+ procps_pids_unref(&info);
+#endif
/* Sanity check: if it can't find the process, it means it has gone */
- if (pipewire_pulse_pid != proc_info->tid)
+ if (pipewire_pulse_pid != tid)
exit(0);
- pw = getpwuid(proc_info->euid);
+ pw = getpwuid(euid);
homedir = pw->pw_dir;
- snprintf(xdg_dir, sizeof(xdg_dir), "/run/user/%d", proc_info->euid);
- setgid(proc_info->egid);
- setuid(proc_info->euid);
+ snprintf(xdg_dir, sizeof(xdg_dir), "/run/user/%d", euid);
+ setgid(egid);
+ setuid(euid);
clearenv();
setenv("HOME", homedir, 1);
setenv("XDG_RUNTIME_DIR",xdg_dir, 1);
- freeproc(proc_info);
-
/*
* pw-reserve will run in background. It will only exit when
* igt_kill_children() is called later on. So, it shouldn't
@@ -1570,9 +1687,7 @@ static void pipewire_reserve_wait(void)
int pipewire_pulse_start_reserve(void)
{
bool is_pw_reserve_running = false;
- proc_t *proc_info;
int attempts = 0;
- PROCTAB *proc;
if (!pipewire_pulse_pid)
return 0;
@@ -1584,6 +1699,10 @@ int pipewire_pulse_start_reserve(void)
* pipewire version 0.3.50 or upper.
*/
for (attempts = 0; attempts < PIPEWIRE_RESERVE_MAX_TIME; attempts++) {
+#ifdef HAVE_LIBPROCPS
+ proc_t *proc_info;
+ PROCTAB *proc;
+
usleep(1000);
proc = openproc(PROC_FILLCOM | PROC_FILLSTAT | PROC_FILLARG);
igt_assert(proc != NULL);
@@ -1598,6 +1717,25 @@ int pipewire_pulse_start_reserve(void)
freeproc(proc_info);
}
closeproc(proc);
+#endif
+#ifdef HAVE_LIBPROC2
+ enum pids_item Items[] = { PIDS_ID_PID, PIDS_CMD };
+ struct pids_info *info = NULL;
+ struct pids_stack *stack;
+
+ usleep(1000);
+
+ if (procps_pids_new(&info, Items, 2) < 0)
+ return 1;
+ while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
+ if (!strcmp(PIDS_VAL(1, str, stack, info), "pw-reserve")) {
+ is_pw_reserve_running = true;
+ pipewire_pw_reserve_pid = PIDS_VAL(0, s_int, stack, info);
+ break;
+ }
+ }
+ procps_pids_unref(&info);
+#endif
if (is_pw_reserve_running)
break;
}
@@ -1645,7 +1783,7 @@ void pipewire_pulse_stop_reserve(void)
* If the check fails, it means that the process can simply be killed.
*/
static int
-__igt_lsof_audio_and_kill_proc(proc_t *proc_info, char *proc_path)
+__igt_lsof_audio_and_kill_proc(const pid_t tid, const char *cmd, const uid_t euid, const gid_t egid, char *proc_path)
{
const char *audio_dev = "/dev/snd/";
char path[PATH_MAX * 2];
@@ -1670,10 +1808,10 @@ __igt_lsof_audio_and_kill_proc(proc_t *p
* 2) unload/unbind the the audio driver(s);
* 3) stop the pw-reserve thread.
*/
- if (!strcmp(proc_info->cmd, "pipewire-pulse")) {
+ if (!strcmp(cmd, "pipewire-pulse")) {
igt_info("process %d (%s) is using audio device. Should be requested to stop using them.\n",
- proc_info->tid, proc_info->cmd);
- pipewire_pulse_pid = proc_info->tid;
+ tid, cmd);
+ pipewire_pulse_pid = tid;
return 0;
}
/*
@@ -1685,9 +1823,9 @@ __igt_lsof_audio_and_kill_proc(proc_t *p
* will respawn them. So, just ignore here, they'll honor pw-reserve,
* when the time comes.
*/
- if (!strcmp(proc_info->cmd, "pipewire-media-session"))
+ if (!strcmp(cmd, "pipewire-media-session"))
return 0;
- if (!strcmp(proc_info->cmd, "wireplumber"))
+ if (!strcmp(cmd, "wireplumber"))
return 0;
dp = opendir(proc_path);
@@ -1723,22 +1861,22 @@ __igt_lsof_audio_and_kill_proc(proc_t *p
* enough to unbind audio modules and won't cause race issues
* with systemd trying to reload it.
*/
- if (!strcmp(proc_info->cmd, "pulseaudio")) {
- pulseaudio_unload_module(proc_info);
+ if (!strcmp(cmd, "pulseaudio")) {
+ pulseaudio_unload_module(euid, egid);
break;
}
/* For all other processes, just kill them */
igt_info("process %d (%s) is using audio device. Should be terminated.\n",
- proc_info->tid, proc_info->cmd);
+ tid, cmd);
- if (kill(proc_info->tid, SIGTERM) < 0) {
+ if (kill(tid, SIGTERM) < 0) {
igt_info("Fail to terminate %s (pid: %d) with SIGTERM\n",
- proc_info->cmd, proc_info->tid);
- if (kill(proc_info->tid, SIGABRT) < 0) {
+ cmd, tid);
+ if (kill(tid, SIGABRT) < 0) {
fail++;
igt_info("Fail to terminate %s (pid: %d) with SIGABRT\n",
- proc_info->cmd, proc_info->tid);
+ cmd, tid);
}
}
@@ -1760,9 +1898,10 @@ int
igt_lsof_kill_audio_processes(void)
{
char path[PATH_MAX];
+ int fail = 0;
+#ifdef HAVE_LIBPROCPS
proc_t *proc_info;
PROCTAB *proc;
- int fail = 0;
proc = openproc(PROC_FILLCOM | PROC_FILLSTAT | PROC_FILLARG);
igt_assert(proc != NULL);
@@ -1772,12 +1911,35 @@ igt_lsof_kill_audio_processes(void)
if (snprintf(path, sizeof(path), "/proc/%d/fd", proc_info->tid) < 1)
fail++;
else
- fail += __igt_lsof_audio_and_kill_proc(proc_info, path);
+ fail += __igt_lsof_audio_and_kill_proc(proc_info->pid, proc_info->cmd, proc_info->euid, proc_info->egid, path);
freeproc(proc_info);
}
closeproc(proc);
+#endif
+#ifdef HAVE_LIBPROC2
+ enum pids_item Items[] = { PIDS_ID_PID, PIDS_CMD, PIDS_ID_EUID, PIDS_ID_EGID };
+ enum rel_items { EU_PID, EU_CMD, EU_EUID, EU_EGID };
+ struct pids_info *info = NULL;
+ struct pids_stack *stack;
+ pid_t tid;
+
+ if (procps_pids_new(&info, Items, 4) < 0)
+ return 1;
+ while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
+ tid = PIDS_VAL(EU_PID, s_int, stack, info);
+ if (snprintf(path, sizeof(path), "/proc/%d/fd", tid) < 1)
+ fail++;
+ else
+ fail += __igt_lsof_audio_and_kill_proc(tid,
+ PIDS_VAL(EU_CMD, str, stack, info),
+ PIDS_VAL(EU_EUID, s_int, stack, info),
+ PIDS_VAL(EU_EGID, s_int, stack, info),
+ path);
+ }
+ procps_pids_unref(&info);
+#endif
return fail;
}
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -105,7 +105,6 @@ lib_deps = [
libdrm,
libdw,
libkmod,
- libprocps,
libudev,
math,
pciaccess,
@@ -169,6 +168,12 @@ if chamelium.found()
lib_sources += 'monitor_edids/monitor_edids_helper.c'
endif
+if libprocps.found()
+ lib_deps += libprocps
+else
+ lib_deps += libproc2
+endif
+
if get_option('srcdir') != ''
srcdir = join_paths(get_option('srcdir'), 'tests')
else
--- a/meson.build
+++ b/meson.build
@@ -120,7 +120,15 @@ build_info += 'With libdrm: ' + ','.join
pciaccess = dependency('pciaccess', version : '>=0.10')
libkmod = dependency('libkmod')
-libprocps = dependency('libprocps', required : true)
+libprocps = dependency('libprocps', required : false)
+libproc2 = dependency('libproc2', required : false)
+if libprocps.found()
+ config.set('HAVE_LIBPROCPS', 1)
+elif libproc2.found()
+ config.set('HAVE_LIBPROC2', 1)
+else
+ error('Either libprocps or libproc2 is required')
+endif
libunwind = dependency('libunwind', required : get_option('libunwind'))
build_info += 'With libunwind: @0@'.format(libunwind.found())

View File

@@ -1,3 +1,41 @@
-------------------------------------------------------------------
Sun Nov 5 09:48:04 UTC 2023 - munix9@googlemail.com
- Update to version 1.28:
* New meson options testplan, sphinx and xe_driver.
* Add amdgpu GFX1036, GFX1037 chips.
* Add xe_pciids.h with Lunar Lake (LNL) support.
* Use the new procps library libproc2.
* Add helper for srandom seed initialization.
* Support for vmwgfx driver.
* i915_pciids.h updated to include Pontevecchio (PVC) platform.
* Add OAM formats and support for media engines in perf tests.
* Support for Xe driver.
* igt_runner can now dump GPU state on timeout.
* igt_runner will now use proper 'abort' as result instead of pseudoresult.
* New vendor agnostic gputop tool.
* New tool to dump Intel GuC/HuC CSS header.
* Improve tools intel_watermark, intel_vbt_decode, intel_reg.
* New way for documenting tests will allow to generate documentation and
testlists during build, see README.md and test_documentation.md. This
is mandatory for Intel (both i915 and xe) and kms tests.
* Move intel specific tests to new directory.
* Ported and refactored drmlib security tests in amdgpu.
* Switch DRM selftests to KUnit.
* Enabled MeteorLake aux ccs tests.
* Exercise oversized object detection for Xe.
* Enable validation for VDSC output formats.
* Add support for Bigjoiner / 8K mode.
* Use intel_cmds_info library.
* Use Intel kernel gpu command definitions.
* Add a basic perf_pmu test.
* Add test for V3D's Wait BO IOCTL.
* Add i915_power test for power measurement.
* Remove sysfs_clients.
- Remove intel-gpu-tools-libproc2_libproc2_library.patch (fixed upstream)
- Remove u_intel-gpu-tools-1.7-fix-bashisms.patch (obsolete)
-------------------------------------------------------------------
Thu Apr 20 00:55:37 UTC 2023 - Tejas Guruswamy <tejas.guruswamy@opensuse.org>
@@ -7,7 +45,7 @@ Thu Apr 20 00:55:37 UTC 2023 - Tejas Guruswamy <tejas.guruswamy@opensuse.org>
-------------------------------------------------------------------
Sat Mar 4 04:16:41 UTC 2023 - Tejas Guruswamy <tejas.guruswamy@opensuse.org>
- Update to version 1.27.1:
- Update to version 1.27.1:
* Support for Intel discrete graphics and other new platforms (Andrzej
Turko, Matt Roper, Clint Taylor, Tejas Upadhyay, et al)
* Support for MSM driver. (Mark Yacoub, Rob Clark)

View File

@@ -17,18 +17,16 @@
Name: intel-gpu-tools
Version: 1.27.1
Version: 1.28
Release: 0
Summary: Collection of tools for development and testing of the Intel DRM driver
License: MIT
Group: Development/Tools/Other
URL: https://xorg.freedesktop.org/
Source0: http://xorg.freedesktop.org/releases/individual/app/igt-gpu-tools-%{version}.tar.xz
Source1: http://xorg.freedesktop.org/releases/individual/app/igt-gpu-tools-%{version}.tar.xz.sig
Patch0: u_%{name}-1.7-fix-bashisms.patch
Patch1: intel-gpu-tools-libproc2_libproc2_library.patch
Source0: https://xorg.freedesktop.org/releases/individual/app/igt-gpu-tools-%{version}.tar.xz
Source1: https://xorg.freedesktop.org/releases/individual/app/igt-gpu-tools-%{version}.tar.xz.sig
BuildRequires: bison
BuildRequires: fdupes
BuildRequires: flex
BuildRequires: meson
BuildRequires: peg
@@ -54,6 +52,7 @@ BuildRequires: pkgconfig(xrandr)
BuildRequires: pkgconfig(xv)
# This was part of the xorg-x11-driver-video package up to version 7.6
Conflicts: xorg-x11-driver-video <= 7.6
Provides: igt-gpu-tools = %{version}
# Intel GPU is only available on x86 and x86-64
ExclusiveArch: %{ix86} x86_64
@@ -70,30 +69,37 @@ Requires: %{name} = %{version}
Development files and library headers for %{name}
%prep
%setup -q -n igt-gpu-tools-%{version}
%patch0
#Only works with libproc2, not libprocps, despite description
%patch1 -p1
%autosetup -n igt-gpu-tools-%{version}
%build
#Tests fail on x86_64 with -z now
#https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/102
export SUSE_ZNOW=0
%meson
# Tests fail on x86_64 with -z now
# https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/102
%meson -Dc_link_args="-z lazy"
%meson_build
# build documentation
ninja -C %{_vpath_builddir} igt-gpu-tools-doc
%install
%meson_install
sed -i 's#/usr/bin/env python3#/usr/bin/python3#' %{buildroot}%{_bindir}/code_cov_gather_on_test
# fix env-script-interpreter
sed -i 's#/usr/bin/env python3#/usr/bin/python3#' \
%{buildroot}%{_bindir}/{code_cov_gather_on_test,intel-gfx-fw-info}
%fdupes %{buildroot}%{_libexecdir}
%check
%meson_test
%post -p /sbin/ldconfig
%if 0%{?suse_version} > 1500
%ldconfig_scriptlets
%else
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%endif
%files
%doc README.md
%doc NEWS README.md
%license COPYING
%{_bindir}/*
%{_libexecdir}/igt-gpu-tools/

View File

@@ -1,10 +0,0 @@
Index: tools/intel_gpu_abrt
===================================================================
--- tools/intel_gpu_abrt.orig
+++ tools/intel_gpu_abrt
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
if [ $(id -ru) -ne 0 ]; then
echo "$0 must be run as root"