Re: [PATCH igt] igt/gen7_forcewake_mt: Make the mmio register as volatile

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

 



Quoting Chris Wilson (2018-03-06 10:41:41)
>  static void *thread(void *arg)
>  {
> +       static const char acquire_error[] = "acquire";
> +       static const char release_error[] = "release";
> +
>         struct thread *t = arg;
> -       uint32_t *forcewake_mt = (uint32_t *)((char *)t->mmio + FORCEWAKE_MT);
> -       uint32_t bit = 1 << t->bit;
> +       const uint32_t bit = 1 << t->bit;
> +       volatile uint32_t *forcewake_mt = t->forcewake_mt;
> +       void *result = NULL;
> +
> +       while (!result && !READ_ONCE(t->done)) {
> +               /*
> +                * The HW is fubar; concurrent mmio access to even
> +                * the FORCEWAKE_MT results in a machine lockup, nullifying
> +                * the entire purpose of FORCEWAKE_MT... Sigh.
> +                */
> +               pthread_mutex_lock(t->lock);
>  
> -       while (1) {
>                 *forcewake_mt = bit << 16 | bit;
> -               igt_assert(*forcewake_mt & bit);
> +               if (!igt_wait(*forcewake_mt & bit, 50, 1))
> +                       result = (void *)acquire_error;
> +

Imagine there was
               pthread_mutex_unlock(t->lock);
	       usleep(10000);
               pthread_mutex_lock(t->lock);
here.

>                 *forcewake_mt = bit << 16;
> -               igt_assert((*forcewake_mt & bit) == 0);
> +               if (!igt_wait((*forcewake_mt & bit) == 0, 50, 1))
> +                       result = (void *)release_error;
> +
> +               pthread_mutex_unlock(t->lock);
>         }
-Chris
_______________________________________________
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