Re: [PATCH 19/37] drm/i915: Test coherency of and barriers between cache domains

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 13, 2017 at 11:44:23AM +0000, Matthew Auld wrote:
> On 11 January 2017 at 21:09, Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> wrote:
> > Write into an object using WB, WC, GTT, and GPU paths and make sure that
> > our internal API is sufficient to ensure coherent reads and writes.
> >
> > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > ---
> >  drivers/gpu/drm/i915/i915_gem.c                    |   1 +
> >  .../gpu/drm/i915/selftests/i915_gem_coherency.c    | 355 +++++++++++++++++++++
> >  .../gpu/drm/i915/selftests/i915_live_selftests.h   |   1 +
> >  3 files changed, 357 insertions(+)
> >  create mode 100644 drivers/gpu/drm/i915/selftests/i915_gem_coherency.c
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > index 4a52c5872898..242d894b356e 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -4899,4 +4899,5 @@ i915_gem_object_get_dma_address(struct drm_i915_gem_object *obj,
> >  #include "selftests/mock_gem_device.c"
> >  #include "selftests/huge_gem_object.c"
> >  #include "selftests/i915_gem_object.c"
> > +#include "selftests/i915_gem_coherency.c"
> >  #endif
> > diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_coherency.c b/drivers/gpu/drm/i915/selftests/i915_gem_coherency.c
> > new file mode 100644
> > index 000000000000..3e57b7a3c73f
> > --- /dev/null
> > +++ b/drivers/gpu/drm/i915/selftests/i915_gem_coherency.c
> > @@ -0,0 +1,355 @@
> > +/*
> > + * Copyright © 2017 Intel Corporation
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a
> > + * copy of this software and associated documentation files (the "Software"),
> > + * to deal in the Software without restriction, including without limitation
> > + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including the next
> > + * paragraph) shall be included in all copies or substantial portions of the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> > + * IN THE SOFTWARE.
> > + *
> > + */
> > +
> > +#include <linux/prime_numbers.h>
> > +
> > +#include "i915_selftest.h"
> > +#include "i915_random.h"
> > +
> > +static int cpu_set(struct drm_i915_gem_object *obj,
> > +                  unsigned long offset,
> > +                  u32 v)
> > +{
> > +       unsigned int needs_clflush;
> > +       struct page *page;
> > +       typeof(v) *map;
> Are you expecting typeof v to change, so less churn ?

A few times in writing. Mainly my intent was to document that map is the
same type as v to avoid any implicit conversion.

> > +       mutex_lock(&i915->drm.struct_mutex);
> > +       for (over = igt_coherency_mode; over->name; over++) {
> > +               if (!over->set)
> > +                       continue;
> > +
> > +               for (write = igt_coherency_mode; write->name; write++) {
> > +                       if (!write->set)
> > +                               continue;
> > +
> > +                       for (read = igt_coherency_mode; read->name; read++) {
> > +                               if (!read->get)
> > +                                       continue;
> > +
> > +                               for_each_prime_number_from(count, 1, ncachelines) {
> > +                                       obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
> > +                                       if (IS_ERR(obj))
> This looks a little nasty, err may be uninitialised, and even worse it
> looks like the if (obj) check will pass.

I forgot about err being unset. I did mean that if we ran out of memory
here, we just give up. That's probably a bit silly, reporting ENOMEM as
an indication that we didn't actually run all phases and so didn't
complete the test is sensible. It was from the time before it looped
over all combinations of modes, thinking that they would be seperate
tests and this was just a memory exhaustion stopping a repeated test.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux