linux/drivers
T.J. Mercier 5aec776ef8 BACKPORT: ANDROID: dma-buf: Move sysfs work out of DMA-BUF export path
Recently, we noticed an issue where a process went into direct reclaim
while holding the kernfs rw semaphore for sysfs in write (exclusive)
mode. This caused processes who were doing DMA-BUF exports and releases
to go into uninterruptible sleep since they needed to acquire the same
semaphore for the DMA-BUF sysfs entry creation/deletion. In order to avoid
blocking DMA-BUF export for an indeterminate amount of time while
another process is holding the sysfs rw semaphore in exclusive mode,
this patch moves the per-buffer sysfs file creation to the default work
queue. Note that this can lead to a short-term inaccuracy in the dmabuf
sysfs statistics, but this is a tradeoff to prevent the hot path from
being blocked. A work_struct is added to dma_buf to achieve this, but as
it is unioned with the kobject in the sysfs_entry, dma_buf does not
increase in size.

Fixes: bdb8d06dfe ("dmabuf: Add the capability to expose DMA-BUF stats in sysfs")
Originally-by: Hridya Valsaraju <hridya@google.com>
Signed-off-by: T.J. Mercier <tjmercier@google.com>
Bug: 206979019
Bug: 254192604
Link: https://lore.kernel.org/lkml/CABdmKX2dNYhgOYdrrJU6-jt6F=LjCidbKhR6t4F7yaa0SPr+-A@mail.gmail.com/T/

Conflicts:
        include/linux/dma-buf.h

1. The android12-5.10 KMI is frozen, and the modification to struct
   dma_buf_sysfs_entry in the original patch triggers ABI check
   failures. Instead of an anonymous union, use the existing struct
   kobject directly as a work_struct with type punning.

