All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Subject: Re: [PATCH v11] drm/i915: Engine discovery query
Date: Wed, 01 May 2019 16:58:44 +0100	[thread overview]
Message-ID: <155672632459.1850.4821984616007913694@skylake-alporthouse-com> (raw)
In-Reply-To: <a97b774d-a0bf-0fe2-6313-d62e397c948f@linux.intel.com>

Quoting Tvrtko Ursulin (2019-05-01 16:51:28)
> 
> On 01/05/2019 12:55, Chris Wilson wrote:
> > Quoting Tvrtko Ursulin (2019-05-01 12:45:36)
> >> Hmm.. probably manual check for no holes _and_ alignment is good enough
> >> for uAPI since once it's in it's in. Will triple-check.
> > 
> > Yeah, we actually need something more like
> > offsetofend(previous_field) == offsetof(next_field)
> > 
> > BUILD_BUG_ON(check_user_struct(info, previous_field, next_field)) ?
> 
> How would you logistically do it? List all struct members for each uapi 
> struct you want to check?
> 
> Maybe a variadic macro like:
> 
> CHECK_USER_STRUCT_FUNCTION(type, member0, ... memberN);
> 
> Which expands to a dedicated function to check this type, using 
> va_start/va_end to iterate all members checking for holes. So somewhere 
> in code we would also need:
> 
> CHECK_USER_STRUCT(type);
> 
> Which would call the function. But thats not build time.. Could be under 
> debug and selftests I guess. Could even be IGT in this case.
> 
> But I am not to keen in listing each struct member with a 
> prev/next_field BUILD_BUG_ON.
> 
> Perhaps IGT is indeed a better place to start testing for this. Since we 
> anyway require each new uAPI to have good IGT coverage.

Definitely don't like the idea of doing it manually, I could have just
about accepted it if we could have rolled it into a get_user wrapper.

We should just go annoy Jani to whip up some Makefile magic to call
pahole and check the structs defined in uapi.h
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-05-01 15:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-01 10:52 [PATCH v11] drm/i915: Engine discovery query Tvrtko Ursulin
2019-05-01 11:03 ` ✗ Fi.CI.BAT: failure for drm/i915: Engine discovery query (rev8) Patchwork
2019-05-01 11:10 ` [PATCH v11] drm/i915: Engine discovery query Chris Wilson
2019-05-01 11:45   ` Tvrtko Ursulin
2019-05-01 11:55     ` Chris Wilson
2019-05-01 15:51       ` Tvrtko Ursulin
2019-05-01 15:58         ` Chris Wilson [this message]
2019-05-02  6:30 Tvrtko Ursulin

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=155672632459.1850.4821984616007913694@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@linux.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.