Message ID | 20210120111115.846341-2-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [i-g-t,1/2] i915/gem_create: Check wrap condition for -1 | expand |
On Wed, 20 Jan 2021 at 11:11, Chris Wilson <chris@chris-wilson.co.uk> wrote: > > The largest processor in the works can support 57b of address space, far > more memory than we can afford to use in CI! It is safe to assume that > we will not have 64b processors for some time, so we can use the top bit > to exercise our oversized object detection. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c index 432ccdefa..3610b3cda 100644 --- a/tests/i915/gem_create.c +++ b/tests/i915/gem_create.c @@ -90,6 +90,17 @@ static void invalid_size_test(int fd) igt_assert_eq(create.handle, 0); } +static void massive_test(int fd) +{ + struct drm_i915_gem_create create = { }; + + /* No system has this much memory... Yet small enough not to wrap */ + create.size = -1ull << 32; + igt_assert_eq(create_ioctl(fd, &create), -E2BIG); + + igt_assert_eq(create.handle, 0); +} + /* * Creating an object with non-aligned size request and assert the buffer is * page aligned. And test the write into the padded extra memory. @@ -289,6 +300,9 @@ igt_main igt_subtest("create-invalid-size") invalid_size_test(fd); + igt_subtest("create-massive") + massive_test(fd); + igt_subtest("create-valid-nonaligned") valid_nonaligned_size(fd);
The largest processor in the works can support 57b of address space, far more memory than we can afford to use in CI! It is safe to assume that we will not have 64b processors for some time, so we can use the top bit to exercise our oversized object detection. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- tests/i915/gem_create.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)