summaryrefslogtreecommitdiff
path: root/tools/intel_gpu_top.c
AgeCommit message (Collapse)Author
2022-06-16intel-gpu-top: Optimise the scanning loop a bitTvrtko Ursulin
Opendir(3) and fdopendir(3) are quite expensive system calls when ran in a loop which iterates all processes in a system times all open files in each. Replace some of them (easy ones) with simpler open(2)/read(2) combo to avoid hammering on the malloc/free. This brings the default CPU usage of the tool on my desktop from ~3% to ~2%. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
2022-05-30intel_gpu_top: Free all memory on exitTvrtko Ursulin
Be nice and explicitly free all memory on exit. Also fix a Valgrind reported unitilised conditional jump. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-05-27intel_gpu_top: Don't show client header if no kernel supportTvrtko Ursulin
On kernels without support for the feature we should skip showing the clients header to avoid confusing users. Simply briefly open a render node to the selected device during init and look if the relevant fields are present in the fdinfo data. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Issue: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/120 Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2022-04-05intel-gpu-top: Add support for per client statsTvrtko Ursulin
Use the i915 exported data in /proc/<pid>/fdinfo to show GPU utilization per DRM client. Example of the output: intel-gpu-top: Intel Tigerlake (Gen12) @ /dev/dri/card0 - 220/ 221 MHz 70% RC6; 0.62/ 7.08 W; 760 irqs/s ENGINES BUSY MI_SEMA MI_WAIT Render/3D 23.06% |██████▊ | 0% 0% Blitter 0.00% | | 0% 0% Video 5.40% |█▋ | 0% 0% VideoEnhance 20.67% |██████ | 0% 0% PID NAME Render/3D Blitter Video VideoEnhance 3082 mpv | || ||▌ ||██ | 3117 neverball |█▉ || || || | 1 systemd |▍ || || || | 2338 gnome-shell | || || || | v2: * Removed hardcoded array size from client add/update by passing in drm_fd_info directly. * Added some asserts and simplified a couple expressions. (Umesh) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
2022-02-21tools/intel_gpu_top: Restore terminal attributesK. Eugene Carlson
Save initial terminal attributes when in interactive mode, and reset when the program quits or receives SIGINT. Prevents bad text entry in some password prompts (e.g., su, passwd). [tursulin: Added commit text from earlier posting. Drop static initializer.] Signed-off-by: K. Eugene Carlson <kvngncrlsn@gmail.com> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2022-02-02intel_gpu_top: Improve error message when insufficient privilegeTvrtko Ursulin
Print out end user friendly help text when the running user has insufficient privilege for accessing system wide performance counters. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Issue: https://gitlab.freedesktop.org/drm/intel/-/issues/5018 Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
2021-12-01intel_gpu_top: Add a sanity check discovered busy metric is per engineTvrtko Ursulin
Adding a cross-check with ABI config name space and not just relying on sysfs names. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com> Acked-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
2021-11-29intel_gpu_top: Remove clients supportTvrtko Ursulin
When kernel feature was removed the intel_gpu_top part was forgotten. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Petri Latvala <petri.latvala@intel.com>
2021-04-01intel_gpu_top: Do not print client header if no client statsTvrtko Ursulin
Add a check if client stats are present to init_clients() so that the returned clients data can be null from the start. This prevents the client stats header to be printed on old kernels. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
2021-02-10intel_gpu_top: Interactive help screenTvrtko Ursulin
Show a list of supported interactive commands when pressing 'h'. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2021-02-10intel_gpu_top: Aggregate clients by PID by defaultTvrtko Ursulin
Implement a default view where clients are aggregated by their PID. Toggled by pressing 'H' similar to top(1). v2: * Fix memory leak. v3: * Do not allow sort by client id in aggregated mode. * Tweak sort criteria and sorting decisions. (Chris) v4: * More tweaks to code flow. (Chris) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2021-02-10intel_gpu_top: Wrap interactive headerTvrtko Ursulin
Slight improvement with regards to wrapping header components to fit console width. If a single element is wider than max it can still overflow but it should now work better for practical console widths. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2021-02-05intel_gpu_top: Include fresh clients in the hide inactive filterChris Wilson
As a new client does not have a delta for its first sample, treat as still as idle and hide it if the user requests not to be shown clients with no activity. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2021-02-05intel_gpu_top: The return of the fractional barChris Wilson
Scale the bar_len into the fractional bar before truncating! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2021-02-03intel_gpu_top: Add option to sort by PIDTvrtko Ursulin
Useful to mimick top view. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2021-02-03intel_gpu_top: Show banner messages when cycling sort modesTvrtko Ursulin
It is useful to let the user know what is the currently active sort mode. v2: * Show some other messages as well. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2021-02-03intel_gpu_top: Always sort the clients array after updateTvrtko Ursulin
Walking the client "list" makes assumptions about the order of active and free slots which means we need to sort the array after every update. Patch is mostly just code movement with the only functional difference of eliminating two subsequent scans with no sort in between This closes a very short window there list iteration could get confused if sysfs clients would change rapidly and unfavourably during tool startup. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2021-02-01intel_gpu_top: Add option to hide inactive clientsTvrtko Ursulin
Allow hiding inactive clients (used no GPU time ever) in interactive mode by pressing 'i'. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2021-01-23intel-gpu-top: Support for client statsTvrtko Ursulin
Adds support for per-client engine busyness stats i915 exports in sysfs and produces output like the below: =============================================================================== intel-gpu-top: Intel Skylake (Gen9) @ /dev/dri/card0 - 951/ 950 MHz; 0% RC6; 14.60/23.62 W; 1482 irqs/s IMC reads: 1287 MiB/s IMC writes: 115 MiB/s ENGINES BUSY MI_SEMA MI_WAIT Render/3D 95.48% |█████████████████████████████████ | 5% 0% Blitter 15.98% |█████ | 10% 0% Video 35.40% |████████████ | 26% 0% VideoEnhance 0.00% | | 0% 0% PID NAME Render/3D Blitter Video VideoEnhance 1053 gem_wsim |███ || ||███ || | 1054 gem_wsim |███████ ||█ || || | =============================================================================== Apart from the existing physical engine utilization it now also shows utilization per client and per engine class. v2: * Version to match removal of global enable_stats toggle. * Plus various fixes. v3: * Support brief backward jumps in client stats. v4: * Support device selection. v5: * Rebase for class aggregation. * Optimise sysfs reads a tiny bit by openat(2) and caching client root. v6: * Show clients as soon as detected, just delay busyness data one period. * Add option to show numeric busyness ('n'). * Further optimize sysfs reads. * Trim overgrown array. (Chris) * Simplify client sort callback and find client loop. (Chris) * Zap non-printable chars when displaying client names. (Chris) v7: * Fix terminal height vs lines printed handling. * Optimise client searches by relying on sorting. * Added some sorting modes cyclable via 's'. * Stray semi-colon and furhter sort cleanup. (Chris) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2020-12-20intel_gpu_top: Fix interactive mode on serial consoleTvrtko Ursulin
TIOCGWINSZ returns zero columns and rows on serial so lets assume 80x24. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2020-12-20intel_gpu_top: Aggregate engine busyness per classTvrtko Ursulin
Similarly to how top(1) handles SMP, we can default to showing engines of a same class as a single bar graph entry. To achieve this a little bit of hackery is employed. PMU sampling is left as is and only at the presentation layer we create a fake set of engines, one for each class, summing and normalizing the load respectively. v2: * Fix building the aggregated engines. * Tidy static variable handling. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2020-12-20intel_gpu_top: Support exiting the tool by pressing 'q'Tvrtko Ursulin
Analogous to top(1) we can enable the user to exit from the tool by pressing 'q' on the console. v2: * Fix sleep period with closed stdin. (Chris) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2020-11-30tools/intel_gpu_top: Add generation info in headerZbigniew Kempczyński
In multi device world we may want to see generation of device we're tracking counters. Add pretty name of the device to be more verbose. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2020-11-26tools/intel_gpu_top: Fixup imc event parsingChris Wilson
After combining rapl_parse and imc_parse into a single pmu_parse, I left the "energy-" prefixes used by rapl (but not imc) in place. Lift the prefix to rapl_open() so that pmu_parse() does work for both rapl and imc! Reported-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Fixes: d0b71b967ccd ("tools/intel_gpu_top: Consolidate imc to use pmu_counter") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2020-11-25tools/intel_gpu_top: Consolidate imc to use pmu_counterChris Wilson
Follow the same pattern as rapl for imc, and consolidate everything to work on struct pmu_counter. v2: Combine rapl_parse/imc_parse into pmu_parse v3: Keep the error message for RAPL not reporting Joules Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2020-11-25tools/intel_gpu_top: Include total package powerChris Wilson
With integrated graphics the TDP is shared between the gpu and the cpu, knowing the total energy consumed by the package is relevant to understanding throttling. v2: Tidy integration by eliminating struct rapl and improve output formatting. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2020-11-17intel_gpu_top: Default GPU list to PCI modeTvrtko Ursulin
It is more obvious for the user to only shows filters for DRM master nodes since those are the ones that intel_gpu_top monitors. v2: * Filter prefix needs to be sys: when listing PCI devices. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2020-11-17lsgpu: Add filter type print-out selectionTvrtko Ursulin
In the previous patch we switched the lsgpu output to a short and user friendly format but some users will need a shorthand for getting other types of device selection filters than the defaut drm. Add some command line switches to enable this: $ lsgpu card0 8086:193B drm:/dev/dri/card0 └─renderD128 drm:/dev/dri/renderD128 $ lsgpu --sysfs card0 8086:193B sys:/sys/devices/pci0000:00/0000:00:02.0/drm/card0 └─renderD128 sys:/sys/devices/pci0000:00/0000:00:02.0/drm/renderD128 $ lsgpu --pci card0 8086:193B pci:vendor=8086,device=193B,card=0 └─renderD128 v2: * Fix pci filter format. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Suggested-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2020-11-17intel_gpu_top: User friendly device listingTvrtko Ursulin
Adding a new device selection print type suitable for user-facing use cases like intel_gpu_top -L and later lsgpu. Instead of: sys:/sys/devices/pci0000:00/0000:00:02.0/drm/card0 subsystem : drm drm card : /dev/dri/card0 parent : sys:/sys/devices/pci0000:00/0000:00:02.0 sys:/sys/devices/pci0000:00/0000:00:02.0/drm/renderD128 subsystem : drm drm render : /dev/dri/renderD128 parent : sys:/sys/devices/pci0000:00/0000:00:02.0 sys:/sys/devices/pci0000:00/0000:00:02.0 subsystem : pci drm card : /dev/dri/card0 drm render : /dev/dri/renderD128 vendor : 8086 device : 193B New format looks like: card0 8086:193B drm:/dev/dri/card0 └─renderD128 drm:/dev/dri/renderD128 Advantages are more compact, more readable, one entry per GPU, shorter string to copy and paste to intel_gpu_top -d, or respective usage. v2: * Increase stack filter size. (Zbigniew) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2020-11-16tools/intel_gpu_top: Show the active deviceChris Wilson
Include the active device name on the update screen. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2020-11-05tools/intel_gpu_top: Fix broken integrated device selectionZbigniew Kempczyński
Last changes incidentally broke integrated device selection on !discrete platforms. Add fallback to select card in discrete / integrated order. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Ayaz A Siddiqui <ayaz.siddiqui@intel.com> Cc: Lyude Paul <lyude@redhat.com> Reviewed-by: Ayaz A Siddiqui <ayaz.siddiqui@intel.com>
2020-10-26lib/igt_device_scan:Add function to get pci subsystem of requested cardAyaz A Siddiqui
intel_gpu_top requires card information and PCI_SLOT_NAME for dGPU. Only pci subsystem contains both information. In case of user filter is other than pci subsystem then we need card information of associated pci subsystem which is stored as parent of requested card if available. A new api has been added to cater intel_gpu_top requirement. Signed-off-by: Ayaz A Siddiqui <ayaz.siddiqui@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Zbigniew Kempczynski <zbigniew.kempczynski@intel.com> Cc: Dixit Ashutosh <ashutosh.dixit@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2020-10-12lib/igt_device_scan: Return true from igt_device_find_first_i915_discrete_card()Lyude Paul
So that we can also print a relevant error message when failing to find any devices in intel_gpu_top. Signed-off-by: Lyude Paul <lyude@redhat.com> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2020-06-11tools/intel_gpu_top: Fix _open_pmu()Ayaz A Siddiqui
_open_pmu() was calling perf_igfx_open_group() which in turn was calling igt_perf_type_id("i915") each time. By making _open_pmu() take type as a parameter and call igt_perf_open_group() we achieve two things: * we use the correct type for engines->device instead of the hardcoded "i915" * optimization - we call igt_perf_type_id() once - it's reading sysfs Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Signed-off-by: Ayaz A Siddiqui <ayaz.siddiqui@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2020-06-08tools/intel_gpu_top: Add support of discrete GPU and card selectionAyaz A Siddiqui
In intel_gpu_top device path was hard coded for integrated GPU. With this patch we: * use igt_device_scan library for device scanning, * make discrete GPU the default one, * provided options for card selection. v2: * explicitly set ret to EXIT_SUCCESS after all the other uses * fix use after free of opt_device (Tvrtko) * use EXIT_FAILURE instead of "1" (Tvrtko) Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Signed-off-by: Ayaz A Siddiqui <ayaz.siddiqui@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2020-01-14i915/perf: Find the associated perf-type for a particular deviceChris Wilson
Since with multiple devices, we may have multiple different perf_pmu each with their own type, we want to find the right one for the job. The tests are run with a specific fd, from which we can extract the appropriate bus-id and find the associated perf-type. The performance monitoring tools are a little more general and not yet ready to probe all device or bind to one in particular, so we just assume the default igfx for the time being. v2: Extract the bus address from out of sysfs v3: A new name for a new decade! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: "Robert M. Fosha" <robert.m.fosha@intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: "Robert M. Fosha" <robert.m.fosha@intel.com> #v2 Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2019-02-25tools/intel_gpu_top: Add file output capabilityTvrtko Ursulin
A new -o command switch enables logging to a file. v2: * Support "-o -" for explicit stdout selection. (Chris Wilson) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> References: https://bugs.freedesktop.org/show_bug.cgi?id=108689 Cc: Eero Tamminen <eero.t.tamminen@intel.com> Cc: 3.14pi@ukr.net Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-02-25tools/intel_gpu_top: Add support for stdout loggingTvrtko Ursulin
Two new output modes are added: listing of text data to standard out (-l on the command line), and dumping of JSON formatted records (-J), also to standard out. The first mode is selected automatically when non-interactive standard out is detected. Example of text output: Freq MHz IRQ RC6 Power IMC MiB/s RCS/0 BCS/0 VCS/0 VCS/1 VECS/0 req act /s % W rd wr % se wa % se wa % se wa % se wa % se wa 0 0 0 0 0.00 360 0 0.00 0 0 0.00 0 0 0.00 0 0 0.00 0 0 0.00 0 0 350 350 0 100 0.00 35 2 0.00 0 0 0.00 0 0 0.00 0 0 0.00 0 0 0.00 0 0 350 350 0 100 0.00 34 2 0.00 0 0 0.00 0 0 0.00 0 0 0.00 0 0 0.00 0 0 350 350 0 100 0.00 143 6 0.00 0 0 0.00 0 0 0.00 0 0 0.00 0 0 0.00 0 0 350 350 0 100 0.00 169 7 0.00 0 0 0.00 0 0 0.00 0 0 0.00 0 0 0.00 0 0 350 350 0 100 0.00 169 7 0.00 0 0 0.00 0 0 0.00 0 0 0.00 0 0 0.00 0 0 Example of JSON output: { "period": { "duration": 1002.525224, "unit": "ms" }, "frequency": { "requested": 349.118398, "actual": 349.118398, "unit": "MHz" }, "interrupts": { "count": 0.000000, "unit": "irq/s" }, "rc6": { "value": 99.897752, "unit": "%" }, "power": { "value": 0.000000, "unit": "W" }, "imc-bandwidth": { "reads": 149.683843, "writes": 6.104093, "unit": "MiB/s" }, "engines": { "Render/3D/0": { "busy": 0.000000, "sema": 0.000000, "wait": 0.000000, "unit": "%" }, "Blitter/0": { "busy": 0.000000, "sema": 0.000000, "wait": 0.000000, "unit": "%" }, "Video/0": { "busy": 0.000000, "sema": 0.000000, "wait": 0.000000, "unit": "%" }, "Video/1": { "busy": 0.000000, "sema": 0.000000, "wait": 0.000000, "unit": "%" }, "VideoEnhance/0": { "busy": 0.000000, "sema": 0.000000, "wait": 0.000000, "unit": "%" } } } v2: * Show example output in commit message. * Install signal handler to complete output on SIGINT. (Chris Wilson) v3: * Use asprintf where possible. (Chris Wilson) v4: * Check asprintf return value, not the pointer. * Rename fmt_d/dd to fmt_width/precision. (Chris Wilson) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> References: https://bugs.freedesktop.org/show_bug.cgi?id=108689 Cc: Eero Tamminen <eero.t.tamminen@intel.com> Cc: 3.14pi@ukr.net Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-05-31intel-gpu-top: Rewrite the tool to be safe to useTvrtko Ursulin
intel-gpu-top is a dangerous tool which can hang machines due unsafe mmio register access. This patch rewrites it to use only PMU. Only overall command streamer busyness and GPU global data such as power and frequencies are included in this new version. For access to more GPU functional unit level data, an OA metric based tool like gpu-top should be used instead. v2: * Sort engines by class and instance. * Do not wait for one sampling period to display something on screen. * Move code out of the asserts. (Rinat Ibragimov) * Continuously adapt to terminal size. (Rinat Ibragimov) v3: * Change layout and precision of some field. (Chris Wilson) Eero Tamminen: * Use more user friendly engine names. * Don't error out if a counter is missing. * Add IMC read/write bandwidth. * Report minimum required kernel version. v4: * Really support 4.16 by skipping of missing engines. * Simpler and less hacky float printing. * Preserve copyright header. (Antonio Argenziano) * Simplify engines_ptr macro. (Rinat Ibragimov) v5: * Get RAPL unit from sysfs. * Consolidate sysfs paths with a macro. * Tidy error handling by carrying over and reporting errno. * Check against console height on all prints. * More readable minimum kernel version message. (Eero Tamminen) * Column banner for per engine stats. (Eero Tamminen) v6: * Man page update. (Eero Tamminen) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Eero Tamminen <eero.t.tamminen@intel.com> Cc: Rinat Ibragimov <ibragimovrinat@mail.ru> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> # v1 Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> # v0.5 Reviewed-by: Matthew Auld <matthew.auld@intel.com>
2018-01-11include inttypes.h for PRI definesMike Frysinger
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96620 Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-11-21tools: Stop opening the driver just to find the debugfsChris Wilson
Since the tools want to work without the module loaded, remove the assumption that we want to load the driver to find debugfs. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Ville Syrjala <ville.syrjala@linux.intel.com>
2017-09-08build: Nuke #ifdef HAVE_CONFIG_H cargo-cultDaniel Vetter
We have it. Daniel Stone said the #ifdef HAVE_CONFIG_H comes from the X11 transition to the modular build, where in the imake -> modular build transition config.h wasn't universally available. Now we just make this a requirement (so yeah Android better generate one too). v2: Improve commit message a bit. Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-08-08intel_gpu_top: Use drm_open_driver, don't need drm masterPetri Latvala
Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2017-03-21Restore "lib: Open debugfs files for the given DRM device"Chris Wilson
This reverts commit 25fbae15262cf570e207e62f50e7c5233e06bc67, restoring commit 301ad44cdf1b868b1ab89096721da91fa8541fdc Author: Tomeu Vizoso <tomeu.vizoso@collabora.com> Date: Thu Mar 2 10:37:11 2017 +0100 lib: Open debugfs files for the given DRM device with fixes. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-03-21Revert "lib: Open debugfs files for the given DRM device"Tomeu Vizoso
This reverts commit 301ad44cdf1b868b1ab89096721da91fa8541fdc. When a render-only device is opened and gem_quiescent_gpu is called, we need to use the debugfs dir for the master device instead. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
2017-03-21lib: Open debugfs files for the given DRM deviceTomeu Vizoso
When opening a DRM debugfs file, locate the right path based on the given DRM device FD. This is needed so, in setups with more than one DRM device, any operations on debugfs files affect the expected DRM device. v2: - rebased and fixed new API additions v3: - updated chamelium test, which was missed previously - use the minor of the device for the debugfs path, not the major - have a proper exit handler for calling igt_hpd_storm_reset with the right device fd. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Robert Foss <robert.foss@collabora.com> Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-08Fix a bunch of printf typesVille Syrjälä
igt_kms.c: In function ‘igt_crtc_set_background’: igt_kms.c:1940:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=] LOG(display, "%s.%d: crtc_set_background(%lu)\n", ^ intel_firmware_decode.c: In function ‘csr_open’: intel_firmware_decode.c:169:2: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 3 has type ‘__off_t’ [-Wformat=] printf("Firmware: %s (%zd bytes)\n", filename, st.st_size); ^ intel_gpu_top.c: In function ‘main’: intel_gpu_top.c:683:10: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Wformat=] stats[i] - last_stats[i]); ^ hsw_compute_wrpll.c: In function ‘main’: hsw_compute_wrpll.c:644:3: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘long long int’ [-Wformat=] igt_fail_on_f(ref->r2 != r2 || ref->n2 != n2 || ref->p != p, ^ gem_gtt_hog.c: In function ‘__real_main155’: gem_gtt_hog.c:177:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformat=] igt_info("Time to execute %lu children: %7.3fms\n", ^ kms_flip.c: In function ‘run_test_step’: kms_flip.c:985:3: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 10 has type ‘__time_t’ [-Wformat=] igt_assert_f(end - start > 0.9 * frame_time(o) && ^ kms_flip.c:985:3: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 11 has type ‘__suseconds_t’ [-Wformat=] kms_frontbuffer_tracking.c: In function ‘setup_sink_crc’: kms_frontbuffer_tracking.c:1364:3: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘ssize_t’ [-Wformat=] igt_info("Unexpected sink CRC error, rc=:%ld errno:%d %s\n", ^ Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-03-22lib/intel_io: rename mmio setup functionsDaniel Vetter
Makes their intent a bit clearer. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22lib: rename intel_gpu_tools.h to intel_io.hDaniel Vetter
With the header cleanup we can now give this header a suitable name, since it now really only contains register access and other I/O functions and assorted definitions. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22lib: remove uncessary #includes from headersDaniel Vetter
Only include what the header itself needs. The big fish here is intel-gpu-tools.h. More will follow. One ugly thing removed here is the duplicated GEN6_TD_CTL #define, one of which was broken. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>