Skip to contentSkip to conversation

RFC: drm/i915: annote drop_caches debugfs interface with lockdep

PATCH In review Daniel Vetter 3 participants 3 messages Mar 10, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RFC: drm/i915: annote drop_caches debugfs interface with lockdep

The trouble we have is that we can't really test all the shrinker recursion stuff exhaustively in BAT because any kind of thrashing stress test just takes too long.

But that leaves a really big gap open, since shrinker recursions are one of the most annoying bugs. Now lockdep already has support for checking allocation deadlocks:

- Direct reclaim paths are marked up with
lockdep_set_current_reclaim_state() and
lockdep_clear_current_reclaim_state().

- Any allocation paths are marked with lockdep_trace_alloc().

If we simply mark up our debugfs with the reclaim annotations, any code and locks taken in there will automatically complete the picture with any allocation paths we already have, as long as we have a simple testcase in BAT which throws out a few objects using this interface. Not stress test or thrashing needed at all.

Just a quick hack as an RFC after a short discussion with Chris on irc.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +2 -0
index fd0aa29e0c3b..72a73bb08a1e 100644
@@ -4268,11 +4268,13 @@ i915_drop_caches_set(void *data, u64 val)
 	if (val & (DROP_RETIRE | DROP_ACTIVE))
 		i915_gem_retire_requests(dev_priv);
 
+	lockdep_set_current_reclaim_state(GFP_KERNEL);
 	if (val & DROP_BOUND)
 		i915_gem_shrink(dev_priv, LONG_MAX, I915_SHRINK_BOUND);
 
 	if (val & DROP_UNBOUND)
 		i915_gem_shrink(dev_priv, LONG_MAX, I915_SHRINK_UNBOUND);
+	lockdep_clear_current_reclaim_state();
 
 unlock:
 	mutex_unlock(&dev->struct_mutex);
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Daniel Vetter

The trouble we have is that we can't really test all the shrinker recursion stuff exhaustively in BAT because any kind of thrashing stress test just takes too long.

But that leaves a really big gap open, since shrinker recursions are one of the most annoying bugs. Now lockdep already has support for checking allocation deadlocks:

- Direct reclaim paths are marked up with
lockdep_set_current_reclaim_state() and
lockdep_clear_current_reclaim_state().

- Any allocation paths are marked with lockdep_trace_alloc().

Quoted 8 lines

If we simply mark up our debugfs with the reclaim annotations, any code and locks taken in there will automatically complete the picture with any allocation paths we already have, as long as we have a simple testcase in BAT which throws out a few objects using this interface. Not stress test or thrashing needed at all.

Just a quick hack as an RFC after a short discussion with Chris on irc.

It matches kswap/shrink_all_memory, looks like the right thing to do. Considering that we call drop_caches everytime we query memory in igt, this will then mark the struct_mutex as involved in reclaim long before we hit kswapd (which is only accidental in current BAT). So, yes a definite

as it solves half the problem of writing gem_exec_shrink/basic. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

✗ Fi.CI.BAT: failure for RFC: drm/i915: annote drop_caches debugfs interface with lockdep

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: RFC: drm/i915: annote drop_caches debugfs interface with lockdep
URL : https://patchwork.freedesktop.org/series/21063/
State : failure

