[Intel-gfx] [PATCH v11] drm/i915: Engine discovery query
Chris Wilson
chris at chris-wilson.co.uk
Wed May 1 15:58:44 UTC 2019
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
More information about the Intel-gfx
mailing list