GitHub/LineageOS/android_kernel_motorola_exynos9610.git
10 years agodrm/ast: Add reduced blanking modes for wide screen mode
Y.C. Chen [Thu, 28 Aug 2014 09:11:04 +0000 (17:11 +0800)]
drm/ast: Add reduced blanking modes for wide screen mode

Signed-off-by: Egbert Eich <eich@suse.com>
Tested-by: Steven You2 Liang <liangyou2@lenovo.com>
Signed-off-by: Y.C. Chen <yc_chen@aspeedtech.com>
v3: based on [PATCH 1/2] drm/ast: Add missing entry to dclk_table[].
    Add reduced blanking modes, improve mode matching to
    identify these modes by thier sync polarities.

[airlied: argh whitespace damage]
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: backmerge tag 'v3.17-rc5' into drm-next
Dave Airlie [Tue, 16 Sep 2014 01:28:52 +0000 (11:28 +1000)]
drm: backmerge tag 'v3.17-rc5' into drm-next

This is requested to get the fixes for intel and radeon into the
same tree for future development work.

i915_display.c: fix missing dev_priv conflict.

10 years agoMerge branch 'linux-3.18' of git://anongit.freedesktop.org/git/nouveau/linux-2.6...
Dave Airlie [Mon, 15 Sep 2014 20:20:53 +0000 (06:20 +1000)]
Merge branch 'linux-3.18' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-next

This is the main merge request for Nouveau 3.18, overview:
- various bits of roy's gt21x clock work
- various bits of kepler memory clock work (don't get too excited, there's at least one more major bit left that's busting higher freqs)
- misc fan control improvements
- kepler hdmi infoframe fixes
- dp audio
- l2 cache + cbc improvements

* 'linux-3.18' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: (68 commits)
  drm/gt214-/disp: enable dp audio
  drm/gt214-/kms: fix hda eld regression
  drm/g94-/disp: calculate some dp audio constants
  drm/gt214-/kms: perform hda codec setup on displayport too
  drm/gk104-/disp: infoframe registers moved yet again on kepler
  drm/nouveau/bios: parse older ramcfg/timing data like we do newer ones
  drm/nva3/fb/ram: Per-partition regs
  drm/nouveau/fb/ram: Support strided regs
  drm/nv50/fb/ram: Store the number of partitions in the designated fields
  drm/nv50/kms: Set VBLANK time in modeset script
  drm/nouveau/bios: Add rammap support for version 1.0
  drm/gf100-/pwr/memx: block host and fifo around reclock
  drm/nouveau/pwr/memx: fix command ordering around block/unblock
  drm/nouveau/pwr/memx: rename fb off/on to block/unblock
  drm/nva3/clk: Pause the GPU before reclocking
  drm/nouveau/gpio: rename g92 class to g94
  drm/gk104-/fb/ram: move fb enable/disable to same place as nvidia
  drm/gk104/fb/ram: twiddle some more bits when reclocking
  drm/nouveau/bios: parse another large chunk of random memory config data
  drm/gk104-/fb/ram: perform certain steps only when bios data differs
  ...

10 years agodrm/gt214-/disp: enable dp audio
Ben Skeggs [Mon, 15 Sep 2014 11:29:05 +0000 (21:29 +1000)]
drm/gt214-/disp: enable dp audio

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gt214-/kms: fix hda eld regression
Ben Skeggs [Mon, 15 Sep 2014 11:11:51 +0000 (21:11 +1000)]
drm/gt214-/kms: fix hda eld regression

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/g94-/disp: calculate some dp audio constants
Ben Skeggs [Mon, 15 Sep 2014 05:55:56 +0000 (15:55 +1000)]
drm/g94-/disp: calculate some dp audio constants

NVIDIA appear to have tweaked the algorithm from GF110, this implements
the previous algorithm for them still.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gt214-/kms: perform hda codec setup on displayport too
Ben Skeggs [Mon, 15 Sep 2014 05:20:47 +0000 (15:20 +1000)]
drm/gt214-/kms: perform hda codec setup on displayport too

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104-/disp: infoframe registers moved yet again on kepler
Ben Skeggs [Mon, 15 Sep 2014 05:15:09 +0000 (15:15 +1000)]
drm/gk104-/disp: infoframe registers moved yet again on kepler

Thanks to Vincent Pelletier for pointing this out and providing a proof of
concept patch on the list.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: parse older ramcfg/timing data like we do newer ones
Ben Skeggs [Mon, 15 Sep 2014 02:30:08 +0000 (12:30 +1000)]
drm/nouveau/bios: parse older ramcfg/timing data like we do newer ones

Done after discussion with Roy.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/fb/ram: Per-partition regs
Roy Spliet [Fri, 12 Sep 2014 16:00:16 +0000 (18:00 +0200)]
drm/nva3/fb/ram: Per-partition regs

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/fb/ram: Support strided regs
Roy Spliet [Fri, 12 Sep 2014 16:00:15 +0000 (18:00 +0200)]
drm/nouveau/fb/ram: Support strided regs

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50/fb/ram: Store the number of partitions in the designated fields
Roy Spliet [Fri, 12 Sep 2014 16:00:14 +0000 (18:00 +0200)]
drm/nv50/fb/ram: Store the number of partitions in the designated fields

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50/kms: Set VBLANK time in modeset script
Roy Spliet [Fri, 12 Sep 2014 16:00:13 +0000 (18:00 +0200)]
drm/nv50/kms: Set VBLANK time in modeset script

Solves blinking on reclocking memory. The value set is an underestimate, but
with non-reduced vblanking this should give us plenty of time

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: Add rammap support for version 1.0
Roy Spliet [Fri, 12 Sep 2014 16:00:12 +0000 (18:00 +0200)]
drm/nouveau/bios: Add rammap support for version 1.0

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/pwr/memx: block host and fifo around reclock
Ben Skeggs [Thu, 11 Sep 2014 13:32:20 +0000 (23:32 +1000)]
drm/gf100-/pwr/memx: block host and fifo around reclock

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr/memx: fix command ordering around block/unblock
Ben Skeggs [Thu, 11 Sep 2014 13:04:22 +0000 (23:04 +1000)]
drm/nouveau/pwr/memx: fix command ordering around block/unblock

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr/memx: rename fb off/on to block/unblock
Ben Skeggs [Thu, 11 Sep 2014 12:59:13 +0000 (22:59 +1000)]
drm/nouveau/pwr/memx: rename fb off/on to block/unblock

More accurate as to the function of the opcodes.  Not only is FB disabled,
but the host is prevented from touching the GPU.  An upcoming patch for
Kepler will also halt PFIFO (as NVIDIA does).

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/clk: Pause the GPU before reclocking
Roy Spliet [Fri, 29 Aug 2014 10:27:42 +0000 (12:27 +0200)]
drm/nva3/clk: Pause the GPU before reclocking

V2: always call post correctly even if pre fails
V3: move function prototype to nva3.h

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
10 years agodrm/nouveau/gpio: rename g92 class to g94
Emil Velikov [Mon, 8 Sep 2014 19:27:57 +0000 (20:27 +0100)]
drm/nouveau/gpio: rename g92 class to g94

nv92 hardware has only 16 interrupt lines, while nv94 and later
has 32. Accessing 0xe0c{0,4} registers on nv92 can lead to incorrect
PDISP setup. This is a regression introduced with

commit 9d0f5ec9ee0fd5dc5fc1cc2cf559286431e406e3
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Mon May 12 15:22:42 2014 +1000

    gpio: split g92 class from nv50

Reported-by: estece on #nouveau
Cc: stable@vger.kernel.org # 3.16+
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104-/fb/ram: move fb enable/disable to same place as nvidia
Ben Skeggs [Mon, 8 Sep 2014 05:21:48 +0000 (15:21 +1000)]
drm/gk104-/fb/ram: move fb enable/disable to same place as nvidia

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/fb/ram: twiddle some more bits when reclocking
Ben Skeggs [Wed, 3 Sep 2014 06:26:20 +0000 (16:26 +1000)]
drm/gk104/fb/ram: twiddle some more bits when reclocking

*when* this is done is only a rough approximation of what the binary driver
does.. need to investigate more to see if it matters

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: parse another large chunk of random memory config data
Ben Skeggs [Wed, 3 Sep 2014 06:25:47 +0000 (16:25 +1000)]
drm/nouveau/bios: parse another large chunk of random memory config data

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104-/fb/ram: perform certain steps only when bios data differs
Ben Skeggs [Mon, 8 Sep 2014 04:41:26 +0000 (14:41 +1000)]
drm/gk104-/fb/ram: perform certain steps only when bios data differs

Awful, awful.  But, on the GK106 I have, some upcoming patches show
that this is actually necessary after all.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104-/fb/ram: parse ramcfg data for all frequencies up-front
Ben Skeggs [Mon, 8 Sep 2014 03:29:04 +0000 (13:29 +1000)]
drm/gk104-/fb/ram: parse ramcfg data for all frequencies up-front

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104-/fb/ram: use parsed timing data in mr routines
Ben Skeggs [Mon, 8 Sep 2014 03:38:02 +0000 (13:38 +1000)]
drm/gk104-/fb/ram: use parsed timing data in mr routines

All the other chipsets should be moved over to this too.  It's not needed
yet for the upcoming commits, so left this step as it'll conflict badly
with Roy's GT21x reclocking work.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: parse freq ranges and timing id into ramcfg struct
Ben Skeggs [Mon, 8 Sep 2014 02:48:31 +0000 (12:48 +1000)]
drm/nouveau/bios: parse freq ranges and timing id into ramcfg struct

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: memset dcb struct to zero before parsing
Ben Skeggs [Mon, 8 Sep 2014 00:33:32 +0000 (10:33 +1000)]
drm/nouveau/bios: memset dcb struct to zero before parsing

Fixes type/mask calculation being based on uninitialised data for VGA
outputs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/fb/ram: make use of training data provided by vbios
Ben Skeggs [Wed, 3 Sep 2014 02:40:04 +0000 (12:40 +1000)]
drm/gk104/fb/ram: make use of training data provided by vbios

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: add support for parsing table at BIT 'M' v2 + 0x09
Ben Skeggs [Mon, 1 Sep 2014 05:42:45 +0000 (15:42 +1000)]
drm/nouveau/bios: add support for parsing table at BIT 'M' v2 + 0x09

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: add support for parsing table at BIT 'M' v2 + 0x05
Ben Skeggs [Mon, 1 Sep 2014 05:33:14 +0000 (15:33 +1000)]
drm/nouveau/bios: add support for parsing table at BIT 'M' v2 + 0x05

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/fb/ram: fix register for second set of training data
Ben Skeggs [Mon, 1 Sep 2014 01:15:21 +0000 (11:15 +1000)]
drm/gk104/fb/ram: fix register for second set of training data

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/fb/ram: more random magic in fb init
Ben Skeggs [Mon, 1 Sep 2014 00:48:39 +0000 (10:48 +1000)]
drm/gk104/fb/ram: more random magic in fb init

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/fb/ram: skip table entry for mode we're already in
Ben Skeggs [Mon, 1 Sep 2014 00:44:57 +0000 (10:44 +1000)]
drm/gk104/fb/ram: skip table entry for mode we're already in

NVIDIA binary driver appears to, not sure if it's for a good reason, but
grasping at straws for some GDDR5 reclocking issues here.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/fb/sddr2: Generate MR values
Roy Spliet [Fri, 5 Sep 2014 00:41:46 +0000 (02:41 +0200)]
drm/nouveau/fb/sddr2: Generate MR values

V2: Always disable DLL reset

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/fb/sddr3: Expand MR generation
Roy Spliet [Thu, 4 Sep 2014 14:58:54 +0000 (16:58 +0200)]
drm/nouveau/fb/sddr3: Expand MR generation

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/pwr/memx: Match blob's fb access behaviour
Roy Spliet [Thu, 4 Sep 2014 14:58:53 +0000 (16:58 +0200)]
drm/nva3/pwr/memx: Match blob's fb access behaviour

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr/memx: Return debugging information
Roy Spliet [Thu, 4 Sep 2014 14:58:52 +0000 (16:58 +0200)]
drm/nouveau/pwr/memx: Return debugging information

Time measured from disabling FB to re-enabling, PPWR_IN reveals status of
heads at the end of script. Helps debug various issues (like flicker).

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr/memx: Make FB disable and enable explicit
Roy Spliet [Thu, 4 Sep 2014 14:58:50 +0000 (16:58 +0200)]
drm/nouveau/pwr/memx: Make FB disable and enable explicit

Needs to be done after wait-for-VBLANK, and NVA3 requires register writes
in between.

Rather than hard-coding register writes, just split out fb_disable and
fb_enable.

v2. Squashed "fb/ramnve0: disable fb before reclocking"

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/pwr/memx: Implement "wait for VBLANK"
Roy Spliet [Thu, 4 Sep 2014 14:58:49 +0000 (16:58 +0200)]
drm/nva3/pwr/memx: Implement "wait for VBLANK"

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/therm/nv84+: do not expose non-calibrated internal temp sensor
Martin Peres [Sun, 24 Aug 2014 21:15:11 +0000 (23:15 +0200)]
drm/nouveau/therm/nv84+: do not expose non-calibrated internal temp sensor

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/therm: make sure the temperature settings are sane on nv84+
Martin Peres [Sun, 24 Aug 2014 21:15:10 +0000 (23:15 +0200)]
drm/nouveau/therm: make sure the temperature settings are sane on nv84+

One of my nv92 has a calibrated internal sensor but it displays 0°C
as the default values use sw calibration values to force the temperature
to 0.

Since we cannot read the temperature from the adt7473 present on this board,
let's re-enable the internal reading!

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/subdev: add a pfuse subdev v2
Martin Peres [Mon, 25 Aug 2014 22:26:38 +0000 (00:26 +0200)]
drm/nouveau/subdev: add a pfuse subdev v2

We will use this subdev to disable temperature reading on cards that did not
get a sensor calibration in the factory.

v2:
- rename "nouveau_fuse_rd32" to "gxXXX_fuse_rd32" as adviced by Christian Costa
- fold the code a little as adviced by Emil Velikov

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/clk: Set intermediate core clock on reclocking
Roy Spliet [Thu, 21 Aug 2014 11:45:17 +0000 (13:45 +0200)]
drm/nva3/clk: Set intermediate core clock on reclocking

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/clk: For PLL clocks always make sure the PLL is not in use
Roy Spliet [Thu, 21 Aug 2014 11:45:16 +0000 (13:45 +0200)]
drm/nva3/clk: For PLL clocks always make sure the PLL is not in use

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/clk: Abort when PLL doesn't lock
Roy Spliet [Thu, 21 Aug 2014 11:45:15 +0000 (13:45 +0200)]
drm/nva3/clk: Abort when PLL doesn't lock

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/clk: HOST clock
Roy Spliet [Thu, 21 Aug 2014 11:45:14 +0000 (13:45 +0200)]
drm/nva3/clk: HOST clock

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/clk: Set PLL refclk
Roy Spliet [Thu, 21 Aug 2014 11:45:13 +0000 (13:45 +0200)]
drm/nva3/clk: Set PLL refclk

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/clk: Parse clock control registers more accurately
Roy Spliet [Thu, 21 Aug 2014 11:45:12 +0000 (13:45 +0200)]
drm/nva3/clk: Parse clock control registers more accurately

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: Fix duplicate definition of NV04_PFB_BOOT_0_*
Pierre Moreau [Mon, 18 Aug 2014 20:32:53 +0000 (22:32 +0200)]
drm/nouveau: Fix duplicate definition of NV04_PFB_BOOT_0_*

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: Display Nouveau boot options at launch
Pierre Moreau [Mon, 18 Aug 2014 20:43:24 +0000 (22:43 +0200)]
drm/nouveau: Display Nouveau boot options at launch

It can help to remove any ambiguity about which options were passed to Nouveau,
especially in case the user had some options set in /etc/modprobe.d/*.conf that
he forgot about, as they won't appear in a dmesg.

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr: wait for scrubbers to finish before uploading new ucode
Ben Skeggs [Mon, 18 Aug 2014 02:41:57 +0000 (12:41 +1000)]
drm/nouveau/pwr: wait for scrubbers to finish before uploading new ucode

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr/fuc: make $r1-$r10 registers callee-saved in kernel.fuc
Martin Peres [Sun, 17 Aug 2014 15:33:14 +0000 (17:33 +0200)]
drm/nouveau/pwr/fuc: make $r1-$r10 registers callee-saved in kernel.fuc

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr/fuc: add ld/st macros
Martin Peres [Sun, 17 Aug 2014 15:33:13 +0000 (17:33 +0200)]
drm/nouveau/pwr/fuc: add ld/st macros

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr: add helpers for delay-to-ticks and ticks-to-delay
Martin Peres [Sun, 17 Aug 2014 15:33:12 +0000 (17:33 +0200)]
drm/nouveau/pwr: add helpers for delay-to-ticks and ticks-to-delay

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr: add some arith functions (mul32_32_64, subu64 and addu64)
Martin Peres [Sun, 17 Aug 2014 15:33:11 +0000 (17:33 +0200)]
drm/nouveau/pwr: add some arith functions (mul32_32_64, subu64 and addu64)

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr: fix the timers implementation with concurent processes
Martin Peres [Sun, 17 Aug 2014 15:33:10 +0000 (17:33 +0200)]
drm/nouveau/pwr: fix the timers implementation with concurent processes

The problem with the current implementation is that adding a timer improperly
checked which process would time up first by not taking into account how much
time elapsed since their timer got scheduled. Rework the re-scheduling
decision t fix this.

The catch with this fix is that we are limited to scheduling timers of up to
2^31 ticks to avoid any potential overflow. Since we are unlikely to need to
wait for more than a second, this won't be a problem :)

Another possible fix would be to decrement the timeouts of all processes but
it would duplicate a lot of code and dealing with edge cases wasn't pretty
last time I checked.

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/ppwr: enable ppwr on gm107
Martin Peres [Sun, 17 Aug 2014 15:33:09 +0000 (17:33 +0200)]
drm/nouveau/ppwr: enable ppwr on gm107

For some reason, it is now required to wait a 20 µs after the 0x200 reset of
the engine.

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gm107/therm: add PWM fan support v2
Martin Peres [Sun, 17 Aug 2014 15:33:08 +0000 (17:33 +0200)]
drm/gm107/therm: add PWM fan support v2

v2: change the copyright ownership from "Nouveau Community" to myself, as per
Illia's recommendation.

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/therm/fan: do not use the pwm mode when the vbios tells us to use toggle
Martin Peres [Sun, 17 Aug 2014 15:33:07 +0000 (17:33 +0200)]
drm/nouveau/therm/fan: do not use the pwm mode when the vbios tells us to use toggle

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios/fan: add support for maxwell's fan management table v2
Martin Peres [Sun, 17 Aug 2014 15:33:06 +0000 (17:33 +0200)]
drm/nouveau/bios/fan: add support for maxwell's fan management table v2

Re-use the therm-exported fan structure with only two minor modifications:
- pwm_freq: u16 -> u32;
- add fan_type (toggle or PWM)

v2:
- Do not memset the table to 0 as it erases the pre-set default values

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/ltc: allocate tagram from memory that spans all partitions
Ben Skeggs [Tue, 12 Aug 2014 05:16:16 +0000 (15:16 +1000)]
drm/nouveau/ltc: allocate tagram from memory that spans all partitions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core/mm: allow allocation to be confined to a specific slice of heap
Ben Skeggs [Tue, 12 Aug 2014 04:30:52 +0000 (14:30 +1000)]
drm/nouveau/core/mm: allow allocation to be confined to a specific slice of heap

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core/mm: fill in holes with "allocated" nodes
Ben Skeggs [Tue, 12 Aug 2014 03:54:37 +0000 (13:54 +1000)]
drm/nouveau/core/mm: fill in holes with "allocated" nodes

The allocation algorithm doesn't expect there to be holes in the mm, which
causes its alignment/cutoff calculations to choke (and go negative) when
encountering the last chunk of a block before a hole.

The least expensive solution is to simply fill in any holes with nodes
that are pre-marked as being allocated.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core/mm: dump mm when trying to tear one down that still has allocations
Ben Skeggs [Tue, 12 Aug 2014 04:48:28 +0000 (14:48 +1000)]
drm/nouveau/core/mm: dump mm when trying to tear one down that still has allocations

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core/mm: modify test for if building a mm with holes in it
Ben Skeggs [Tue, 12 Aug 2014 03:40:42 +0000 (13:40 +1000)]
drm/nouveau/core/mm: modify test for if building a mm with holes in it

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core/mm: make it clearer what (type == 0) means
Ben Skeggs [Tue, 12 Aug 2014 01:16:58 +0000 (11:16 +1000)]
drm/nouveau/core/mm: make it clearer what (type == 0) means

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100/ltc: translate interrupt status into more meaningful names
Ben Skeggs [Tue, 12 Aug 2014 00:22:31 +0000 (10:22 +1000)]
drm/gf100/ltc: translate interrupt status into more meaningful names

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/ltc: drop workaround for an interrupt storm that no longer happens
Ben Skeggs [Tue, 12 Aug 2014 00:01:13 +0000 (10:01 +1000)]
drm/nouveau/ltc: drop workaround for an interrupt storm that no longer happens

This is really the wrong thing to do, but at the time it was our only
option to prevent worse issues.

We no longer cause quite so much anger from LTC, so it's not needed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: add support for completion events
Ben Skeggs [Mon, 11 Aug 2014 04:38:10 +0000 (14:38 +1000)]
drm/nv50-/disp: add support for completion events

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: pass related object into notify constructor
Ben Skeggs [Mon, 11 Aug 2014 03:56:56 +0000 (13:56 +1000)]
drm/nouveau/core: pass related object into notify constructor

The event source types/index might need to be derived from it.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bar: ioremap only the areas that we're actually using
Ben Skeggs [Mon, 11 Aug 2014 02:23:23 +0000 (12:23 +1000)]
drm/nouveau/bar: ioremap only the areas that we're actually using

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agoMerge tag 'topic/core-stuff-2014-09-15' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Mon, 15 Sep 2014 09:55:55 +0000 (19:55 +1000)]
Merge tag 'topic/core-stuff-2014-09-15' of git://anongit.freedesktop.org/drm-intel into drm-next

Here's the updated topic/core-stuff pull request with the two patches
already merged into drm-fixes dropped.

* tag 'topic/core-stuff-2014-09-15' of git://anongit.freedesktop.org/drm-intel:
  drm: Drop modeset locking from crtc init function
  drm/i915/hdmi: Enable pipe pixel replication for SD interlaced modes
  drm/edid: Reduce horizontal timings for pixel replicated modes
  drm: Include task->name and master status in debugfs clients info
  drm/gem: Fix kerneldoc typo
  drm: use c99 initializers in structures
  drm: fix drm_modeset_lock.h kernel-doc notation

10 years agodrm: Drop modeset locking from crtc init function
Daniel Vetter [Mon, 8 Sep 2014 07:02:49 +0000 (09:02 +0200)]
drm: Drop modeset locking from crtc init function

At driver init no one can access modeset objects and we're
single-threaded. So locking is just cargo-culting here. Worse, with
the new ww mutexes and ww mutex slowpath debugging the mutex_lock
might actually fail, and we don't have the full-blown ww recovery
dance.

Which then leads to fireworks when we try to unlock the not-locked
crtc lock.

An audit of all the functions called from here shows that none of them
contain locking checks, so there's also no reason to keep the locking
around just for consistency of caller contexts. Besides that I have
the rule (at least in i915) that such places where we take locks just
to simplify locking checks and not for correctness always require a
comment.

This regression was introduced in

commit 51fd371bbaf94018a1223b4e2cf20b9880fd92d4
Author: Rob Clark <robdclark@gmail.com>
Date:   Tue Nov 19 12:10:12 2013 -0500

    drm: convert crtc and connection_mutex to ww_mutex (v5)

v2: Don't drop the lock_init call, spotted by the 0day builder.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=83341
Cc: Rob Clark <robdclark@gmail.com>
Cc: thellstrom@vmware.com
Cc: maarten.lankhorst@canonical.com
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
10 years agodrm/i915/hdmi: Enable pipe pixel replication for SD interlaced modes
Clint Taylor [Wed, 3 Sep 2014 00:03:36 +0000 (17:03 -0700)]
drm/i915/hdmi: Enable pipe pixel replication for SD interlaced modes

Enable 2x pixel replication for modes the mode flag DBLCLK to double
horizontal timings and pixel clock across TMDS.

Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/edid: Reduce horizontal timings for pixel replicated modes
Clint Taylor [Wed, 3 Sep 2014 00:03:35 +0000 (17:03 -0700)]
drm/edid: Reduce horizontal timings for pixel replicated modes

Pixel replicated modes should be non-2x horizontal timings and pixel
replicated by the HW across the HDMI cable at 2X pixel clock. Current
horizontal resolution of 1440 does not allow pixel duplication to
occur and scaling artifacts occur on the TV. HDMI certification
7-26 currently fails for all pixel replicated modes. This change will
allow HDMI certification with 480i/576i modes once pixel replication
is turned on.

Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Include task->name and master status in debugfs clients info
Chris Wilson [Tue, 2 Sep 2014 07:03:22 +0000 (08:03 +0100)]
drm: Include task->name and master status in debugfs clients info

Showing who is the current master is useful for trying to decypher
errors when trying to acquire master (e.g. a race with X taking over
from plymouth). By including the process name as well as the pid
simplifies the task of grabbing enough information remotely at the point
of error.

v2: Add the command column header and flesh out a couple of comments.
(David Herrmann)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/gem: Fix kerneldoc typo
Laurent Pinchart [Thu, 28 Aug 2014 12:34:36 +0000 (14:34 +0200)]
drm/gem: Fix kerneldoc typo

The drm_gem_private_object_init function is called drm_gem_object_init
in its kerneldoc. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agoLinux 3.17-rc5
Linus Torvalds [Mon, 15 Sep 2014 00:50:12 +0000 (17:50 -0700)]
Linux 3.17-rc5

10 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Mon, 15 Sep 2014 00:37:36 +0000 (17:37 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/viro/vfs

Pull vfs fixes from Al Viro:
 "double iput() on failure exit in lustre, racy removal of spliced
  dentries from ->s_anon in __d_materialise_dentry() plus a bunch of
  assorted RCU pathwalk fixes"

The RCU pathwalk fixes end up fixing a couple of cases where we
incorrectly dropped out of RCU walking, due to incorrect initialization
and testing of the sequence locks in some corner cases.  Since dropping
out of RCU walk mode forces the slow locked accesses, those corner cases
slowed down quite dramatically.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  be careful with nd->inode in path_init() and follow_dotdot_rcu()
  don't bugger nd->seq on set_root_rcu() from follow_dotdot_rcu()
  fix bogus read_seqretry() checks introduced in b37199e
  move the call of __d_drop(anon) into __d_materialise_unique(dentry, anon)
  [fix] lustre: d_make_root() does iput() on dentry allocation failure

10 years agovfs: avoid non-forwarding large load after small store in path lookup
Linus Torvalds [Mon, 15 Sep 2014 00:28:32 +0000 (17:28 -0700)]
vfs: avoid non-forwarding large load after small store in path lookup

The performance regression that Josef Bacik reported in the pathname
lookup (see commit 99d263d4c5b2 "vfs: fix bad hashing of dentries") made
me look at performance stability of the dcache code, just to verify that
the problem was actually fixed.  That turned up a few other problems in
this area.

There are a few cases where we exit RCU lookup mode and go to the slow
serializing case when we shouldn't, Al has fixed those and they'll come
in with the next VFS pull.

But my performance verification also shows that link_path_walk() turns
out to have a very unfortunate 32-bit store of the length and hash of
the name we look up, followed by a 64-bit read of the combined hash_len
field.  That screws up the processor store to load forwarding, causing
an unnecessary hickup in this critical routine.

It's caused by the ugly calling convention for the "hash_name()"
function, and easily fixed by just making hash_name() fill in the whole
'struct qstr' rather than passing it a pointer to just the hash value.

With that, the profile for this function looks much smoother.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoMerge branch 'parisc-3.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
Linus Torvalds [Sun, 14 Sep 2014 19:28:08 +0000 (12:28 -0700)]
Merge branch 'parisc-3.17-1' of git://git./linux/kernel/git/deller/parisc-linux

Pull parisc updates from Helge Deller:
 "The most important patch is a new Light Weigth Syscall (LWS) for 8,
  16, 32 and 64 bit atomic CAS operations which is required in order to
  be able to implement the atomic gcc builtins on our platform.

  Other than that, we wire up the seccomp, getrandom and memfd_create
  syscalls, fixes a minor off-by-one bug and a wrong printk string"

* 'parisc-3.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  parisc: Implement new LWS CAS supporting 64 bit operations.
  parisc: Wire up seccomp, getrandom and memfd_create syscalls
  parisc: dino: fix %d confusingly prefixed with 0x in format string
  parisc: sys_hpux: NUL terminator is one past the end

10 years agobe careful with nd->inode in path_init() and follow_dotdot_rcu()
Al Viro [Sun, 14 Sep 2014 01:59:43 +0000 (21:59 -0400)]
be careful with nd->inode in path_init() and follow_dotdot_rcu()

in the former we simply check if dentry is still valid after picking
its ->d_inode; in the latter we fetch ->d_inode in the same places
where we fetch dentry and its ->d_seq, under the same checks.

Cc: stable@vger.kernel.org # 2.6.38+
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
10 years agodon't bugger nd->seq on set_root_rcu() from follow_dotdot_rcu()
Al Viro [Sun, 14 Sep 2014 01:55:46 +0000 (21:55 -0400)]
don't bugger nd->seq on set_root_rcu() from follow_dotdot_rcu()

return the value instead, and have path_init() do the assignment.  Broken by
"vfs: Fix absolute RCU path walk failures due to uninitialized seq number",
which was Cc-stable with 2.6.38+ as destination.  This one should go where
it went.

To avoid dummy value returned in case when root is already set (it would do
no harm, actually, since the only caller that doesn't ignore the return value
is guaranteed to have nd->root *not* set, but it's more obvious that way),
lift the check into callers.  And do the same to set_root(), to keep them
in sync.

Cc: stable@vger.kernel.org # 2.6.38+
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
10 years agoMerge tag 'ntb-3.17' of git://github.com/jonmason/ntb
Linus Torvalds [Sun, 14 Sep 2014 17:54:12 +0000 (10:54 -0700)]
Merge tag 'ntb-3.17' of git://github.com/jonmason/ntb

Pull ntb driver bugfixes from Jon Mason:
 "NTB driver fixes for queue spread and buffer alignment.  Also, update
  to MAINTAINERS to reflect new e-mail address"

* tag 'ntb-3.17' of git://github.com/jonmason/ntb:
  ntb: Add alignment check to meet hardware requirement
  MAINTAINERS: update NTB info
  NTB: correct the spread of queues over mw's

10 years agoMerge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 14 Sep 2014 17:37:10 +0000 (10:37 -0700)]
Merge branch 'irq-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull ARM irq chip fixes from Thomas Gleixner:
 "Another pile of ARM specific irq chip fixlets:

   - off by one bugs in the crossbar driver
   - missing annotations
   - a bunch of "make it compile" updates

  I pulled the lot today from Jason, but it has been in -next for at
  least a week"

* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip: gic-v3: Declare rdist as __percpu pointer to __iomem pointer
  irqchip: gic: Make gic_default_routable_irq_domain_ops static
  irqchip: exynos-combiner: Fix compilation error on ARM64
  irqchip: crossbar: Off by one bugs in init
  irqchip: gic-v3: Tag all low level accessors __maybe_unused
  irqchip: gic-v3: Only define gic_peek_irq() when building SMP

10 years agoMerge tag 'irqchip-urgent-3.17' of git://git.infradead.org/users/jcooper/linux into...
Thomas Gleixner [Sun, 14 Sep 2014 13:19:19 +0000 (15:19 +0200)]
Merge tag 'irqchip-urgent-3.17' of git://git.infradead.org/users/jcooper/linux into irq/urgent

irqchip fixes for v3.17 from Jason Cooper

 - GIC/GICV3: Various fixlets
 - crossbar: Fix off-by-one bug
 - exynos-combiner: Fix arm64 build error

10 years agontb: Add alignment check to meet hardware requirement
Dave Jiang [Thu, 28 Aug 2014 20:53:02 +0000 (13:53 -0700)]
ntb: Add alignment check to meet hardware requirement

The NTB translate register must have the value to be BAR size aligned.
This alignment check make sure that the DMA memory allocated has the
proper alignment. Another requirement for NTB to function properly with
memory window BAR size greater or equal to 4M is to use the CMA feature
in 3.16 kernel with the appropriate CONFIG_CMA_ALIGNMENT and
CONFIG_CMA_SIZE_MBYTES set.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
10 years agoMAINTAINERS: update NTB info
Jon Mason [Thu, 19 Jun 2014 17:44:24 +0000 (10:44 -0700)]
MAINTAINERS: update NTB info

Update my contact info to my personal email address and add Dave Jiang.

Signed-off-by: Jon Mason <jon.mason@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
10 years agoNTB: correct the spread of queues over mw's
Jon Mason [Thu, 19 Jun 2014 17:11:13 +0000 (10:11 -0700)]
NTB: correct the spread of queues over mw's

The detection of an uneven number of queues on the given memory windows
was not correct.  The mw_num is zero based and the mod should be
division to spread them evenly over the mw's.

Signed-off-by: Jon Mason <jon.mason@intel.com>
10 years agofix bogus read_seqretry() checks introduced in b37199e
Al Viro [Sun, 14 Sep 2014 01:50:45 +0000 (21:50 -0400)]
fix bogus read_seqretry() checks introduced in b37199e

read_seqretry() returns true on mismatch, not on match...

Cc: stable@vger.kernel.org # 3.15+
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
10 years agomove the call of __d_drop(anon) into __d_materialise_unique(dentry, anon)
Al Viro [Thu, 11 Sep 2014 22:55:50 +0000 (18:55 -0400)]
move the call of __d_drop(anon) into __d_materialise_unique(dentry, anon)

and lock the right list there

Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
10 years ago[fix] lustre: d_make_root() does iput() on dentry allocation failure
Al Viro [Wed, 3 Sep 2014 17:11:09 +0000 (13:11 -0400)]
[fix] lustre: d_make_root() does iput() on dentry allocation failure

double-free is a bad thing

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
10 years agoMerge branches 'locking-urgent-for-linus' and 'timers-urgent-for-linus' of git:/...
Linus Torvalds [Sat, 13 Sep 2014 21:22:12 +0000 (14:22 -0700)]
Merge branches 'locking-urgent-for-linus' and 'timers-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull futex and timer fixes from Thomas Gleixner:
 "A oneliner bugfix for the jinxed futex code:

   - Drop hash bucket lock in the error exit path.  I really could slap
     myself for intruducing that bug while fixing all the other horror
     in that code three month ago ...

  and the timer department is not too proud about the following fixes:

   - Deal with a long standing rounding bug in the timeval to jiffies
     conversion.  It's a real issue and this fix fell through the cracks
     for quite some time.

   - Another round of alarmtimer fixes.  Finally this code gets used
     more widely and the subtle issues hidden for quite some time are
     noticed and fixed.  Nothing really exciting, just the itty bitty
     details which bite the serious users here and there"

* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  futex: Unlock hb->lock in futex_wait_requeue_pi() error path

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  alarmtimer: Lock k_itimer during timer callback
  alarmtimer: Do not signal SIGEV_NONE timers
  alarmtimer: Return relative times in timer_gettime
  jiffies: Fix timeval conversion to jiffies

10 years agoparisc: Implement new LWS CAS supporting 64 bit operations.
Guy Martin [Fri, 12 Sep 2014 16:02:34 +0000 (18:02 +0200)]
parisc: Implement new LWS CAS supporting 64 bit operations.

The current LWS cas only works correctly for 32bit. The new LWS allows
for CAS operations of variable size.

Signed-off-by: Guy Martin <gmsoft@tuxicoman.be>
Cc: <stable@vger.kernel.org> # 3.13+
Signed-off-by: Helge Deller <deller@gmx.de>
10 years agovfs: fix bad hashing of dentries
Linus Torvalds [Sat, 13 Sep 2014 18:30:10 +0000 (11:30 -0700)]
vfs: fix bad hashing of dentries

Josef Bacik found a performance regression between 3.2 and 3.10 and
narrowed it down to commit bfcfaa77bdf0 ("vfs: use 'unsigned long'
accesses for dcache name comparison and hashing"). He reports:

 "The test case is essentially

      for (i = 0; i < 1000000; i++)
              mkdir("a$i");

  On xfs on a fio card this goes at about 20k dir/sec with 3.2, and 12k
  dir/sec with 3.10.  This is because we spend waaaaay more time in
  __d_lookup on 3.10 than in 3.2.

  The new hashing function for strings is suboptimal for <
  sizeof(unsigned long) string names (and hell even > sizeof(unsigned
  long) string names that I've tested).  I broke out the old hashing
  function and the new one into a userspace helper to get real numbers
  and this is what I'm getting:

      Old hash table had 1000000 entries, 0 dupes, 0 max dupes
      New hash table had 12628 entries, 987372 dupes, 900 max dupes
      We had 11400 buckets with a p50 of 30 dupes, p90 of 240 dupes, p99 of 567 dupes for the new hash

  My test does the hash, and then does the d_hash into a integer pointer
  array the same size as the dentry hash table on my system, and then
  just increments the value at the address we got to see how many
  entries we overlap with.

  As you can see the old hash function ended up with all 1 million
  entries in their own bucket, whereas the new one they are only
  distributed among ~12.5k buckets, which is why we're using so much
  more CPU in __d_lookup".

The reason for this hash regression is two-fold:

 - On 64-bit architectures the down-mixing of the original 64-bit
   word-at-a-time hash into the final 32-bit hash value is very
   simplistic and suboptimal, and just adds the two 32-bit parts
   together.

   In particular, because there is no bit shuffling and the mixing
   boundary is also a byte boundary, similar character patterns in the
   low and high word easily end up just canceling each other out.

 - the old byte-at-a-time hash mixed each byte into the final hash as it
   hashed the path component name, resulting in the low bits of the hash
   generally being a good source of hash data.  That is not true for the
   word-at-a-time case, and the hash data is distributed among all the
   bits.

The fix is the same in both cases: do a better job of mixing the bits up
and using as much of the hash data as possible.  We already have the
"hash_32|64()" functions to do that.

Reported-by: Josef Bacik <jbacik@fb.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Chris Mason <clm@fb.com>
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoMake hash_64() use a 64-bit multiply when appropriate
Linus Torvalds [Sat, 13 Sep 2014 18:24:03 +0000 (11:24 -0700)]
Make hash_64() use a 64-bit multiply when appropriate

The hash_64() function historically does the multiply by the
GOLDEN_RATIO_PRIME_64 number with explicit shifts and adds, because
unlike the 32-bit case, gcc seems unable to turn the constant multiply
into the more appropriate shift and adds when required.

However, that means that we generate those shifts and adds even when the
architecture has a fast multiplier, and could just do it better in
hardware.

Use the now-cleaned-up CONFIG_ARCH_HAS_FAST_MULTIPLIER (together with
"is it a 64-bit architecture") to decide whether to use an integer
multiply or the explicit sequence of shift/add instructions.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoMake ARCH_HAS_FAST_MULTIPLIER a real config variable
Linus Torvalds [Sat, 13 Sep 2014 18:14:53 +0000 (11:14 -0700)]
Make ARCH_HAS_FAST_MULTIPLIER a real config variable

It used to be an ad-hoc hack defined by the x86 version of
<asm/bitops.h> that enabled a couple of library routines to know whether
an integer multiply is faster than repeated shifts and additions.

This just makes it use the real Kconfig system instead, and makes x86
(which was the only architecture that did this) select the option.

NOTE! Even for x86, this really is kind of wrong.  If we cared, we would
probably not enable this for builds optimized for netburst (P4), where
shifts-and-adds are generally faster than multiplies.  This patch does
*not* change that kind of logic, though, it is purely a syntactic change
with no code changes.

This was triggered by the fact that we have other places that really
want to know "do I want to expand multiples by constants by hand or
not", particularly the hash generation code.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoMerge tag 'dm-3.17-fix2' of git://git.kernel.org/pub/scm/linux/kernel/git/device...
Linus Torvalds [Sat, 13 Sep 2014 17:04:10 +0000 (10:04 -0700)]
Merge tag 'dm-3.17-fix2' of git://git./linux/kernel/git/device-mapper/linux-dm

Pull device mapper fix from Mike Snitzer:
 "Fix a race in the DM cache target that caused dirty blocks to be
  marked as clean.  This could cause no writeback to occur or spurious
  dirty block counts"

* tag 'dm-3.17-fix2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
  dm cache: fix race causing dirty blocks to be marked as clean

10 years agoMerge branch 'for-linus' of git://git.kernel.dk/linux-block
Linus Torvalds [Sat, 13 Sep 2014 16:39:55 +0000 (09:39 -0700)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
 "A small collection of fixes for the current rc series.  This contains:

   - Two small blk-mq patches from Rob Elliott, cleaning up error case
     at init time.

   - A fix from Ming Lei, fixing SG merging for blk-mq where
     QUEUE_FLAG_SG_NO_MERGE is the default.

   - A dev_t minor lifetime fix from Keith, fixing an issue where a
     minor might be reused before all references to it were gone.

   - Fix from Alan Stern where an unbalanced queue bypass caused SCSI
     some headaches when it does a series of add/del on devices without
     fully registrering the queue.

   - A fix from me for improving the scaling of tag depth in blk-mq if
     we are short on memory"

* 'for-linus' of git://git.kernel.dk/linux-block:
  blk-mq: scale depth and rq map appropriate if low on memory
  Block: fix unbalanced bypass-disable in blk_register_queue
  block: Fix dev_t minor allocation lifetime
  blk-mq: cleanup after blk_mq_init_rq_map failures
  blk-mq: pass along blk_mq_alloc_tag_set return values
  blk-merge: fix blk_recount_segments

10 years agoMerge tag 'stable/for-linus-3.17-b-rc4-arm-tag' of git://git.kernel.org/pub/scm/linux...
Linus Torvalds [Sat, 13 Sep 2014 00:45:27 +0000 (17:45 -0700)]
Merge tag 'stable/for-linus-3.17-b-rc4-arm-tag' of git://git./linux/kernel/git/xen/tip

Pull Xen ARM bugfix from Stefano Stabellini:
 "The patches fix the "xen_add_mach_to_phys_entry: cannot add" bug that
  has been affecting xen on arm and arm64 guests since 3.16.  They
  require a few hypervisor side changes that just went in xen-unstable.

  A couple of days ago David sent out a pull request with a few other
  Xen fixes (it is already in master).  Sorry we didn't synchronized
  better among us"

* tag 'stable/for-linus-3.17-b-rc4-arm-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  xen/arm: remove mach_to_phys rbtree
  xen/arm: reimplement xen_dma_unmap_page & friends
  xen/arm: introduce XENFEAT_grant_map_identity