All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Arkadiusz Hiler <arkadiusz.hiler@intel.com>,
	igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t] tests/i915/module_load: Add probe subtest
Date: Tue, 11 Dec 2018 13:41:48 +0000	[thread overview]
Message-ID: <154453570790.11001.16772635558002964262@skylake-alporthouse-com> (raw)
In-Reply-To: <20181211130206.18804-1-arkadiusz.hiler@intel.com>

Quoting Arkadiusz Hiler (2018-12-11 13:02:06)
> The subtest is intended to be run as the very first thing on a machine with
> i915 blacklisted. It is supposed to be a catch-all for warnings/issues that
> happen during the initial module load.
> 
> If i915 turns out to be already loaded, the subtest simply skips.
> 
> Cc: Petri Latvala <petri.latvala@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> ---
>  tests/i915/module_load.c | 40 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
> 
> diff --git a/tests/i915/module_load.c b/tests/i915/module_load.c
> index 7fe83520..14552990 100644
> --- a/tests/i915/module_load.c
> +++ b/tests/i915/module_load.c
> @@ -324,8 +324,48 @@ hda_dynamic_debug(bool enable)
>         fclose(fp);
>  }
>  
> +static void
> +reprobe_connectors(int fd)
> +{
> +       int i, ret;
> +       struct drm_mode_get_connector conn;
> +
> +       drmModeResPtr res = drmModeGetResources(fd);
> +       if (!res)
> +               return;
> +
> +       for (i = 0; i < res->count_connectors; ++i) {
> +               memset(&conn, 0, sizeof(conn));
> +               conn.connector_id = res->connectors[i];
> +               ret = drmIoctl(fd, DRM_IOCTL_MODE_GETCONNECTOR, &conn);
> +               igt_assert_neq(ret, -EFAULT);

drmIoctl(GETCONNECTOR) returns 0 or -1.

There's an interesting compat issue with struct drm_mode_get_connector
and needs padding for 32b userspace on 64b kernel. Worth double checking
if that's been fixed in the headers or not, and if not provide a compat
struct, which can be zeroed inside the block with just a local C99
instantiation.

> +       }
> +
> +       drmModeFreeResources(res);

res is a global? Now a dangling pointer.

Since all you want is connectors[], you can just do GETRESOURCES and
just get the connectors[] into an onstack array. Give it 32 or 64 u32
and add a fixme if we ever need more (or do just a malloc for the large
array).
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2018-12-11 13:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 13:02 [igt-dev] [PATCH i-g-t] tests/i915/module_load: Add probe subtest Arkadiusz Hiler
2018-12-11 13:32 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-12-11 13:41 ` Chris Wilson [this message]
2018-12-11 14:47 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=154453570790.11001.16772635558002964262@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=arkadiusz.hiler@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.