(cherry picked from commit fc02d3582a6668bfff235c78f601fca0a15125da
         https://android.git.corp.google.com/kernel/common android13-5.10)
Signed-off-by: T.J. Mercier <tjmercier@google.com>
Change-Id: Ic0386849b6b248b0a72215633fc1a50782455bac
2022-10-25 20:20:48 +00:00
..
accessibility tty: the rest, stop using tty_schedule_flip() 2022-07-29 17:19:28 +02:00
acpi This is the 5.10.136 stable release 2022-08-11 15:56:44 +02:00
amba
android ANDROID: sched: add restricted hooks to replace the former hooks 2022-10-24 14:26:09 +08:00
ata ata: libata-core: fix NULL pointer deref in ata_host_alloc_pinfo() 2022-06-22 14:13:14 +02:00
atm
auxdisplay
base Revert "firmware_loader: use kernel credentials when reading firmware" 2022-10-10 10:24:30 -07:00
bcma
block This is the 5.10.129 stable release 2022-07-28 16:55:29 +02:00
bluetooth This is the 5.10.136 stable release 2022-08-11 15:56:44 +02:00
bus bus: ti-sysc: Fix warnings for unbind for serial 2022-06-14 18:32:34 +02:00
cdrom
char This is the 5.10.127 stable release 2022-07-28 16:08:09 +02:00
clk This is the 5.10.124 stable release 2022-07-28 15:53:46 +02:00
clocksource This is the 5.10.129 stable release 2022-07-28 16:55:29 +02:00
connector
counter
cpufreq This is the 5.10.132 stable release 2022-07-28 17:17:55 +02:00
cpuidle
crypto This is the 5.10.121 stable release 2022-07-23 16:10:22 +02:00
dax
dca
devfreq PM / devfreq: exynos-ppmu: Fix refcount leak in of_get_devfreq_events 2022-07-07 17:52:18 +02:00
dio
dma dmaengine: ti: Add missing put_device in ti_dra7_xbar_route_allocate 2022-07-12 16:32:23 +02:00
dma-buf BACKPORT: ANDROID: dma-buf: Move sysfs work out of DMA-BUF export path 2022-10-25 20:20:48 +00:00
edac EDAC/ghes: Set the DIMM label unconditionally 2022-08-03 12:00:50 +02:00
eisa
extcon extcon: Modify extcon device to be created after driver data is set 2022-06-14 18:32:43 +02:00
firewire
firmware This is the 5.10.122 stable release 2022-07-28 15:05:26 +02:00
fpga
fsi
gnss
gpio This is the 5.10.134 stable release 2022-08-03 12:42:13 +02:00
gpu This is the 5.10.135 stable release 2022-08-04 10:59:03 +02:00
greybus
hid BACKPORT: HID: steam: Prevent NULL pointer dereference in steam_{recv,send}_report 2022-10-11 22:09:21 +00:00
hsi
hv Drivers: hv: vmbus: Release cpu lock in error case 2022-06-22 14:13:16 +02:00
hwmon This is the 5.10.129 stable release 2022-07-28 16:55:29 +02:00
hwspinlock
hwtracing This is the 5.10.122 stable release 2022-07-28 15:05:26 +02:00
i2c This is the 5.10.134 stable release 2022-08-03 12:42:13 +02:00
i3c
ide
idle intel_idle: Disable IBRS during long idle 2022-07-25 11:26:43 +02:00
iio iio: adc: adi-axi-adc: Fix refcount leak in adi_axi_adc_attach_client 2022-06-29 08:59:52 +02:00
infiniband This is the 5.10.129 stable release 2022-07-28 16:55:29 +02:00
input Input: soc_button_array - also add Lenovo Yoga Tablet2 1051F to dmi_use_low_level_irq 2022-06-22 14:13:14 +02:00
interconnect This is the 5.10.122 stable release 2022-07-28 15:05:26 +02:00
iommu Merge branch 'android12-5.10' into branch 'android12-5.10-lts' 2022-08-16 14:34:54 +02:00
ipack
irqchip This is the 5.10.132 stable release 2022-07-28 17:17:55 +02:00
isdn
leds
lightnvm
macintosh macintosh/adb: fix oob read in do_adb_query() function 2022-08-11 13:06:47 +02:00
mailbox Revert "mailbox: forward the hrtimer if not queued and under a lock" 2022-07-28 14:52:52 +02:00
mcb
md Merge tag 'android12-5.10.136_r00' into android12-5.10 2022-09-28 09:54:28 +02:00
media This is the 5.10.121 stable release 2022-07-23 16:10:22 +02:00
memory This is the 5.10.127 stable release 2022-07-28 16:08:09 +02:00
memstick
message
mfd mfd: davinci_voicecodec: Fix possible null-ptr-deref davinci_vc_probe() 2022-06-09 10:21:18 +02:00
misc This is the 5.10.130 stable release 2022-07-28 17:04:30 +02:00
mmc This is the 5.10.127 stable release 2022-07-28 16:08:09 +02:00
most
mtd This is the 5.10.131 stable release 2022-07-28 17:15:00 +02:00
mux
net UPSTREAM: wifi: mac80211_hwsim: avoid mac80211 warning on bad rate 2022-10-25 18:14:48 +00:00
nfc NFC: nxp-nci: don't print header length mismatch on i2c error 2022-07-21 21:20:14 +02:00
ntb
nubus
nvdimm nvdimm: Fix badblocks clear off-by-one error 2022-07-07 17:52:15 +02:00
nvme This is the 5.10.132 stable release 2022-07-28 17:17:55 +02:00
nvmem
of Merge tag 'android12-5.10.136_r00' into android12-5.10 2022-09-28 09:54:28 +02:00
opp This is the 5.10.121 stable release 2022-07-23 16:10:22 +02:00
oprofile
parisc
parport
pci Merge branch 'android12-5.10' into branch 'android12-5.10-lts' 2022-08-16 14:34:54 +02:00
pcmcia pcmcia: db1xxx_ss: restrict to MIPS_DB1XXX boards 2022-06-14 18:32:30 +02:00
perf
phy phy: qcom-qmp: fix pipe-clock imbalance on power-on failure 2022-06-14 18:32:32 +02:00
pinctrl This is the 5.10.134 stable release 2022-08-03 12:42:13 +02:00
platform This is the 5.10.132 stable release 2022-07-28 17:17:55 +02:00
pnp
power This is the 5.10.134 stable release 2022-08-03 12:42:13 +02:00
powercap
pps
ps3
ptp
pwm This is the 5.10.122 stable release 2022-07-28 15:05:26 +02:00
rapidio
ras
regulator This is the 5.10.121 stable release 2022-07-23 16:10:22 +02:00
remoteproc FROMLIST: remoteproc: Fix dma_mem leak after rproc_shutdown 2022-05-31 17:47:14 +00:00
reset
rpmsg This is the 5.10.122 stable release 2022-07-28 15:05:26 +02:00
rtc rtc: mt6397: check return value after calling platform_get_resource() 2022-06-14 18:32:33 +02:00
s390 This is the 5.10.134 stable release 2022-08-03 12:42:13 +02:00
sbus
scsi Merge tag 'android12-5.10.136_r00' into android12-5.10 2022-09-28 09:54:28 +02:00
sfi
sh
siox
slimbus
soc This is the 5.10.132 stable release 2022-07-28 17:17:55 +02:00
soundwire
spi This is the 5.10.134 stable release 2022-08-03 12:42:13 +02:00
spmi
ssb
staging This is the 5.10.134 stable release 2022-08-03 12:42:13 +02:00
target This is the 5.10.121 stable release 2022-07-23 16:10:22 +02:00
tc
tee
thermal Merge tag 'android12-5.10.136_r00' into android12-5.10 2022-09-28 09:54:28 +02:00
thunderbolt
tty This is the 5.10.134 stable release 2022-08-03 12:42:13 +02:00
uio
usb Merge tag 'android12-5.10.136_r00' into android12-5.10 2022-09-28 09:54:28 +02:00
vdpa vdpasim: allow to enable a vq repeatedly 2022-06-09 10:21:29 +02:00
vfio
vhost This is the 5.10.122 stable release 2022-07-28 15:05:26 +02:00
video This is the 5.10.130 stable release 2022-07-28 17:04:30 +02:00
virt
virtio ANDROID: fix up 5.10.132 merge with the virtio_mmio.c driver 2022-07-30 17:39:01 +02:00
visorbus
vlynq
vme
w1
watchdog watchdog: wdat_wdt: Stop watchdog when rebooting the system 2022-06-14 18:32:43 +02:00
xen xen/gntdev: Ignore failure to unmap INVALID_GRANT_HANDLE 2022-07-29 17:19:07 +02:00
zorro
Kconfig
Makefile