GPU clocks drop to lowest possible when GPU active due to SW power cap

You can see the clocks dropping as soon as the GPU is active here:

$ nvidia-smi dmon
# gpu   pwr  temp    sm   mem   enc   dec  mclk  pclk
# Idx     W     C     %     %     %     %   MHz   MHz
    0     -    40     0     0     0     0  2505   936
    0     -    40     0     0     0     0  2505   936
    0     -    40     0     0     0     0  2505   936
    0     -    40     0     0     0     0  2505   936
    0     -    40     1     0     0     0  2505   936
    0     -    40     0     0     0     0  2505   936
    0     -    40   100    46     0     0   405   135 <== glxgears started
    0     -    40   100    58     0     0   405   135
    0     -    40   100    58     0     0   405   135
    0     -    41   100    57     0     0   405   135
    0     -    40   100    56     0     0   405   135
    0     -    41   100    58     0     0   405   135
    0     -    41   100    57     0     0   405   135
    0     -    41   100    58     0     0   405   135
    0     -    41    50     8     0     0  2505   936 <== glxgears stopped
    0     -    41     1     0     0     0  2505   936
    0     -    41     0     0     0     0  2505   936

If I look at the clock throttle reasons while glxgears is running I see:

$ nvidia-smi -q | grep 'Power Cap' -C 5
    Fan Speed                       : N/A
    Performance State               : P8
    Clocks Throttle Reasons
        Idle                        : Not Active
        Applications Clocks Setting : Not Active
        SW Power Cap                : Active
        HW Slowdown                 : Not Active
        Sync Boost                  : Not Active
        Unknown                     : Not Active
    FB Memory Usage
        Total                       : 4037 MiB

This is not specific to glxgears. It happens with everything I’ve tried so far. It is resulting in terrible performance!

This is on a new laptop; a HP Omen 15-ax000na. It has a GTX 965M. I’m running Ubuntu 16.04.1 64-bit with the nvidia-375 driver package from the graphics-drivers PPA (https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa). I’ve seen the same thing with all driver versions I have tried so far though: 340, 367, 370, 375.

It was working for a brief period yesterday with the 367 driver. I believe it started working after a resume when I plugged the laptop into AC power. I then foolishly upgraded to the 375 driver to see if it would work with that and it stopped working :(. After downgrading to 367 again it was still broken.
nvidia-bug-report.log.gz (213 KB)

I believe it started working after a resume

I guess I should have tried this again sooner. Suspending and resuming appears to fix the issue. It comes back again after a reboot.