[PATCH i-g-t] lib/igt_device_scan: Skip attributes in subdirectories
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Mon Jul 8 06:58:11 UTC 2024
On Thu, Jul 04, 2024 at 06:44:37PM +0200, Marcin Bernatowicz wrote:
> Skip attributes in subdirectories as they are not used for filtering.
> This change improves speed and reduces the impact of non-DRM related
> component bugs on testing, such as ASPM issues.
>
> Rename function is_on_blacklist to is_on_blocklist to promote more
> inclusive language.
>
> Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz at linux.intel.com>
> ---
> lib/igt_device_scan.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
> index 9a2da3d62..6473ca7ad 100644
> --- a/lib/igt_device_scan.c
> +++ b/lib/igt_device_scan.c
> @@ -433,7 +433,7 @@ static enum dev_type __pci_devtype(uint16_t vendor, uint16_t device, const char
> /* Reading sysattr values can take time (even seconds),
> * we want to avoid reading such keys.
> */
> -static bool is_on_blacklist(const char *what)
> +static bool is_on_blocklist(const char *what)
> {
> static const char *keys[] = { "config", "modalias", "modes",
> "resource",
> @@ -442,16 +442,18 @@ static bool is_on_blacklist(const char *what)
> "resource0_wc", "resource1_wc", "resource2_wc",
> "resource3_wc", "resource4_wc", "resource5_wc",
> "uevent", NULL};
> - const char *key;
> - int i = 0;
> + const char **key;
>
> if (what == NULL)
> return false;
>
> - while ((key = keys[i++])) {
> - if (strcmp(key, what) == 0)
> + /* Skip attributes in subdirectories */
> + if (strchr(what, '/') != NULL)
> + return true;
As we already drop some attributes I have nothing against further
list expanding. I've checked what attributes I see on 'lsgpu -p'
on devices I have an access to and it is mostly 'power/*'. Only
doubt I have is if someone is using this for its scripting but
we can revert this change then.
So from me:
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
--
Zbigniew
> +
> + for (key = keys; *key; key++)
> + if (strcmp(*key, what) == 0)
> return true;
> - }
>
> return false;
>
> @@ -553,7 +555,7 @@ static void get_attrs(struct udev_device *dev, struct igt_device *idev)
> const char *key = udev_list_entry_get_name(entry);
> const char *value;
>
> - if (is_on_blacklist(key)) {
> + if (is_on_blocklist(key)) {
> entry = udev_list_entry_get_next(entry);
> continue;
> }
> --
> 2.31.1
>
More information about the igt-dev
mailing list