== Summary ==

  CHECK   usr/include/linux/hdlc/ (1 files)
  CHECK   usr/include/linux/spi/ (1 files)
  CHECK   usr/include/linux/hsi/ (2 files)
  CHECK   usr/include/linux/ (452 files)
  CHECK   usr/include/linux/tc_act/ (15 files)
  CHECK   usr/include/linux/android/ (1 files)
  CHECK   usr/include/linux/usb/ (11 files)
  CHECK   usr/include/linux/netfilter/ (87 files)
  CHECK   usr/include/linux/tc_ematch/ (4 files)
  CHECK   usr/include/linux/dvb/ (8 files)
  CHECK   usr/include/linux/byteorder/ (2 files)
  CHECK   usr/include/linux/mmc/ (1 files)
  CHECK   usr/include/linux/iio/ (2 files)
  CHECK   usr/include/linux/can/ (5 files)
  CHECK   usr/include/linux/raid/ (2 files)
  CHECK   usr/include/linux/isdn/ (1 files)
  CHECK   usr/include/linux/sunrpc/ (1 files)
  CHECK   usr/include/linux/netfilter_ipv6/ (12 files)
  CHECK   usr/include/linux/netfilter_bridge/ (17 files)
  CHECK   usr/include/linux/nfsd/ (5 files)
  CHECK   usr/include/linux/netfilter_arp/ (2 files)
  CHECK   usr/include/linux/netfilter/ipset/ (4 files)
  CHECK   usr/include/linux/caif/ (2 files)
  CHECK   usr/include/linux/wimax/ (1 files)
  CHECK   usr/include/asm/ (62 files)
  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      vmlinux.o
  MODPOST vmlinux.o
  KSYM    .tmp_kallsyms1.o
  KSYM    .tmp_kallsyms2.o
  LD      vmlinux
  SORTEX  vmlinux
  SYSMAP  System.map
  CC      arch/x86/boot/a20.o
  CC      arch/x86/boot/cmdline.o
  AS      arch/x86/boot/bioscall.o
  CC      arch/x86/boot/cpucheck.o
  AS      arch/x86/boot/copy.o
  CC      arch/x86/boot/cpuflags.o
  CC      arch/x86/boot/edd.o
  CC      arch/x86/boot/early_serial_console.o
  HOSTCC  arch/x86/boot/mkcpustr
  CC      arch/x86/boot/main.o
  AS      arch/x86/boot/pmjump.o
  CC      arch/x86/boot/memory.o
  CC      arch/x86/boot/printf.o
  CC      arch/x86/boot/string.o
  CC      arch/x86/boot/tty.o
  CC      arch/x86/boot/video.o
  CC      arch/x86/boot/pm.o
  CC      arch/x86/boot/version.o
  CC      arch/x86/boot/video-mode.o
  CC      arch/x86/boot/video-vesa.o
  CC      arch/x86/boot/video-vga.o
  CC      arch/x86/boot/regs.o
  HOSTCC  arch/x86/boot/tools/build
  CC      arch/x86/boot/video-bios.o
  Building modules, stage 2.
  MODPOST 100 modules
  CPUSTR  arch/x86/boot/cpustr.h
  CC      arch/x86/boot/cpu.o
  LDS     arch/x86/boot/compressed/vmlinux.lds
  AS      arch/x86/boot/compressed/head_64.o
  VOFFSET arch/x86/boot/compressed/../voffset.h
  CC      arch/x86/boot/compressed/string.o
  CC      arch/x86/boot/compressed/error.o
  HOSTCC  arch/x86/boot/compressed/mkpiggy
  CC      arch/x86/boot/compressed/cpuflags.o
  CC      arch/x86/boot/compressed/early_serial_console.o
  CC      arch/x86/boot/compressed/eboot.o
  AS      arch/x86/boot/compressed/efi_stub_64.o
  CC      arch/x86/boot/compressed/cmdline.o

OBJCOPY arch/x86/boot/compressed/vmlinux.bin
XZKERN arch/x86/boot/compressed/vmlinux.bin.xz
ERROR: "lockdep_set_current_reclaim_state" [drivers/gpu/drm/i915/i915.ko] undefined!
ERROR: "lockdep_clear_current_reclaim_state" [drivers/gpu/drm/i915/i915.ko] undefined! scripts/Makefile.modpost:91: recipe for target '__modpost' failed make[1]: *** [__modpost] Error 1
Makefile:1198: recipe for target 'modules' failed
make: *** [modules] Error 2
make: *** Waiting for unfinished jobs....
CC arch/x86/boot/compressed/misc.o
MKPIGGY arch/x86/boot/compressed/piggy.S
AS arch/x86/boot/compressed/piggy.o
DATAREL arch/x86/boot/compressed/vmlinux
LD arch/x86/boot/compressed/vmlinux
ZOFFSET arch/x86/boot/zoffset.h
OBJCOPY arch/x86/boot/vmlinux.bin
AS arch/x86/boot/header.o
LD arch/x86/boot/setup.elf
OBJCOPY arch/x86/boot/setup.bin
BUILD arch/x86/boot/bzImage
Setup is 16444 bytes (padded to 16896 bytes).
System is 4912 kB
CRC 3079c52d
Kernel: arch/x86/boot/bzImage is ready (#1)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx