From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org,
Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: Re: [igt-dev] [RFT i-g-t] lib/i915: Assert mmap size alignment
Date: Tue, 5 Mar 2019 09:23:02 +0000 [thread overview]
Message-ID: <484bd183-ae0b-7231-e1ce-91db16b067ec@linux.intel.com> (raw)
In-Reply-To: <155177513173.27405.11341659637150090555@skylake-alporthouse-com>
On 05/03/2019 08:38, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2019-03-05 07:55:43)
>>
>> On 04/03/2019 14:45, Chris Wilson wrote:
>>> Quoting Tvrtko Ursulin (2019-03-04 14:11:31)
>>>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>>
>>>> Fishing for fails...
>>>>
>>>> /*
>>>> mmap(2) mandates size is page aligned so check this in our wrappers.
>>>> */
>>>>
>>>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>> ---
>>>> lib/i915/gem_mman.c | 4 ++++
>>>> lib/igt_fb.c | 14 ++++++++------
>>>> tests/kms_ccs.c | 14 ++++++++------
>>>> tests/kms_psr.c | 8 ++++----
>>>> 4 files changed, 24 insertions(+), 16 deletions(-)
>>>>
>>>> diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c
>>>> index 3cf9a6bbdb31..084dbb3b3678 100644
>>>> --- a/lib/i915/gem_mman.c
>>>> +++ b/lib/i915/gem_mman.c
>>>> @@ -57,6 +57,8 @@ void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot)
>>>> struct drm_i915_gem_mmap_gtt mmap_arg;
>>>> void *ptr;
>>>>
>>>> + igt_assert(!(size & 4095));
>>>
>>> Fwiw, it's probably best if we had some kind of IGT_BUG_ON() that caused
>>> a much more visible explosion than a mere test failure.
>>>
>>> #define IGT_BUG_ON(cond) if (!(cond)) raise(SIGILL)
>>
>> No idea if that would be worthwhile.
>>
>> But anyway, it seems I have identified all the tests which do
>> non-page-aligned mmap. So..
>>
>> a) leave the assert in low level mmap helpers
>> b) move the assert to higher level wrappers
>> c) round up in wrappers is not an option due unmap
>> d) do nothing in igt
>
> Imo leave the wrappers alone, fix the bugs in the callers, fume that it
> didn't explode earlier.
Not even a small igt_warn or tiny igt_debug in the wrappers? :)
Regards,
Tvrtko
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
WARNING: multiple messages have this Message-ID (diff)
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [igt-dev] [RFT i-g-t] lib/i915: Assert mmap size alignment
Date: Tue, 5 Mar 2019 09:23:02 +0000 [thread overview]
Message-ID: <484bd183-ae0b-7231-e1ce-91db16b067ec@linux.intel.com> (raw)
In-Reply-To: <155177513173.27405.11341659637150090555@skylake-alporthouse-com>
On 05/03/2019 08:38, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2019-03-05 07:55:43)
>>
>> On 04/03/2019 14:45, Chris Wilson wrote:
>>> Quoting Tvrtko Ursulin (2019-03-04 14:11:31)
>>>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>>
>>>> Fishing for fails...
>>>>
>>>> /*
>>>> mmap(2) mandates size is page aligned so check this in our wrappers.
>>>> */
>>>>
>>>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>> ---
>>>> lib/i915/gem_mman.c | 4 ++++
>>>> lib/igt_fb.c | 14 ++++++++------
>>>> tests/kms_ccs.c | 14 ++++++++------
>>>> tests/kms_psr.c | 8 ++++----
>>>> 4 files changed, 24 insertions(+), 16 deletions(-)
>>>>
>>>> diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c
>>>> index 3cf9a6bbdb31..084dbb3b3678 100644
>>>> --- a/lib/i915/gem_mman.c
>>>> +++ b/lib/i915/gem_mman.c
>>>> @@ -57,6 +57,8 @@ void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot)
>>>> struct drm_i915_gem_mmap_gtt mmap_arg;
>>>> void *ptr;
>>>>
>>>> + igt_assert(!(size & 4095));
>>>
>>> Fwiw, it's probably best if we had some kind of IGT_BUG_ON() that caused
>>> a much more visible explosion than a mere test failure.
>>>
>>> #define IGT_BUG_ON(cond) if (!(cond)) raise(SIGILL)
>>
>> No idea if that would be worthwhile.
>>
>> But anyway, it seems I have identified all the tests which do
>> non-page-aligned mmap. So..
>>
>> a) leave the assert in low level mmap helpers
>> b) move the assert to higher level wrappers
>> c) round up in wrappers is not an option due unmap
>> d) do nothing in igt
>
> Imo leave the wrappers alone, fix the bugs in the callers, fume that it
> didn't explode earlier.
Not even a small igt_warn or tiny igt_debug in the wrappers? :)
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-03-05 9:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-04 14:11 [igt-dev] [RFT i-g-t] lib/i915: Assert mmap size alignment Tvrtko Ursulin
2019-03-04 14:11 ` Tvrtko Ursulin
2019-03-04 14:41 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/i915: Assert mmap size alignment (rev4) Patchwork
2019-03-04 14:45 ` [igt-dev] [RFT i-g-t] lib/i915: Assert mmap size alignment Chris Wilson
2019-03-04 14:45 ` Chris Wilson
2019-03-05 7:55 ` Tvrtko Ursulin
2019-03-05 7:55 ` Tvrtko Ursulin
2019-03-05 8:38 ` Chris Wilson
2019-03-05 8:38 ` Chris Wilson
2019-03-05 9:23 ` Tvrtko Ursulin [this message]
2019-03-05 9:23 ` Tvrtko Ursulin
2019-03-05 9:30 ` Chris Wilson
2019-03-05 9:30 ` Chris Wilson
2019-03-04 18:33 ` [igt-dev] ✓ Fi.CI.IGT: success for lib/i915: Assert mmap size alignment (rev4) Patchwork
-- strict thread matches above, loose matches on Subject: below --
2019-03-04 7:14 [igt-dev] [RFT i-g-t] lib/i915: Assert mmap size alignment Tvrtko Ursulin
2019-03-04 7:11 Tvrtko Ursulin
2019-03-01 9:37 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=484bd183-ae0b-7231-e1ce-91db16b067ec@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
--cc=tvrtko.ursulin@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.