Revision 9128b040eb774e04bc23777b005ace2b66ab2a85 authored by Daniel Vetter on 03 March 2015, 16:31:21 UTC, committed by Linus Torvalds on 03 March 2015, 17:04:33 UTC
This is a tricky story of the new atomic state handling and the legacy code fighting over each another. The bug at hand is an underrun of the framebuffer reference with subsequent hilarity caused by the load detect code. Which is peculiar since the the exact same code works fine as the implementation of the legacy setcrtc ioctl. Let's look at the ingredients: - Currently our code is a crazy mix of legacy modeset interfaces to set the parameters and half-baked atomic state tracking underneath. While this transition is going we're using the transitional plane helpers to update the atomic side (drm_plane_helper_disable/update and friends), i.e. plane->state->fb. Since the state structure owns the fb those functions take care of that themselves. The legacy state (specifically crtc->primary->fb) is still managed by the old code (and mostly by the drm core), with the fb reference counting done by callers (core drm for the ioctl or the i915 load detect code). The relevant commit is commit ea2c67bb4affa84080c616920f3899f123786e56 Author: Matt Roper <matthew.d.roper@intel.com> Date: Tue Dec 23 10:41:52 2014 -0800 drm/i915: Move to atomic plane helpers (v9) - drm_plane_helper_disable has special code to handle multiple calls in a row - it checks plane->crtc == NULL and bails out. This is to match the proper atomic implementation which needs the crtc to get at the implied locking context atomic updates always need. See commit acf24a395c5a9290189b080383564437101d411c Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Tue Jul 29 15:33:05 2014 +0200 drm/plane-helper: transitional atomic plane helpers - The universal plane code split out the implicit primary plane from the CRTC into it's own full-blown drm_plane object. As part of that the setcrtc ioctl (which updated both the crtc mode and primary plane) learned to set crtc->primary->crtc on modeset to make sure the plane->crtc assignments statate up to date in commit e13161af80c185ecd8dc4641d0f5df58f9e3e0af Author: Matt Roper <matthew.d.roper@intel.com> Date: Tue Apr 1 15:22:38 2014 -0700 drm: Add drm_crtc_init_with_planes() (v2) Unfortunately we've forgotten to update the load detect code. Which wasn't a problem since the load detect modeset is temporary and always undone before we drop the locks. - Finally there is a organically grown history (i.e. don't ask) around who sets the legacy plane->fb for the various driver entry points. Originally updating that was the drivers duty, but for almost all places we've moved that (plus updating the refcounts) into the core. Again the exception is the load detect code. Taking all together the following happens: - The load detect code doesn't set crtc->primary->crtc. This is only really an issue on crtcs never before used or when userspace explicitly disabled the primary plane. - The plane helper glue code short-circuits because of that and leaves a non-NULL fb behind in plane->state->fb and plane->fb. The state fb isn't a real problem (it's properly refcounted on its own), it's just the canary. - Load detect code drops the reference for that fb, but doesn't set plane->fb = NULL. This is ok since it's still living in that old world where drivers had to clear the pointer but the core/callers handled the refcounting. - On the next modeset the drm core notices plane->fb and takes care of refcounting it properly by doing another unref. This drops the refcount to zero, leaving state->plane now pointing at freed memory. - intel_plane_duplicate_state still assume it owns a reference to that very state->fb and bad things start to happen. Fix this all by applying the same duct-tape as for the legacy setcrtc ioctl code and set crtc->primary->crtc properly. Cc: Matt Roper <matthew.d.roper@intel.com> Cc: Paul Bolle <pebolle@tiscali.nl> Cc: Rob Clark <robdclark@gmail.com> Cc: Paulo Zanoni <przanoni@gmail.com> Cc: Sean Paul <seanpaul@chromium.org> Cc: Matt Roper <matthew.d.roper@intel.com> Reported-and-tested-by: Linus Torvalds <torvalds@linux-foundation.org> Reported-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 023a600
File | Mode | Size |
---|---|---|
ABI | ||
DocBook | ||
EDID | ||
PCI | ||
RCU | ||
accounting | ||
acpi | ||
aoe | ||
arm | ||
arm64 | ||
auxdisplay | ||
backlight | ||
blackfin | ||
block | ||
blockdev | ||
bus-devices | ||
cdrom | ||
cgroups | ||
connector | ||
console | ||
cpu-freq | ||
cpuidle | ||
cris | ||
crypto | ||
development-process | ||
device-mapper | ||
devicetree | ||
dmaengine | ||
driver-model | ||
dvb | ||
early-userspace | ||
extcon | ||
fault-injection | ||
fb | ||
filesystems | ||
firmware_class | ||
fmc | ||
frv | ||
gpio | ||
hid | ||
hwmon | ||
i2c | ||
i2o | ||
ia64 | ||
ide | ||
infiniband | ||
input | ||
ioctl | ||
isdn | ||
ja_JP | ||
kbuild | ||
kdump | ||
ko_KR | ||
laptops | ||
leds | ||
locking | ||
m68k | ||
memory-devices | ||
metag | ||
mic | ||
mips | ||
misc-devices | ||
mmc | ||
mn10300 | ||
mtd | ||
namespaces | ||
netlabel | ||
networking | ||
nfc | ||
nios2 | ||
parisc | ||
pcmcia | ||
phy | ||
platform | ||
power | ||
powerpc | ||
pps | ||
prctl | ||
pti | ||
ptp | ||
rapidio | ||
s390 | ||
scheduler | ||
scsi | ||
security | ||
serial | ||
sh | ||
sound | ||
spi | ||
sysctl | ||
target | ||
thermal | ||
timers | ||
tpm | ||
trace | ||
usb | ||
vDSO | ||
video4linux | ||
virtual | ||
vm | ||
w1 | ||
watchdog | ||
wimax | ||
x86 | ||
xtensa | ||
zh_CN | ||
00-INDEX | -rw-r--r-- | 16.8 KB |
BUG-HUNTING | -rw-r--r-- | 8.1 KB |
Changes | -rw-r--r-- | 11.1 KB |
CodingStyle | -rw-r--r-- | 33.8 KB |
DMA-API-HOWTO.txt | -rw-r--r-- | 34.7 KB |
DMA-API.txt | -rw-r--r-- | 27.7 KB |
DMA-ISA-LPC.txt | -rw-r--r-- | 5.2 KB |
DMA-attributes.txt | -rw-r--r-- | 4.5 KB |
HOWTO | -rw-r--r-- | 27.1 KB |
IPMI.txt | -rw-r--r-- | 29.0 KB |
IRQ-affinity.txt | -rw-r--r-- | 2.5 KB |
IRQ-domain.txt | -rw-r--r-- | 10.0 KB |
IRQ.txt | -rw-r--r-- | 962 bytes |
Intel-IOMMU.txt | -rw-r--r-- | 3.8 KB |
Makefile | -rw-r--r-- | 185 bytes |
ManagementStyle | -rw-r--r-- | 12.9 KB |
SAK.txt | -rw-r--r-- | 2.8 KB |
SM501.txt | -rw-r--r-- | 2.8 KB |
SecurityBugs | -rw-r--r-- | 1.8 KB |
SubmitChecklist | -rw-r--r-- | 4.4 KB |
SubmittingDrivers | -rw-r--r-- | 6.2 KB |
SubmittingPatches | -rw-r--r-- | 35.0 KB |
VGA-softcursor.txt | -rw-r--r-- | 2.0 KB |
applying-patches.txt | -rw-r--r-- | 19.5 KB |
assoc_array.txt | -rw-r--r-- | 20.0 KB |
atomic_ops.txt | -rw-r--r-- | 21.6 KB |
bad_memory.txt | -rw-r--r-- | 1.1 KB |
basic_profiling.txt | -rw-r--r-- | 1.7 KB |
bcache.txt | -rw-r--r-- | 16.4 KB |
binfmt_misc.txt | -rw-r--r-- | 6.5 KB |
braille-console.txt | -rw-r--r-- | 1.4 KB |
bt8xxgpio.txt | -rw-r--r-- | 4.3 KB |
btmrvl.txt | -rw-r--r-- | 2.9 KB |
bus-virt-phys-mapping.txt | -rw-r--r-- | 7.9 KB |
cachetlb.txt | -rw-r--r-- | 17.1 KB |
circular-buffers.txt | -rw-r--r-- | 8.4 KB |
clk.txt | -rw-r--r-- | 11.5 KB |
coccinelle.txt | -rw-r--r-- | 9.0 KB |
cpu-hotplug.txt | -rw-r--r-- | 16.8 KB |
cpu-load.txt | -rw-r--r-- | 3.0 KB |
cputopology.txt | -rw-r--r-- | 3.8 KB |
crc32.txt | -rw-r--r-- | 8.5 KB |
dcdbas.txt | -rw-r--r-- | 3.6 KB |
debugging-modules.txt | -rw-r--r-- | 954 bytes |
debugging-via-ohci1394.txt | -rw-r--r-- | 7.4 KB |
dell_rbu.txt | -rw-r--r-- | 4.9 KB |
devices.txt | -rw-r--r-- | 116.2 KB |
digsig.txt | -rw-r--r-- | 2.8 KB |
dma-buf-sharing.txt | -rw-r--r-- | 20.8 KB |
dontdiff | -rw-r--r-- | 2.5 KB |
dynamic-debug-howto.txt | -rw-r--r-- | 12.6 KB |
edac.txt | -rw-r--r-- | 24.3 KB |
efi-stub.txt | -rw-r--r-- | 3.2 KB |
eisa.txt | -rw-r--r-- | 7.1 KB |
email-clients.txt | -rw-r--r-- | 9.1 KB |
flexible-arrays.txt | -rw-r--r-- | 5.5 KB |
futex-requeue-pi.txt | -rw-r--r-- | 5.0 KB |
gcov.txt | -rw-r--r-- | 7.6 KB |
gdb-kernel-debugging.txt | -rw-r--r-- | 5.9 KB |
highuid.txt | -rw-r--r-- | 2.4 KB |
hsi.txt | -rw-r--r-- | 2.9 KB |
hw_random.txt | -rw-r--r-- | 3.5 KB |
hwspinlock.txt | -rw-r--r-- | 12.1 KB |
init.txt | -rw-r--r-- | 2.5 KB |
initrd.txt | -rw-r--r-- | 14.1 KB |
intel_txt.txt | -rw-r--r-- | 10.2 KB |
io-mapping.txt | -rw-r--r-- | 3.2 KB |
io_ordering.txt | -rw-r--r-- | 1.9 KB |
iostats.txt | -rw-r--r-- | 8.0 KB |
irqflags-tracing.txt | -rw-r--r-- | 2.3 KB |
isapnp.txt | -rw-r--r-- | 433 bytes |
java.txt | -rw-r--r-- | 10.9 KB |
kasan.txt | -rw-r--r-- | 7.9 KB |
kernel-doc-nano-HOWTO.txt | -rw-r--r-- | 11.7 KB |
kernel-docs.txt | -rw-r--r-- | 33.1 KB |
kernel-parameters.txt | -rw-r--r-- | 139.1 KB |
kernel-per-CPU-kthreads.txt | -rw-r--r-- | 12.8 KB |
kmemcheck.txt | -rw-r--r-- | 29.9 KB |
kmemleak.txt | -rw-r--r-- | 8.5 KB |
kobject.txt | -rw-r--r-- | 18.0 KB |
kprobes.txt | -rw-r--r-- | 30.3 KB |
kref.txt | -rw-r--r-- | 8.4 KB |
kselftest.txt | -rw-r--r-- | 2.0 KB |
ldm.txt | -rw-r--r-- | 3.8 KB |
local_ops.txt | -rw-r--r-- | 6.5 KB |
lockup-watchdogs.txt | -rw-r--r-- | 3.1 KB |
logo.gif | -rw-r--r-- | 16.0 KB |
logo.txt | -rw-r--r-- | 563 bytes |
lzo.txt | -rw-r--r-- | 7.8 KB |
magic-number.txt | -rw-r--r-- | 8.8 KB |
mailbox.txt | -rw-r--r-- | 4.2 KB |
md.txt | -rw-r--r-- | 25.3 KB |
media-framework.txt | -rw-r--r-- | 14.7 KB |
memory-barriers.txt | -rw-r--r-- | 109.6 KB |
memory-hotplug.txt | -rw-r--r-- | 16.2 KB |
module-signing.txt | -rw-r--r-- | 8.7 KB |
mono.txt | -rw-r--r-- | 2.5 KB |
nommu-mmap.txt | -rw-r--r-- | 12.7 KB |
numastat.txt | -rw-r--r-- | 836 bytes |
oops-tracing.txt | -rw-r--r-- | 12.8 KB |
padata.txt | -rw-r--r-- | 7.3 KB |
parport-lowlevel.txt | -rw-r--r-- | 32.2 KB |
parport.txt | -rw-r--r-- | 8.8 KB |
percpu-rw-semaphore.txt | -rw-r--r-- | 1.1 KB |
phy.txt | -rw-r--r-- | 6.5 KB |
pi-futex.txt | -rw-r--r-- | 5.7 KB |
pinctrl.txt | -rw-r--r-- | 49.9 KB |
pnp.txt | -rw-r--r-- | 6.8 KB |
preempt-locking.txt | -rw-r--r-- | 5.2 KB |
printk-formats.txt | -rw-r--r-- | 8.3 KB |
pwm.txt | -rw-r--r-- | 4.7 KB |
ramoops.txt | -rw-r--r-- | 5.2 KB |
rbtree.txt | -rw-r--r-- | 13.3 KB |
remoteproc.txt | -rw-r--r-- | 12.3 KB |
rfkill.txt | -rw-r--r-- | 4.8 KB |
robust-futex-ABI.txt | -rw-r--r-- | 8.7 KB |
robust-futexes.txt | -rw-r--r-- | 9.4 KB |
rpmsg.txt | -rw-r--r-- | 13.5 KB |
rtc.txt | -rw-r--r-- | 15.6 KB |
serial-console.txt | -rw-r--r-- | 4.0 KB |
sgi-ioc4.txt | -rw-r--r-- | 2.0 KB |
smsc_ece1099.txt | -rw-r--r-- | 2.4 KB |
sparse.txt | -rw-r--r-- | 3.8 KB |
stable_api_nonsense.txt | -rw-r--r-- | 9.2 KB |
stable_kernel_rules.txt | -rw-r--r-- | 5.4 KB |
static-keys.txt | -rw-r--r-- | 11.9 KB |
svga.txt | -rw-r--r-- | 14.1 KB |
sysfs-rules.txt | -rw-r--r-- | 9.0 KB |
sysrq.txt | -rw-r--r-- | 11.7 KB |
this_cpu_ops.txt | -rw-r--r-- | 11.1 KB |
unaligned-memory-access.txt | -rw-r--r-- | 10.4 KB |
unicode.txt | -rw-r--r-- | 6.5 KB |
unshare.txt | -rw-r--r-- | 13.1 KB |
vfio.txt | -rw-r--r-- | 18.6 KB |
vgaarbiter.txt | -rw-r--r-- | 8.1 KB |
video-output.txt | -rw-r--r-- | 1.1 KB |
vme_api.txt | -rw-r--r-- | 13.2 KB |
volatile-considered-harmful.txt | -rw-r--r-- | 5.6 KB |
workqueue.txt | -rw-r--r-- | 14.7 KB |
xillybus.txt | -rw-r--r-- | 17.7 KB |
xz.txt | -rw-r--r-- | 5.7 KB |
zorro.txt | -rw-r--r-- | 2.9 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...