[igt-dev] [PATCH i-g-t v5 2/3] tests: add i915 query tests
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Thu Mar 8 14:52:45 UTC 2018
On 08/03/18 14:44, Chris Wilson wrote:
> Quoting Lionel Landwerlin (2018-03-08 14:31:16)
>> On 08/03/18 11:22, Tvrtko Ursulin wrote:
>>> Interesting question how we want to name this test. We don't have any
>>> i915_ prefix tests, but for instance there is drv_getparams_basic,
>>> suggesting this could be called drv_query_ioctl or something?
>>>
>>> Open for discussion I guess.
>> I've been considering renaming perf.c (that's a pretty confusing one...)
>>
>> One could argue that if IGT tests more than intel devices, we should
>> have a driver prefix (I see vc4 has).
> Yes. Move all of the i915.ko specific tests to tests/i915/
>
> For build system simplicity, I'd advocate keeping generic tests
> separate from driver specific tests. So kms_flip would have kms/ and
> i915/ portions, etc.
>
> (And tools/i915; benchmarks/i915 etc)
>
>>>> + items_ptr = mmap(0, 4096, PROT_WRITE, MAP_PRIVATE | MAP_ANON,
>>>> -1, 0);
>>>> + items_ptr[0].query_id = DRM_I915_QUERY_TOPOLOGY_INFO;
>>>> + i915_query_item(fd, items_ptr, 1);
>>>> + igt_assert(items_ptr[0].length >= sizeof(struct
>>>> drm_i915_query_topology_info));
>>>> + munmap(items_ptr, 4096);
>>>> + i915_query_item_err(fd, items_ptr, 1, EFAULT);
>>> Another good test would be passing in a read only mapping and checking
>>> for EFAULT when length writeback fails.
>> Hm... how to do you write something sensible into a read only mapping so
>> that the kernel would at least try to write to it? :)
> ptr = mmap(sz);
> memset(ptr, 0xc5, sz);
> mprotect(ptr, sz, PROT_READ);
>
> So you can setup a valid blob tricking the kernel to write back to it
> and send us an EFAULT.
> -Chris
>
Thanks I ended up answering my own question :)
More information about the igt-dev
mailing list