alistair23-linux/drivers
John Harrison 29b1b415fc drm/i915: Reserve ring buffer space for i915_add_request() commands
It is a bad idea for i915_add_request() to fail. The work will already have been
send to the ring and will be processed, but there will not be any tracking or
management of that work.

The only way the add request call can fail is if it can't write its epilogue
commands to the ring (cache flushing, seqno updates, interrupt signalling). The
reasons for that are mostly down to running out of ring buffer space and the
problems associated with trying to get some more. This patch prevents that
situation from happening in the first place.

When a request is created, it marks sufficient space as reserved for the
epilogue commands. Thus guaranteeing that by the time the epilogue is written,
there will be plenty of space for it. Note that a ring_begin() call is required
to actually reserve the space (and do any potential waiting). However, that is
not currently done at request creation time. This is because the ring_begin()
code can allocate a request. Hence calling begin() from the request allocation
code would lead to infinite recursion! Later patches in this series remove the
need for begin() to do the allocate. At that point, it becomes safe for the
allocate to call begin() and really reserve the space.

Until then, there is a potential for insufficient space to be available at the
point of calling i915_add_request(). However, that would only be in the case
where the request was created and immediately submitted without ever calling
ring_begin() and adding any work to that request. Which should never happen. And
even if it does, and if that request happens to fall down the tiny window of
opportunity for failing due to being out of ring space then does it really
matter because the request wasn't doing anything in the first place?

v2: Updated the 'reserved space too small' warning to include the offending
sizes. Added a 'cancel' operation to clean up when a request is abandoned. Added
re-initialisation of tracking state after a buffer wrap to keep the sanity
checks accurate.

v3: Incremented the reserved size to accommodate Ironlake (after finally
managing to run on an ILK system). Also fixed missing wrap code in LRC mode.

v4: Added extra comment and removed duplicate WARN (feedback from Tomas).

For: VIZ-5115
CC: Tomas Elf <tomas.elf@intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-06-23 14:01:56 +02:00
..
accessibility
acpi Merge branches 'acpi-init' and 'acpica' 2015-05-15 00:31:23 +02:00
amba
android
ata Merge branch 'for-4.1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2015-05-11 10:54:20 -07:00
atm
auxdisplay
base
bcma
block nvme: fix kernel memory corruption with short INQUIRY buffers 2015-05-13 10:22:12 -04:00
bluetooth Bluetooth: ath3k: add support of 04ca:300f AR3012 device 2015-05-13 23:04:20 +02:00
bus MIPS: Fix CDMM to use native endian MMIO reads 2015-05-26 16:46:52 +02:00
cdrom
char
clk clk: si5351: Do not pass struct clk in platform_data 2015-05-08 11:22:30 -07:00
clocksource
connector
cpufreq
cpuidle
crypto
dca
devfreq
dio
dma
dma-buf
edac
eisa
extcon
firewire
firmware Merge branch 'dmi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2015-05-14 18:02:15 -07:00
fmc
gpio gpio: gpio-kempld: Fix get_direction return value 2015-05-12 13:49:13 +02:00
gpu drm/i915: Reserve ring buffer space for i915_add_request() commands 2015-06-23 14:01:56 +02:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2015-05-21 17:23:11 -07:00
hsi
hv
hwmon hwmon: (nct6683) Add missing sysfs attribute initialization 2015-05-29 17:47:42 -07:00
hwspinlock
hwtracing/coresight
i2c
ide Merge branch 'for-4.1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2015-05-11 10:54:20 -07:00
idle
iio The usual mixed bag of fixes for IIO in the 4.1 cycle. 2015-05-13 11:51:14 -07:00
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2015-05-31 11:31:42 -07:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2015-05-22 14:49:55 -07:00
iommu break kconfig dependency loop 2015-06-02 10:17:21 +02:00
ipack
irqchip irqchip/gicv3-its: ITS table size should not be smaller than PSZ 2015-05-20 22:13:37 +02:00
isdn
leds
lguest lguest: fix out-by-one error in address checking. 2015-05-27 09:57:21 -07:00
macintosh
mailbox
mcb
md Quite a few fixes for DM's blk-mq support thanks to extra DM multipath 2015-05-29 14:39:24 -07:00
media break kconfig dependency loop 2015-06-02 10:17:21 +02:00
memory
memstick
message
mfd mfd: da9052: Fix broken regulator probe 2015-05-27 13:34:15 +01:00
misc
mmc mmc: atmel-mci: fix bad variable type for clkdiv 2015-05-18 09:04:42 +02:00
mtd Two MTD fixes for 4.1: 2015-05-18 10:01:54 -07:00
net ** NOW WITH TESTING! ** 2015-05-29 11:24:28 -07:00
nfc
ntb
nubus
of of: add EXPORT_SYMBOL for of_graph_get_endpoint_by_regs 2015-06-23 10:19:10 +10:00
oprofile
parisc
parport
pci
pcmcia
phy
pinctrl pinctrl: Fix gpio/pin mapping for Meson8b 2015-05-19 11:40:52 +02:00
platform thinkpad_acpi: Revert unintentional device attribute renaming 2015-05-20 02:18:12 -07:00
pnp
power
powercap
pps
ps3
ptp
pwm pwm: img: Impose upper and lower timebase steps value 2015-05-19 16:07:40 +02:00
rapidio
ras
regulator mfd: da9052: Fix broken regulator probe 2015-05-27 13:34:15 +01:00
remoteproc
reset
rpmsg
rtc drivers/rtc/rtc-armada38x.c: remove unused local `flags' 2015-05-14 17:55:51 -07:00
s390 s390/zcrypt: Fix invalid domain handling during ap module unload 2015-05-13 09:57:29 +02:00
sbus
scsi Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2015-05-31 11:31:42 -07:00
sfi
sh
sn
soc
spi Merge remote-tracking branches 'spi/fix/fsl-cpm', 'spi/fix/fsl-dspi' and 'spi/fix/fsl-espi' into spi-linus 2015-05-11 17:29:49 +01:00
spmi
ssb ssb: extend fix for PCI related silent reboots to all chipsets 2015-05-20 16:36:06 +03:00
staging Staging / IIO driver fixes for 4.1-rc4 2015-05-16 21:04:56 -07:00
target target: Use a PASSTHROUGH flag instead of transport_types 2015-05-30 19:58:11 -07:00
tc
thermal Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal into for-rc 2015-05-19 08:12:27 +08:00
thunderbolt
tty ttyFDC: Fix to use native endian MMIO reads 2015-05-26 16:46:52 +02:00
uio
usb USB-serial fixes for v4.1-rc4 2015-05-14 12:43:36 -07:00
uwb
vfio
vhost target: Fix se_tpg_tfo->tf_subsys regression + remove tf_subsystem 2015-05-30 18:04:20 -07:00
video backlight: pwm: Handle EPROBE_DEFER while requesting the PWM 2015-05-26 08:44:59 +01:00
virt
virtio
vlynq
vme
w1
watchdog
xen xen/events: don't bind non-percpu VIRQs with percpu chip 2015-05-19 19:55:36 +01:00
zorro
Kconfig
Makefile