1. 26 Mar, 2017 3 commits
    • Linus Torvalds's avatar
      give up on gcc ilog2() constant optimizations · 85f68770
      Linus Torvalds authored
      commit 474c9015 upstream.
      
      gcc-7 has an "optimization" pass that completely screws up, and
      generates the code expansion for the (impossible) case of calling
      ilog2() with a zero constant, even when the code gcc compiles does not
      actually have a zero constant.
      
      And we try to generate a compile-time error for anybody doing ilog2() on
      a constant where that doesn't make sense (be it zero or negative).  So
      now gcc7 will fail the build due to our sanity checking, because it
      created that constant-zero case that didn't actually exist in the source
      code.
      
      There's a whole long discussion on the kernel mailing about how to work
      around this gcc bug.  The gcc people themselevs have discussed their
      "feature" in
      
         https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785
      
      but it's all water under the bridge, because while it looked at one
      point like it would be solved by the time gcc7 was released, that was
      not to be.
      
      So now we have to deal with this compiler braindamage.
      
      And the only simple approach seems to be to just delete the code that
      tries to warn about bad uses of ilog2().
      
      So now "ilog2()" will just return 0 not just for the value 1, but for
      any non-positive value too.
      
      It's not like I can recall anybody having ever actually tried to use
      this function on any invalid value, but maybe the sanity check just
      meant that such code never made it out in public.
      Reported-by: default avatarLaura Abbott <labbott@redhat.com>
      Cc: John Stultz <john.stultz@linaro.org>,
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      85f68770
    • Eric Anholt's avatar
      drm/vc4: Use runtime autosuspend to avoid thrashing V3D power state. · 2bbcbc24
      Eric Anholt authored
      commit 3a622346 upstream.
      
      The pm_runtime_put() we were using immediately released power on the
      device, which meant that we were generally turning the device off and
      on once per frame.  In many profiles I've looked at, that added up to
      about 1% of CPU time, but this could get worse in the case of frequent
      rendering and readback (as may happen in X rendering).  By keeping the
      device on until we've been idle for a couple of frames, we drop the
      overhead of runtime PM down to sub-.1%.
      Signed-off-by: default avatarEric Anholt <eric@anholt.net>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2bbcbc24
    • Eric Anholt's avatar
      drm/vc4: Fix termination of the initial scan for branch targets. · dd0b0e22
      Eric Anholt authored
      commit 457e67a7 upstream.
      
      The loop is scanning until the original max_ip (size of the BO), but
      we want to not examine any code after the PROG_END's delay slots.
      There was a block trying to do that, except that we had some early
      continue statements if the signal wasn't a PROG_END or a BRANCH.
      
      The failure mode would be that a valid shader is rejected because some
      undefined memory after the PROG_END slots is parsed as a branch and
      the rest of its setup is illegal.  I haven't seen this in the wild,
      but valgrind was complaining when about this up in the userland
      simulator mode.
      Signed-off-by: default avatarEric Anholt <eric@anholt.net>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dd0b0e22
  2. 22 Mar, 2017 37 commits