Compile-time thread-safety checking
Subsystems (428)
Bart Van Assche
maintainercover Compile-time thread-safety checking
Hi Peter,
As you may know the Clang compiler can perform certain thread-safety checks at compile time. This includes checking whether locking calls in a function match the function attributes and also whether annotated structure members are protected by the synchronization objects declared with GUARDED_BY(). As one can see this patch series includes a significant number of fixes for locking bugs. All these locking bugs have been discovered by the Clang thread-safety checker. I think this shows that it is useful to enable compile-time thread-safety checks.
The Clang thread-safety infrastructure is not new. Some user space code in the kernel tree already uses it. See also the header file tools/perf/util/mutex.h. There are other projects that started using this infrastructure a while ago, e.g. Qemu. The header file include/qemu/clang-tsa.h was added more than two years ago to the Qemu project.
This patch series has been posted as an RFC because at this stage my goal is to gather feedback about the following:
- Whether or not to enable compile-time thread-safety checking in the Linux kernel.
- The names of the macros in header file include/linux/thread_safety.h. The proposed names come from the Clang documentation (ACQUIRE(), RELEASE(), REQUIRES(), ...). In the Qemu header file for thread-safety support these macros have a prefix (TSA_ = Thread-Safety Analysis).
- The changes made in header file include/linux/cleanup.h that support annotating constructor functions with function attributes.
- Whether or not to split the two treewide patches in this series into one patch per kernel driver.
- How to merge this patch series. The second last patch in this series modifies 888 source files. If it is split into one patch per driver, this patch series will become too large to be posted as a single patch series.
Annotating struct mutex is a first step. Once struct mutex is annotated, driver contributors and/or maintainers can annotate structure members with GUARDED_BY() where this is considered useful.
There are more synchronization objects that can be annotated with thread-safety attributes, e.g. spinlocks. This patch series only annotates struct mutex because annotating other synchronization objects too would have made this patch series too large.
Thanks,
Bart.
Bart Van Assche (33):
scsi, usb: Rename the RESERVE and RELEASE constants
s390: Comment out the RELEASE constant
locking: Introduce <linux/thread_safety.h> include/linux/cleanup.h: Support thread-safety analysis locking/mutex: Change the atomic_dec_and_mutex_lock() return type locking/mutex: Annotate struct mutex and mutex functions driver core: Annotate locking functions in <linux/device.h>
kref: Add thread-safety annotations in <linux/kref.h>
refcount: Add thread-safety annotations in <linux/refcount.h>
treewide: Modify mutex_lock_interruptible() return value checks
PNP: isapnp: Check the isapnp_cfg_begin() return value
scsi: mpi3mr: Fix locking in an error path
scsi: mpt3sas: Fix a locking bug in an error path
ice: Split ice_dcb_rebuild()
ice: Fix a locking bug in an error path
net/mlx5e: Make the code easier to analyze
Input: synaptics-rmi4 - fix a locking bug in an error path
misc: nsm: Fix a locking bug in an error path drm/amdgpu: Unlock a mutex before destroying it drm/amdgpu: Fix a locking bug in an error path drm/amdgpu: Fix locking bugs in error paths
drm: bridge: cdns-mhdp8546: Fix a locking bug in an error path
drm: bridge: cdns-mhdp8546: Fix a locking bug in an error path
drm: zynqmp_dp: Fix a deadlock in zynqmp_dp_ignore_hpd_set()
wifi: ath12k: Fix locking in error paths
mctp i3c: Fix locking in error paths
iavf: Fix a locking bug in an error path
wifi: mt76: mt7925: Fix a locking bug in an error path
hwmon: (it87) Check the it87_lock() return value drivers/net/ethernet/marvell/octeontx2/nic: Fix locking in an error
path
md/raid*: Fix raid*_set_queue_limits()
treewide: Annotate all struct mutex users
kbuild: clang: Unconditionally enable thread-safety checking
Documentation/locking/mutex-design.rst | 2 +- arch/arm64/kvm/arm.c | 2 + arch/powerpc/kernel/rtas.c | 1 + arch/powerpc/platforms/powermac/low_i2c.c | 6 + arch/powerpc/platforms/pseries/papr-vpd.c | 2 + arch/x86/events/core.c | 1 + arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 2 + arch/x86/kernel/cpu/sgx/encl.c | 2 + arch/x86/kernel/ftrace.c | 2 + arch/x86/kernel/module.c | 1 + arch/x86/kvm/svm/sev.c | 6 + block/bdev.c | 3 + block/blk-cgroup.c | 2 + block/ioctl.c | 1 + drivers/accel/amdxdna/aie2_error.c | 5 +- drivers/accel/qaic/qaic_control.c | 1 + drivers/acpi/scan.c | 5 + drivers/ata/libata-core.c | 31 +++- drivers/ata/libata-eh.c | 2 + drivers/ata/libata.h | 6 +- drivers/base/bus.c | 1 + drivers/base/core.c | 7 + drivers/base/dd.c | 2 + drivers/base/power/clock_ops.c | 4 + drivers/base/power/main.c | 2 + drivers/base/regmap/regmap-irq.c | 2 + drivers/base/regmap/regmap.c | 2 + drivers/block/drbd/drbd_bitmap.c | 2 + drivers/block/drbd/drbd_main.c | 7 + drivers/block/drbd/drbd_nl.c | 1 + drivers/block/drbd/drbd_receiver.c | 1 + drivers/block/drbd/drbd_state.c | 4 + drivers/block/loop.c | 2 + drivers/block/nbd.c | 3 + drivers/block/null_blk/zoned.c | 2 + drivers/block/rnbd/rnbd-clt.c | 2 + drivers/bus/fsl-mc/mc-sys.c | 1 + drivers/bus/vexpress-config.c | 2 + drivers/cdx/cdx_msi.c | 2 + drivers/char/ipmi/ipmi_msghandler.c | 1 + drivers/char/misc.c | 2 + drivers/char/powernv-op-panel.c | 2 + drivers/char/tpm/tpm-chip.c | 3 + drivers/char/xillybus/xillybus_core.c | 1 + drivers/clk/clk.c | 4 + drivers/comedi/comedi_fops.c | 2 + drivers/comedi/drivers.c | 1 + drivers/comedi/drivers/usbduxsigma.c | 1 + drivers/counter/rz-mtu3-cnt.c | 3 + drivers/cpuidle/cpuidle.c | 2 + drivers/crypto/exynos-rng.c | 1 + drivers/crypto/hisilicon/qm.c | 4 + drivers/crypto/intel/qat/qat_common/adf_cfg.c | 2 + .../qat/qat_common/adf_transport_debug.c | 4 + drivers/cxl/core/port.c | 2 + drivers/devfreq/devfreq.c | 1 + drivers/dpll/dpll_netlink.c | 6 + drivers/firmware/arm_ffa/driver.c | 1 + drivers/firmware/arm_scmi/notify.c | 1 + .../firmware/arm_scmi/transports/mailbox.c | 2 + drivers/firmware/arm_scmi/transports/optee.c | 2 + .../firmware/qcom/qcom_qseecom_uefisecapp.c | 2 + drivers/fpga/fpga-bridge.c | 2 + drivers/fpga/fpga-region.c | 3 + drivers/gpio/gpio-adnp.c | 2 + drivers/gpio/gpio-crystalcove.c | 2 + drivers/gpio/gpio-dln2.c | 2 + drivers/gpio/gpio-ljca.c | 2 + drivers/gpio/gpio-max77620.c | 2 + drivers/gpio/gpio-mlxbf2.c | 6 +- drivers/gpio/gpio-pca953x.c | 2 + drivers/gpio/gpio-pcf857x.c | 2 + drivers/gpio/gpio-pmic-eic-sprd.c | 2 + drivers/gpio/gpio-stmpe.c | 2 + drivers/gpio/gpio-tc3589x.c | 2 + drivers/gpio/gpio-virtio.c | 2 + drivers/gpio/gpio-wcove.c | 2 + drivers/gpu/drm/amd/amdgpu/aldebaran.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 1 + .../drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c | 4 + .../drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c | 4 + .../drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c | 4 + .../drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12.c | 4 + .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 4 + .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c | 4 + .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 8 + drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c | 14 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.h | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 1 + drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c | 2 + drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 4 +- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 + .../drm/amd/amdkfd/kfd_device_queue_manager.c | 5 + .../drm/amd/amdkfd/kfd_device_queue_manager.h | 2 + drivers/gpu/drm/amd/amdkfd/kfd_svm.h | 2 + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 + .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 1 + drivers/gpu/drm/ast/ast_ddc.c | 2 + .../drm/bridge/cadence/cdns-mhdp8546-core.c | 9 +- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 2 + drivers/gpu/drm/clients/drm_log.c | 2 + drivers/gpu/drm/display/drm_dp_helper.c | 3 + drivers/gpu/drm/display/drm_dp_mst_topology.c | 2 + drivers/gpu/drm/drm_atomic_helper.c | 3 + drivers/gpu/drm/drm_auth.c | 2 + drivers/gpu/drm/drm_client_modeset.c | 1 + drivers/gpu/drm/drm_color_mgmt.c | 1 + drivers/gpu/drm/drm_crtc.c | 1 + drivers/gpu/drm/drm_drv.c | 1 + drivers/gpu/drm/drm_fb_helper.c | 1 + drivers/gpu/drm/drm_file.c | 4 + drivers/gpu/drm/drm_gem.c | 4 +- drivers/gpu/drm/drm_mode_object.c | 2 + drivers/gpu/drm/drm_modeset_lock.c | 2 + drivers/gpu/drm/drm_plane.c | 1 + drivers/gpu/drm/drm_prime.c | 1 + drivers/gpu/drm/i915/display/intel_cdclk.c | 1 + .../drm/i915/display/intel_display_reset.c | 2 + drivers/gpu/drm/i915/display/intel_gmbus.c | 3 + drivers/gpu/drm/i915/display/intel_pps.c | 2 + drivers/gpu/drm/i915/display/intel_psr.c | 3 + drivers/gpu/drm/i915/display/intel_tc.c | 4 + drivers/gpu/drm/i915/gem/i915_gem_context.h | 2 + .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 1 + drivers/gpu/drm/i915/gt/intel_context.h | 4 + drivers/gpu/drm/i915/gt/selftest_context.c | 1 + drivers/gpu/drm/i915/gt/selftest_timeline.c | 1 + drivers/gpu/drm/i915/gvt/vgpu.c | 1 + drivers/gpu/drm/i915/i915_request.c | 1 + drivers/gpu/drm/i915/i915_vma.c | 3 +- drivers/gpu/drm/i915/intel_sbi.c | 2 + drivers/gpu/drm/i915/intel_wakeref.c | 2 + drivers/gpu/drm/i915/intel_wakeref.h | 2 + drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c | 1 + drivers/gpu/drm/i915/vlv_sideband.c | 2 + drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 1 + drivers/gpu/drm/mgag200/mgag200_ddc.c | 2 + drivers/gpu/drm/msm/msm_atomic.c | 2 + drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 + drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 + drivers/gpu/drm/nouveau/nouveau_uvmm.h | 2 + drivers/gpu/drm/nouveau/nvkm/core/subdev.c | 1 + .../gpu/drm/nouveau/nvkm/engine/fifo/chan.c | 3 +- .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c | 1 + drivers/gpu/drm/nouveau/nvkm/falcon/cmdq.c | 3 + .../gpu/drm/nouveau/nvkm/subdev/i2c/auxch.c | 2 + drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c | 2 + drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c | 2 + .../drm/nouveau/nvkm/subdev/instmem/nv50.c | 24 +-- drivers/gpu/drm/panthor/panthor_mmu.c | 1 + drivers/gpu/drm/qxl/qxl_cmd.c | 1 + drivers/gpu/drm/qxl/qxl_display.c | 2 + drivers/gpu/drm/radeon/radeon_i2c.c | 2 + drivers/gpu/drm/radeon/radeon_ring.c | 3 + drivers/gpu/drm/rockchip/cdn-dp-core.c | 1 + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 2 + drivers/gpu/drm/tegra/hdmi.c | 2 + drivers/gpu/drm/ttm/tests/ttm_bo_test.c | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c | 7 +- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 5 + drivers/gpu/drm/vmwgfx/vmwgfx_validation.c | 3 + drivers/gpu/drm/xe/xe_migrate.c | 1 + drivers/gpu/drm/xe/xe_pcode.c | 1 + drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +- drivers/gpu/host1x/bus.c | 2 + drivers/gpu/host1x/cdma.c | 6 + drivers/gpu/host1x/context.c | 1 + drivers/gpu/host1x/mipi.c | 2 + drivers/hid/hid-wiimote.h | 3 + drivers/hv/channel.c | 2 + drivers/hwmon/abituguru.c | 2 + drivers/hwmon/abituguru3.c | 2 + drivers/hwmon/asus_rog_ryujin.c | 4 +- drivers/hwmon/gigabyte_waterforce.c | 2 +- drivers/hwmon/it87.c | 6 +- drivers/hwmon/lm78.c | 1 + drivers/hwmon/nct7904.c | 2 + drivers/hwmon/nzxt-kraken3.c | 2 +- drivers/hwmon/pmbus/pmbus_core.c | 1 + drivers/hwmon/w83781d.c | 1 + drivers/hwtracing/intel_th/msu.c | 1 + drivers/hwtracing/stm/policy.c | 2 + drivers/i2c/busses/i2c-amd-mp2-pci.c | 2 + drivers/i2c/busses/i2c-xiic.c | 1 + drivers/i2c/i2c-atr.c | 3 + drivers/iio/accel/kionix-kx022a.c | 3 + drivers/iio/adc/meson_saradc.c | 2 + drivers/iio/buffer/industrialio-buffer-dma.c | 2 + drivers/iio/industrialio-core.c | 4 + drivers/iio/light/opt3001.c | 1 + drivers/infiniband/core/cma.c | 5 + drivers/infiniband/core/security.c | 1 + drivers/infiniband/core/umem_odp.c | 1 + drivers/infiniband/hw/hns/hns_roce_hem.c | 2 + drivers/infiniband/hw/mlx4/main.c | 2 + drivers/infiniband/hw/mlx5/mr.c | 1 + drivers/infiniband/hw/mlx5/odp.c | 1 + drivers/infiniband/hw/mlx5/umr.c | 2 + drivers/infiniband/ulp/srp/ib_srp.c | 2 +- drivers/infiniband/ulp/srpt/ib_srpt.c | 4 +- drivers/input/input.c | 3 + drivers/input/joystick/pxrc.c | 2 + drivers/input/keyboard/adp5588-keys.c | 2 + drivers/input/misc/ati_remote2.c | 2 + drivers/input/misc/cm109.c | 2 + drivers/input/mouse/psmouse-base.c | 1 + drivers/input/mouse/synaptics_usb.c | 2 + drivers/input/rmi4/rmi_f54.c | 5 +- drivers/input/serio/i8042.c | 2 + drivers/input/serio/libps2.c | 2 + drivers/iommu/iommufd/device.c | 2 + drivers/iommu/iommufd/hw_pagetable.c | 1 + drivers/leds/leds-blinkm.c | 2 +- drivers/md/bcache/alloc.c | 2 + drivers/md/bcache/btree.c | 1 + drivers/md/bcache/super.c | 2 + drivers/md/dm-bufio.c | 2 + drivers/md/dm-crypt.c | 1 + drivers/md/dm-vdo/indexer/index-session.c | 1 + drivers/md/dm-vdo/indexer/volume-index.c | 3 + drivers/md/dm-vdo/indexer/volume.c | 1 + drivers/md/dm-writecache.c | 6 + drivers/md/dm-zoned-metadata.c | 6 + drivers/md/dm.c | 5 + drivers/md/md-cluster.c | 12 +- drivers/md/md.c | 8 + drivers/md/md.h | 9 +- drivers/md/raid0.c | 4 +- drivers/md/raid1.c | 4 +- drivers/md/raid10.c | 4 +- drivers/media/cec/core/cec-adap.c | 5 + .../media/common/videobuf2/videobuf2-core.c | 2 + .../media/common/videobuf2/videobuf2-v4l2.c | 7 + drivers/media/dvb-core/dvb_frontend.c | 1 + drivers/media/dvb-core/dvb_vb2.c | 2 + drivers/media/dvb-frontends/bcm3510.c | 2 +- drivers/media/dvb-frontends/dib0070.c | 4 +- drivers/media/dvb-frontends/dib0090.c | 8 +- drivers/media/dvb-frontends/dib7000m.c | 4 +- drivers/media/dvb-frontends/dib7000p.c | 4 +- drivers/media/dvb-frontends/dib8000.c | 10 +- drivers/media/dvb-frontends/dib9000.c | 43 +++--- drivers/media/dvb-frontends/dibx000_common.c | 10 +- drivers/media/dvb-frontends/stv090x.c | 2 + drivers/media/dvb-frontends/stv0910.c | 1 + drivers/media/dvb-frontends/ts2020.c | 2 + drivers/media/mc/mc-device.c | 1 + drivers/media/mc/mc-entity.c | 1 + drivers/media/pci/cx18/cx18-alsa.h | 2 + drivers/media/pci/ddbridge/ddbridge-core.c | 1 + drivers/media/pci/ivtv/ivtv-alsa.h | 2 + drivers/media/pci/ivtv/ivtv-fileops.c | 2 + drivers/media/pci/ivtv/ivtv-ioctl.c | 3 + drivers/media/pci/ivtv/ivtv-yuv.c | 3 + drivers/media/platform/amphion/vpu_v4l2.c | 3 + .../platform/chips-media/coda/coda-jpeg.c | 1 + .../mediatek/vcodec/decoder/mtk_vcodec_dec.c | 2 + .../vcodec/decoder/mtk_vcodec_dec_pm.c | 2 + .../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 2 + .../media/platform/nvidia/tegra-vde/h264.c | 5 + drivers/media/platform/nvidia/tegra-vde/vde.c | 2 + .../platform/samsung/exynos4-is/media-dev.h | 2 + .../media/platform/samsung/s5p-mfc/s5p_mfc.c | 2 + drivers/media/platform/st/sti/hva/hva-hw.c | 1 + drivers/media/platform/ti/omap3isp/ispvideo.c | 2 + .../test-drivers/vivid/vivid-kthread-cap.c | 1 + drivers/media/usb/dvb-usb-v2/af9035.c | 2 +- drivers/media/usb/dvb-usb-v2/anysee.c | 2 +- drivers/media/usb/dvb-usb-v2/au6610.c | 2 +- drivers/media/usb/dvb-usb-v2/az6007.c | 6 +- drivers/media/usb/dvb-usb-v2/ce6230.c | 2 +- drivers/media/usb/dvb-usb-v2/dvbsky.c | 2 +- drivers/media/usb/dvb-usb-v2/ec168.c | 2 +- drivers/media/usb/dvb-usb-v2/lmedm04.c | 2 +- drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.c | 2 +- drivers/media/usb/dvb-usb-v2/mxl111sf.c | 2 + drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 2 +- drivers/media/usb/dvb-usb/af9005.c | 2 +- drivers/media/usb/dvb-usb/az6027.c | 2 +- drivers/media/usb/dvb-usb/cxusb-analog.c | 1 + drivers/media/usb/dvb-usb/cxusb.c | 3 +- drivers/media/usb/dvb-usb/dib0700_core.c | 20 +-- drivers/media/usb/dvb-usb/dibusb-common.c | 2 +- drivers/media/usb/dvb-usb/digitv.c | 2 +- drivers/media/usb/dvb-usb/dtv5100.c | 2 +- drivers/media/usb/dvb-usb/dvb-usb-urb.c | 3 +- drivers/media/usb/dvb-usb/dw2102.c | 16 +- drivers/media/usb/dvb-usb/gp8psk.c | 6 +- drivers/media/usb/dvb-usb/m920x.c | 2 +- drivers/media/usb/dvb-usb/opera1.c | 4 +- drivers/media/usb/dvb-usb/pctv452e.c | 4 +- drivers/media/usb/dvb-usb/technisat-usb2.c | 10 +- drivers/media/usb/dvb-usb/ttusb2.c | 2 +- drivers/media/usb/dvb-usb/vp702x.c | 5 +- drivers/media/usb/go7007/go7007-i2c.c | 3 + drivers/media/usb/gspca/finepix.c | 1 + drivers/media/usb/gspca/jl2005bcd.c | 1 + drivers/media/usb/gspca/sn9c20x.c | 1 + drivers/media/usb/gspca/sonixj.c | 1 + drivers/media/usb/gspca/sq905.c | 2 + drivers/media/usb/gspca/sq905c.c | 1 + drivers/media/usb/gspca/vicam.c | 1 + drivers/media/usb/gspca/zc3xx.c | 1 + drivers/media/usb/hdpvr/hdpvr-video.c | 1 + drivers/media/usb/pvrusb2/pvrusb2-context.c | 2 + .../media/usb/ttusb-budget/dvb-ttusb-budget.c | 4 +- drivers/media/usb/uvc/uvc_ctrl.c | 7 +- drivers/media/v4l2-core/v4l2-event.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + drivers/media/v4l2-core/v4l2-mem2mem.c | 1 + drivers/media/v4l2-core/v4l2-subdev.c | 1 + drivers/message/fusion/mptctl.c | 11 +- drivers/message/fusion/mptscsih.c | 4 +- drivers/mfd/88pm860x-core.c | 2 + drivers/mfd/atc260x-core.c | 2 + drivers/mfd/kempld-core.c | 2 + drivers/mfd/lp8788-irq.c | 2 + drivers/mfd/max8925-core.c | 2 + drivers/mfd/max8997-irq.c | 2 + drivers/mfd/max8998-irq.c | 2 + drivers/mfd/mc13xxx-core.c | 2 + drivers/mfd/mt6358-irq.c | 2 + drivers/mfd/mt6397-irq.c | 2 + drivers/mfd/rc5t583-irq.c | 2 + drivers/mfd/stmfx.c | 2 + drivers/mfd/stmpe.c | 2 + drivers/mfd/tps65217.c | 2 + drivers/mfd/tps6586x.c | 2 + drivers/mfd/twl4030-irq.c | 2 + drivers/mfd/wm831x-irq.c | 2 + drivers/mfd/wm8350-irq.c | 2 + drivers/misc/cardreader/rtsx_usb.c | 2 + drivers/misc/mei/client.c | 7 + drivers/misc/mei/hbm.c | 1 + drivers/misc/mei/hw-me.c | 9 ++ drivers/misc/mei/hw-txe.c | 4 + drivers/misc/mei/main.c | 1 + drivers/misc/nsm.c | 2 +- drivers/misc/ntsync.c | 2 + drivers/misc/sgi-gru/grufault.c | 3 + drivers/misc/sgi-gru/grumain.c | 1 + drivers/misc/vmw_vmci/vmci_queue_pair.c | 2 + drivers/mmc/host/vub300.c | 2 + drivers/mtd/chips/cfi_cmdset_0001.c | 4 + drivers/mtd/chips/cfi_cmdset_0002.c | 6 + drivers/mtd/lpddr/lpddr_cmds.c | 4 + drivers/mtd/nand/ecc-mtk.c | 2 + drivers/mtd/nand/ecc-mxic.c | 2 + drivers/mtd/nand/raw/atmel/pmecc.c | 2 + drivers/mtd/nand/raw/nand_base.c | 4 + drivers/mtd/spi-nor/controllers/hisi-sfc.c | 2 + drivers/mtd/spi-nor/core.c | 6 + drivers/net/can/softing/softing_main.c | 1 + drivers/net/dsa/microchip/ksz_common.c | 2 + drivers/net/dsa/microchip/ksz_common.h | 2 + drivers/net/dsa/microchip/ksz_ptp.c | 2 + drivers/net/dsa/mt7530-mdio.c | 2 + drivers/net/dsa/mt7530.c | 2 + drivers/net/dsa/mv88e6xxx/chip.c | 3 + drivers/net/dsa/mv88e6xxx/chip.h | 2 + drivers/net/dsa/mv88e6xxx/global2.c | 2 + drivers/net/dsa/mv88e6xxx/pcs-6352.c | 2 + drivers/net/dsa/mv88e6xxx/phy.c | 2 + drivers/net/dsa/qca/ar9331.c | 2 + drivers/net/dsa/realtek/rtl83xx.c | 2 + drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 2 + .../net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 + .../net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 2 + .../net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c | 2 + .../net/ethernet/broadcom/bnxt/bnxt_hwrm.c | 2 + drivers/net/ethernet/broadcom/tg3.c | 1 + drivers/net/ethernet/davicom/dm9000.c | 1 + drivers/net/ethernet/davicom/dm9051.c | 2 + drivers/net/ethernet/emulex/benet/be_cmds.c | 2 + .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 + drivers/net/ethernet/hisilicon/hns3/hnae3.c | 2 + .../hisilicon/hns3/hns3pf/hclge_main.c | 1 + drivers/net/ethernet/intel/e1000e/82571.c | 3 + drivers/net/ethernet/intel/e1000e/ich8lan.c | 2 + drivers/net/ethernet/intel/iavf/iavf_main.c | 3 +- drivers/net/ethernet/intel/ice/ice_common.c | 1 + drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 49 +++--- drivers/net/ethernet/intel/ice/ice_ddp.c | 2 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 1 + drivers/net/ethernet/intel/ice/ice_vf_lib.c | 1 + drivers/net/ethernet/intel/idpf/idpf.h | 2 + .../ethernet/marvell/octeontx2/af/rvu_nix.c | 3 + .../marvell/octeontx2/af/rvu_npc_fs.c | 1 + .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 2 +- .../net/ethernet/marvell/octeontx2/nic/rep.c | 1 + .../marvell/prestera/prestera_counter.c | 4 + .../ethernet/marvell/prestera/prestera_pci.c | 2 + drivers/net/ethernet/mellanox/mlx4/cmd.c | 2 + drivers/net/ethernet/mellanox/mlx4/port.c | 5 + .../ethernet/mellanox/mlx5/core/en/mod_hdr.c | 1 + .../mellanox/mlx5/core/en/reporter_rx.c | 2 + .../mellanox/mlx5/core/en/tc/ct_fs_hmfs.c | 1 + .../mellanox/mlx5/core/en/tc/ct_fs_smfs.c | 1 + .../mellanox/mlx5/core/en/tc/int_port.c | 1 + .../mellanox/mlx5/core/en/tc_tun_encap.c | 3 + .../mellanox/mlx5/core/en_accel/macsec.c | 62 +++----- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 1 + .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 2 + .../net/ethernet/mellanox/mlx5/core/main.c | 2 + .../mellanox/mlx5/core/steering/hws/bwc.c | 2 + .../mlx5/core/steering/sws/dr_types.h | 6 + drivers/net/ethernet/mellanox/mlxsw/i2c.c | 4 +- drivers/net/ethernet/micrel/ks8851_spi.c | 2 + .../ethernet/microchip/encx24j600-regmap.c | 2 + .../net/ethernet/microchip/vcap/vcap_api.c | 4 + .../netronome/nfp/nfpcore/nfp_cppcore.c | 2 + drivers/net/ethernet/qlogic/qed/qed_ll2.c | 1 + drivers/net/ethernet/qlogic/qed/qed_vf.c | 4 +- drivers/net/ethernet/qlogic/qede/qede_main.c | 7 + drivers/net/ethernet/sfc/ef10_sriov.c | 1 + drivers/net/ethernet/sfc/efx_common.c | 5 + drivers/net/ethernet/sfc/falcon/efx.c | 2 + drivers/net/ethernet/sfc/mcdi_filters.c | 1 + drivers/net/ethernet/sfc/siena/efx_common.c | 3 + drivers/net/ethernet/xilinx/xilinx_axienet.h | 2 + drivers/net/macsec.c | 1 + drivers/net/mctp/mctp-i3c.c | 7 +- drivers/net/phy/dp83640.c | 2 + drivers/net/phy/phy-core.c | 3 + drivers/net/phy/phy_device.c | 1 + drivers/net/phy/sfp-bus.c | 1 + drivers/net/pse-pd/pse_core.c | 2 +- drivers/net/team/team_core.c | 2 + drivers/net/tun.c | 1 + drivers/net/usb/cdc_subset.c | 2 +- drivers/net/usb/hso.c | 2 + drivers/net/usb/lan78xx.c | 2 + drivers/net/wireless/ath/ath12k/core.c | 4 +- drivers/net/wireless/ath/ath6kl/sdio.c | 1 + drivers/net/wireless/ath/ath9k/hif_usb.c | 1 + drivers/net/wireless/ath/wil6210/main.c | 1 + drivers/net/wireless/ath/wil6210/p2p.c | 2 + drivers/net/wireless/broadcom/b43/main.c | 1 + .../net/wireless/broadcom/b43legacy/main.c | 1 + .../broadcom/brcm80211/brcmfmac/fwvid.c | 2 + drivers/net/wireless/intel/iwlwifi/dvm/lib.c | 1 + drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 3 + drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 3 + .../wireless/intel/iwlwifi/mvm/time-event.c | 2 + drivers/net/wireless/intersil/p54/p54pci.c | 1 + drivers/net/wireless/intersil/p54/p54usb.c | 3 +- drivers/net/wireless/marvell/mwl8k.c | 2 + .../wireless/mediatek/mt76/mt7615/testmode.c | 1 + .../net/wireless/mediatek/mt76/mt76_connac.h | 2 + .../net/wireless/mediatek/mt76/mt7915/main.c | 1 + .../wireless/mediatek/mt76/mt7915/testmode.c | 5 + .../net/wireless/mediatek/mt76/mt7925/main.c | 6 +- .../net/wireless/microchip/wilc1000/wlan.c | 2 + drivers/net/wireless/quantenna/qtnfmac/bus.h | 2 + drivers/net/wireless/realtek/rtw88/main.c | 1 + drivers/net/wireless/realtek/rtw89/core.c | 1 + drivers/net/wireless/realtek/rtw89/mac80211.c | 2 + drivers/net/wireless/realtek/rtw89/wow.c | 4 + drivers/net/wireless/realtek/rtw89/wow.h | 2 +- drivers/net/wireless/rsi/rsi_91x_hal.c | 1 + drivers/net/wireless/st/cw1200/pm.c | 2 + drivers/net/wireless/ti/wl12xx/main.c | 1 + drivers/net/wireless/ti/wlcore/main.c | 4 + drivers/net/wireless/ti/wlcore/sysfs.c | 2 +- drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 2 + drivers/nvdimm/bus.c | 1 + drivers/nvdimm/core.c | 2 + drivers/nvdimm/namespace_devs.c | 1 + drivers/nvme/host/core.c | 2 + drivers/nvme/host/pci.c | 1 + drivers/nvmem/sc27xx-efuse.c | 2 + drivers/nvmem/sprd-efuse.c | 2 + drivers/of/dynamic.c | 4 + drivers/of/overlay.c | 2 + drivers/opp/core.c | 2 + drivers/pci/pci.c | 10 ++ drivers/pci/pcie/bwctrl.c | 1 + drivers/pci/probe.c | 2 + drivers/pci/switch/switchtec.c | 1 + drivers/pcmcia/rsrc_nonstatic.c | 1 + drivers/perf/arm-cci.c | 1 + drivers/pinctrl/pinctrl-aw9523.c | 2 + drivers/pinctrl/pinctrl-cy8c95x0.c | 2 + drivers/pinctrl/pinctrl-mcp23s08.c | 2 + drivers/pinctrl/pinctrl-stmfx.c | 2 + drivers/pinctrl/pinctrl-sx150x.c | 2 + drivers/platform/chrome/cros_ec_lpc_mec.c | 2 + .../platform/cznic/turris-omnia-mcu-gpio.c | 2 + .../platform/x86/intel/crystal_cove_charger.c | 2 + drivers/platform/x86/thinkpad_acpi.c | 12 +- drivers/pmdomain/core.c | 4 + drivers/pmdomain/rockchip/pm-domains.c | 2 + drivers/pnp/isapnp/core.c | 18 ++- drivers/power/supply/da9150-fg.c | 2 + drivers/power/supply/power_supply_core.c | 1 + drivers/pwm/core.c | 8 + drivers/regulator/core.c | 2 + drivers/remoteproc/mtk_scp_ipi.c | 2 + drivers/s390/char/tape_std.h | 2 + drivers/scsi/aacraid/aachba.c | 4 +- drivers/scsi/aacraid/commctrl.c | 1 + drivers/scsi/arm/acornscsi.c | 2 +- drivers/scsi/fnic/fnic_scsi.c | 1 + drivers/scsi/hpsa.c | 2 +- drivers/scsi/ips.c | 8 +- drivers/scsi/libfc/fc_disc.c | 6 +- drivers/scsi/libiscsi.c | 1 + drivers/scsi/megaraid.c | 10 +- drivers/scsi/megaraid/megaraid_mbox.c | 10 +- drivers/scsi/megaraid/megaraid_sas.h | 3 +- drivers/scsi/megaraid/megaraid_sas_base.c | 20 ++- drivers/scsi/megaraid/megaraid_sas_fusion.c | 2 + drivers/scsi/mpi3mr/mpi3mr_app.c | 1 + drivers/scsi/mpt3sas/mpt3sas_base.c | 12 +- drivers/scsi/scsi_transport_iscsi.c | 1 + drivers/scsi/sg.c | 1 + drivers/scsi/smartpqi/smartpqi_init.c | 18 +++ drivers/siox/siox-core.c | 2 + drivers/soc/qcom/qcom_pd_mapper.c | 1 + drivers/soc/tegra/pmc.c | 1 + drivers/soundwire/stream.c | 3 + drivers/spi/spi-mem.c | 2 + drivers/spi/spi.c | 3 + drivers/ssb/main.c | 2 + drivers/staging/Makefile | 2 + .../gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 4 +- drivers/staging/greybus/light.c | 2 + .../interface/vchiq_arm/vchiq_core.c | 1 + drivers/target/iscsi/iscsi_target_tpg.c | 1 + drivers/target/target_core_device.c | 9 +- drivers/target/target_core_pr.c | 6 +- drivers/target/target_core_spc.c | 20 +-- drivers/tee/amdtee/core.c | 1 + drivers/thermal/mediatek/auxadc_thermal.c | 2 + drivers/thermal/tegra/soctherm.c | 2 + drivers/thermal/thermal_debugfs.c | 4 + drivers/tty/n_tty.c | 1 + drivers/tty/serial/sc16is7xx.c | 2 + drivers/tty/tty_buffer.c | 2 + drivers/tty/tty_io.c | 8 +- drivers/tty/tty_mutex.c | 5 + drivers/ufs/core/ufshcd.c | 4 + drivers/usb/class/cdc-wdm.c | 6 +- drivers/usb/class/usblp.c | 5 +- drivers/usb/class/usbtmc.c | 3 + drivers/usb/core/devio.c | 7 + drivers/usb/core/hcd-pci.c | 2 + drivers/usb/core/hub.c | 7 + drivers/usb/core/message.c | 2 +- drivers/usb/core/sysfs.c | 24 +-- drivers/usb/gadget/configfs.c | 6 + drivers/usb/gadget/function/f_fs.c | 14 +- drivers/usb/gadget/function/f_mass_storage.c | 4 +- drivers/usb/gadget/function/u_fs.h | 2 + drivers/usb/gadget/legacy/inode.c | 14 +- drivers/usb/misc/yurex.c | 2 +- drivers/usb/serial/mos7720.c | 2 + drivers/usb/serial/usb-serial.c | 3 + drivers/usb/storage/debug.c | 4 +- drivers/usb/storage/transport.c | 3 +- drivers/usb/storage/usb.c | 2 + drivers/usb/typec/tcpm/tcpm.c | 16 ++ drivers/usb/usb-skeleton.c | 2 +- drivers/usb/usbip/stub_dev.c | 2 +- drivers/usb/usbip/stub_main.c | 1 + drivers/usb/usbip/stub_rx.c | 2 +- drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 2 + drivers/vfio/group.c | 1 + drivers/vfio/pci/mlx5/cmd.h | 3 +- drivers/vfio/pci/virtio/migrate.c | 1 + drivers/vfio/vfio_iommu_type1.c | 1 + drivers/vhost/vhost.c | 3 + drivers/video/fbdev/core/fb_procfs.c | 2 + drivers/video/fbdev/smscufx.c | 1 + drivers/video/fbdev/udlfb.c | 1 + drivers/virt/vboxguest/vboxguest_linux.c | 2 + drivers/virtio/virtio_mem.c | 5 + drivers/w1/masters/omap_hdq.c | 8 +- drivers/w1/slaves/w1_therm.c | 9 ++ drivers/w1/w1.c | 3 + drivers/w1/w1_netlink.c | 1 + drivers/xen/balloon.c | 2 + drivers/xen/xen-pciback/passthrough.c | 1 + drivers/xen/xen-pciback/vpci.c | 1 + drivers/xen/xenbus/xenbus_comms.c | 1 + drivers/xen/xenbus/xenbus_xs.c | 4 + fs/affs/affs.h | 6 + fs/afs/validation.c | 3 +- fs/afs/vl_alias.c | 6 +- fs/autofs/waitq.c | 3 + fs/bcachefs/alloc_foreground.c | 4 + fs/bcachefs/alloc_foreground.h | 1 + fs/bcachefs/btree_locking.c | 1 + fs/bcachefs/btree_write_buffer.c | 4 + fs/bcachefs/debug.c | 2 + fs/bcachefs/ec.c | 3 + fs/bcachefs/fs-ioctl.c | 1 + fs/bcachefs/fs.c | 4 + fs/bcachefs/io_write.c | 3 + fs/bcachefs/journal.c | 2 + fs/bcachefs/quota.c | 2 + fs/bcachefs/seqmutex.h | 4 + fs/btrfs/block-group.c | 2 + fs/btrfs/delayed-ref.c | 4 + fs/btrfs/delayed-ref.h | 1 + fs/btrfs/extent-tree.c | 1 + fs/btrfs/free-space-cache.c | 1 + fs/btrfs/ioctl.c | 2 + fs/btrfs/qgroup.c | 1 + fs/btrfs/scrub.c | 2 + fs/btrfs/tests/delayed-refs-tests.c | 1 + fs/btrfs/tree-log.c | 2 + fs/btrfs/volumes.c | 4 + fs/btrfs/zoned.h | 4 + fs/ceph/caps.c | 4 + fs/ceph/mds_client.c | 1 + fs/coda/upcall.c | 1 + fs/dcache.c | 1 + fs/dlm/recoverd.c | 2 + fs/ecryptfs/main.c | 1 + fs/ecryptfs/messaging.c | 1 + fs/erofs/zdata.c | 3 + fs/eventpoll.c | 3 + fs/exec.c | 4 + fs/ext4/fast_commit.c | 1 + fs/ext4/mballoc.c | 2 + fs/f2fs/data.c | 1 + fs/fat/fatent.c | 2 + fs/fat/inode.c | 2 + fs/file.c | 2 + fs/fsopen.c | 2 +- fs/fuse/inode.c | 2 + fs/gfs2/rgrp.c | 2 + fs/gfs2/util.c | 1 + fs/hfs/bfind.c | 2 + fs/hfsplus/bfind.c | 2 + fs/hfsplus/extents.c | 2 + fs/hpfs/hpfs_fn.h | 2 + fs/jbd2/checkpoint.c | 2 + fs/jbd2/commit.c | 1 + fs/jbd2/journal.c | 5 + fs/jbd2/transaction.c | 2 + fs/jffs2/dir.c | 4 + fs/jffs2/fs.c | 1 + fs/jffs2/gc.c | 1 + fs/jffs2/nodemgmt.c | 2 + fs/jffs2/write.c | 2 + fs/jfs/namei.c | 1 + fs/kernfs/file.c | 9 ++ fs/lockd/host.c | 1 + fs/lockd/svclock.c | 1 + fs/namei.c | 4 + fs/namespace.c | 2 +- fs/netfs/write_issue.c | 2 + fs/nfsd/nfs4layouts.c | 2 + fs/nfsd/nfs4proc.c | 2 + fs/nfsd/nfs4state.c | 11 ++ fs/ntfs3/frecord.c | 4 +- fs/ntfs3/inode.c | 1 + fs/ntfs3/namei.c | 2 + fs/ntfs3/ntfs_fs.h | 4 + fs/ntfs3/record.c | 1 + fs/ntfs3/xattr.c | 2 + fs/ocfs2/cluster/nodemanager.c | 2 + fs/ocfs2/dlmglue.c | 2 + fs/ocfs2/inode.c | 2 + fs/ocfs2/refcounttree.c | 2 + fs/orangefs/devorangefs-req.c | 2 +- fs/orangefs/orangefs-debugfs.c | 2 + fs/orangefs/waitqueue.c | 1 + fs/overlayfs/overlayfs.h | 3 + fs/pipe.c | 2 + fs/proc/base.c | 2 +- fs/proc/proc_tty.c | 2 + fs/pstore/zone.c | 1 + fs/smb/client/cifsglob.h | 2 + fs/smb/client/connect.c | 3 +- fs/smb/client/fs_context.h | 2 + fs/smb/client/smbdirect.c | 2 + fs/smb/client/smbdirect.h | 2 +- fs/smb/server/connection.h | 6 +- fs/super.c | 6 + fs/ubifs/compress.c | 2 + fs/ubifs/dir.c | 4 + fs/ubifs/file.c | 6 + fs/ubifs/journal.c | 3 + fs/ubifs/misc.h | 2 + fs/xfs/scrub/dirtree.c | 2 + fs/xfs/scrub/dirtree_repair.c | 3 + fs/xfs/scrub/quota.c | 1 + fs/xfs/scrub/quota_repair.c | 3 + fs/xfs/scrub/quotacheck_repair.c | 3 + fs/xfs/scrub/rmap_repair.c | 1 + fs/xfs/scrub/rtrmap_repair.c | 1 + fs/xfs/xfs_dquot.c | 7 + fs/xfs/xfs_dquot.h | 10 +- fs/xfs/xfs_dquot_item.c | 2 + fs/xfs/xfs_qm.c | 3 + fs/xfs/xfs_qm_syscalls.c | 1 + fs/xfs/xfs_trans_dquot.c | 3 + include/linux/blkdev.h | 11 +- include/linux/cgroup.h | 2 + include/linux/cleanup.h | 34 ++++- include/linux/device.h | 13 +- include/linux/fb.h | 2 + include/linux/fpga/fpga-bridge.h | 2 +- include/linux/fpga/fpga-mgr.h | 4 +- include/linux/fsnotify_backend.h | 2 + include/linux/gameport.h | 1 + include/linux/kref.h | 3 + include/linux/memory_hotplug.h | 2 + include/linux/mfd/si476x-core.h | 2 + include/linux/mutex.h | 46 +++--- include/linux/mutex_types.h | 5 +- include/linux/netdevice.h | 2 + include/linux/phy.h | 2 + include/linux/refcount.h | 5 +- include/linux/thread_safety.h | 141 ++++++++++++++++++ include/linux/usb.h | 3 +- include/media/v4l2-ctrls.h | 2 + include/media/v4l2-subdev.h | 5 + include/net/bluetooth/l2cap.h | 2 + include/net/cfg80211.h | 2 + include/scsi/scsi_proto.h | 4 +- include/sound/emu10k1.h | 12 +- include/sound/i2c.h | 2 + include/sound/soc-card.h | 3 + include/sound/soc.h | 14 ++ include/trace/events/scsi.h | 4 +- include/trace/events/target.h | 4 +- io_uring/cancel.c | 1 + io_uring/fdinfo.c | 1 + io_uring/io_uring.c | 5 + io_uring/io_uring.h | 2 + io_uring/msg_ring.c | 3 + io_uring/register.c | 6 + io_uring/rsrc.c | 3 + io_uring/sqpoll.c | 3 + io_uring/tctx.c | 1 + kernel/acct.c | 3 + kernel/audit.c | 2 + kernel/audit_tree.c | 2 + kernel/audit_watch.c | 1 + kernel/bpf/btf.c | 1 + kernel/bpf/cgroup_iter.c | 2 + kernel/bpf/verifier.c | 1 + kernel/cgroup/cgroup-v1.c | 4 + kernel/cgroup/cgroup.c | 18 +++ kernel/cgroup/cpuset.c | 2 + kernel/cpu.c | 2 + kernel/events/callchain.c | 1 + kernel/events/core.c | 9 ++ kernel/events/hw_breakpoint.c | 2 + kernel/fail_function.c | 2 + kernel/futex/core.c | 3 + kernel/irq/autoprobe.c | 3 + kernel/irq/irqdesc.c | 2 + kernel/irq/msi.c | 2 + kernel/jump_label.c | 2 + kernel/kprobes.c | 3 + kernel/locking/locktorture.c | 4 + kernel/locking/mutex.c | 20 ++- kernel/module/main.c | 1 + kernel/module/procfs.c | 2 + kernel/params.c | 2 + kernel/power/autosleep.c | 2 + kernel/power/main.c | 2 + kernel/printk/printk.c | 2 + kernel/rcu/srcutree.c | 4 +- kernel/rcu/tree_exp.h | 1 + kernel/sched/core.c | 1 + kernel/seccomp.c | 11 +- kernel/static_call_inline.c | 2 + kernel/torture.c | 2 + kernel/trace/ftrace.c | 7 + kernel/trace/ring_buffer.c | 2 + kernel/trace/rv/rv.c | 3 + kernel/trace/rv/rv_reactors.c | 2 + kernel/trace/trace.c | 12 ++ kernel/trace/trace_dynevent.c | 2 + kernel/trace/trace_events.c | 10 ++ kernel/trace/trace_events_trigger.c | 2 + kernel/trace/trace_events_user.c | 1 + kernel/trace/trace_hwlat.c | 2 + kernel/trace/trace_osnoise.c | 2 + kernel/trace/trace_printk.c | 8 + kernel/trace/trace_recursion_record.c | 2 + kernel/trace/trace_stat.c | 2 + kernel/trace/trace_uprobe.c | 2 + kernel/workqueue.c | 2 + lib/Makefile | 2 + lib/dynamic_debug.c | 2 + lib/error-inject.c | 2 + lib/kunit/platform.c | 1 + lib/once.c | 2 + mm/damon/sysfs.c | 3 + mm/hugetlb.c | 4 + mm/kmemleak.c | 6 +- mm/ksm.c | 1 + mm/oom_kill.c | 1 + mm/page_alloc.c | 4 + mm/percpu.c | 1 + mm/slab_common.c | 2 + mm/swap_slots.c | 2 + mm/swapfile.c | 2 + mm/vma.c | 2 + mm/zswap.c | 2 + net/atm/resources.c | 2 + net/bluetooth/l2cap_core.c | 9 ++ net/bluetooth/l2cap_sock.c | 2 + net/bluetooth/rfcomm/sock.c | 1 + net/bridge/netfilter/ebtables.c | 5 + net/caif/caif_socket.c | 2 + net/can/j1939/main.c | 2 + net/ceph/messenger.c | 3 + net/ceph/messenger_v1.c | 2 + net/ceph/messenger_v2.c | 14 ++ net/core/dev.c | 4 + net/core/drop_monitor.c | 2 + net/core/netdev-genl.c | 5 + net/core/pktgen.c | 1 + net/core/rtnetlink.c | 12 ++ net/core/sock.c | 2 + net/devlink/core.c | 3 + net/devlink/devl_internal.h | 2 + net/ethtool/ioctl.c | 1 + net/ipv6/mcast.c | 1 + net/mac802154/cfg.c | 2 + net/mac802154/mib.c | 2 + net/netfilter/ipset/ip_set_core.c | 2 + net/netfilter/ipvs/ip_vs_app.c | 2 + net/netfilter/nf_log.c | 2 + net/netfilter/nf_tables_api.c | 5 + net/netfilter/nfnetlink.c | 2 + net/netfilter/x_tables.c | 8 + net/netfilter/xt_hashlimit.c | 1 + net/netlink/af_netlink.c | 2 + net/netlink/genetlink.c | 7 + net/openvswitch/datapath.c | 2 + net/phonet/socket.c | 2 + net/qrtr/af_qrtr.c | 1 + net/rds/ib_cm.c | 1 + net/rds/rdma_transport.c | 1 + net/rds/tcp_listen.c | 1 + net/rxrpc/af_rxrpc.c | 1 + net/rxrpc/call_object.c | 1 + net/rxrpc/recvmsg.c | 2 +- net/rxrpc/sendmsg.c | 5 +- net/sched/act_api.c | 1 + net/sched/cls_api.c | 1 + net/shaper/shaper.c | 2 + net/smc/af_smc.c | 1 + net/sunrpc/rpc_pipe.c | 2 + net/sunrpc/svc_xprt.c | 2 + net/unix/af_unix.c | 1 + net/unix/unix_bpf.c | 1 + net/wireless/nl80211.c | 9 ++ samples/vfio-mdev/mtty.c | 1 + scripts/Makefile.clang | 3 + security/apparmor/apparmorfs.c | 3 + security/integrity/ima/ima_fs.c | 2 +- security/integrity/ima/ima_main.c | 1 + security/keys/keyring.c | 3 + security/tomoyo/gc.c | 3 + sound/core/compress_offload.c | 3 + sound/core/oss/pcm_oss.c | 9 ++ sound/core/pcm_native.c | 8 + sound/core/seq/oss/seq_oss.c | 1 + sound/core/seq/seq_clientmgr.c | 2 + sound/core/seq/seq_memory.c | 1 + sound/core/sound.c | 1 + sound/isa/gus/gus_mem.c | 3 + sound/pci/ac97/ac97_codec.c | 2 + sound/pci/hda/hda_intel.c | 1 + sound/pci/hda/patch_realtek.c | 2 + sound/pci/hda/tas2781_hda_i2c.c | 1 + sound/pci/ice1712/ak4xxx.c | 2 + sound/pci/ice1712/delta.c | 4 + sound/pci/ice1712/ews.c | 6 + sound/pci/ice1712/hoontech.c | 1 + sound/pci/ice1712/ice1712.h | 2 + sound/pci/ice1712/prodigy192.c | 2 + sound/pci/ice1712/revo.c | 4 + sound/pci/oxygen/oxygen_lib.c | 2 +- sound/pci/pcxhr/pcxhr_core.c | 1 + sound/soc/codecs/rt5677.c | 2 + sound/soc/codecs/wcd-mbhc-v2.c | 7 +- sound/soc/soc-dapm.c | 9 ++ sound/soc/soc-pcm.c | 25 ++++ sound/soc/sof/intel/hda-mlink.c | 2 + sound/soc/sof/ipc3-control.c | 1 + sound/soc/sof/ipc4-control.c | 1 + sound/synth/emux/soundfont.c | 2 + virt/kvm/kvm_main.c | 3 + 910 files changed, 2635 insertions(+), 422 deletions(-) create mode 100644 include/linux/thread_safety.h
Bart Van Assche
maintainerRFC PATCH 1/33 scsi, usb: Rename the RESERVE and RELEASE constants
The RESERVE(6) and RELEASE(6) commands are obsolete SCSI commands defined in the SCSI-2 standard. These commands have been replaced by PERSISTENT RESERVE IN and PERSISTENT RESERVE OUT. Rename RESERVE into RESERVE_6 and RELEASE into RELEASE_6 in preparation of introducing a new RELEASE macro in the new header file include/linux/thread_safety.h.
--- drivers/message/fusion/mptscsih.c | 4 ++-- drivers/scsi/aacraid/aachba.c | 4 ++-- drivers/scsi/arm/acornscsi.c | 2 +- drivers/scsi/ips.c | 8 ++++---- drivers/scsi/megaraid.c | 10 +++++----- drivers/scsi/megaraid/megaraid_mbox.c | 10 +++++----- drivers/target/target_core_device.c | 8 ++++---- drivers/target/target_core_pr.c | 6 +++--- drivers/target/target_core_spc.c | 20 ++++++++++---------- drivers/usb/gadget/function/f_mass_storage.c | 4 ++-- drivers/usb/storage/debug.c | 4 ++-- include/scsi/scsi_proto.h | 4 ++-- include/trace/events/scsi.h | 4 ++-- include/trace/events/target.h | 4 ++-- 14 files changed, 46 insertions(+), 46 deletions(-)
drivers/message/fusion/mptscsih.c +2 -2
@@ -2915,14 +2915,14 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io) timeout =10 ;break ; -case RESERVE : +case RESERVE_6 : cmdLen =6 ; dir =MPI_SCSIIO_CONTROL_READ ;CDB [0 ] = cmd; timeout =10 ;break ; -case RELEASE : +case RELEASE_6 : cmdLen =6 ; dir =MPI_SCSIIO_CONTROL_READ ;CDB [0 ] = cmd;
drivers/scsi/aacraid/aachba.c +2 -2
@@ -3221,8 +3221,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)break ; } fallthrough; -case RESERVE : -case RELEASE : +case RESERVE_6 : +case RELEASE_6 :case REZERO_UNIT :case REASSIGN_BLOCKS :case SEEK_10 :
drivers/scsi/arm/acornscsi.c +1 -1
@@ -591,7 +591,7 @@ datadir_t acornscsi_datadirection(int command)case CHANGE_DEFINITION :case COMPARE :case COPY :case COPY_VERIFY :case LOG_SELECT :case MODE_SELECT :case MODE_SELECT_10 :case SEND_DIAGNOSTIC :case WRITE_BUFFER : -case FORMAT_UNIT :case REASSIGN_BLOCKS :case RESERVE : +case FORMAT_UNIT :case REASSIGN_BLOCKS :case RESERVE_6 :case SEARCH_EQUAL :case SEARCH_HIGH :case SEARCH_LOW :case WRITE_6 :case WRITE_10 :case WRITE_VERIFY :case UPDATE_BLOCK :case WRITE_LONG :case WRITE_SAME :
drivers/scsi/ips.c +4 -4
@@ -3631,8 +3631,8 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)break ; -case RESERVE : -case RELEASE : +case RESERVE_6 : +case RELEASE_6 : scb->scsi_cmd->result =DID_OK <<16 ;break ;
@@ -3899,8 +3899,8 @@ ips_chkstatus(ips_ha_t * ha, IPS_STATUS * pstatus)case WRITE_6 :case READ_10 :case WRITE_10 : -case RESERVE : -case RELEASE : +case RESERVE_6 : +case RELEASE_6 :break ;case MODE_SENSE :
drivers/scsi/megaraid.c +5 -5
@@ -855,8 +855,8 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)return scb;#if MEGA_HAVE_CLUSTERING -case RESERVE : -case RELEASE : +case RESERVE_6 : +case RELEASE_6 :/* * Do we support clustering and is the support enabled
@@ -875,7 +875,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy) } scb->raw_mbox[0 ] =MEGA_CLUSTER_CMD ; - scb->raw_mbox[2 ] = ( *cmd->cmnd ==RESERVE ) ? + scb->raw_mbox[2 ] = *cmd->cmnd ==RESERVE_6 ?MEGA_RESERVE_LD :MEGA_RELEASE_LD ; scb->raw_mbox[3 ] = ldrv_num;
@@ -1618,8 +1618,8 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)* failed or the input parameter is invalid */ if ( status ==1 && - (cmd->cmnd[0 ] ==RESERVE || - cmd->cmnd[0 ] ==RELEASE ) ) { + (cmd->cmnd[0 ] ==RESERVE_6 || + cmd->cmnd[0 ] ==RELEASE_6 ) ) { cmd->result |= (DID_ERROR <<16 ) |SAM_STAT_RESERVATION_CONFLICT ;
drivers/scsi/megaraid/megaraid_mbox.c +5 -5
@@ -1725,8 +1725,8 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)return scb; -case RESERVE : -case RELEASE : +case RESERVE_6 : +case RELEASE_6 :/* * Do we support clustering and is the support enabled */
@@ -1748,7 +1748,7 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy) scb->dev_channel =0xFF ; scb->dev_target = target; ccb->raw_mbox[0 ] =CLUSTER_CMD ; - ccb->raw_mbox[2 ] = (scp->cmnd[0 ] ==RESERVE ) ? + ccb->raw_mbox[2 ] = scp->cmnd[0 ] ==RESERVE_6 ?RESERVE_LD :RELEASE_LD ; ccb->raw_mbox[3 ] = target;
@@ -2334,8 +2334,8 @@ megaraid_mbox_dpc(unsigned long devp)* Error code returned is 1 if Reserve or Release * failed or the input parameter is invalid */ -if (status ==1 && (scp->cmnd[0 ] ==RESERVE || - scp->cmnd[0 ] ==RELEASE )) { +if (status ==1 && (scp->cmnd[0 ] ==RESERVE_6 || + scp->cmnd[0 ] ==RELEASE_6 )) { scp->result =DID_ERROR <<16 |SAM_STAT_RESERVATION_CONFLICT ;
drivers/target/target_core_device.c +4 -4
@@ -1078,8 +1078,8 @@ passthrough_parse_cdb(struct se_cmd *cmd,if (!dev->dev_attrib.emulate_pr && ((cdb[0 ] ==PERSISTENT_RESERVE_IN ) || (cdb[0 ] ==PERSISTENT_RESERVE_OUT ) || - (cdb[0 ] ==RELEASE || cdb[0 ] ==RELEASE_10 ) || - (cdb[0 ] ==RESERVE || cdb[0 ] ==RESERVE_10 ))) { + (cdb[0 ] ==RELEASE_6 || cdb[0 ] ==RELEASE_10 ) || + (cdb[0 ] ==RESERVE_6 || cdb[0 ] ==RESERVE_10 ))) {return TCM_UNSUPPORTED_SCSI_OPCODE ; }
@@ -1101,7 +1101,7 @@ passthrough_parse_cdb(struct se_cmd *cmd,return target_cmd_size_check (cmd, size); } -if (cdb[0 ] ==RELEASE || cdb[0 ] ==RELEASE_10 ) { +if (cdb[0 ] ==RELEASE_6 || cdb[0 ] ==RELEASE_10 ) { cmd->execute_cmd = target_scsi2_reservation_release;if (cdb[0 ] ==RELEASE_10 ) size =get_unaligned_be16 (&cdb[7 ]);
@@ -1109,7 +1109,7 @@ passthrough_parse_cdb(struct se_cmd *cmd, size = cmd->data_length;return target_cmd_size_check (cmd, size); } -if (cdb[0 ] ==RESERVE || cdb[0 ] ==RESERVE_10 ) { +if (cdb[0 ] ==RESERVE_6 || cdb[0 ] ==RESERVE_10 ) { cmd->execute_cmd = target_scsi2_reservation_reserve;if (cdb[0 ] ==RESERVE_10 ) size =get_unaligned_be16 (&cdb[7 ]);
drivers/target/target_core_pr.c +3 -3
@@ -91,7 +91,7 @@ target_scsi2_reservation_check(struct se_cmd *cmd)switch (cmd->t_task_cdb[0 ]) {case INQUIRY : -case RELEASE : +case RELEASE_6 :case RELEASE_10 :return 0 ;default :
@@ -418,12 +418,12 @@ static int core_scsi3_pr_seq_non_holder(struct se_cmd *cmd, u32 pr_reg_type,return -EINVAL ; }break ; -case RELEASE : +case RELEASE_6 :case RELEASE_10 :/* Handled by CRH=1 in target_scsi2_reservation_release() */ ret =0 ;break ; -case RESERVE : +case RESERVE_6 :case RESERVE_10 :/* Handled by CRH=1 in target_scsi2_reservation_reserve() */ ret =0 ;
drivers/target/target_core_spc.c +10 -10
@@ -1674,9 +1674,9 @@ static bool tcm_is_pr_enabled(struct target_opcode_descriptor *descr,return true;switch (descr->opcode) { -case RESERVE : +case RESERVE_6 :case RESERVE_10 : -case RELEASE : +case RELEASE_6 :case RELEASE_10 :/* * The pr_ops which are used by the backend modules don't
@@ -1828,9 +1828,9 @@ static struct target_opcode_descriptor tcm_opcode_pro_register_move = {static struct target_opcode_descriptor tcm_opcode_release = { .support =SCSI_SUPPORT_FULL , - .opcode =RELEASE , + .opcode =RELEASE_6 , .cdb_size =6 , - .usage_bits = {RELEASE ,0x00 ,0x00 ,0x00 , + .usage_bits = {RELEASE_6 ,0x00 ,0x00 ,0x00 ,0x00 ,SCSI_CONTROL_MASK }, .enabled = tcm_is_pr_enabled, };
@@ -1847,9 +1847,9 @@ static struct target_opcode_descriptor tcm_opcode_release10 = {static struct target_opcode_descriptor tcm_opcode_reserve = { .support =SCSI_SUPPORT_FULL , - .opcode =RESERVE , + .opcode =RESERVE_6 , .cdb_size =6 , - .usage_bits = {RESERVE ,0x00 ,0x00 ,0x00 , + .usage_bits = {RESERVE_6 ,0x00 ,0x00 ,0x00 ,0x00 ,SCSI_CONTROL_MASK }, .enabled = tcm_is_pr_enabled, };
@@ -2267,9 +2267,9 @@ spc_parse_cdb(struct se_cmd *cmd, unsigned int *size)unsigned char *cdb = cmd->t_task_cdb;switch (cdb[0 ]) { -case RESERVE : +case RESERVE_6 :case RESERVE_10 : -case RELEASE : +case RELEASE_6 :case RELEASE_10 :if (!dev->dev_attrib.emulate_pr)return TCM_UNSUPPORTED_SCSI_OPCODE ;
@@ -2313,7 +2313,7 @@ spc_parse_cdb(struct se_cmd *cmd, unsigned int *size) *size =get_unaligned_be32 (&cdb[5 ]); cmd->execute_cmd = target_scsi3_emulate_pr_out;break ; -case RELEASE : +case RELEASE_6 :case RELEASE_10 :if (cdb[0 ] ==RELEASE_10 ) *size =get_unaligned_be16 (&cdb[7 ]);
@@ -2322,7 +2322,7 @@ spc_parse_cdb(struct se_cmd *cmd, unsigned int *size) cmd->execute_cmd = target_scsi2_reservation_release;break ; -case RESERVE : +case RESERVE_6 :case RESERVE_10 :/* * The SPC-2 RESERVE does not contain a size in the SCSI CDB.
drivers/usb/gadget/function/f_mass_storage.c +2 -2
@@ -2142,8 +2142,8 @@ static int do_scsi_command(struct fsg_common *common)* of Posix locks. */ case FORMAT_UNIT : -case RELEASE : -case RESERVE : +case RELEASE_6 : +case RESERVE_6 :case SEND_DIAGNOSTIC :default :
drivers/usb/storage/debug.c +2 -2
@@ -58,8 +58,8 @@ void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb)case INQUIRY : what ="INQUIRY" ;break ;case RECOVER_BUFFERED_DATA : what ="RECOVER_BUFFERED_DATA" ;break ;case MODE_SELECT : what ="MODE_SELECT" ;break ; -case RESERVE : what ="RESERVE" ;break ; -case RELEASE : what ="RELEASE" ;break ; +case RESERVE_6 : what ="RESERVE" ;break ; +case RELEASE_6 : what ="RELEASE" ;break ;case COPY : what ="COPY" ;break ;case ERASE : what ="ERASE" ;break ;case MODE_SENSE : what ="MODE_SENSE" ;break ;
include/scsi/scsi_proto.h +2 -2
@@ -33,8 +33,8 @@#define INQUIRY 0x12#define RECOVER_BUFFERED_DATA 0x14#define MODE_SELECT 0x15 -#define RESERVE 0x16 -#define RELEASE 0x17 +#define RESERVE_6 0x16 +#define RELEASE_6 0x17#define COPY 0x18#define ERASE 0x19#define MODE_SENSE 0x1a
include/trace/events/scsi.h +2 -2
@@ -29,8 +29,8 @@scsi_opcode_name (INQUIRY ), \scsi_opcode_name (RECOVER_BUFFERED_DATA ), \scsi_opcode_name (MODE_SELECT ), \ -scsi_opcode_name (RESERVE ), \ -scsi_opcode_name (RELEASE ), \ +scsi_opcode_name (RESERVE_6 ), \ +scsi_opcode_name (RELEASE_6 ), \scsi_opcode_name (COPY ), \scsi_opcode_name (ERASE ), \ scsi_opcode_name(MODE_SENSE), \
include/trace/events/target.h +2 -2
@@ -31,8 +31,8 @@scsi_opcode_name (INQUIRY ), \scsi_opcode_name (RECOVER_BUFFERED_DATA ), \scsi_opcode_name (MODE_SELECT ), \ -scsi_opcode_name (RESERVE ), \ -scsi_opcode_name (RELEASE ), \ +scsi_opcode_name (RESERVE_6 ), \ +scsi_opcode_name (RELEASE_6 ), \scsi_opcode_name (COPY ), \scsi_opcode_name (ERASE ), \ scsi_opcode_name(MODE_SENSE), \
Re: [PATCH RFC 01/33] scsi, usb: Rename the RESERVE and RELEASE constants
Quoted 5 lines · Bart Van Assche
The RESERVE(6) and RELEASE(6) commands are obsolete SCSI commands defined in the SCSI-2 standard. These commands have been replaced by PERSISTENT RESERVE IN and PERSISTENT RESERVE OUT. Rename RESERVE into
RESERVE_6and RELEASE intoRELEASE_6in preparation of introducing a new RELEASE macro in the new header fileinclude/linux/thread_safety.h.
The rename itself looks good:
But RELEASE is not a good name for a global macro, I'll return to that argument later.
Bart Van Assche
maintainerRFC PATCH 2/33 s390: Comment out the RELEASE constant
In reply to Bart Van AsscheBefore introducing a new macro with the name RELEASE in include/linux/ thread_safety.h, comment out the unused RELEASE constant in tape_std.h.
--- drivers/s390/char/tape_std.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/s390/char/tape_std.h +2 -0
@@ -53,7 +53,9 @@#define READ_BLOCK_ID 0x22/* 3420 REJECT,3480 OK */ #define READ_BUFFER 0x12/* 3420 REJECT,3480 OK */ #define READ_BUFF_LOG 0x24/* 3420 REJECT,3480 OK */ +#if 0 #define RELEASE 0xD4/* 3420 NOP, 3480 REJECT */ +#endif #define REQ_TRK_IN_ERROR 0x1B/* 3420 NOP, 3480 REJECT */ #define RESERVE 0xF4/* 3420 NOP, 3480 REJECT */ #define SENSE_GROUP_ID 0x34/* 3420 REJECT,3480 OK */
Bart Van Assche
maintainerRFC PATCH 3/33 locking: Introduce <linux/thread_safety.h>
In reply to Bart Van AsscheIntroduce a new kernel header with the Clang thread-safety attributes. If:
- a struct that represents a synchronization object is annotated with the CAPABILITY() attribute,
- the operations on that synchronization object are annotated with the ACQUIRE() and RELEASE() attributes,
- if variables or members that should be guarded by a synchronization object are annotated with GUARDED_BY(),
then the Clang compiler verifies the following if -Wthread-safety is enabled:
- Whether or not locking in a function implementation matches the thread-safety attributes in the function declaration. No annotation is necessary if a lock call is followed by an unlock call. For other patterns, annotation is required.
- Whether or not the requirements of the GUARDED_BY() annotations are met.
Some highlights from the Clang thread-safety attribute documentation:
- Alias analysis is not performed on thread-safety attribute arguments. Hence the expansion of some local variables in subsequent patches.
- Most thread-safety attributes affect the function interface. NO_THREAD_SAFETY_ANALYSIS only affects the function definition.
- If a private struct definition (in a .c file) includes a synchronization object, annotations of functions in .h files must not refer to the name of the private struct. A possible solution is to define a capability with DEFINE_CAPABILITY and to use the name of that capability in the thread-safety annotations.
A few notes from me:
- Thread-safety attributes are not included in function pointer types. In other words, when passing an annotated function as an argument to another function, the thread-safety attributes are discarded.
- Annotating conditional locking functions that return a pointer is not yet supported by Clang.
More information is available here:
https://clang.llvm.org/docs/ThreadSafetyAnalysis.html
In case anyone would be interested, the equivalent Qemu header file is available here:
https://github.com/qemu/qemu/blob/master/include/qemu/clang-tsa.h
--- include/linux/thread_safety.h | 141 ++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 include/linux/thread_safety.h
include/linux/thread_safety.h new file +141 -0
@@ -0,0 +1,141 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _THREAD_SAFETY_H_ +#define _THREAD_SAFETY_H_ + +/* See also https://clang.llvm.org/docs/ThreadSafetyAnalysis.html */ + +/* +* Enable thread safety attributes only for clang. The attributes can be safely +* ignored when compiling with other compilers. +*/ +#if defined(__clang__) +#define THREAD_ANNOTATION_ATTRIBUTE_ (...) __attribute__((__VA_ARGS__)) +#else +#define THREAD_ANNOTATION_ATTRIBUTE_ (...) +#endif + +/* +* Macro for applying a capability as an attribute to a type definition. +* This macro can be used in struct definitions and also in typedefs. +* @x must be a string. +*/ +#define CAPABILITY (x) THREAD_ANNOTATION_ATTRIBUTE_(capability(x)) + +/* +* Macro for defining a capability name that is not tied to an existing type. +* @capability_name is declared as an external variable. Any attempt to +* read or modify that external variable will result in a linker error. +*/ +#define DEFINE_CAPABILITY (capability_name) \ + extern const struct {} CAPABILITY(#capability_name) capability_name + +/* +* Attribute for structure members that declares that the structure members are +* protected by the given capability. +*/ +#define GUARDED_BY (x) THREAD_ANNOTATION_ATTRIBUTE_(guarded_by(x)) + +/* +* Attribute for pointer structure members that declares that the contents +* of these pointers are protected by the given capability. +*/ +#define PT_GUARDED_BY (x) THREAD_ANNOTATION_ATTRIBUTE_(pt_guarded_by(x)) + +/* +* Attribute for instances of data structures that declares that the given +* capabilities must be acquired before the annotated data structure. +*/ +#define ACQUIRED_BEFORE (...) \ + THREAD_ANNOTATION_ATTRIBUTE_(acquired_before(__VA_ARGS__)) + +/* +* Attribute for instances of data structures that declares that the given +* capabilities must be acquired after the annotated data structure. +*/ +#define ACQUIRED_AFTER (...) \ + THREAD_ANNOTATION_ATTRIBUTE_(acquired_after(__VA_ARGS__)) + +/* +* Function attribute that declares that the caller must have exclusive access +* to the given capabilities. +*/ +#define REQUIRES (...) \ + THREAD_ANNOTATION_ATTRIBUTE_(requires_capability(__VA_ARGS__)) + +/* +* Function attribute that declares that the caller must have shared access +* to the given capabilities. +*/ +#define REQUIRES_SHARED (...) \ + THREAD_ANNOTATION_ATTRIBUTE_(requires_shared_capability(__VA_ARGS__)) + +/* +* Function attribute that declares that the function acquires the given +* capability. +*/ +#define ACQUIRE (...) \ + THREAD_ANNOTATION_ATTRIBUTE_(acquire_capability(__VA_ARGS__)) + +/* +* Function attribute that declares that the function acquires the given +* shared capability. +*/ +#define ACQUIRE_SHARED (...) \ + THREAD_ANNOTATION_ATTRIBUTE_(acquire_shared_capability(__VA_ARGS__)) + +/* +* Function attribute that declares that the function releases the given +* capability. +*/ +#define RELEASE (...) \ + THREAD_ANNOTATION_ATTRIBUTE_(release_capability(__VA_ARGS__)) + +/* +* Function attribute that declares that the function releases the given +* shared capability. +*/ +#define RELEASE_SHARED (...) \ + THREAD_ANNOTATION_ATTRIBUTE_(release_shared_capability(__VA_ARGS__)) + +/* +* Function attribute that declares that a function only acquires the given +* capability (2nd argument) for a given return value (first argument). +*/ +#define TRY_ACQUIRE (...) \ + THREAD_ANNOTATION_ATTRIBUTE_(try_acquire_capability(__VA_ARGS__)) + +/* +* Function attribute that declares that a function only acquires the given +* shared capability (2nd argument) for a given return value (first argument). +*/ +#define TRY_ACQUIRE_SHARED (...) \ + THREAD_ANNOTATION_ATTRIBUTE_(try_acquire_shared_capability(__VA_ARGS__)) + +/* +* Function attribute that declares that the caller must not hold the given +* capabilities. +*/ +#define EXCLUDES (...) THREAD_ANNOTATION_ATTRIBUTE_(locks_excluded(__VA_ARGS__)) + +/* +* Tell the compiler that the given capability is held. +*/ +#define ASSERT_CAPABILITY (x) THREAD_ANNOTATION_ATTRIBUTE_(assert_capability(x)) + +/* +* Tell the compiler that the given shared capability is held. +*/ +#define ASSERT_SHARED_CAPABILITY (x) \ + THREAD_ANNOTATION_ATTRIBUTE_(assert_shared_capability(x)) + +/* +* Function attribute that declares that a function returns a pointer to a +* capability. +*/ +#define RETURN_CAPABILITY (x) THREAD_ANNOTATION_ATTRIBUTE_(lock_returned(x)) + +/* Function attribute that disables thread-safety analysis. */ +#define NO_THREAD_SAFETY_ANALYSIS \ + THREAD_ANNOTATION_ATTRIBUTE_(no_thread_safety_analysis) + +#endif /* _THREAD_SAFETY_H_ */
Christoph Hellwig
maintainerRe: [PATCH RFC 03/33] locking: Introduce <linux/thread_safety.h>
Quoted 6 lines
- a struct that represents a synchronization object is annotated with the
CAPABILITY()attribute,
- the operations on that synchronization object are annotated with theACQUIRE()andRELEASE()attributes,
- if variables or members that should be guarded by a synchronization object are annotated withGUARDED_BY(),
Those are all nasty shouting names, without and good prefixing.
But more importantly ACQUIRE() and RELEASE() seems to duplicate the existing __acquires/__releases annotations from sparse. We really need to find away to unify them instead of duplicating the annotations.
Re: [PATCH RFC 03/33] locking: Introduce <linux/thread_safety.h>
Quoted 8 lines · Christoph Hellwig
Quoted 7 lines
- a struct that represents a synchronization object is annotated with the
CAPABILITY()attribute,
- the operations on that synchronization object are annotated with theACQUIRE()andRELEASE()attributes,
- if variables or members that should be guarded by a synchronization object are annotated withGUARDED_BY(),
Quoted 5 lines
Those are all nasty shouting names, without and good prefixing.
But more importantly
ACQUIRE()andRELEASE()seems to duplicate the existing __acquires/__releases annotations from sparse. We really need to find away to unify them instead of duplicating the annotations.
This is exactly what my approach tries to do:
https://lore.kernel.org/all/[email protected]/T/#u
(Make it work with the existing keywords and extend them.)
Bart Van Assche
maintainerRe: [PATCH RFC 03/33] locking: Introduce <linux/thread_safety.h>
In reply to Christoph HellwigQuoted 7 lines · Christoph Hellwig
Quoted 6 lines
- a struct that represents a synchronization object is annotated with the
CAPABILITY()attribute,
- the operations on that synchronization object are annotated with theACQUIRE()andRELEASE()attributes,
- if variables or members that should be guarded by a synchronization object are annotated withGUARDED_BY(),
Quoted 5 lines
Those are all nasty shouting names, without and good prefixing.
But more importantly
ACQUIRE()andRELEASE()seems to duplicate the existing __acquires/__releases annotations from sparse. We really need to find away to unify them instead of duplicating the annotations.
I think that we are better off to drop support for the sparse locking annotations. Linus added the macro __cond_acquires() two years ago in the Linux kernel but support for that macro has never been implemented in sparse. In the description of commit 4a557a5d1a61 ("sparse: introduce conditional lock acquire function attribute") I found the following URL:
https://lore.kernel.org/all/CAHk-=wjZfO9hGqJ2_hGQG3U_XzSh9_XaXze=HgPdvJbgrvASfA@mail.gmail.com/
That URL points to an e-mail from Linus Torvalds with a patch for sparse that implements support for __cond_acquires(). It seems to me that the sparse patch has never been applied to the sparse code base (the git URL for sparse is available at https://sparse.docs.kernel.org/en/latest/).
So while __cond_acquires() can be translated into a Clang annotation, __cond_acquires() is not supported by sparse. There are other challenges:
* The argument of __acquire() and __release() can be a "capability" or the address of a synchronization object. A few examples where the argument represents a capability:
__acquire(RCU); __acquire(RCU_BH); __acquire(RCU_SCHED); __acquire(bitlock);
An example where the argument represents the address of a synchronization object:
static inline void do_raw_spin_lock(raw_spinlock_t *lock)
__acquires(lock)
{
__acquire(lock);
arch_spin_lock(&lock->raw_lock);
mmiowb_spin_lock();}
If __acquire() and __release() would have to be supported for both sparse and Clang, that would probably involve modifying all instances of these two macros across the entire kernel tree and making it explicit whether the argument is a capability or the address of a synchronization object.
* Clang verifies the thread-safety attribute arguments at compile time while sparse does not. An example from the scheduler:
extern
struct rq *__task_rq_lock(struct task_struct *p, struct rq_flags *rf)
__acquires(rq->lock);
An example from the workqueue implementation:
static void maybe_create_worker(struct worker_pool *pool) __releases(&pool->lock)__acquires(&pool->lock)
{
[ ... ]
}
If __acquires() and __releases() are converted into Clang function attributes then compilation fails because Clang verifies the expressions passed to function attributes before the function body is compiled.
The team that is maintaining sparse is small (a single person?) and the rate of change of sparse is low (the latest commit was published more than a year ago). If we support both sparse locking annotations and the Clang thread-safety annotations then we will end up fixing bugs in both compilers. I propose to focus the maintenance effort on the project with the highest velocity (Clang) and to drop support for the sparse locking annotations.
Thanks,
Bart.
Re: [PATCH RFC 03/33] locking: Introduce <linux/thread_safety.h>
On Fri, 7 Feb 2025 at 23:34, Bart Van Assche <[email protected]> wrote:
[...]
Quoted 8 lines
Quoted 5 lines
Those are all nasty shouting names, without and good prefixing.
But more importantly
ACQUIRE()andRELEASE()seems to duplicate the existing __acquires/__releases annotations from sparse. We really need to find away to unify them instead of duplicating the annotations.I think that we are better off to drop support for the sparse locking annotations. Linus added the macro
__cond_acquires()two years ago in
+1 to dropping Sparse support -- although we can retain the same keywords.
[...]
Quoted 3 lines
* The argument of
__acquire()and__release()can be a "capability" or the address of a synchronization object. A few examples where the argument represents a capability:
Not a problem, and can be solved by introducing "token" instances...
Quoted 3 lines
__acquire(RCU); __acquire(RCU_BH); __acquire(RCU_SCHED);
For RCU: https://lore.kernel.org/lkml/[email protected]/
Quoted 1 line
__acquire(bitlock);
For bitlock: https://lore.kernel.org/lkml/[email protected]/
Quoted 11 lines
An example where the argument represents the address of a synchronization object:
static inline void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock) { __acquire(lock); arch_spin_lock(&lock->raw_lock); mmiowb_spin_lock(); }
Quoted 5 lines
If
__acquire()and__release()would have to be supported for both sparse and Clang, that would probably involve modifying all instances of these two macros across the entire kernel tree and making it explicit whether the argument is a capability or the address of a synchronization object.
This is not a problem as I have demonstrated with my approach. Using token instances is also the way we'd be able to support things like preempt-disable-enable, irq-disable-enable, etc.
In general I'm in favor of dropping Sparse support, but the majority of existing annotations can be reused, simplifying our work.
Bart Van Assche
maintainerRe: [PATCH RFC 03/33] locking: Introduce <linux/thread_safety.h>
Quoted 1 line · Marco Elver
This is not a problem as I have demonstrated with my approach.
That's not what my email is about. My email is about whether or not to continue supporting the sparse locking context annotations.
Bart.
Bart Van Assche
maintainerRFC PATCH 4/33 include/linux/cleanup.h: Support thread-safety analysis
In reply to Bart Van AsscheIntroduce variants of the DEFINE_CLASS(), DEFINE_GUARD() and DEFINE_GUARD_COND() macros that support passing function attributes for the constructor functions.
Suppress thread-safety analysis for free functions because some free functions change the state of synchronization objects. An example from net/core/dev.h:
DEFINE_FREE(netdev_unlock, struct net_device *, if (_T) netdev_unlock(_T));
--- include/linux/cleanup.h | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-)
include/linux/cleanup.h +26 -8
@@ -3,6 +3,7 @@#define _LINUX_CLEANUP_H#include <linux/compiler.h> +#include <linux/thread_safety.h> /** * DOC: scope-based cleanup helpers
@@ -195,7 +196,8 @@*/ #define DEFINE_FREE (_name, _type, _free) \ - static inline void __free_##_name(void *p) { _type _T = *(_type *)p; _free; } + static inline void __free_##_name(void *p) NO_THREAD_SAFETY_ANALYSIS \ + { _type _T = *(_type *)p; _free; }#define __free (_name) __cleanup(__free_##_name)
@@ -241,17 +243,25 @@ const volatile void * __must_check_fn(const volatile void *val)*/ #define DEFINE_CLASS(_name, _type, _exit, _init, _init_args...) \ + DEFINE_CLASS_ATTR(_name, _type, _exit, \ + _init, NO_THREAD_SAFETY_ANALYSIS, _init_args) + +#define DEFINE_CLASS_ATTR (_name, _type, _exit, _init, _init_attr, \ + _init_args...) \ typedef _type class_##_name##_t; \ static inline void class_##_name##_destructor(_type *p) \ + NO_THREAD_SAFETY_ANALYSIS \ { _type _T = *p; _exit; } \ -static inline _type class_##_name##_constructor(_init_args) \ +static inline _type class_##_name##_constructor(_init_args) _init_attr \ { _type t = _init; return t; } -#define EXTEND_CLASS(_name, ext, _init, _init_args...) \ +#define EXTEND_CLASS(_name, ext, _init, _init_attr, _init_args...) \ typedef class_##_name##_t class_##_name##ext##_t; \ static inline void class_##_name##ext##_destructor(class_##_name##_t *p)\ + NO_THREAD_SAFETY_ANALYSIS \ { class_##_name##_destructor(p); } \ static inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \ + _init_attr \ { class_##_name##_t t = _init; return t; }#define CLASS (_name, var) \
@@ -291,17 +301,25 @@ static inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \#define __DEFINE_CLASS_IS_CONDITIONAL (_name, _is_cond) \ static __maybe_unused const bool class_##_name##_is_conditional = _is_cond -#define DEFINE_GUARD (_name, _type, _lock, _unlock) \ - __DEFINE_CLASS_IS_CONDITIONAL(_name, false); \ - DEFINE_CLASS(_name, _type, if (_T) { _unlock; }, ({ _lock; _T; }), _type _T); \ +#define DEFINE_GUARD (_name, _type, _lock, _unlock) \ + DEFINE_GUARD_ATTR(_name, _type, _lock, NO_THREAD_SAFETY_ANALYSIS,\ + _unlock) + +#define DEFINE_GUARD_ATTR (_name, _type, _lock, _lock_attr, _unlock) \ + __DEFINE_CLASS_IS_CONDITIONAL(_name, false); \ + DEFINE_CLASS_ATTR(_name, _type, if (_T) { _unlock; }, \ + ({ _lock; _T; }), _lock_attr, _type _T); \ static inline void * class_##_name##_lock_ptr(class_##_name##_t *_T) \ { return (void *)(__force unsigned long)*_T; }#define DEFINE_GUARD_COND (_name, _ext, _condlock) \ + DEFINE_GUARD_COND_ATTR(_name, _ext, _condlock, ) + +#define DEFINE_GUARD_COND_ATTR (_name, _ext, _condlock, _condlock_attr) \ __DEFINE_CLASS_IS_CONDITIONAL(_name##_ext, true); \ EXTEND_CLASS(_name, _ext, \ ({ void *_t = _T; if (_T && !(_condlock)) _t = NULL; _t; }), \ - class_##_name##_t _T) \ + _condlock_attr, class_##_name##_t _T) \ static inline void * class_##_name##_ext##_lock_ptr(class_##_name##_t *_T) \ { return class_##_name##_lock_ptr(_T); }
@@ -413,7 +431,7 @@ __DEFINE_LOCK_GUARD_0(_name, _lock)EXTEND_CLASS (_name, _ext, \ ({ class_##_name##_t _t = { .lock = l }, *_T = &_t;\if (_T->lock && !(_condlock)) _T->lock =NULL ; \ - _t; }), \ + _t; }), , \ typeof_member(class_##_name##_t, lock) l) \ static inline void * class_##_name##_ext##_lock_ptr(class_##_name##_t *_T) \ { return class_##_name##_lock_ptr(_T); }
Bart Van Assche
maintainerRFC PATCH 5/33 locking/mutex: Change the atomic_dec_and_mutex_lock() return type
In reply to Bart Van AsscheChange the return type of atomic_dec_and_mutex_lock() from int into bool. This will make it easier to add a thread-safety annotation to this function. This patch does not change the behavior of any kernel code because all atomic_dec_and_mutex_lock() callers either check whether the return value of this function is zero or that it differs from zero.
This patch makes the atomic_dec_and_mutex_lock() signature consistent with that of refcount_dec_and_mutex_lock().
--- Documentation/locking/mutex-design.rst | 2 +- include/linux/mutex.h | 2 +- kernel/locking/mutex.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-)
Documentation/locking/mutex-design.rst +1 -1
@@ -144,7 +144,7 @@ Acquire the mutex, interruptible:: Acquire the mutex, interruptible, if dec to 0:: - int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); + bool atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); Unlock the mutex::
include/linux/mutex.h +1 -1
@@ -196,7 +196,7 @@ extern void mutex_lock_io(struct mutex *lock);extern int mutex_trylock (struct mutex *lock);extern void mutex_unlock (struct mutex *lock); -extern int atomic_dec_and_mutex_lock (atomic_t *cnt,struct mutex *lock); +bool atomic_dec_and_mutex_lock (atomic_t *cnt,struct mutex *lock); DEFINE_GUARD(mutex, struct mutex *, mutex_lock(_T), mutex_unlock(_T))DEFINE_GUARD_COND (mutex, _try,mutex_trylock (_T))
kernel/locking/mutex.c +4 -4
@@ -1118,19 +1118,19 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(contention_end);* * return true and hold lock if we dec to 0, return false otherwise */ -int atomic_dec_and_mutex_lock (atomic_t *cnt,struct mutex *lock) +bool atomic_dec_and_mutex_lock (atomic_t *cnt,struct mutex *lock) {/* dec if we can't possibly hit 0 */ if (atomic_add_unless (cnt,-1 ,1 )) -return 0 ; +return false;/* we might hit 0, so take the lock */ mutex_lock (lock);if (!atomic_dec_and_test (cnt)) {/* when we actually did the dec, we didn't hit 0 */ mutex_unlock (lock); -return 0 ; +return false; }/* we hit 0, and we hold the lock */ -return 1 ; +return true; }EXPORT_SYMBOL (atomic_dec_and_mutex_lock);
Re: [PATCH RFC 05/33] locking/mutex: Change the atomic_dec_and_mutex_lock() return type
Looks good:
Bart Van Assche
maintainerRFC PATCH 6/33 locking/mutex: Annotate struct mutex and mutex functions
In reply to Bart Van AsscheInform the Clang thread-safety analyzer about mutex operations and also about the meaning of the return value of the functions that operate on mutexes.
--- include/linux/mutex.h | 46 +++++++++++++++++++++++-------------- include/linux/mutex_types.h | 5 ++-- kernel/locking/mutex.c | 12 ++++++++++ 3 files changed, 44 insertions(+), 19 deletions(-)
include/linux/mutex.h +29 -17
@@ -21,6 +21,7 @@#include <linux/debug_locks.h> #include <linux/cleanup.h> #include <linux/mutex_types.h> +#include <linux/thread_safety.h> struct device ;
@@ -154,14 +155,18 @@ static inline int __devm_mutex_init(struct device *dev, struct mutex *lock)* Also see Documentation/locking/mutex-design.rst. */ #ifdef CONFIG_DEBUG_LOCK_ALLOC -extern void mutex_lock_nested (struct mutex *lock,unsigned int subclass); -extern void _mutex_lock_nest_lock (struct mutex *lock,struct lockdep_map *nest_lock); +void mutex_lock_nested(struct mutex *lock, unsigned int subclass) ACQUIRE(*lock); +void _mutex_lock_nest_lock(struct mutex *lock, struct lockdep_map *nest_lock) + ACQUIRE(*lock); extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock, -unsigned int subclass); + unsigned int subclass) + TRY_ACQUIRE(0, *lock); extern int __must_check mutex_lock_killable_nested(struct mutex *lock, -unsigned int subclass); -extern void mutex_lock_io_nested (struct mutex *lock,unsigned int subclass); + unsigned int subclass) + TRY_ACQUIRE(0, *lock); +extern void mutex_lock_io_nested(struct mutex *lock, unsigned int subclass) + ACQUIRE(*lock);#define mutex_lock (lock) mutex_lock_nested(lock, 0)#define mutex_lock_interruptible (lock) mutex_lock_interruptible_nested(lock, 0)
@@ -175,10 +180,11 @@ do { \ } while (0)#else -extern void mutex_lock (struct mutex *lock); -extern int __must_check mutex_lock_interruptible (struct mutex *lock); -extern int __must_check mutex_lock_killable (struct mutex *lock); -extern void mutex_lock_io (struct mutex *lock); +void mutex_lock(struct mutex *lock) ACQUIRE(*lock); +int __must_check mutex_lock_interruptible(struct mutex *lock) + TRY_ACQUIRE(0, *lock); +int __must_check mutex_lock_killable(struct mutex *lock) TRY_ACQUIRE(0, *lock); +void mutex_lock_io(struct mutex *lock) ACQUIRE(*lock);# define mutex_lock_nested (lock, subclass) mutex_lock(lock)# define mutex_lock_interruptible_nested (lock, subclass) mutex_lock_interruptible(lock)
@@ -193,13 +199,19 @@ extern void mutex_lock_io(struct mutex *lock);* * Returns 1 if the mutex has been acquired successfully, and 0 on contention. */ -extern int mutex_trylock (struct mutex *lock); -extern void mutex_unlock (struct mutex *lock); - -bool atomic_dec_and_mutex_lock (atomic_t *cnt,struct mutex *lock); - -DEFINE_GUARD(mutex, struct mutex *, mutex_lock(_T), mutex_unlock(_T)) -DEFINE_GUARD_COND(mutex, _try, mutex_trylock(_T)) -DEFINE_GUARD_COND(mutex, _intr, mutex_lock_interruptible(_T) == 0) +int mutex_trylock(struct mutex *lock) TRY_ACQUIRE(1, *lock); +void mutex_unlock(struct mutex *lock) RELEASE(*lock); + +bool atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock) + TRY_ACQUIRE(true, *lock); + +DEFINE_GUARD_ATTR(mutex, struct mutex *, + mutex_lock(_T), + ASSERT_CAPABILITY(*_T) NO_THREAD_SAFETY_ANALYSIS, + mutex_unlock(_T)) +DEFINE_GUARD_COND_ATTR(mutex, _try, mutex_trylock(_T), + ASSERT_CAPABILITY(*_T) NO_THREAD_SAFETY_ANALYSIS) +DEFINE_GUARD_COND_ATTR(mutex, _intr, mutex_lock_interruptible(_T) == 0, + ASSERT_CAPABILITY(*_T) NO_THREAD_SAFETY_ANALYSIS)#endif /* __LINUX_MUTEX_H */
include/linux/mutex_types.h +3 -2
@@ -6,6 +6,7 @@#include <linux/lockdep_types.h> #include <linux/osq_lock.h> #include <linux/spinlock_types.h> +#include <linux/thread_safety.h> #include <linux/types.h> #ifndef CONFIG_PREEMPT_RT
@@ -38,7 +39,7 @@* - detects multi-task circular deadlocks and prints out all affected * locks and tasks (and only those tasks) */ -struct mutex { +struct CAPABILITY("mutex") mutex {atomic_long_t owner;raw_spinlock_t wait_lock;#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
@@ -59,7 +60,7 @@ struct mutex {*/ #include <linux/rtmutex.h> -struct mutex { +struct CAPABILITY("mutex") mutex {struct rt_mutex_base rtmutex;#ifdef CONFIG_DEBUG_LOCK_ALLOC struct lockdep_map dep_map;
kernel/locking/mutex.c +12 -0
@@ -254,6 +254,7 @@ static void __sched __mutex_lock_slowpath(struct mutex *lock);* This function is similar to (but not equivalent to) down(). */ void __sched mutex_lock(struct mutex *lock) +NO_THREAD_SAFETY_ANALYSIS {might_sleep ();
@@ -515,6 +516,7 @@ static noinline void __sched __mutex_unlock_slowpath(struct mutex *lock, unsigne* This function is similar to (but not equivalent to) up(). */ void __sched mutex_unlock(struct mutex *lock) +NO_THREAD_SAFETY_ANALYSIS {#ifndef CONFIG_DEBUG_LOCK_ALLOC if (__mutex_unlock_fast (lock))
@@ -536,6 +538,7 @@ EXPORT_SYMBOL(mutex_unlock);* of a unlocked mutex is not allowed. */ void __sched ww_mutex_unlock(struct ww_mutex *lock) +NO_THREAD_SAFETY_ANALYSIS {__ww_mutex_unlock (lock);mutex_unlock (&lock->base);
@@ -751,6 +754,7 @@ __ww_mutex_lock(struct mutex *lock, unsigned int state, unsigned int subclass,* A mutex acquired with this function must be released with ww_mutex_unlock. */ int ww_mutex_trylock (struct ww_mutex *ww,struct ww_acquire_ctx *ww_ctx) +NO_THREAD_SAFETY_ANALYSIS {if (!ww_ctx)return mutex_trylock (&ww->base);
@@ -778,6 +782,7 @@ EXPORT_SYMBOL(ww_mutex_trylock);#ifdef CONFIG_DEBUG_LOCK_ALLOC void __schedmutex_lock_nested (struct mutex *lock,unsigned int subclass) +NO_THREAD_SAFETY_ANALYSIS {__mutex_lock (lock,TASK_UNINTERRUPTIBLE , subclass,NULL , _RET_IP_); }
@@ -786,6 +791,7 @@ EXPORT_SYMBOL_GPL(mutex_lock_nested); void __sched_mutex_lock_nest_lock (struct mutex *lock,struct lockdep_map *nest) +NO_THREAD_SAFETY_ANALYSIS {__mutex_lock (lock,TASK_UNINTERRUPTIBLE ,0 , nest, _RET_IP_); }
@@ -807,6 +813,7 @@ EXPORT_SYMBOL_GPL(mutex_lock_interruptible_nested); void __schedmutex_lock_io_nested (struct mutex *lock,unsigned int subclass) +NO_THREAD_SAFETY_ANALYSIS {int token;
@@ -957,6 +964,7 @@ __mutex_lock_interruptible_slowpath(struct mutex *lock);* signal arrived. */ int __sched mutex_lock_interruptible(struct mutex *lock) +NO_THREAD_SAFETY_ANALYSIS {might_sleep ();
@@ -981,6 +989,7 @@ EXPORT_SYMBOL(mutex_lock_interruptible);* fatal signal arrived. */ int __sched mutex_lock_killable(struct mutex *lock) +NO_THREAD_SAFETY_ANALYSIS {might_sleep ();
@@ -1061,6 +1070,7 @@ __ww_mutex_lock_interruptible_slowpath(struct ww_mutex *lock,* mutex must be released by the same task that acquired it. */ int __sched mutex_trylock(struct mutex *lock) +NO_THREAD_SAFETY_ANALYSIS {bool locked;
@@ -1077,6 +1087,7 @@ EXPORT_SYMBOL(mutex_trylock);#ifndef CONFIG_DEBUG_LOCK_ALLOC int __schedww_mutex_lock (struct ww_mutex *lock,struct ww_acquire_ctx *ctx) +NO_THREAD_SAFETY_ANALYSIS {might_sleep ();
@@ -1092,6 +1103,7 @@ EXPORT_SYMBOL(ww_mutex_lock); int __schedww_mutex_lock_interruptible (struct ww_mutex *lock,struct ww_acquire_ctx *ctx) +NO_THREAD_SAFETY_ANALYSIS {might_sleep ();
Bart Van Assche
maintainerRFC PATCH 7/33 driver core: Annotate locking functions in <linux/device.h>
In reply to Bart Van AsscheAnnotate the locking functions in <linux/device.h> with thread-safety attributes.
--- include/linux/device.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
include/linux/device.h +10 -3
@@ -31,6 +31,7 @@#include <linux/device/class.h> #include <linux/device/driver.h> #include <linux/cleanup.h> +#include <linux/thread_safety.h> #include <asm/device.h> struct device ;
@@ -1026,21 +1027,25 @@ static inline bool dev_pm_test_driver_flags(struct device *dev, u32 flags) }static inline void device_lock (struct device *dev) + ACQUIRE(dev->mutex) {mutex_lock (&dev->mutex); }static inline int device_lock_interruptible (struct device *dev) + TRY_ACQUIRE(0, dev->mutex) {return mutex_lock_interruptible (&dev->mutex); }static inline int device_trylock (struct device *dev) + TRY_ACQUIRE(1, dev->mutex) {return mutex_trylock (&dev->mutex); }static inline void device_unlock (struct device *dev) + RELEASE(dev->mutex) {mutex_unlock (&dev->mutex); }
@@ -1182,9 +1187,11 @@ do { \ _THIS_IP_); \ }while (0 ) -void lock_device_hotplug(void); -void unlock_device_hotplug (void ); -int lock_device_hotplug_sysfs (void ); +DEFINE_CAPABILITY (device_hotplug_capability); + +void lock_device_hotplug(void) ACQUIRE(device_hotplug_capability); +void unlock_device_hotplug(void) RELEASE(device_hotplug_capability); +int lock_device_hotplug_sysfs(void) TRY_ACQUIRE(0, device_hotplug_capability);int device_offline (struct device *dev);int device_online (struct device *dev);
Bart Van Assche
maintainerRFC PATCH 8/33 kref: Add thread-safety annotations in <linux/kref.h>
In reply to Bart Van AsscheInform the Clang thread-safety analyzer that kref_put_mutex() callers must not hold *mutex.
Note: annotating that the 'release' function pointer releases 'mutex' is not possible because the mutex pointer is not an argument of the 'release' function.
--- include/linux/kref.h | 3 +++ 1 file changed, 3 insertions(+)
include/linux/kref.h +3 -0
@@ -15,6 +15,7 @@#include <linux/spinlock.h> #include <linux/refcount.h> +#include <linux/thread_safety.h> struct kref {refcount_t refcount;
@@ -81,6 +82,8 @@ static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)static inline int kref_put_mutex (struct kref *kref,void (*release)(struct kref *kref),struct mutex *mutex) + EXCLUDES(*mutex) +NO_THREAD_SAFETY_ANALYSIS {if (refcount_dec_and_mutex_lock (&kref->refcount, mutex)) {release (kref);
Bart Van Assche
maintainerRFC PATCH 9/33 refcount: Add thread-safety annotations in <linux/refcount.h>
In reply to Bart Van AsscheInform the Clang thread-safety analyzer that refcount_dec_and_mutex_lock() may lock a mutex.
--- include/linux/refcount.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/refcount.h +4 -1
@@ -98,6 +98,7 @@#include <linux/limits.h> #include <linux/refcount_types.h> #include <linux/spinlock_types.h> +#include <linux/thread_safety.h> struct mutex ;
@@ -353,7 +354,9 @@ static inline void refcount_dec(refcount_t *r)extern __must_check bool refcount_dec_if_one (refcount_t *r);extern __must_check bool refcount_dec_not_one (refcount_t *r); -extern __must_check bool refcount_dec_and_mutex_lock(refcount_t *r, struct mutex *lock) __cond_acquires(lock); +__must_check bool refcount_dec_and_mutex_lock(refcount_t *r, struct mutex *lock) + __cond_acquires(lock) + TRY_ACQUIRE(true, *lock); extern __must_check bool refcount_dec_and_lock(refcount_t *r, spinlock_t *lock) __cond_acquires(lock); extern __must_check bool refcount_dec_and_lock_irqsave(refcount_t *r, spinlock_t *lock,
Bart Van Assche
maintainerRFC PATCH 10/33 treewide: Modify mutex_lock_interruptible() return value checks
In reply to Bart Van AsscheChange all checks of the mutex_lock_interruptible() return value and also all the checks of callers of this function into != 0 or == 0.
This patch prepares for annotating mutex_lock_interruptible() and its callers with the thread-safety attribute TRY_ACQUIRE(0, mutex_ptr). This tells Clang that the return value 0 and only this return value indicates that the mutex has been locked. This change is necessary because checks like < 0 on the mutex_lock_interruptible() return value confuse the Clang thread-safety checker.
This patch has been generated by applying the following Coccinelle semantic patch on the kernel tree:
@@
expression mutex, expr;
statement stmnt;
@@
(
-if (device_lock_interruptible(mutex) < 0) stmnt +if (device_lock_interruptible(mutex)) stmnt |
-if (mutex_lock_interruptible(mutex) < 0) stmnt +if (mutex_lock_interruptible(mutex)) stmnt
|
-if (mutex_lock_killable(mutex) < 0) stmnt +if (mutex_lock_killable(mutex)) stmnt
|
-if (mutex_lock_killable_nested(mutex) < 0) stmnt +if (mutex_lock_killable_nested(mutex)) stmnt |
-if (usb_lock_device_for_reset(mutex, expr) < 0) stmnt +if (usb_lock_device_for_reset(mutex, expr)) stmnt )
@@
expression mutex, expr, expr1, expr2, expr3, tty; statement stmnt, stmnt1, stmnt2;
identifier ret;
@@
(
-ret = device_lock_interruptible(mutex);
-if (ret < 0) stmnt
+ret = device_lock_interruptible(mutex);
+if (ret) stmnt
|
-if ((ret = get_ready_ep(expr1, expr2, expr3)) < 0) stmnt +ret = get_ready_ep(expr1, expr2, expr3);
+if (ret) stmnt
|
-ret = mlxbf2_gpio_lock_acquire(mutex);
-if (ret < 0) stmnt
+ret = mlxbf2_gpio_lock_acquire(mutex);
+if (ret) stmnt
|
-int ret = mutex_lock_interruptible(mutex);
-if (ret < 0) stmnt
+int ret = mutex_lock_interruptible(mutex);
+if (ret) stmnt
|
-ret = mutex_lock_interruptible(mutex);
-if (ret < 0) stmnt
+ret = mutex_lock_interruptible(mutex);
+if (ret) stmnt
|
-if ((ret = mutex_lock_interruptible(mutex))) -return ret;
+ret = mutex_lock_interruptible(&d->usb_mutex); +if (ret) return ret;
|
-if (mutex_lock_interruptible(mutex) == -EINTR) stmnt +if (mutex_lock_interruptible(mutex)) stmnt
|
-ret = mutex_lock_killable(mutex);
-if (ret < 0) stmnt
+ret = mutex_lock_killable(mutex);
+if (ret) stmnt
|
-ret = mutex_lock_killable_nested(mutex);
-if (ret < 0) stmnt
+ret = mutex_lock_killable_nested(mutex);
+if (ret) stmnt
|
-ret = tty_write_lock(tty, expr);
-if (ret < 0) stmnt
+ret = tty_write_lock(tty, expr);
+if (ret) stmnt
|
-if (tty_write_lock(tty, expr) < 0) stmnt
+if (tty_write_lock(tty, expr)) stmnt
|
-if (tty_write_lock(tty, expr) < 0) stmnt;
-if (ret < 0) stmnt
+ret = tty_write_lock(tty, expr);
+if (ret) stmnt
|
-ret = usb_lock_device_for_reset(expr1, expr2); -if (ret < 0) stmnt
+ret = usb_lock_device_for_reset(expr1, expr2); +if (ret) stmnt
|
-ret = usb_lock_device_for_reset(expr1, expr2); -if (ret < 0) stmnt1 else stmnt2
+ret = usb_lock_device_for_reset(expr1, expr2); +if (ret) stmnt1 else stmnt2
|
-ret = usb_lock_device_for_reset(expr1, expr2); -if (ret >= 0) stmnt
+ret = usb_lock_device_for_reset(expr1, expr2); +if (ret == 0) stmnt
|
-ret = usb_lock_device_interruptible(expr);
-if (ret < 0) stmnt
+ret = usb_lock_device_interruptible(expr);
+if (ret) stmnt
|
-ret = usblp_rwait_and_lock(mutex, expr);
-if (ret < 0) stmnt
+ret = usblp_rwait_and_lock(mutex, expr);
+if (ret) stmnt
)
--- drivers/gpio/gpio-mlxbf2.c | 4 +- drivers/hwmon/asus_rog_ryujin.c | 4 +- drivers/hwmon/gigabyte_waterforce.c | 2 +- drivers/hwmon/nzxt-kraken3.c | 2 +- drivers/infiniband/ulp/srp/ib_srp.c | 2 +- drivers/infiniband/ulp/srpt/ib_srpt.c | 4 +- drivers/leds/leds-blinkm.c | 2 +- drivers/media/dvb-frontends/bcm3510.c | 2 +- drivers/media/dvb-frontends/dib0070.c | 4 +- drivers/media/dvb-frontends/dib0090.c | 8 ++-- drivers/media/dvb-frontends/dib7000m.c | 4 +- drivers/media/dvb-frontends/dib7000p.c | 4 +- drivers/media/dvb-frontends/dib8000.c | 10 ++--- drivers/media/dvb-frontends/dib9000.c | 42 +++++++++---------- drivers/media/dvb-frontends/dibx000_common.c | 10 ++--- drivers/media/usb/dvb-usb-v2/af9035.c | 2 +- drivers/media/usb/dvb-usb-v2/anysee.c | 2 +- drivers/media/usb/dvb-usb-v2/au6610.c | 2 +- drivers/media/usb/dvb-usb-v2/az6007.c | 6 +-- drivers/media/usb/dvb-usb-v2/ce6230.c | 2 +- drivers/media/usb/dvb-usb-v2/dvbsky.c | 2 +- drivers/media/usb/dvb-usb-v2/ec168.c | 2 +- drivers/media/usb/dvb-usb-v2/lmedm04.c | 2 +- drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.c | 2 +- drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 2 +- drivers/media/usb/dvb-usb/af9005.c | 2 +- drivers/media/usb/dvb-usb/az6027.c | 2 +- drivers/media/usb/dvb-usb/cxusb.c | 2 +- drivers/media/usb/dvb-usb/dib0700_core.c | 20 ++++----- drivers/media/usb/dvb-usb/dibusb-common.c | 2 +- drivers/media/usb/dvb-usb/digitv.c | 2 +- drivers/media/usb/dvb-usb/dtv5100.c | 2 +- drivers/media/usb/dvb-usb/dvb-usb-urb.c | 3 +- drivers/media/usb/dvb-usb/dw2102.c | 16 +++---- drivers/media/usb/dvb-usb/gp8psk.c | 6 ++- drivers/media/usb/dvb-usb/m920x.c | 2 +- drivers/media/usb/dvb-usb/opera1.c | 4 +- drivers/media/usb/dvb-usb/pctv452e.c | 4 +- drivers/media/usb/dvb-usb/technisat-usb2.c | 10 ++--- drivers/media/usb/dvb-usb/ttusb2.c | 2 +- drivers/media/usb/dvb-usb/vp702x.c | 5 ++- .../media/usb/ttusb-budget/dvb-ttusb-budget.c | 4 +- drivers/media/usb/uvc/uvc_ctrl.c | 6 +-- drivers/net/ethernet/mellanox/mlxsw/i2c.c | 4 +- drivers/net/usb/cdc_subset.c | 2 +- drivers/net/wireless/intersil/p54/p54usb.c | 2 +- drivers/net/wireless/ti/wlcore/sysfs.c | 2 +- drivers/platform/x86/thinkpad_acpi.c | 12 +++--- drivers/scsi/hpsa.c | 2 +- .../gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 4 +- drivers/tty/tty_io.c | 6 +-- drivers/usb/class/cdc-wdm.c | 3 +- drivers/usb/class/usblp.c | 2 +- drivers/usb/core/message.c | 2 +- drivers/usb/core/sysfs.c | 24 +++++------ drivers/usb/gadget/legacy/inode.c | 13 +++--- drivers/usb/misc/yurex.c | 2 +- drivers/usb/storage/transport.c | 2 +- drivers/usb/usb-skeleton.c | 2 +- drivers/usb/usbip/stub_dev.c | 2 +- drivers/usb/usbip/stub_rx.c | 2 +- drivers/w1/masters/omap_hdq.c | 8 ++-- fs/afs/validation.c | 2 +- fs/afs/vl_alias.c | 6 +-- fs/fsopen.c | 2 +- fs/namespace.c | 2 +- fs/orangefs/devorangefs-req.c | 2 +- fs/proc/base.c | 2 +- kernel/seccomp.c | 10 ++--- mm/kmemleak.c | 4 +- net/rxrpc/recvmsg.c | 2 +- net/rxrpc/sendmsg.c | 2 +- security/integrity/ima/ima_fs.c | 2 +- sound/pci/oxygen/oxygen_lib.c | 2 +- 74 files changed, 181 insertions(+), 175 deletions(-)
drivers/gpio/gpio-mlxbf2.c +2 -2
@@ -191,7 +191,7 @@ static int mlxbf2_gpio_direction_input(struct gpio_chip *chip,* if it is still enabled to be able to write to the ModeX registers. */ ret =mlxbf2_gpio_lock_acquire (gs); -if (ret <0 ) +if (ret)return ret;writel (BIT (offset), gs->gpio_io +YU_GPIO_MODE0_CLEAR );
@@ -219,7 +219,7 @@ static int mlxbf2_gpio_direction_output(struct gpio_chip *chip,* ModeX registers. */ ret =mlxbf2_gpio_lock_acquire (gs); -if (ret <0 ) +if (ret)return ret;writel (BIT (offset), gs->gpio_io +YU_GPIO_MODE1_CLEAR );
drivers/hwmon/asus_rog_ryujin.c +2 -2
@@ -198,7 +198,7 @@ static int rog_ryujin_get_status(struct rog_ryujin_data *priv) {int ret =mutex_lock_interruptible (&priv->status_report_request_mutex); -if (ret <0 ) +if (ret)return ret;if (!time_after (jiffies, priv->updated +msecs_to_jiffies (STATUS_VALIDITY ))) {
@@ -304,7 +304,7 @@ static int rog_ryujin_write_fixed_duty(struct rog_ryujin_data *priv, int channel* together, then write back with one of them modified. */ ret =mutex_lock_interruptible (&priv->status_report_request_mutex); -if (ret <0 ) +if (ret)return ret; ret = rog_ryujin_execute_cmd(priv, get_cooler_duty_cmd, GET_CMD_LENGTH,
drivers/hwmon/gigabyte_waterforce.c +1 -1
@@ -125,7 +125,7 @@ static int waterforce_get_status(struct waterforce_data *priv) {int ret =mutex_lock_interruptible (&priv->status_report_request_mutex); -if (ret <0 ) +if (ret)return ret;if (!time_after (jiffies, priv->updated +msecs_to_jiffies (STATUS_VALIDITY ))) {
drivers/hwmon/nzxt-kraken3.c +1 -1
@@ -251,7 +251,7 @@ static int kraken3_read_z53(struct kraken3_data *priv) {int ret =mutex_lock_interruptible (&priv->z53_status_request_lock); -if (ret <0 ) +if (ret)return ret;if (!time_after (jiffies, priv->updated +msecs_to_jiffies (STATUS_VALIDITY ))) {
drivers/infiniband/ulp/srp/ib_srp.c +1 -1
@@ -3731,7 +3731,7 @@ static ssize_t add_target_store(struct device *dev,scsi_host_get (target->scsi_host); ret =mutex_lock_interruptible (&host->add_target_mutex); -if (ret <0 ) +if (ret) goto put; ret =srp_parse_options (target->net, buf, target);
drivers/infiniband/ulp/srpt/ib_srpt.c +2 -2
@@ -3647,10 +3647,10 @@ static ssize_t srpt_tpg_attrib_use_srq_store(struct config_item *item,return -EINVAL ; ret =mutex_lock_interruptible (&sdev->sdev_mutex); -if (ret <0 ) +if (ret)return ret; ret =mutex_lock_interruptible (&sport->mutex); -if (ret <0 ) +if (ret) goto unlock_sdev; enabled = sport->enabled;/* Log out all initiator systems before changing 'use_srq'. */
drivers/leds/leds-blinkm.c +1 -1
@@ -357,7 +357,7 @@ static int blinkm_transfer_hw(struct i2c_client *client, int cmd)/* We start hardware transfers which are not to be * mixed with other commands. Aquire a lock now. */ -if (mutex_lock_interruptible (&data->update_lock) <0 ) +if (mutex_lock_interruptible (&data->update_lock))return -EAGAIN ;/* switch cmd - usually write before reads */
drivers/media/dvb-frontends/bcm3510.c +1 -1
@@ -225,7 +225,7 @@ static int bcm3510_do_hab_cmd(struct bcm3510_state *st, u8 cmd, u8 msgid, u8 *obdbufout (ob,olen+2 ,deb_hab);deb_hab ("\n" ); -if (mutex_lock_interruptible (&st->hab_mutex) <0 ) +if (mutex_lock_interruptible (&st->hab_mutex))return -EAGAIN ; if ((ret = bcm3510_hab_send_request(st, ob, olen+2)) < 0 ||
drivers/media/dvb-frontends/dib0070.c +2 -2
@@ -70,7 +70,7 @@ static u16 dib0070_read_reg(struct dib0070_state *state, u8 reg) {u16 ret; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&state->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return 0 ; }
@@ -102,7 +102,7 @@ static int dib0070_write_reg(struct dib0070_state *state, u8 reg, u16 val) {int ret; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&state->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return -EINVAL ; }
drivers/media/dvb-frontends/dib0090.c +4 -4
@@ -201,7 +201,7 @@ static u16 dib0090_read_reg(struct dib0090_state *state, u8 reg) {u16 ret; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&state->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return 0 ; }
@@ -233,7 +233,7 @@ static int dib0090_write_reg(struct dib0090_state *state, u32 reg, u16 val) {int ret; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&state->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return -EINVAL ; }
@@ -262,7 +262,7 @@ static u16 dib0090_fw_read_reg(struct dib0090_fw_state *state, u8 reg) {u16 ret; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&state->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return 0 ; }
@@ -289,7 +289,7 @@ static int dib0090_fw_write_reg(struct dib0090_fw_state *state, u8 reg, u16 val) {int ret; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&state->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return -EINVAL ; }
drivers/media/dvb-frontends/dib7000m.c +2 -2
@@ -77,7 +77,7 @@ static u16 dib7000m_read_word(struct dib7000m_state *state, u16 reg) {u16 ret; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&state->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return 0 ; }
@@ -108,7 +108,7 @@ static int dib7000m_write_word(struct dib7000m_state *state, u16 reg, u16 val) {int ret; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&state->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return -EINVAL ; }
drivers/media/dvb-frontends/dib7000p.c +2 -2
@@ -96,7 +96,7 @@ static u16 dib7000p_read_word(struct dib7000p_state *state, u16 reg) {u16 ret; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&state->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return 0 ; }
@@ -126,7 +126,7 @@ static int dib7000p_write_word(struct dib7000p_state *state, u16 reg, u16 val) {int ret; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&state->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return -EINVAL ; }
drivers/media/dvb-frontends/dib8000.c +5 -5
@@ -150,7 +150,7 @@ static u16 dib8000_i2c_read16(struct i2c_device *i2c, u16 reg) {.addr = i2c->addr >> 1, .flags = I2C_M_RD, .len = 2}, }; -if (mutex_lock_interruptible (i2c->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (i2c->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return 0 ; }
@@ -197,7 +197,7 @@ static u16 dib8000_read_word(struct dib8000_state *state, u16 reg) {u16 ret; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&state->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return 0 ; }
@@ -213,7 +213,7 @@ static u32 dib8000_read32(struct dib8000_state *state, u16 reg) {u16 rw[2 ]; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&state->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return 0 ; }
@@ -231,7 +231,7 @@ static int dib8000_i2c_write16(struct i2c_device *i2c, u16 reg, u16 val)struct i2c_msg msg = {.addr = i2c->addr >>1 , .flags =0 , .len =4 };int ret =0 ; -if (mutex_lock_interruptible (i2c->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (i2c->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return -EINVAL ; }
@@ -252,7 +252,7 @@ static int dib8000_write_word(struct dib8000_state *state, u16 reg, u16 val) {int ret; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&state->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return -EINVAL ; }
drivers/media/dvb-frontends/dib9000.c +21 -21
162 lines not on this page · raw message
drivers/media/dvb-frontends/dibx000_common.c +5 -5
@@ -21,7 +21,7 @@ static int dibx000_write_word(struct dibx000_i2c_master *mst, u16 reg, u16 val) {int ret; -if (mutex_lock_interruptible (&mst->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&mst->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return -EINVAL ; }
@@ -47,7 +47,7 @@ static u16 dibx000_read_word(struct dibx000_i2c_master *mst, u16 reg) {u16 ret; -if (mutex_lock_interruptible (&mst->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&mst->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return 0 ; }
@@ -296,7 +296,7 @@ static int dibx000_i2c_gated_gpio67_xfer(struct i2c_adapter *i2c_adap,dibx000_i2c_select_interface (mst,DIBX000_I2C_INTERFACE_GPIO_6_7 ); -if (mutex_lock_interruptible (&mst->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&mst->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return -EINVAL ; }
@@ -343,7 +343,7 @@ static int dibx000_i2c_gated_tuner_xfer(struct i2c_adapter *i2c_adap,dibx000_i2c_select_interface (mst,DIBX000_I2C_INTERFACE_TUNER ); -if (mutex_lock_interruptible (&mst->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&mst->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return -EINVAL ; }
@@ -440,7 +440,7 @@ int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev,int ret;mutex_init (&mst->i2c_buffer_lock); -if (mutex_lock_interruptible (&mst->i2c_buffer_lock) <0 ) { +if (mutex_lock_interruptible (&mst->i2c_buffer_lock)) {dprintk ("could not acquire lock\n" );return -EINVAL ; }
drivers/media/usb/dvb-usb-v2/af9035.c +1 -1
@@ -271,7 +271,7 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,struct state *state =d_to_priv (d);int ret; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;/*
drivers/media/usb/dvb-usb-v2/anysee.c +1 -1
@@ -188,7 +188,7 @@ static int anysee_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msg,int ret =0 , inc, i =0 ;u8 buf[52 ];/* 4 + 48 (I2C WR USB command header + I2C WR max) */ -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;while (i < num) {
drivers/media/usb/dvb-usb-v2/au6610.c +1 -1
@@ -89,7 +89,7 @@ static int au6610_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],if (num >2 )return -EINVAL ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;for (i =0 ; i < num; i++) {
drivers/media/usb/dvb-usb-v2/az6007.c +3 -3
@@ -128,7 +128,7 @@ static int az6007_read(struct dvb_usb_device *d, u8 req, u16 value,struct az6007_device_state *st = d->priv;int ret; -if (mutex_lock_interruptible (&st->mutex) <0 ) +if (mutex_lock_interruptible (&st->mutex))return -EAGAIN ; ret =__az6007_read (d->udev, req, value, index, b, blen);
@@ -175,7 +175,7 @@ static int az6007_write(struct dvb_usb_device *d, u8 req, u16 value,struct az6007_device_state *st = d->priv;int ret; -if (mutex_lock_interruptible (&st->mutex) <0 ) +if (mutex_lock_interruptible (&st->mutex))return -EAGAIN ; ret =__az6007_write (d->udev, req, value, index, b, blen);
@@ -752,7 +752,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],int length;u8 req, addr; -if (mutex_lock_interruptible (&st->mutex) <0 ) +if (mutex_lock_interruptible (&st->mutex))return -EAGAIN ;for (i =0 ; i < num; i++) {
drivers/media/usb/dvb-usb-v2/ce6230.c +1 -1
@@ -94,7 +94,7 @@ static int ce6230_i2c_master_xfer(struct i2c_adapter *adap,memset (&req,0 ,sizeof (req)); -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;while (i < num) {
drivers/media/usb/dvb-usb-v2/dvbsky.c +1 -1
@@ -103,7 +103,7 @@ static int dvbsky_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],int ret =0 ;u8 ibuf[64 ], obuf[64 ]; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;if (num >2 ) {
drivers/media/usb/dvb-usb-v2/ec168.c +1 -1
@@ -109,7 +109,7 @@ static int ec168_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],if (num >2 )return -EINVAL ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;while (i < num) {
drivers/media/usb/dvb-usb-v2/lmedm04.c +1 -1
@@ -147,7 +147,7 @@ static int lme2510_usb_talk(struct dvb_usb_device *d,return -EINVAL ; ret =mutex_lock_interruptible (&d->usb_mutex); -if (ret <0 ) +if (ret)return -EAGAIN ;memcpy (st->usb_buffer, wbuf, wlen);
drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.c +1 -1
@@ -804,7 +804,7 @@ int mxl111sf_i2c_xfer(struct i2c_adapter *adap,int hwi2c = (state->chip_rev >MXL111SF_V6 );int i, ret; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;for (i =0 ; i < num; i++) {
drivers/media/usb/dvb-usb-v2/rtl28xxu.c +1 -1
@@ -166,7 +166,7 @@ static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],* where write is more than one byte. */ -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ; if (num == 2 && !(msg[0].flags & I2C_M_RD) &&
drivers/media/usb/dvb-usb/af9005.c +1 -1
@@ -407,7 +407,7 @@ static int af9005_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],u8 reg, addr;u8 *value; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;if (num >2 )
drivers/media/usb/dvb-usb/az6027.c +1 -1
@@ -962,7 +962,7 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nif (!data)return -ENOMEM ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) { +if (mutex_lock_interruptible (&d->i2c_mutex)) {kfree (data);return -EAGAIN ; }
drivers/media/usb/dvb-usb/cxusb.c +1 -1
@@ -183,7 +183,7 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],int ret;int i; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;for (i =0 ; i < num; i++) {
drivers/media/usb/dvb-usb/dib0700_core.c +10 -10
@@ -24,7 +24,7 @@ int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion,struct dib0700_state *st = d->priv;int ret; -if (mutex_lock_interruptible (&d->usb_mutex) <0 ) { +if (mutex_lock_interruptible (&d->usb_mutex)) {err ("could not acquire lock" );return -EINTR ; }
@@ -110,7 +110,7 @@ int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_struct dib0700_state *st = d->priv;int ret; -if (mutex_lock_interruptible (&d->usb_mutex) <0 ) { +if (mutex_lock_interruptible (&d->usb_mutex)) {err ("could not acquire lock" );return -EINTR ; }
@@ -131,7 +131,7 @@ static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets)int ret;if (st->fw_version >=0x10201 ) { -if (mutex_lock_interruptible (&d->usb_mutex) <0 ) { +if (mutex_lock_interruptible (&d->usb_mutex)) {err ("could not acquire lock" );return -EINTR ; }
@@ -171,7 +171,7 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg,/* Ensure nobody else hits the i2c bus while we're sending our sequence of messages, (such as the remote control thread) */ -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EINTR ;for (i =0 ; i < num; i++) {
@@ -229,7 +229,7 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg, }else {/* Write request */ -if (mutex_lock_interruptible (&d->usb_mutex) <0 ) { +if (mutex_lock_interruptible (&d->usb_mutex)) {err ("could not acquire lock" ); result = -EINTR ; goto unlock;
@@ -286,9 +286,9 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap,struct dib0700_state *st = d->priv;int i, len, result; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EINTR ; -if (mutex_lock_interruptible (&d->usb_mutex) <0 ) { +if (mutex_lock_interruptible (&d->usb_mutex)) {err ("could not acquire lock" );mutex_unlock (&d->i2c_mutex);return -EINTR ;
@@ -404,7 +404,7 @@ static int dib0700_set_clock(struct dvb_usb_device *d, u8 en_pll,struct dib0700_state *st = d->priv;int ret; -if (mutex_lock_interruptible (&d->usb_mutex) <0 ) { +if (mutex_lock_interruptible (&d->usb_mutex)) {err ("could not acquire lock" );return -EINTR ; }
@@ -436,7 +436,7 @@ int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz)if (scl_kHz ==0 )return -EINVAL ; -if (mutex_lock_interruptible (&d->usb_mutex) <0 ) { +if (mutex_lock_interruptible (&d->usb_mutex)) {err ("could not acquire lock" );return -EINTR ; }
@@ -641,7 +641,7 @@ int dib0700_change_protocol(struct rc_dev *rc, u64 *rc_proto)struct dib0700_state *st = d->priv;int new_proto, ret; -if (mutex_lock_interruptible (&d->usb_mutex) <0 ) { +if (mutex_lock_interruptible (&d->usb_mutex)) {err ("could not acquire lock" );return -EINTR ; }
drivers/media/usb/dvb-usb/dibusb-common.c +1 -1
@@ -181,7 +181,7 @@ static int dibusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int numstruct dvb_usb_device *d =i2c_get_adapdata (adap);int i; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;for (i =0 ; i < num; i++) {
drivers/media/usb/dvb-usb/digitv.c +1 -1
@@ -56,7 +56,7 @@ static int digitv_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int numstruct dvb_usb_device *d =i2c_get_adapdata (adap);int i; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;if (num >2 )
drivers/media/usb/dvb-usb/dtv5100.c +1 -1
@@ -72,7 +72,7 @@ static int dtv5100_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],if (num >2 )return -EINVAL ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;for (i =0 ; i < num; i++) {
drivers/media/usb/dvb-usb/dvb-usb-urb.c +2 -1
@@ -22,7 +22,8 @@ int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf,return -EINVAL ; } -if ((ret =mutex_lock_interruptible (&d->usb_mutex))) + ret =mutex_lock_interruptible (&d->usb_mutex); +if (ret)return ret;deb_xfer (">>> " );
drivers/media/usb/dvb-usb/dw2102.c +8 -8
@@ -121,7 +121,7 @@ static int dw2102_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],if (!d)return -ENODEV ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;switch (num) {
@@ -216,7 +216,7 @@ static int dw2102_serit_i2c_transfer(struct i2c_adapter *adap,if (!d)return -ENODEV ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;switch (num) {
@@ -291,7 +291,7 @@ static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msif (!d)return -ENODEV ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;switch (num) {
@@ -399,7 +399,7 @@ static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], iif (!d)return -ENODEV ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;for (j =0 ; j < num; j++) {
@@ -501,7 +501,7 @@ static int dw3101_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],if (!d)return -ENODEV ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;switch (num) {
@@ -589,7 +589,7 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],if (!d)return -ENODEV ; udev = d->udev; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;for (j =0 ; j < num; j++) {
@@ -726,9 +726,9 @@ static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], state = d->priv; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ; -if (mutex_lock_interruptible (&d->data_mutex) <0 ) { +if (mutex_lock_interruptible (&d->data_mutex)) {mutex_unlock (&d->i2c_mutex);return -EAGAIN ; }
drivers/media/usb/dvb-usb/gp8psk.c +4 -2
@@ -35,7 +35,8 @@ static int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value,if (blen >sizeof (st->data))return -EIO ; -if ((ret =mutex_lock_interruptible (&d->usb_mutex))) + ret =mutex_lock_interruptible (&d->usb_mutex); +if (ret)return ret;while (ret >=0 && ret != blen && try <3 ) {
@@ -77,7 +78,8 @@ static int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,if (blen >sizeof (st->data))return -EIO ; -if ((ret =mutex_lock_interruptible (&d->usb_mutex))) + ret =mutex_lock_interruptible (&d->usb_mutex); +if (ret)return ret;memcpy (st->data, b, blen);
drivers/media/usb/dvb-usb/m920x.c +1 -1
@@ -252,7 +252,7 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nuint i, j;int ret =0 ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;for (i =0 ; i < num; i++) {
drivers/media/usb/dvb-usb/opera1.c +2 -2
@@ -92,7 +92,7 @@ static int opera1_usb_i2c_msgxfer(struct dvb_usb_device *dev, u16 addr,info ("no usb_device" );return -EINVAL ; } -if (mutex_lock_interruptible (&dev->usb_mutex) <0 ) +if (mutex_lock_interruptible (&dev->usb_mutex))return -EAGAIN ;switch (addr>>1 ){
@@ -132,7 +132,7 @@ static int opera1_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],if (!d)return -ENODEV ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;for (i =0 ; i < num; i++) {
drivers/media/usb/dvb-usb/pctv452e.c +2 -2
@@ -478,7 +478,7 @@ static int pctv452e_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msg,struct dvb_usb_device *d =i2c_get_adapdata (adapter);int i; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;for (i =0 ; i < num; i++) {
@@ -623,7 +623,7 @@ static int pctv452e_read_mac_address(struct dvb_usb_device *d, u8 mac[6])int ret; ret = -EAGAIN ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex)) goto failed; ret = pctv452e_i2c_msg(d, I2C_ADDR_24C16,
drivers/media/usb/dvb-usb/technisat-usb2.c +5 -5
@@ -166,7 +166,7 @@ static int technisat_usb2_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msg/* Ensure nobody else hits the i2c bus while we're sending our sequence of messages, (such as the remote control thread) */ -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;for (i =0 ; i < num; i++) {
@@ -259,7 +259,7 @@ static int technisat_usb2_set_led(struct dvb_usb_device *d, int red,break ; } -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ; ret = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev, 0),
@@ -280,7 +280,7 @@ static int technisat_usb2_set_led_timer(struct dvb_usb_device *d, u8 red, u8 gre b[0 ] =0 ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ; ret = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev, 0),
@@ -550,7 +550,7 @@ static int technisat_usb2_frontend_attach(struct dvb_usb_adapter *a)if (a->fe_adap[0 ].fe->ops.init) a->fe_adap[0 ].fe->ops.init (a->fe_adap[0 ].fe); -if (mutex_lock_interruptible (&a->dev->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&a->dev->i2c_mutex))return -EAGAIN ; ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -618,7 +618,7 @@ static int technisat_usb2_get_ir(struct dvb_usb_device *d) buf[3 ] =MINIMUM_IR_BIT_TRANSITION_TICK_COUNT ; buf[4 ] =MAXIMUM_IR_BIT_TIME_TICK_COUNT ; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ; ret = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev, 0), GET_IR_DATA_VENDOR_REQUEST,
drivers/media/usb/dvb-usb/ttusb2.c +1 -1
@@ -371,7 +371,7 @@ static int ttusb2_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int numstatic u8 obuf[60 ], ibuf[60 ];int i, write_read, read; -if (mutex_lock_interruptible (&d->i2c_mutex) <0 ) +if (mutex_lock_interruptible (&d->i2c_mutex))return -EAGAIN ;if (num >2 )
drivers/media/usb/dvb-usb/vp702x.c +3 -2
@@ -99,7 +99,8 @@ int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int il {int ret; -if ((ret =mutex_lock_interruptible (&d->usb_mutex))) + ret =mutex_lock_interruptible (&d->usb_mutex); +if (ret)return ret; ret =vp702x_usb_out_op_unlocked (d,REQUEST_OUT ,0 ,0 , o, olen);
@@ -119,7 +120,7 @@ static int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o,int buflen =max (olen +2 , ilen +1 ); ret =mutex_lock_interruptible (&st->buf_mutex); -if (ret <0 ) +if (ret)return ret;if (buflen > st->buf_len) {
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c +2 -2
@@ -143,7 +143,7 @@ static int ttusb_cmd(struct ttusb *ttusb, u8 *data, int len, int len_result)int actual_len;int err; -if (mutex_lock_interruptible (&ttusb->semusb) <0 ) +if (mutex_lock_interruptible (&ttusb->semusb))return -EAGAIN ;if (debug >=3 )
@@ -236,7 +236,7 @@ static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int numint i =0 ;int inc; -if (mutex_lock_interruptible (&ttusb->semi2c) <0 ) +if (mutex_lock_interruptible (&ttusb->semi2c))return -EAGAIN ;while (i < num) {
drivers/media/usb/uvc/uvc_ctrl.c +3 -3
@@ -1392,7 +1392,7 @@ int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,int ret; ret =mutex_lock_interruptible (&chain->ctrl_mutex); -if (ret <0 ) +if (ret)return -ERESTARTSYS ;/* Check if the ctrl is a know class */
@@ -1453,7 +1453,7 @@ int uvc_query_v4l2_menu(struct uvc_video_chain *chain,return -EINVAL ; ret =mutex_lock_interruptible (&chain->ctrl_mutex); -if (ret <0 ) +if (ret)return -ERESTARTSYS ; ctrl =uvc_find_control (chain, query_menu->id, &mapping);
@@ -1760,7 +1760,7 @@ static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev, unsigned elems)int ret; ret =mutex_lock_interruptible (&handle->chain->ctrl_mutex); -if (ret <0 ) +if (ret)return -ERESTARTSYS ;if (__uvc_query_v4l2_class (handle->chain, sev->id,0 ) >=0 ) {
drivers/net/ethernet/mellanox/mlxsw/i2c.c +2 -2
@@ -426,7 +426,7 @@ mlxsw_i2c_cmd(struct device *dev, u16 opcode, u32 in_mod, size_t in_mbox_size, reg_size =mlxsw_i2c_get_reg_size (in_mbox); num =DIV_ROUND_UP (reg_size, mlxsw_i2c->block_size); -if (mutex_lock_interruptible (&mlxsw_i2c->cmd.lock) <0 ) { +if (mutex_lock_interruptible (&mlxsw_i2c->cmd.lock)) {dev_err (&client->dev,"Could not acquire lock" );return -EINVAL ; }
@@ -445,7 +445,7 @@ mlxsw_i2c_cmd(struct device *dev, u16 opcode, u32 in_mod, size_t in_mbox_size, reg_size =MLXSW_I2C_MAX_DATA_SIZE ; num =DIV_ROUND_UP (reg_size, mlxsw_i2c->block_size); -if (mutex_lock_interruptible (&mlxsw_i2c->cmd.lock) <0 ) { +if (mutex_lock_interruptible (&mlxsw_i2c->cmd.lock)) {dev_err (&client->dev,"Could not acquire lock" );return -EINVAL ; }
drivers/net/usb/cdc_subset.c +1 -1
@@ -80,7 +80,7 @@ static void m5632_recover(struct usbnet *dev)int r; r =usb_lock_device_for_reset (udev, intf); -if (r <0 ) +if (r)return ;usb_reset_device (udev);
drivers/net/wireless/intersil/p54/p54usb.c +1 -1
@@ -455,7 +455,7 @@ static int p54u_device_reset(struct ieee80211_hw *dev)if (lock) { ret =usb_lock_device_for_reset (priv->udev, priv->intf); -if (ret <0 ) { +if (ret) {dev_err (&priv->udev->dev,"(p54usb) unable to lock " "device for reset (%d)!\n" , ret);return ret;
drivers/net/wireless/ti/wlcore/sysfs.c +1 -1
@@ -97,7 +97,7 @@ static ssize_t wl1271_sysfs_read_fwlog(struct file *filp, struct kobject *kobj,int ret; ret =mutex_lock_interruptible (&wl->mutex); -if (ret <0 ) +if (ret)return -ERESTARTSYS ;/* Check if the fwlog is still valid */
drivers/platform/x86/thinkpad_acpi.c +6 -6
@@ -6462,7 +6462,7 @@ static void tpacpi_brightness_checkpoint_nvram(void)vdbg_printk (TPACPI_DBG_BRGHT ,"trying to checkpoint backlight level to NVRAM...\n" ); -if (mutex_lock_killable (&brightness_mutex) <0 ) +if (mutex_lock_killable (&brightness_mutex))return ;if (unlikely (!acpi_ec_read (TP_EC_BACKLIGHT , &lec)))
@@ -6565,7 +6565,7 @@ static int brightness_set(unsigned int value) "set backlight level to %d\n", value); res =mutex_lock_killable (&brightness_mutex); -if (res <0 ) +if (res)return res;switch (brightness_mode) {
@@ -6604,7 +6604,7 @@ static int brightness_get(struct backlight_device *bd)int status, res; res =mutex_lock_killable (&brightness_mutex); -if (res <0 ) +if (res)return 0 ; res =tpacpi_brightness_get_raw (&status);
@@ -7075,7 +7075,7 @@ static void tpacpi_volume_checkpoint_nvram(void)else ec_mask =TP_EC_AUDIO_MUTESW_MSK |TP_EC_AUDIO_LVL_MSK ; -if (mutex_lock_killable (&volume_mutex) <0 ) +if (mutex_lock_killable (&volume_mutex))return ;if (unlikely (!acpi_ec_read (TP_EC_AUDIO , &lec)))
@@ -7147,7 +7147,7 @@ static int __volume_set_mute_ec(const bool mute)int rc;u8 s, n; -if (mutex_lock_killable (&volume_mutex) <0 ) +if (mutex_lock_killable (&volume_mutex))return -EINTR ; rc =volume_get_status_ec (&s);
@@ -7195,7 +7195,7 @@ static int __volume_set_volume_ec(const u8 vol)if (vol >TP_EC_VOLUME_MAX )return -EINVAL ; -if (mutex_lock_killable (&volume_mutex) <0 ) +if (mutex_lock_killable (&volume_mutex))return -EINTR ; rc =volume_get_status_ec (&s);
drivers/scsi/hpsa.c +1 -1
@@ -3176,7 +3176,7 @@ static int hpsa_do_reset(struct ctlr_info *h, struct hpsa_scsi_dev_t *dev,int rc =0 ;/* We can really only handle one reset at a time */ -if (mutex_lock_interruptible (&h->reset_mutex) == -EINTR ) { +if (mutex_lock_interruptible (&h->reset_mutex)) {dev_warn (&h->pdev->dev,"concurrent reset wait interrupted.\n" );return -EINTR ; }
drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c +2 -2
@@ -1175,7 +1175,7 @@ static int usb_gpib_init_module(struct usb_interface *interface)int j, mask, rv; rv =mutex_lock_interruptible (&minors_lock); -if (rv <0 ) +if (rv)return rv;if (!assigned_usb_minors) {
@@ -1513,7 +1513,7 @@ static ssize_t skel_do_read(struct usb_skel *dev, char *buffer, size_t count)DIA_LOG (2 ,"restart with %zd %zd.\n" , dev->bulk_in_filled, dev->bulk_in_copied); rv =mutex_lock_interruptible (&dev->io_mutex); -if (rv <0 ) +if (rv)return rv;if (!dev->interface) {/* disconnect() was called */
drivers/tty/tty_io.c +3 -3
@@ -965,7 +965,7 @@ static ssize_t iterate_tty_write(struct tty_ldisc *ld, struct tty_struct *tty,ssize_t ret, written =0 ; ret =tty_write_lock (tty, file->f_flags &O_NDELAY ); -if (ret <0 ) +if (ret)return ret;/*
@@ -1154,7 +1154,7 @@ int tty_send_xchar(struct tty_struct *tty, u8 ch)return 0 ; } -if (tty_write_lock (tty, false) <0 ) +if (tty_write_lock (tty, false))return -ERESTARTSYS ;down_read (&tty->termios_rwsem);
@@ -2486,7 +2486,7 @@ static int send_break(struct tty_struct *tty, unsigned int duration)return tty->ops->break_ctl (tty, duration);/* Do the work ourselves */ -if (tty_write_lock (tty, false) <0 ) +if (tty_write_lock (tty, false))return -EINTR ; retval = tty->ops->break_ctl (tty,-1 );
drivers/usb/class/cdc-wdm.c +1 -2
@@ -523,9 +523,8 @@ static ssize_t wdm_readint i =0 ;struct wdm_device *desc = file->private_data; - rv =mutex_lock_interruptible (&desc->rlock);/*concurrent reads */ -if (rv <0 ) +if (rv)return -ERESTARTSYS ; cntr =READ_ONCE (desc->length);
drivers/usb/class/usblp.c +1 -1
@@ -849,7 +849,7 @@ static ssize_t usblp_read(struct file *file, char __user *buffer, size_t len, loreturn -EINVAL ; rv =usblp_rwait_and_lock (usblp, !!(file->f_flags &O_NONBLOCK )); -if (rv <0 ) +if (rv)return rv;if (!usblp->present) {
drivers/usb/core/message.c +1 -1
@@ -1900,7 +1900,7 @@ static void __usb_queue_reset_device(struct work_struct *ws)struct usb_device *udev =interface_to_usbdev (iface); rc =usb_lock_device_for_reset (udev, iface); -if (rc >=0 ) { +if (rc ==0 ) {usb_reset_device (udev);usb_unlock_device (udev); }
drivers/usb/core/sysfs.c +12 -12
@@ -32,7 +32,7 @@ static ssize_t field##_show(struct device *dev, \ \ udev =to_usb_device (dev); \ rc =usb_lock_device_interruptible (udev); \ -if (rc <0 ) \ +if (rc) \return -EINTR ; \ actconfig = udev->actconfig; \if (actconfig) \
@@ -58,7 +58,7 @@ static ssize_t bMaxPower_show(struct device *dev, udev =to_usb_device (dev); rc =usb_lock_device_interruptible (udev); -if (rc <0 ) +if (rc)return -EINTR ; actconfig = udev->actconfig;if (actconfig)
@@ -77,7 +77,7 @@ static ssize_t configuration_show(struct device *dev, udev =to_usb_device (dev); rc =usb_lock_device_interruptible (udev); -if (rc <0 ) +if (rc)return -EINTR ; actconfig = udev->actconfig;if (actconfig && actconfig->string)
@@ -100,7 +100,7 @@ static ssize_t bConfigurationValue_store(struct device *dev,if (sscanf (buf,"%d" , &config) !=1 || config <-1 || config >255 )return -EINVAL ; rc =usb_lock_device_interruptible (udev); -if (rc <0 ) +if (rc)return -EINTR ; value =usb_set_configuration (udev, config);usb_unlock_device (udev);
@@ -130,7 +130,7 @@ static ssize_t name##_show(struct device *dev, \ \ udev =to_usb_device (dev); \ retval =usb_lock_device_interruptible (udev); \ -if (retval <0 ) \ +if (retval) \return -EINTR ; \ retval =sysfs_emit (buf,"%s\n" , udev->name); \usb_unlock_device (udev); \
@@ -279,7 +279,7 @@ static ssize_t avoid_reset_quirk_store(struct device *dev,if (kstrtobool (buf, &val) !=0 )return -EINVAL ; rc =usb_lock_device_interruptible (udev); -if (rc <0 ) +if (rc)return -EINTR ;if (val) udev->quirks |=USB_QUIRK_RESET ;
@@ -334,7 +334,7 @@ static ssize_t persist_store(struct device *dev, struct device_attribute *attr,return -EINVAL ; rc =usb_lock_device_interruptible (udev); -if (rc <0 ) +if (rc)return -EINTR ; udev->persist_enabled = !!value;usb_unlock_device (udev);
@@ -460,7 +460,7 @@ static ssize_t level_store(struct device *dev, struct device_attribute *attr, len = cp - buf; rv =usb_lock_device_interruptible (udev); -if (rv <0 ) +if (rv)return -EINTR ; if (len == sizeof on_string - 1 &&
@@ -502,7 +502,7 @@ static ssize_t usb2_hardware_lpm_store(struct device *dev,int ret; ret =usb_lock_device_interruptible (udev); -if (ret <0 ) +if (ret)return -EINTR ; ret =kstrtobool (buf, &value);
@@ -579,7 +579,7 @@ static ssize_t usb3_hardware_lpm_u1_show(struct device *dev,int rc; rc =usb_lock_device_interruptible (udev); -if (rc <0 ) +if (rc)return -EINTR ;if (udev->usb3_lpm_u1_enabled)
@@ -601,7 +601,7 @@ static ssize_t usb3_hardware_lpm_u2_show(struct device *dev,int rc; rc =usb_lock_device_interruptible (udev); -if (rc <0 ) +if (rc)return -EINTR ;if (udev->usb3_lpm_u2_enabled)
@@ -1188,7 +1188,7 @@ static ssize_t supports_autosuspend_show(struct device *dev,int s; s =device_lock_interruptible (dev); -if (s <0 ) +if (s)return -EINTR ;/* Devices will be autosuspended even when an interface isn't claimed */ s = (!dev->driver ||to_usb_driver (dev->driver)->supports_autosuspend);
drivers/usb/gadget/legacy/inode.c +8 -5
@@ -313,7 +313,7 @@ get_ready_ep (unsigned f_flags, struct ep_data *epdata, bool is_write) } val =mutex_lock_interruptible (&epdata->lock); -if (val <0 ) +if (val)return val;switch (epdata->state) {
@@ -386,7 +386,7 @@ ep_release (struct inode *inode, struct file *fd)int value; value =mutex_lock_interruptible (&data->lock); -if (value <0 ) +if (value)return value;/* clean up if this can be reopened */
@@ -406,7 +406,8 @@ static long ep_ioctl(struct file *fd, unsigned code, unsigned long value)struct ep_data *data = fd->private_data;int status; -if ((status =get_ready_ep (fd->f_flags, data, false)) <0 ) + status =get_ready_ep (fd->f_flags, data, false); +if (status)return status;spin_lock_irq (&data->dev->lock);
@@ -587,7 +588,8 @@ ep_read_iter(struct kiocb *iocb, struct iov_iter *to)ssize_t value;char *buf; -if ((value =get_ready_ep (file->f_flags, epdata, false)) <0 ) + value =get_ready_ep (file->f_flags, epdata, false); +if (value)return value;/* halt any endpoint by doing a "wrong direction" i/o call */
@@ -647,7 +649,8 @@ ep_write_iter(struct kiocb *iocb, struct iov_iter *from)ssize_t value;char *buf; -if ((value =get_ready_ep (file->f_flags, epdata, true)) <0 ) + value =get_ready_ep (file->f_flags, epdata, true); +if (value)return value; configured = epdata->state ==STATE_EP_ENABLED ;
drivers/usb/misc/yurex.c +1 -1
@@ -442,7 +442,7 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer, goto error; retval =mutex_lock_interruptible (&dev->io_mutex); -if (retval <0 ) +if (retval)return -EINTR ;if (dev->disconnected) {/* already disconnected */
drivers/usb/storage/transport.c +1 -1
@@ -1427,7 +1427,7 @@ int usb_stor_port_reset(struct us_data *us)return -EPERM ; result =usb_lock_device_for_reset (us->pusb_dev, us->pusb_intf); -if (result <0 ) +if (result)usb_stor_dbg (us,"unable to lock device for reset: %d\n" , result);else {
drivers/usb/usb-skeleton.c +1 -1
@@ -235,7 +235,7 @@ static ssize_t skel_read(struct file *file, char *buffer, size_t count,/* no concurrent readers */ rv =mutex_lock_interruptible (&dev->io_mutex); -if (rv <0 ) +if (rv)return rv;if (dev->disconnected) {/* disconnect() was called */
drivers/usb/usbip/stub_dev.c +1 -1
@@ -218,7 +218,7 @@ static void stub_device_reset(struct usbip_device *ud)dev_dbg (&udev->dev,"device reset" ); ret =usb_lock_device_for_reset (udev,NULL ); -if (ret <0 ) { +if (ret) {dev_err (&udev->dev,"lock for reset\n" );spin_lock_irq (&ud->lock); ud->status =SDEV_ST_ERROR ;
drivers/usb/usbip/stub_rx.c +1 -1
@@ -156,7 +156,7 @@ static int tweak_reset_device_cmd(struct urb *urb)dev_info (&urb->dev->dev,"usb_queue_reset_device\n" ); err =usb_lock_device_for_reset (sdev->udev,NULL ); -if (err <0 ) { +if (err) {dev_err (&urb->dev->dev,"could not obtain lock to reset device\n" );return err; }
drivers/w1/masters/omap_hdq.c +4 -4
@@ -135,7 +135,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)u8 tmp_status; ret =mutex_lock_interruptible (&hdq_data->hdq_mutex); -if (ret <0 ) { +if (ret) { ret = -EINTR ; goto rtn; }
@@ -235,7 +235,7 @@ static int omap_hdq_break(struct hdq_data *hdq_data)u8 tmp_status; ret =mutex_lock_interruptible (&hdq_data->hdq_mutex); -if (ret <0 ) { +if (ret) {dev_dbg (hdq_data->dev,"Could not acquire mutex\n" ); ret = -EINTR ; goto rtn;
@@ -305,7 +305,7 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val)u8 status; ret =mutex_lock_interruptible (&hdq_data->hdq_mutex); -if (ret <0 ) { +if (ret) { ret = -EINTR ; goto rtn; }
@@ -374,7 +374,7 @@ static u8 omap_w1_triplet(void *_hdq, u8 bdir) } err =mutex_lock_interruptible (&hdq_data->hdq_mutex); -if (err <0 ) { +if (err) {dev_dbg (hdq_data->dev,"Could not acquire mutex\n" ); goto rtn; }
fs/afs/validation.c +1 -1
@@ -420,7 +420,7 @@ int afs_validate(struct afs_vnode *vnode, struct key *key)if (volume->cb_expires_at <= deadline ||atomic_read (&volume->cb_v_check) !=atomic_read (&volume->cb_v_break)) { ret =mutex_lock_interruptible (&volume->cb_check_lock); -if (ret <0 ) +if (ret) goto error_unlock; locked_vol = true; }
fs/afs/vl_alias.c +3 -3
@@ -188,7 +188,7 @@ static int afs_query_for_alias(struct afs_cell *cell, struct key *key)_enter ("%s" , cell->name); -if (mutex_lock_interruptible (&cell->net->proc_cells_lock) <0 ) +if (mutex_lock_interruptible (&cell->net->proc_cells_lock))return -ERESTARTSYS ;hlist_for_each_entry (p, &cell->net->proc_cells, proc_link) {
@@ -204,7 +204,7 @@ static int afs_query_for_alias(struct afs_cell *cell, struct key *key)if (afs_query_for_alias_one (cell, key, p) !=0 ) goto is_alias; -if (mutex_lock_interruptible (&cell->net->proc_cells_lock) <0 ) { +if (mutex_lock_interruptible (&cell->net->proc_cells_lock)) {afs_unuse_cell (cell->net, p, afs_cell_trace_unuse_check_alias);return -ERESTARTSYS ; }
@@ -318,7 +318,7 @@ int afs_cell_detect_alias(struct afs_cell *cell, struct key *key)struct afs_net *net = cell->net;int ret; -if (mutex_lock_interruptible (&net->cells_alias_lock) <0 ) +if (mutex_lock_interruptible (&net->cells_alias_lock))return -ERESTARTSYS ;if (test_bit (AFS_CELL_FL_CHECK_ALIAS , &cell->flags)) {
fs/fsopen.c +1 -1
@@ -33,7 +33,7 @@ static ssize_t fscontext_read(struct file *file,int index, n; ret =mutex_lock_interruptible (&fc->uapi_mutex); -if (ret <0 ) +if (ret)return ret;if (log->head == log->tail) {
fs/namespace.c +1 -1
@@ -4198,7 +4198,7 @@ SYSCALL_DEFINE3(fsmount, int, fs_fd, unsigned int, flags, fc =fd_file (f)->private_data; ret =mutex_lock_interruptible (&fc->uapi_mutex); -if (ret <0 ) +if (ret)return ret;/* There must be a valid superblock or we can't mount it */
fs/orangefs/devorangefs-req.c +1 -1
@@ -637,7 +637,7 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg)* mounts to fail) */ ret =mutex_lock_interruptible (&orangefs_request_mutex); -if (ret <0 ) +if (ret)return ret; gossip_debug(GOSSIP_DEV_DEBUG, "%s: priority remount in progress\n",
fs/proc/base.c +1 -1
@@ -2841,7 +2841,7 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,/* Guard against adverse ptrace interaction */ rv =mutex_lock_interruptible (¤t->signal->cred_guard_mutex); -if (rv <0 ) +if (rv) goto out_free; rv = security_setprocattr(PROC_I(inode)->op.lsmid,
kernel/seccomp.c +5 -5
@@ -1603,7 +1603,7 @@ static long seccomp_notify_send(struct seccomp_filter *filter,return -EINVAL ; ret =mutex_lock_interruptible (&filter->notify_lock); -if (ret <0 ) +if (ret)return ret; knotif =find_notification (filter, resp.id);
@@ -1643,7 +1643,7 @@ static long seccomp_notify_id_valid(struct seccomp_filter *filter,return -EFAULT ; ret =mutex_lock_interruptible (&filter->notify_lock); -if (ret <0 ) +if (ret)return ret; knotif =find_notification (filter, id);
@@ -1665,7 +1665,7 @@ static long seccomp_notify_set_flags(struct seccomp_filter *filter,return -EINVAL ; ret =mutex_lock_interruptible (&filter->notify_lock); -if (ret <0 ) +if (ret)return ret; filter->notif->flags = flags;mutex_unlock (&filter->notify_lock);
@@ -1711,7 +1711,7 @@ static long seccomp_notify_addfd(struct seccomp_filter *filter,init_completion (&kaddfd.completion); ret =mutex_lock_interruptible (&filter->notify_lock); -if (ret <0 ) +if (ret) goto out; knotif =find_notification (filter, addfd.id);
@@ -1824,7 +1824,7 @@ static __poll_t seccomp_notify_poll(struct file *file,poll_wait (file, &filter->wqh, poll_tab); -if (mutex_lock_interruptible (&filter->notify_lock) <0 ) +if (mutex_lock_interruptible (&filter->notify_lock))return EPOLLERR ;list_for_each_entry (cur, &filter->notif->notifications, list) {
mm/kmemleak.c +2 -2
@@ -1916,7 +1916,7 @@ static void *kmemleak_seq_start(struct seq_file *seq, loff_t *pos)int err; err =mutex_lock_interruptible (&scan_mutex); -if (err <0 ) +if (err)return ERR_PTR (err);rcu_read_lock ();
@@ -2074,7 +2074,7 @@ static ssize_t kmemleak_write(struct file *file, const char __user *user_buf, buf[buf_size] =0 ; ret =mutex_lock_interruptible (&scan_mutex); -if (ret <0 ) +if (ret)return ret;if (strncmp (buf,"clear" ,5 ) ==0 ) {
net/rxrpc/recvmsg.c +1 -1
@@ -368,7 +368,7 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,if (flags &MSG_DONTWAIT ) goto error_requeue_call; ret = -ERESTARTSYS ; -if (mutex_lock_interruptible (&call->user_mutex) <0 ) +if (mutex_lock_interruptible (&call->user_mutex)) goto error_requeue_call; }
net/rxrpc/sendmsg.c +1 -1
@@ -487,7 +487,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,if (ret <0 ) goto maybe_error;if (call->interruptibility ==RXRPC_INTERRUPTIBLE ) { -if (mutex_lock_interruptible (&call->user_mutex) <0 ) { +if (mutex_lock_interruptible (&call->user_mutex)) { ret =sock_intr_errno (timeo); goto maybe_error; }
security/integrity/ima/ima_fs.c +1 -1
@@ -370,7 +370,7 @@ static ssize_t ima_write_policy(struct file *file, const char __user *buf, } result =mutex_lock_interruptible (&ima_write_mutex); -if (result <0 ) +if (result) goto out_free;if (data[0 ] =='/' ) {
sound/pci/oxygen/oxygen_lib.c +1 -1
@@ -203,7 +203,7 @@ static void oxygen_proc_read(struct snd_info_entry *entry,snd_iprintf (buffer," %02x" ,oxygen_read8 (chip, i + j));snd_iprintf (buffer,"\n" ); } -if (mutex_lock_interruptible (&chip->mutex) <0 ) +if (mutex_lock_interruptible (&chip->mutex))return ;if (chip->has_ac97_0) {snd_iprintf (buffer,"\nAC97:\n" );
Bart Van Assche
maintainerRFC PATCH 11/33 PNP: isapnp: Check the isapnp_cfg_begin() return value
In reply to Bart Van AsscheInstead of ignoring isapnp_cfg_begin() failures, propagate the value returned by this function in case of a failure. This patch prepares for annotating mutex operations since isapnp_cfg_begin() only locks a particular mutex if it returns zero.
--- drivers/pnp/isapnp/core.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/pnp/isapnp/core.c +12 -4
@@ -851,7 +851,9 @@ static int isapnp_get_resources(struct pnp_dev *dev)pnp_dbg (&dev->dev,"get resources\n" );pnp_init_resources (dev); -isapnp_cfg_begin (dev->card->number, dev->number); + ret =isapnp_cfg_begin (dev->card->number, dev->number); +if (ret) +return ret; dev->active =isapnp_read_byte (ISAPNP_CFG_ACTIVATE );if (!dev->active) goto __end;
@@ -885,10 +887,12 @@ static int isapnp_get_resources(struct pnp_dev *dev)static int isapnp_set_resources (struct pnp_dev *dev) {struct resource *res; -int tmp; +int tmp, ret;pnp_dbg (&dev->dev,"set resources\n" ); -isapnp_cfg_begin (dev->card->number, dev->number); + ret =isapnp_cfg_begin (dev->card->number, dev->number); +if (ret) +return ret; dev->active =1 ;for (tmp =0 ; tmp <ISAPNP_MAX_PORT ; tmp++) { res =pnp_get_resource (dev,IORESOURCE_IO , tmp);
@@ -934,9 +938,13 @@ static int isapnp_set_resources(struct pnp_dev *dev)static int isapnp_disable_resources (struct pnp_dev *dev) { +int ret; +if (!dev->active)return -EINVAL ; -isapnp_cfg_begin (dev->card->number, dev->number); + ret =isapnp_cfg_begin (dev->card->number, dev->number); +if (ret) +return ret;isapnp_deactivate (dev->number); dev->active =0 ;isapnp_cfg_end ();
Bart Van Assche
maintainerRFC PATCH 12/33 scsi: mpi3mr: Fix locking in an error path
In reply to Bart Van AsscheMake all error paths unlock rioc->bsg_cmds.mutex.
This bug has been detected by the Clang thread-safety analyzer.
--- drivers/scsi/mpi3mr/mpi3mr_app.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/mpi3mr/mpi3mr_app.c +1 -0
@@ -2339,6 +2339,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job) }if (!mrioc->ioctl_sges_allocated) { +mutex_unlock (&mrioc->bsg_cmds.mutex);dprint_bsg_err (mrioc,"%s: DMA memory was not allocated\n" , __func__);return -ENOMEM ;
Bart Van Assche
maintainerRFC PATCH 13/33 scsi: mpt3sas: Fix a locking bug in an error path
In reply to Bart Van AsscheCall mutex_unlock(&ioc->hostdiag_unlock_mutex) once from error paths instead of twice.
This bug has been detected by the Clang thread-safety analyzer.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +7 -5
@@ -8018,7 +8018,7 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc)mutex_lock (&ioc->hostdiag_unlock_mutex);if (mpt3sas_base_unlock_and_get_host_diagnostic (ioc, &host_diagnostic)) - goto out; + goto unlock; hcb_size = ioc->base_readl (&ioc->chip->HCBSize);drsprintk (ioc,ioc_info (ioc,"diag reset: issued\n" ));
@@ -8038,7 +8038,7 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc)ioc_info (ioc,"Invalid host diagnostic register value\n" );_base_dump_reg_set (ioc); - goto out; + goto unlock; }if (!(host_diagnostic &MPI2_DIAG_RESET_ADAPTER ))break ;
@@ -8074,17 +8074,19 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc)ioc_err (ioc,"%s: failed going to ready state (ioc_state=0x%x)\n" , __func__, ioc_state);_base_dump_reg_set (ioc); - goto out; + goto fail; }pci_cfg_access_unlock (ioc->pdev);ioc_info (ioc,"diag reset: SUCCESS\n" );return 0 ; - out: +unlock: +mutex_unlock (&ioc->hostdiag_unlock_mutex); + +fail:pci_cfg_access_unlock (ioc->pdev);ioc_err (ioc,"diag reset: FAILED\n" ); -mutex_unlock (&ioc->hostdiag_unlock_mutex);return -EFAULT ; }
Bart Van Assche
maintainerRFC PATCH 14/33 ice: Split ice_dcb_rebuild()
In reply to Bart Van AsschePrepare for adding a second caller. No functionality has been changed.
--- drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 46 +++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-)
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +25 -21
@@ -526,6 +526,30 @@ ice_dcb_need_recfg(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg,return need_reconfig; } +static void disable_dcb (struct ice_pf *pf) +{ +struct ice_dcbx_cfg *err_cfg; +struct device *dev =ice_pf_to_dev (pf); + +dev_err (dev,"Disabling DCB until new settings occur\n" ); + err_cfg =kzalloc (sizeof (*err_cfg),GFP_KERNEL ); +if (!err_cfg) +return ; + + err_cfg->etscfg.willing = true; + err_cfg->etscfg.tcbwtable[0 ] =ICE_TC_MAX_BW ; + err_cfg->etscfg.tsatable[0 ] =ICE_IEEE_TSA_ETS ; +memcpy (&err_cfg->etsrec, &err_cfg->etscfg,sizeof (err_cfg->etsrec)); +/* Coverity warns the return code of ice_pf_dcb_cfg() is not checked +* here as is done for other calls to that function. That check is +* not necessary since this is in this function's error cleanup path. +* Suppress the Coverity warning with the following comment... +*/ +/* coverity[check_return] */ +ice_pf_dcb_cfg (pf, err_cfg, false); +kfree (err_cfg); +} +/** * ice_dcb_rebuild - rebuild DCB post reset * @pf: physical function instance
@@ -534,7 +558,6 @@ void ice_dcb_rebuild(struct ice_pf *pf) {struct ice_aqc_port_ets_elem buf = {0 };struct device *dev =ice_pf_to_dev (pf); -struct ice_dcbx_cfg *err_cfg;int ret; ret =ice_query_port_ets (pf->hw.port_info, &buf,sizeof (buf),NULL );
@@ -574,26 +597,7 @@ void ice_dcb_rebuild(struct ice_pf *pf)return ; dcb_error: -dev_err (dev,"Disabling DCB until new settings occur\n" ); - err_cfg =kzalloc (sizeof (*err_cfg),GFP_KERNEL ); -if (!err_cfg) { -mutex_unlock (&pf->tc_mutex); -return ; - } - - err_cfg->etscfg.willing = true; - err_cfg->etscfg.tcbwtable[0 ] =ICE_TC_MAX_BW ; - err_cfg->etscfg.tsatable[0 ] =ICE_IEEE_TSA_ETS ; -memcpy (&err_cfg->etsrec, &err_cfg->etscfg,sizeof (err_cfg->etsrec)); -/* Coverity warns the return code of ice_pf_dcb_cfg() is not checked -* here as is done for other calls to that function. That check is -* not necessary since this is in this function's error cleanup path. -* Suppress the Coverity warning with the following comment... -*/ -/* coverity[check_return] */ -ice_pf_dcb_cfg (pf, err_cfg, false); -kfree (err_cfg); - +disable_dcb (pf);mutex_unlock (&pf->tc_mutex); }
Przemek Kitszel
maintainerRe: [PATCH RFC 14/33] ice: Split ice_dcb_rebuild()
Quoted 5 lines · Bart Van Assche
Prepare for adding a second caller. No functionality has been changed.
Cc Tony Nguyen <[email protected]>Cc Przemek Kitszel <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
Thank you for fixes for our driver!
Just minor issues from me below.
drivers/net/ethernet/intel/ice/ice_dcb_lib.c ice_dcb_need_recfg(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg, · line 529
Quoted 13 lines
--- drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 46 +++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-)drivers/net/ethernet/intel/ice/ice_dcb_lib.c +1
-0@@ -526,6 +526,30 @@ ice_dcb_need_recfg(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg,return need_reconfig; } +static void disable_dcb (struct ice_pf *pf)
you have to prefix it with ice_
drivers/net/ethernet/intel/ice/ice_dcb_lib.c ice_dcb_need_recfg(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg, · line 532
Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +3
-0+{ +struct ice_dcbx_cfg *err_cfg; +struct device *dev =ice_pf_to_dev (pf);
Networking code mandates to sort declaration lines by their length, longest to shortest. We call that "reverse xmass tree rule".
drivers/net/ethernet/intel/ice/ice_dcb_lib.c ice_dcb_need_recfg(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg, · line 534
Quoted 2 lines
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +2
-0+ +dev_err (dev,"Disabling DCB until new settings occur\n" );
even for copy-pasted code, it hurts to have this as error here
Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +4
-0+ err_cfg =kzalloc (sizeof (*err_cfg),GFP_KERNEL ); +if (!err_cfg) +return ; +
drivers/net/ethernet/intel/ice/ice_dcb_lib.c ice_dcb_need_recfg(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg, · line 548
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +10
-0+ err_cfg->etscfg.willing = true; + err_cfg->etscfg.tcbwtable[0 ] =ICE_TC_MAX_BW ; + err_cfg->etscfg.tsatable[0 ] =ICE_IEEE_TSA_ETS ; +memcpy (&err_cfg->etsrec, &err_cfg->etscfg,sizeof (err_cfg->etsrec)); +/* Coverity warns the return code of ice_pf_dcb_cfg() is not checked +* here as is done for other calls to that function. That check is +* not necessary since this is in this function's error cleanup path. +* Suppress the Coverity warning with the following comment... +*/ +/* coverity[check_return] */
the comment was silly in the first place, but makes even less sense when extracted to helper function
Quoted 43 lines
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +5
-21+ice_pf_dcb_cfg (pf, err_cfg, false); +kfree (err_cfg); +} +/** * ice_dcb_rebuild - rebuild DCB post reset * @pf: physical function instance @@ -534,7 +558,6 @@ void ice_dcb_rebuild(struct ice_pf *pf) {struct ice_aqc_port_ets_elem buf = {0 };struct device *dev =ice_pf_to_dev (pf); -struct ice_dcbx_cfg *err_cfg;int ret; ret =ice_query_port_ets (pf->hw.port_info, &buf,sizeof (buf),NULL );@@ -574,26 +597,7 @@ void ice_dcb_rebuild(struct ice_pf *pf)return ; dcb_error: -dev_err (dev,"Disabling DCB until new settings occur\n" ); - err_cfg =kzalloc (sizeof (*err_cfg),GFP_KERNEL ); -if (!err_cfg) { -mutex_unlock (&pf->tc_mutex); -return ; - } - - err_cfg->etscfg.willing = true; - err_cfg->etscfg.tcbwtable[0 ] =ICE_TC_MAX_BW ; - err_cfg->etscfg.tsatable[0 ] =ICE_IEEE_TSA_ETS ; -memcpy (&err_cfg->etsrec, &err_cfg->etscfg,sizeof (err_cfg->etsrec)); -/* Coverity warns the return code of ice_pf_dcb_cfg() is not checked -* here as is done for other calls to that function. That check is -* not necessary since this is in this function's error cleanup path. -* Suppress the Coverity warning with the following comment... -*/ -/* coverity[check_return] */ -ice_pf_dcb_cfg (pf, err_cfg, false); -kfree (err_cfg); - +disable_dcb (pf);mutex_unlock (&pf->tc_mutex); }
Bart Van Assche
maintainerRFC PATCH 15/33 ice: Fix a locking bug in an error path
In reply to Bart Van AsscheDo not unlock pf->tc_mutex if it has not been locked. Jumping to 'dcb_error' causes pf->tc_mutex to be unlocked. This bug has been detected by the Clang thread-safety analyzer.
--- drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +2 -1
@@ -563,7 +563,8 @@ void ice_dcb_rebuild(struct ice_pf *pf) ret =ice_query_port_ets (pf->hw.port_info, &buf,sizeof (buf),NULL );if (ret) {dev_err (dev,"Query Port ETS failed\n" ); - goto dcb_error; +disable_dcb (pf); +return ; }mutex_lock (&pf->tc_mutex);
Tony Nguyen
maintainerRe: [PATCH RFC 15/33] ice: Fix a locking bug in an error path
Quoted 3 lines · Bart Van Assche
Do not unlock
pf->tc_mutexif it has not been locked. Jumping to 'dcb_error' causespf->tc_mutexto be unlocked. This bug has been detected by the Clang thread-safety analyzer.
Thanks for catching this Bart. I think it would be better to move the tc_mutex up to cover this call. Though unlikely, the DCB settings could change after this call so it would be better to protect this under the mutex. Also, as the error path is changing configuration, that should be done under this mutex as well.
Thanks,
Tony
Quoted 22 lines
Cc Tony Nguyen <[email protected]>Cc Przemek Kitszel <[email protected]>Fixes 242b5e068b25 ("ice: Fix DCB rebuild after reset")Signed-off-by Bart Van Assche <[email protected]>--- drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_dcb_lib.c +2
-1@@ -563,7 +563,8 @@ void ice_dcb_rebuild(struct ice_pf *pf) ret =ice_query_port_ets (pf->hw.port_info, &buf,sizeof (buf),NULL );if (ret) {dev_err (dev,"Query Port ETS failed\n" ); - goto dcb_error; +disable_dcb (pf); +return ; }mutex_lock (&pf->tc_mutex);
Bart Van Assche
maintainerRe: [PATCH RFC 15/33] ice: Fix a locking bug in an error path
Quoted 6 lines · Tony Nguyen
Quoted 3 lines · Bart Van Assche
Do not unlock
pf->tc_mutexif it has not been locked. Jumping to 'dcb_error' causespf->tc_mutexto be unlocked. This bug has been detected by the Clang thread-safety analyzer.Thanks for catching this Bart. I think it would be better to move the
tc_mutexup to cover this call. Though unlikely, the DCB settings could change after this call so it would be better to protect this under the mutex. Also, as the error path is changing configuration, that should be done under this mutex as well.
Thanks Tony for having taken a look. Is this perhaps the change that you want me to make?
Thanks,
Bart.
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +2 -2
@@ -537,14 +537,14 @@ void ice_dcb_rebuild(struct ice_pf *pf)struct ice_dcbx_cfg *err_cfg;int ret; +mutex_lock (&pf->tc_mutex); + ret =ice_query_port_ets (pf->hw.port_info, &buf,sizeof (buf),NULL );if (ret) {dev_err (dev,"Query Port ETS failed\n" ); goto dcb_error; } -mutex_lock (&pf->tc_mutex); -if (!pf->hw.port_info->qos_cfg.is_sw_lldp)ice_cfg_etsrec_defaults (pf->hw.port_info);
Tony Nguyen
maintainerRe: [PATCH RFC 15/33] ice: Fix a locking bug in an error path
Quoted 10 lines · Bart Van Assche
Quoted 6 lines · Tony Nguyen
Quoted 3 lines · Bart Van Assche
Do not unlock
pf->tc_mutexif it has not been locked. Jumping to 'dcb_error' causespf->tc_mutexto be unlocked. This bug has been detected by the Clang thread-safety analyzer.Thanks for catching this Bart. I think it would be better to move the
tc_mutexup to cover this call. Though unlikely, the DCB settings could change after this call so it would be better to protect this under the mutex. Also, as the error path is changing configuration, that should be done under this mutex as well.Thanks Tony for having taken a look. Is this perhaps the change that you want me to make?
Yes, looks good to me.
Thanks,
Tony
Quoted 26 lines
Thanks,
Bart.
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +2
-2@@ -537,14 +537,14 @@ void ice_dcb_rebuild(struct ice_pf *pf) struct ice_dcbx_cfg *err_cfg; int ret; + mutex_lock(&pf->tc_mutex); + ret = ice_query_port_ets(pf->hw.port_info, &buf, sizeof(buf), NULL); if (ret) { dev_err(dev, "Query Port ETS failed\n"); goto dcb_error; } - mutex_lock(&pf->tc_mutex); - if (!pf->hw.port_info->qos_cfg.is_sw_lldp) ice_cfg_etsrec_defaults(pf->hw.port_info);
Bart Van Assche
maintainerRFC PATCH 16/33 net/mlx5e: Make the code easier to analyze
In reply to Bart Van AsscheMake it possible for clang to perform its compile-time thread-safety analysis by making the arguments of mutex_lock() and mutex_unlock() derived from function arguments instead of local variables. Additionally, move initializers of variables that are not changed into the declaration block.
--- .../mellanox/mlx5/core/en_accel/macsec.c | 62 +++++++------------ 1 file changed, 24 insertions(+), 38 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +24 -38
@@ -510,12 +510,11 @@ static int mlx5e_macsec_add_txsa(struct macsec_context *ctx)struct mlx5_core_dev *mdev = priv->mdev;u8 assoc_num = ctx->sa.assoc_num;struct mlx5e_macsec_sa *tx_sa; -struct mlx5e_macsec *macsec; +struct mlx5e_macsec *macsec = priv->macsec;int err =0 ; -mutex_lock (&priv->macsec->lock); +mutex_lock (&macsec->lock); - macsec = priv->macsec; macsec_device =mlx5e_macsec_get_macsec_device_context (macsec, ctx);if (!macsec_device) {netdev_err (ctx->netdev,"MACsec offload: Failed to find device context\n" );
@@ -581,13 +580,12 @@ static int mlx5e_macsec_upd_txsa(struct macsec_context *ctx)struct mlx5e_macsec_device *macsec_device;u8 assoc_num = ctx->sa.assoc_num;struct mlx5e_macsec_sa *tx_sa; -struct mlx5e_macsec *macsec; +struct mlx5e_macsec *macsec = priv->macsec;struct net_device *netdev;int err =0 ; -mutex_lock (&priv->macsec->lock); +mutex_lock (&macsec->lock); - macsec = priv->macsec; netdev = ctx->netdev; macsec_device =mlx5e_macsec_get_macsec_device_context (macsec, ctx);if (!macsec_device) {
@@ -641,11 +639,10 @@ static int mlx5e_macsec_del_txsa(struct macsec_context *ctx)struct mlx5e_macsec_device *macsec_device;u8 assoc_num = ctx->sa.assoc_num;struct mlx5e_macsec_sa *tx_sa; -struct mlx5e_macsec *macsec; +struct mlx5e_macsec *macsec = priv->macsec;int err =0 ; -mutex_lock (&priv->macsec->lock); - macsec = priv->macsec; +mutex_lock (&macsec->lock); macsec_device =mlx5e_macsec_get_macsec_device_context (macsec, ctx);if (!macsec_device) {netdev_err (ctx->netdev,"MACsec offload: Failed to find device context\n" );
@@ -679,11 +676,10 @@ static int mlx5e_macsec_add_rxsc(struct macsec_context *ctx)struct mlx5e_macsec_device *macsec_device;struct mlx5e_macsec_rx_sc *rx_sc;struct list_head *rx_sc_list; -struct mlx5e_macsec *macsec; +struct mlx5e_macsec *macsec = priv->macsec;int err =0 ; -mutex_lock (&priv->macsec->lock); - macsec = priv->macsec; +mutex_lock (&macsec->lock); macsec_device =mlx5e_macsec_get_macsec_device_context (macsec, ctx);if (!macsec_device) {netdev_err (ctx->netdev,"MACsec offload: Failed to find device context\n" );
@@ -759,14 +755,12 @@ static int mlx5e_macsec_upd_rxsc(struct macsec_context *ctx)struct mlx5e_macsec_device *macsec_device;struct mlx5e_macsec_rx_sc *rx_sc;struct mlx5e_macsec_sa *rx_sa; -struct mlx5e_macsec *macsec; +struct mlx5e_macsec *macsec = priv->macsec;struct list_head *list;int i;int err =0 ; -mutex_lock (&priv->macsec->lock); - - macsec = priv->macsec; +mutex_lock (&macsec->lock); macsec_device =mlx5e_macsec_get_macsec_device_context (macsec, ctx);if (!macsec_device) {netdev_err (ctx->netdev,"MACsec offload: Failed to find device context\n" );
@@ -838,13 +832,11 @@ static int mlx5e_macsec_del_rxsc(struct macsec_context *ctx)struct mlx5e_priv *priv =macsec_netdev_priv (ctx->netdev);struct mlx5e_macsec_device *macsec_device;struct mlx5e_macsec_rx_sc *rx_sc; -struct mlx5e_macsec *macsec; +struct mlx5e_macsec *macsec = priv->macsec;struct list_head *list;int err =0 ; -mutex_lock (&priv->macsec->lock); - - macsec = priv->macsec; +mutex_lock (&macsec->lock); macsec_device =mlx5e_macsec_get_macsec_device_context (macsec, ctx);if (!macsec_device) {netdev_err (ctx->netdev,"MACsec offload: Failed to find device context\n" );
@@ -879,13 +871,11 @@ static int mlx5e_macsec_add_rxsa(struct macsec_context *ctx)struct mlx5e_macsec_rx_sc *rx_sc;sci_t sci = ctx_rx_sa->sc->sci;struct mlx5e_macsec_sa *rx_sa; -struct mlx5e_macsec *macsec; +struct mlx5e_macsec *macsec = priv->macsec;struct list_head *list;int err =0 ; -mutex_lock (&priv->macsec->lock); - - macsec = priv->macsec; +mutex_lock (&macsec->lock); macsec_device =mlx5e_macsec_get_macsec_device_context (macsec, ctx);if (!macsec_device) {netdev_err (ctx->netdev,"MACsec offload: Failed to find device context\n" );
@@ -963,13 +953,11 @@ static int mlx5e_macsec_upd_rxsa(struct macsec_context *ctx)struct mlx5e_macsec_rx_sc *rx_sc;sci_t sci = ctx_rx_sa->sc->sci;struct mlx5e_macsec_sa *rx_sa; -struct mlx5e_macsec *macsec; +struct mlx5e_macsec *macsec = priv->macsec;struct list_head *list;int err =0 ; -mutex_lock (&priv->macsec->lock); - - macsec = priv->macsec; +mutex_lock (&macsec->lock); macsec_device =mlx5e_macsec_get_macsec_device_context (macsec, ctx);if (!macsec_device) {netdev_err (ctx->netdev,"MACsec offload: Failed to find device context\n" );
@@ -1020,13 +1008,11 @@ static int mlx5e_macsec_del_rxsa(struct macsec_context *ctx)struct mlx5e_macsec_rx_sc *rx_sc;u8 assoc_num = ctx->sa.assoc_num;struct mlx5e_macsec_sa *rx_sa; -struct mlx5e_macsec *macsec; +struct mlx5e_macsec *macsec = priv->macsec;struct list_head *list;int err =0 ; -mutex_lock (&priv->macsec->lock); - - macsec = priv->macsec; +mutex_lock (&macsec->lock); macsec_device =mlx5e_macsec_get_macsec_device_context (macsec, ctx);if (!macsec_device) {netdev_err (ctx->netdev,"MACsec offload: Failed to find device context\n" );
@@ -1078,8 +1064,9 @@ static int mlx5e_macsec_add_secy(struct macsec_context *ctx)if (!mlx5e_macsec_secy_features_validate (ctx))return -EINVAL ; -mutex_lock (&priv->macsec->lock); macsec = priv->macsec; + +mutex_lock (&macsec->lock);if (mlx5e_macsec_get_macsec_device_context (macsec, ctx)) {netdev_err (netdev,"MACsec offload: MACsec net_device already exist\n" ); goto out;
@@ -1180,9 +1167,9 @@ static int mlx5e_macsec_upd_secy(struct macsec_context *ctx)if (!mlx5e_macsec_secy_features_validate (ctx))return -EINVAL ; -mutex_lock (&priv->macsec->lock); - macsec = priv->macsec; + +mutex_lock (&macsec->lock); macsec_device =mlx5e_macsec_get_macsec_device_context (macsec, ctx);if (!macsec_device) {netdev_err (ctx->netdev,"MACsec offload: Failed to find device context\n" );
@@ -1229,13 +1216,12 @@ static int mlx5e_macsec_del_secy(struct macsec_context *ctx)struct mlx5e_macsec_device *macsec_device;struct mlx5e_macsec_rx_sc *rx_sc, *tmp;struct mlx5e_macsec_sa *tx_sa; -struct mlx5e_macsec *macsec; +struct mlx5e_macsec *macsec = priv->macsec;struct list_head *list;int err =0 ;int i; -mutex_lock (&priv->macsec->lock); - macsec = priv->macsec; +mutex_lock (&macsec->lock); macsec_device =mlx5e_macsec_get_macsec_device_context (macsec, ctx);if (!macsec_device) {netdev_err (ctx->netdev,"MACsec offload: Failed to find device context\n" );
Bart Van Assche
maintainerRFC PATCH 17/33 Input: synaptics-rmi4 - fix a locking bug in an error path
In reply to Bart Van AsscheLock f54->data_mutex before the first 'goto error' statement since jumping to the 'error' label causes that mutex to be unlocked.
--- drivers/input/rmi4/rmi_f54.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/input/rmi4/rmi_f54.c +3 -2
@@ -541,6 +541,9 @@ static void rmi_f54_work(struct work_struct *work)int i; report_size =rmi_f54_get_report_size (f54); + +mutex_lock (&f54->data_mutex); +if (report_size ==0 ) {dev_err (&fn->dev,"Bad report size, report type=%d\n" , f54->report_type);
@@ -548,8 +551,6 @@ static void rmi_f54_work(struct work_struct *work) goto error;/* retry won't help */ } -mutex_lock (&f54->data_mutex); -/* * Need to check if command has completed. * If not try again later.
Bart Van Assche
maintainerRFC PATCH 18/33 misc: nsm: Fix a locking bug in an error path
In reply to Bart Van AsscheIf nsm->lock has not been locked, do not unlock it from any error path. This bug has been detected by the Clang thread-safety analyzer.
--- drivers/misc/nsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/nsm.c +1 -1
@@ -367,7 +367,7 @@ static long nsm_dev_ioctl(struct file *file, unsigned int cmd,/* Copy user argument struct to kernel argument struct */ r = -EFAULT ;if (copy_from_user (&raw, argp,_IOC_SIZE (cmd))) - goto out; +return r;mutex_lock (&nsm->lock);
Bart Van Assche
maintainerRFC PATCH 19/33 drm/amdgpu: Unlock a mutex before destroying it
In reply to Bart Van AsscheMutexes must be unlocked before these are destroyed. This has been detected by the Clang thread-safety analyzer.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +1 -0
@@ -572,6 +572,7 @@ static void aca_error_fini(struct aca_error *aerr)aca_bank_error_remove (aerr, bank_error); out_unlock: +mutex_unlock (&aerr->lock);mutex_destroy (&aerr->lock); }
Bart Van Assche
maintainerRFC PATCH 20/33 drm/amdgpu: Fix a locking bug in an error path
In reply to Bart Van AsscheDo not unlock con->recovery_lock if it has not been locked.
This bug has been detected by the Clang thread-safety checker.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2 -3
@@ -2820,8 +2820,7 @@ int amdgpu_ras_add_bad_pages(struct amdgpu_device *adev, sizeof(struct eeprom_table_record), GFP_KERNEL);if (!err_data.err_addr) {dev_warn (adev->dev,"Failed to alloc UMC error address record in mca2pa conversion!\n" ); - ret = -ENOMEM ; - goto out; +return -ENOMEM ; } err_rec = err_data.err_addr;
@@ -2927,7 +2926,7 @@ int amdgpu_ras_add_bad_pages(struct amdgpu_device *adev, free:if (from_rom)kfree (err_data.err_addr); -out: +mutex_unlock (&con->recovery_lock);return ret;
Bart Van Assche
maintainerRFC PATCH 21/33 drm/amdgpu: Fix locking bugs in error paths
In reply to Bart Van AsscheDo not unlock psp->ras_context.mutex if it has not been locked. This has been detected by the Clang thread-safety analyzer.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c +8 -6
@@ -332,7 +332,7 @@ static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf, sizereturn -ENOMEM ;if (copy_from_user ((void *)shared_buf, &buf[copy_pos], shared_buf_len)) { ret = -EFAULT ; - goto err_free_shared_buf; + goto free_shared_buf; }set_ta_context_funcs (psp, ta_type, &context);
@@ -340,13 +340,13 @@ static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf, sizeif (!context || !context->initialized) {dev_err (adev->dev,"TA is not initialized\n" ); ret = -EINVAL ; - goto err_free_shared_buf; + goto free_shared_buf; }if (!psp->ta_funcs || !psp->ta_funcs->fn_ta_invoke) {dev_err (adev->dev,"Unsupported function to invoke TA\n" ); ret = -EOPNOTSUPP ; - goto err_free_shared_buf; + goto free_shared_buf; } context->session_id = ta_id;
@@ -354,7 +354,7 @@ static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf, sizemutex_lock (&psp->ras_context.mutex); ret =prep_ta_mem_context (&context->mem_context, shared_buf, shared_buf_len);if (ret) - goto err_free_shared_buf; + goto unlock; ret =psp_fn_ta_invoke (psp, cmd_id);if (ret || context->resp_status) {
@@ -362,15 +362,17 @@ static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf, size ret, context->resp_status);if (!ret) { ret = -EINVAL ; - goto err_free_shared_buf; + goto unlock; } }if (copy_to_user ((char *)&buf[copy_pos], context->mem_context.shared_buf, shared_buf_len)) ret = -EFAULT ; -err_free_shared_buf: +unlock:mutex_unlock (&psp->ras_context.mutex); + +free_shared_buf:kfree (shared_buf);return ret;
Bart Van Assche
maintainerRFC PATCH 22/33 drm: bridge: cdns-mhdp8546: Fix a locking bug in an error path
In reply to Bart Van AsscheDo not unlock mhdp->mbox_mutex if it has not been locked.
This bug has been detected by the Clang thread-safety analyzer.
--- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +1 -2
@@ -502,8 +502,7 @@ int cdns_mhdp_adjust_lt(struct cdns_mhdp_device *mhdp, unsigned int nlanes,if (nlanes !=4 && nlanes !=2 && nlanes !=1 ) {dev_err (mhdp->dev,"invalid number of lanes: %u\n" , nlanes); - ret = -EINVAL ; - goto out; +return -EINVAL ; } payload[0 ] = nlanes;
Bart Van Assche
maintainerRFC PATCH 23/33 drm: bridge: cdns-mhdp8546: Fix a locking bug in an error path
In reply to Bart Van AsscheUnlock mhdp->link_mutex before returning.
This bug has been detected by the Clang thread-safety analyzer.
--- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +4 -2
@@ -2053,8 +2053,10 @@ static void cdns_mhdp_atomic_enable(struct drm_bridge *bridge, mhdp_state =to_cdns_mhdp_bridge_state (new_state); mhdp_state->current_mode =drm_mode_duplicate (bridge->dev, mode); -if (!mhdp_state->current_mode) -return ; +if (!mhdp_state->current_mode) { + ret =0 ; + goto out; + }drm_mode_set_name (mhdp_state->current_mode);
Bart Van Assche
maintainerRFC PATCH 24/33 drm: zynqmp_dp: Fix a deadlock in zynqmp_dp_ignore_hpd_set()
In reply to Bart Van AsscheInstead of attempting the same mutex twice, lock and unlock it.
This bug has been detected by the Clang thread-safety analyzer.
--- drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xlnx/zynqmp_dp.c +1 -1
@@ -2295,7 +2295,7 @@ static int zynqmp_dp_ignore_hpd_set(void *data, u64 val)mutex_lock (&dp->lock); dp->ignore_hpd = val; -mutex_lock (&dp->lock); +mutex_unlock (&dp->lock);return 0 ; }
Re: [PATCH RFC 24/33] drm: zynqmp_dp: Fix a deadlock in zynqmp_dp_ignore_hpd_set()
Quoted 17 lines · Bart Van Assche
Instead of attempting the same mutex twice, lock and unlock it.
This bug has been detected by the Clang thread-safety analyzer.
Cc Sean Anderson <[email protected]>Cc Tomi Valkeinen <[email protected]>Fixes 28edaacb821c ("drm: zynqmp_dp: Add debugfs interface for compliance testing")Signed-off-by Bart Van Assche <[email protected]>--- drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/xlnx/zynqmp_dp.c +0
-0
drivers/gpu/drm/xlnx/zynqmp_dp.c static int zynqmp_dp_ignore_hpd_set(void *data, u64 val) · line 2301
Quoted 8 lines
drivers/gpu/drm/xlnx/zynqmp_dp.c +1
-1@@ -2295,7 +2295,7 @@ static int zynqmp_dp_ignore_hpd_set(void *data, u64 val)mutex_lock (&dp->lock); dp->ignore_hpd = val; -mutex_lock (&dp->lock); +mutex_unlock (&dp->lock);return 0 ; }
Since this patch is marked RFC will it be applied soon? I am about to send a patch which conflicts with this one. I would like to just add this patch to my series.
--Sean
Bart Van Assche
maintainerRe: [PATCH RFC 24/33] drm: zynqmp_dp: Fix a deadlock in zynqmp_dp_ignore_hpd_set()
Quoted 3 lines · Sean Anderson
Since this patch is marked RFC will it be applied soon? I am about to send a patch which conflicts with this one. I would like to just add this patch to my series.
Hi Sean,
Thanks for having taken a look. Please include this patch in your patch series if you want it to be merged in the upstream kernel soon.
Bart.
Bart Van Assche
maintainerRFC PATCH 25/33 wifi: ath12k: Fix locking in error paths
In reply to Bart Van AsscheIf ag->mutex has been locked, unlock it before returning. If it has not been locked, do not unlock it before returning. These bugs have been detected by the Clang thread-safety analyzer.
--- drivers/net/wireless/ath/ath12k/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/core.c +3 -1
@@ -1122,16 +1122,18 @@ int ath12k_core_qmi_firmware_ready(struct ath12k_base *ab)ath12k_core_stop (ab);mutex_unlock (&ab->core_lock); } +mutex_unlock (&ag->mutex); goto exit; err_dp_free:ath12k_dp_free (ab);mutex_unlock (&ab->core_lock); +mutex_unlock (&ag->mutex); + err_firmware_stop:ath12k_qmi_firmware_stop (ab); exit: -mutex_unlock (&ag->mutex);return ret; }
Re: [PATCH RFC 25/33] wifi: ath12k: Fix locking in error paths
Quoted 26 lines · Bart Van Assche
If
ag->mutexhas been locked, unlock it before returning. If it has not been locked, do not unlock it before returning. These bugs have been detected by the Clang thread-safety analyzer.Cc Karthikeyan Periyasamy <[email protected]>Cc Jeff Johnson <[email protected]>Fixes ee146e11b4d9 ("wifi: ath12k: refactor core start based on hardware group")Signed-off-by Bart Van Assche <[email protected]>--- drivers/net/wireless/ath/ath12k/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/wireless/ath/ath12k/core.c +1
-0@@ -1122,16 +1122,18 @@ int ath12k_core_qmi_firmware_ready(struct ath12k_base *ab)ath12k_core_stop (ab);mutex_unlock (&ab->core_lock); } +mutex_unlock (&ag->mutex); goto exit; err_dp_free:ath12k_dp_free (ab);mutex_unlock (&ab->core_lock);
drivers/net/wireless/ath/ath12k/core.c int ath12k_core_qmi_firmware_ready(struct ath12k_base *ab) · line 1139
Quoted 10 lines
drivers/net/wireless/ath/ath12k/core.c +2
-1+mutex_unlock (&ag->mutex); + err_firmware_stop:ath12k_qmi_firmware_stop (ab); exit: -mutex_unlock (&ag->mutex);return ret; }
This looks like a legitimate issue.
Can you submit this as a single patch and cc the ath12k and linux-wireless lists (as I've done in this reply)
Bart Van Assche
maintainerRe: [PATCH RFC 25/33] wifi: ath12k: Fix locking in error paths
Quoted 2 lines · Jeff Johnson
Can you submit this as a single patch and cc the ath12k and linux-wireless lists (as I've done in this reply)
Done :-)
Bart Van Assche
maintainerRFC PATCH 26/33 mctp i3c: Fix locking in error paths
In reply to Bart Van AsscheOnly unlock mi->lock if it is locked. This bug has been detected by the Clang thread-safety analyzer.
--- drivers/net/mctp/mctp-i3c.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/mctp/mctp-i3c.c +4 -1
@@ -112,7 +112,7 @@ static int mctp_i3c_read(struct mctp_i3c_device *mi)if (!skb) { stats->rx_dropped++; rc = -ENOMEM ; - goto err; + goto free_skb; } skb->protocol =htons (ETH_P_MCTP );
@@ -170,8 +170,11 @@ static int mctp_i3c_read(struct mctp_i3c_device *mi)mutex_unlock (&mi->lock);return 0 ; + err:mutex_unlock (&mi->lock); + +free_skb:kfree_skb (skb);return rc; }
Bart Van Assche
maintainerRFC PATCH 27/33 iavf: Fix a locking bug in an error path
In reply to Bart Van AsscheIf the netdev lock has been obtained, unlock it before returning. This bug has been detected by the Clang thread-safety analyzer.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
@@ -2903,8 +2903,8 @@ static void iavf_watchdog_task(struct work_struct *work) }mutex_unlock (&adapter->crit_lock); -netdev_unlock (netdev); restart_watchdog: +netdev_unlock (netdev);if (adapter->state >= __IAVF_DOWN)queue_work (adapter->wq, &adapter->adminq_task);if (adapter->aq_required)
Re: [PATCH RFC 27/33] iavf: Fix a locking bug in an error path
Quoted 6 lines · On Thu, 6 Feb 2025 09:51:08 -0800 Bart Van Assche wrote:
If the netdev lock has been obtained, unlock it before returning. This bug has been detected by the Clang thread-safety analyzer.
Cc Jakub Kicinski <[email protected]>Fixes afc664987ab3 ("eth: iavf: extend the netdev_lock usage")Signed-off-by Bart Van Assche <[email protected]>
Applied to net, thanks!
Bart Van Assche
maintainerRFC PATCH 28/33 wifi: mt76: mt7925: Fix a locking bug in an error path
In reply to Bart Van AsscheCall mt792x_mutex_release() before returning.
This bug has been detected by the Clang thread-safety checker.
--- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +4 -2
@@ -1992,8 +1992,10 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, GFP_KERNEL); mlink =devm_kzalloc (dev->mt76.dev,sizeof (*mlink),GFP_KERNEL ); -if (!mconf || !mlink) -return -ENOMEM ; +if (!mconf || !mlink) { + err = -ENOMEM ; + goto free; + } } mconfs[link_id] = mconf;
Bart Van Assche
maintainerRFC PATCH 29/33 hwmon: (it87) Check the it87_lock() return value
In reply to Bart Van AsscheReturn early in it87_resume() if it87_lock() fails instead of ignoring the return value of that function. This patch suppresses a Clang thread-safety warning.
--- drivers/hwmon/it87.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hwmon/it87.c +3 -1
@@ -3593,7 +3593,9 @@ static int it87_resume(struct device *dev)it87_resume_sio (pdev); -it87_lock (data); +int err =it87_lock (data); +if (err) +return err;it87_check_pwm (dev);it87_check_limit_regs (data);
Guenter Roeck
maintainerRe: [PATCH RFC 29/33] hwmon: (it87) Check the it87_lock() return value
Quoted 17 lines · Bart Van Assche
Return early in
it87_resume()ifit87_lock()fails instead of ignoring the return value of that function. This patch suppresses a Clang thread-safety warning.Cc Frank Crawford <[email protected]>Cc Guenter Roeck <[email protected]>Fixes 376e1a937b30 ("hwmon: (it87) Add calls to smbus_enable/smbus_disable as required")Signed-off-by Bart Van Assche <[email protected]>--- drivers/hwmon/it87.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/hwmon/it87.c +0
-0
drivers/hwmon/it87.c static int it87_resume(struct device *dev) · line 3596
Quoted 5 lines
drivers/hwmon/it87.c +1
-1@@ -3593,7 +3593,9 @@ static int it87_resume(struct device *dev)it87_resume_sio (pdev); -it87_lock (data); +int err =it87_lock (data);
I am not going to accept patches with inline variable declarations if the patch is fixing an earlier problem, sorry. This only results in unnecessary backport failures.
Guenter
Bart Van Assche
maintainerRe: [PATCH RFC 29/33] hwmon: (it87) Check the it87_lock() return value
Quoted 13 lines · Guenter Roeck
drivers/hwmon/it87.c static int it87_resume(struct device *dev) · line 3594
Quoted 8 lines · Bart Van Assche
drivers/hwmon/it87.c +1
-1@@ -3593,7 +3593,9 @@ static int it87_resume(struct device *dev) it87_resume_sio(pdev); - it87_lock(data); + int err = it87_lock(data);I am not going to accept patches with inline variable declarations if the patch is fixing an earlier problem, sorry. This only results in unnecessary backport failures.
Hi Guenter,
Is this perhaps how you want me to format this patch?
drivers/hwmon/it87.c +4 -1
@@ -3590,10 +3590,13 @@ static int it87_resume(struct device *dev) {struct platform_device *pdev =to_platform_device (dev);struct it87_data *data =dev_get_drvdata (dev); +int err;it87_resume_sio (pdev); -it87_lock (data); + err =it87_lock (data); +if (err) +return err;it87_check_pwm (dev);it87_check_limit_regs (data);
Thanks,
Bart.
Guenter Roeck
maintainerRe: [PATCH RFC 29/33] hwmon: (it87) Check the it87_lock() return value
Quoted 15 lines · Bart Van Assche
Quoted 13 lines · Guenter Roeck
drivers/hwmon/it87.c static int it87_resume(struct device *dev) · line 3594
Quoted 8 lines · Bart Van Assche
drivers/hwmon/it87.c +1
-1@@ -3593,7 +3593,9 @@ static int it87_resume(struct device *dev) it87_resume_sio(pdev); - it87_lock(data); + int err = it87_lock(data);I am not going to accept patches with inline variable declarations if the patch is fixing an earlier problem, sorry. This only results in unnecessary backport failures.
Quoted 4 lines
Hi Guenter,
Is this perhaps how you want me to format this patch?
Yes, that would be ok.
Guenter
Quoted 23 lines
drivers/hwmon/it87.c +4
-1@@ -3590,10 +3590,13 @@ static int it87_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct it87_data *data = dev_get_drvdata(dev); + int err; it87_resume_sio(pdev); - it87_lock(data); + err = it87_lock(data); + if (err) + return err; it87_check_pwm(dev); it87_check_limit_regs(data);Thanks,
Bart.
Re: [PATCH RFC 29/33] hwmon: (it87) Check the it87_lock() return value
Bart,
Quoted 40 lines · Guenter Roeck
Quoted 18 lines · Bart Van Assche
Quoted 16 lines · Guenter Roeck
drivers/hwmon/it87.c static int it87_resume(struct device · line 3595
Quoted 9 lines · Bart Van Assche
drivers/hwmon/it87.c +1
-1@@ -3593,7 +3593,9 @@ static int it87_resume(struct device *dev) it87_resume_sio(pdev); - it87_lock(data); + int err = it87_lock(data);I am not going to accept patches with inline variable declarations
if the patch is fixing an earlier problem, sorry. This only results
in unnecessary backport failures.Quoted 4 lines
Hi Guenter,
Is this perhaps how you want me to format this patch?
Yes, that would be ok.
Guenter
Quoted 12 lines
drivers/hwmon/it87.c +1
-0@@ -3590,10 +3590,13 @@ static int it87_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct it87_data *data = dev_get_drvdata(dev); + int err; it87_resume_sio(pdev);
Quoted 8 lines
drivers/hwmon/it87.c static int it87_resume(struct device *dev) · line 3602
Quoted 8 lines
drivers/hwmon/it87.c +3
-1- it87_lock(data); + err = it87_lock(data); + if (err) + return err; it87_check_pwm(dev); it87_check_limit_regs(data);
Thanks for that (and to Guenter to get it correctly formatted).
I will check it doesn't cause any other problems, but given the location, I think it should be all fine.
Quoted 4 lines
Quoted 3 lines
Thanks,
Bart.
Regards
Frank
Christoph Hellwig
maintainerRe: [PATCH RFC 29/33] hwmon: (it87) Check the it87_lock() return value
In reply to Guenter RoeckQuoted 6 lines · Guenter Roeck
drivers/hwmon/it87.c static int it87_resume(struct device *dev) · line 3596
Quoted 2 lines
- it87_lock(data);drivers/hwmon/it87.c +1
-0+int err =it87_lock (data);I am not going to accept patches with inline variable declarations if the patch is fixing an earlier problem, sorry. This only results in unnecessary backport failures.
In fact the inline variable declarations should never be used in "normal" code by Linux coding standards. The only reason the warning is disabled is for some of the magic scoping macros.
Bart Van Assche
maintainerRFC PATCH 30/33 drivers/net/ethernet/marvell/octeontx2/nic: Fix locking in an error path
In reply to Bart Van AsscheOnly unlock pf->mbox.lock if it has been locked by otx2_do_set_vf_vlan(). This bug has been detected by the Clang thread-safety analyzer.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +1 -1
@@ -2517,7 +2517,7 @@ static int otx2_do_set_vf_vlan(struct otx2_nic *pf, int vf, u16 vlan, u8 qos, config = &pf->vf_configs[vf];if (!vlan && !config->vlan) - goto out; +return err;mutex_lock (&pf->mbox.lock);
Bart Van Assche
maintainerRFC PATCH 31/33 md/raid*: Fix raid*_set_queue_limits()
In reply to Bart Van Asschequeue_limits_cancel_update() must only be called if queue_limits_start_update() is called first. Remove the queue_limits_cancel_update() calls from the raid*_set_limits() functions because there is no corresponding queue_limits_start_update() call.
--- drivers/md/raid0.c | 4 +--- drivers/md/raid1.c | 4 +--- drivers/md/raid10.c | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-)
drivers/md/raid0.c +1 -3
@@ -386,10 +386,8 @@ static int raid0_set_limits(struct mddev *mddev) lim.io_opt = lim.io_min * mddev->raid_disks; lim.features |=BLK_FEAT_ATOMIC_WRITES ; err =mddev_stack_rdev_limits (mddev, &lim,MDDEV_STACK_INTEGRITY ); -if (err) { -queue_limits_cancel_update (mddev->gendisk->queue); +if (err)return err; - }return queue_limits_set (mddev->gendisk->queue, &lim); }
drivers/md/raid1.c +1 -3
@@ -3219,10 +3219,8 @@ static int raid1_set_limits(struct mddev *mddev) lim.max_write_zeroes_sectors =0 ; lim.features |=BLK_FEAT_ATOMIC_WRITES ; err =mddev_stack_rdev_limits (mddev, &lim,MDDEV_STACK_INTEGRITY ); -if (err) { -queue_limits_cancel_update (mddev->gendisk->queue); +if (err)return err; - }return queue_limits_set (mddev->gendisk->queue, &lim); }
drivers/md/raid10.c +1 -3
@@ -4020,10 +4020,8 @@ static int raid10_set_queue_limits(struct mddev *mddev) lim.io_opt = lim.io_min *raid10_nr_stripes (conf); lim.features |=BLK_FEAT_ATOMIC_WRITES ; err =mddev_stack_rdev_limits (mddev, &lim,MDDEV_STACK_INTEGRITY ); -if (err) { -queue_limits_cancel_update (mddev->gendisk->queue); +if (err)return err; - }return queue_limits_set (mddev->gendisk->queue, &lim); }
Bart Van Assche
maintainerRFC PATCH 32/33 treewide: Annotate all struct mutex users
In reply to Bart Van AsscheAnnotate functions with one of the following attributes as appropriate:
* ACQUIRE() if a mutex is acquired by a function.
* RELEASE() if a mutex is unlocked by a function.
* REQUIRES() if a mutex is unlocked and locked by a function.
* NO_THREAD_SAFETY_ANALYSIS if the locking pattern is too complex for the Clang thread-safety analyzer.
Expand local variables in mutex lock/unlock calls where necessary since the Clang thread-safety checker does not support alias analysis.
--- arch/arm64/kvm/arm.c | 2 ++ arch/powerpc/kernel/rtas.c | 1 + arch/powerpc/platforms/powermac/low_i2c.c | 6 ++++ arch/powerpc/platforms/pseries/papr-vpd.c | 2 ++ arch/x86/events/core.c | 1 + arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 2 ++ arch/x86/kernel/cpu/sgx/encl.c | 2 ++ arch/x86/kernel/ftrace.c | 2 ++ arch/x86/kernel/module.c | 1 + arch/x86/kvm/svm/sev.c | 6 ++++ block/bdev.c | 3 ++ block/blk-cgroup.c | 2 ++ block/ioctl.c | 1 + drivers/accel/amdxdna/aie2_error.c | 5 +-- drivers/accel/qaic/qaic_control.c | 1 + drivers/acpi/scan.c | 5 +++ drivers/ata/libata-core.c | 31 +++++++++++++++++-- drivers/ata/libata-eh.c | 2 ++ drivers/ata/libata.h | 6 ++-- drivers/base/bus.c | 1 + drivers/base/core.c | 7 +++++ drivers/base/dd.c | 2 ++ drivers/base/power/clock_ops.c | 4 +++ drivers/base/power/main.c | 2 ++ drivers/base/regmap/regmap-irq.c | 2 ++ drivers/base/regmap/regmap.c | 2 ++ drivers/block/drbd/drbd_bitmap.c | 2 ++ drivers/block/drbd/drbd_main.c | 7 +++++ drivers/block/drbd/drbd_nl.c | 1 + drivers/block/drbd/drbd_receiver.c | 1 + drivers/block/drbd/drbd_state.c | 4 +++ drivers/block/loop.c | 2 ++ drivers/block/nbd.c | 3 ++ drivers/block/null_blk/zoned.c | 2 ++ drivers/block/rnbd/rnbd-clt.c | 2 ++ drivers/bus/fsl-mc/mc-sys.c | 1 + drivers/bus/vexpress-config.c | 2 ++ drivers/cdx/cdx_msi.c | 2 ++ drivers/char/ipmi/ipmi_msghandler.c | 1 + drivers/char/misc.c | 2 ++ drivers/char/powernv-op-panel.c | 2 ++ drivers/char/tpm/tpm-chip.c | 3 ++ drivers/char/xillybus/xillybus_core.c | 1 + drivers/clk/clk.c | 4 +++ drivers/comedi/comedi_fops.c | 2 ++ drivers/comedi/drivers.c | 1 + drivers/comedi/drivers/usbduxsigma.c | 1 + drivers/counter/rz-mtu3-cnt.c | 3 ++ drivers/cpuidle/cpuidle.c | 2 ++ drivers/crypto/exynos-rng.c | 1 + drivers/crypto/hisilicon/qm.c | 4 +++ drivers/crypto/intel/qat/qat_common/adf_cfg.c | 2 ++ .../qat/qat_common/adf_transport_debug.c | 4 +++ drivers/cxl/core/port.c | 2 ++ drivers/devfreq/devfreq.c | 1 + drivers/dpll/dpll_netlink.c | 6 ++++ drivers/firmware/arm_ffa/driver.c | 1 + drivers/firmware/arm_scmi/notify.c | 1 + .../firmware/arm_scmi/transports/mailbox.c | 2 ++ drivers/firmware/arm_scmi/transports/optee.c | 2 ++ .../firmware/qcom/qcom_qseecom_uefisecapp.c | 2 ++ drivers/fpga/fpga-bridge.c | 2 ++ drivers/fpga/fpga-region.c | 3 ++ drivers/gpio/gpio-adnp.c | 2 ++ drivers/gpio/gpio-crystalcove.c | 2 ++ drivers/gpio/gpio-dln2.c | 2 ++ drivers/gpio/gpio-ljca.c | 2 ++ drivers/gpio/gpio-max77620.c | 2 ++ drivers/gpio/gpio-mlxbf2.c | 2 ++ drivers/gpio/gpio-pca953x.c | 2 ++ drivers/gpio/gpio-pcf857x.c | 2 ++ drivers/gpio/gpio-pmic-eic-sprd.c | 2 ++ drivers/gpio/gpio-stmpe.c | 2 ++ drivers/gpio/gpio-tc3589x.c | 2 ++ drivers/gpio/gpio-virtio.c | 2 ++ drivers/gpio/gpio-wcove.c | 2 ++ drivers/gpu/drm/amd/amdgpu/aldebaran.c | 1 + .../drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c | 4 +++ .../drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c | 4 +++ .../drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c | 4 +++ .../drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12.c | 4 +++ .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 4 +++ .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c | 4 +++ .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 8 +++++ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 1 + drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c | 2 ++ drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 4 ++- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 +++ .../drm/amd/amdkfd/kfd_device_queue_manager.c | 5 +++ .../drm/amd/amdkfd/kfd_device_queue_manager.h | 2 ++ drivers/gpu/drm/amd/amdkfd/kfd_svm.h | 2 ++ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++ .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 1 + drivers/gpu/drm/ast/ast_ddc.c | 2 ++ drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 2 ++ drivers/gpu/drm/clients/drm_log.c | 2 ++ drivers/gpu/drm/display/drm_dp_helper.c | 3 ++ drivers/gpu/drm/display/drm_dp_mst_topology.c | 2 ++ drivers/gpu/drm/drm_atomic_helper.c | 3 ++ drivers/gpu/drm/drm_auth.c | 2 ++ drivers/gpu/drm/drm_client_modeset.c | 1 + drivers/gpu/drm/drm_color_mgmt.c | 1 + drivers/gpu/drm/drm_crtc.c | 1 + drivers/gpu/drm/drm_drv.c | 1 + drivers/gpu/drm/drm_fb_helper.c | 1 + drivers/gpu/drm/drm_file.c | 4 +++ drivers/gpu/drm/drm_gem.c | 4 ++- drivers/gpu/drm/drm_mode_object.c | 2 ++ drivers/gpu/drm/drm_modeset_lock.c | 2 ++ drivers/gpu/drm/drm_plane.c | 1 + drivers/gpu/drm/drm_prime.c | 1 + drivers/gpu/drm/i915/display/intel_cdclk.c | 1 + .../drm/i915/display/intel_display_reset.c | 2 ++ drivers/gpu/drm/i915/display/intel_gmbus.c | 3 ++ drivers/gpu/drm/i915/display/intel_pps.c | 2 ++ drivers/gpu/drm/i915/display/intel_psr.c | 3 ++ drivers/gpu/drm/i915/display/intel_tc.c | 4 +++ drivers/gpu/drm/i915/gem/i915_gem_context.h | 2 ++ .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 1 + drivers/gpu/drm/i915/gt/intel_context.h | 4 +++ drivers/gpu/drm/i915/gt/selftest_context.c | 1 + drivers/gpu/drm/i915/gt/selftest_timeline.c | 1 + drivers/gpu/drm/i915/gvt/vgpu.c | 1 + drivers/gpu/drm/i915/i915_request.c | 1 + drivers/gpu/drm/i915/i915_vma.c | 3 +- drivers/gpu/drm/i915/intel_sbi.c | 2 ++ drivers/gpu/drm/i915/intel_wakeref.c | 2 ++ drivers/gpu/drm/i915/intel_wakeref.h | 2 ++ drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c | 1 + drivers/gpu/drm/i915/vlv_sideband.c | 2 ++ drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 1 + drivers/gpu/drm/mgag200/mgag200_ddc.c | 2 ++ drivers/gpu/drm/msm/msm_atomic.c | 2 ++ drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 ++ drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 ++ drivers/gpu/drm/nouveau/nouveau_uvmm.h | 2 ++ drivers/gpu/drm/nouveau/nvkm/core/subdev.c | 1 + .../gpu/drm/nouveau/nvkm/engine/fifo/chan.c | 3 +- .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c | 1 + drivers/gpu/drm/nouveau/nvkm/falcon/cmdq.c | 3 ++ .../gpu/drm/nouveau/nvkm/subdev/i2c/auxch.c | 2 ++ drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c | 2 ++ drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c | 2 ++ .../drm/nouveau/nvkm/subdev/instmem/nv50.c | 24 +++++++------- drivers/gpu/drm/panthor/panthor_mmu.c | 1 + drivers/gpu/drm/qxl/qxl_cmd.c | 1 + drivers/gpu/drm/qxl/qxl_display.c | 2 ++ drivers/gpu/drm/radeon/radeon_i2c.c | 2 ++ drivers/gpu/drm/radeon/radeon_ring.c | 3 ++ drivers/gpu/drm/rockchip/cdn-dp-core.c | 1 + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 2 ++ drivers/gpu/drm/tegra/hdmi.c | 2 ++ drivers/gpu/drm/ttm/tests/ttm_bo_test.c | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c | 7 ++++- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 5 +++ drivers/gpu/drm/vmwgfx/vmwgfx_validation.c | 3 ++ drivers/gpu/drm/xe/xe_migrate.c | 1 + drivers/gpu/drm/xe/xe_pcode.c | 1 + drivers/gpu/host1x/bus.c | 2 ++ drivers/gpu/host1x/cdma.c | 6 ++++ drivers/gpu/host1x/context.c | 1 + drivers/gpu/host1x/mipi.c | 2 ++ drivers/hid/hid-wiimote.h | 3 ++ drivers/hv/channel.c | 2 ++ drivers/hwmon/abituguru.c | 2 ++ drivers/hwmon/abituguru3.c | 2 ++ drivers/hwmon/it87.c | 2 ++ drivers/hwmon/lm78.c | 1 + drivers/hwmon/nct7904.c | 2 ++ drivers/hwmon/pmbus/pmbus_core.c | 1 + drivers/hwmon/w83781d.c | 1 + drivers/hwtracing/intel_th/msu.c | 1 + drivers/hwtracing/stm/policy.c | 2 ++ drivers/i2c/busses/i2c-amd-mp2-pci.c | 2 ++ drivers/i2c/busses/i2c-xiic.c | 1 + drivers/i2c/i2c-atr.c | 3 ++ drivers/iio/accel/kionix-kx022a.c | 3 ++ drivers/iio/adc/meson_saradc.c | 2 ++ drivers/iio/buffer/industrialio-buffer-dma.c | 2 ++ drivers/iio/industrialio-core.c | 4 +++ drivers/iio/light/opt3001.c | 1 + drivers/infiniband/core/cma.c | 5 +++ drivers/infiniband/core/security.c | 1 + drivers/infiniband/core/umem_odp.c | 1 + drivers/infiniband/hw/hns/hns_roce_hem.c | 2 ++ drivers/infiniband/hw/mlx4/main.c | 2 ++ drivers/infiniband/hw/mlx5/mr.c | 1 + drivers/infiniband/hw/mlx5/odp.c | 1 + drivers/infiniband/hw/mlx5/umr.c | 2 ++ drivers/input/input.c | 3 ++ drivers/input/joystick/pxrc.c | 2 ++ drivers/input/keyboard/adp5588-keys.c | 2 ++ drivers/input/misc/ati_remote2.c | 2 ++ drivers/input/misc/cm109.c | 2 ++ drivers/input/mouse/psmouse-base.c | 1 + drivers/input/mouse/synaptics_usb.c | 2 ++ drivers/input/serio/i8042.c | 2 ++ drivers/input/serio/libps2.c | 2 ++ drivers/iommu/iommufd/device.c | 2 ++ drivers/iommu/iommufd/hw_pagetable.c | 1 + drivers/md/bcache/alloc.c | 2 ++ drivers/md/bcache/btree.c | 1 + drivers/md/bcache/super.c | 2 ++ drivers/md/dm-bufio.c | 2 ++ drivers/md/dm-crypt.c | 1 + drivers/md/dm-vdo/indexer/index-session.c | 1 + drivers/md/dm-vdo/indexer/volume-index.c | 3 ++ drivers/md/dm-vdo/indexer/volume.c | 1 + drivers/md/dm-writecache.c | 6 ++++ drivers/md/dm-zoned-metadata.c | 6 ++++ drivers/md/dm.c | 5 +++ drivers/md/md-cluster.c | 12 +++++-- drivers/md/md.c | 8 +++++ drivers/md/md.h | 9 +++++- drivers/media/cec/core/cec-adap.c | 5 +++ .../media/common/videobuf2/videobuf2-core.c | 2 ++ .../media/common/videobuf2/videobuf2-v4l2.c | 7 +++++ drivers/media/dvb-core/dvb_frontend.c | 1 + drivers/media/dvb-core/dvb_vb2.c | 2 ++ drivers/media/dvb-frontends/dib9000.c | 1 + drivers/media/dvb-frontends/stv090x.c | 2 ++ drivers/media/dvb-frontends/stv0910.c | 1 + drivers/media/dvb-frontends/ts2020.c | 2 ++ drivers/media/mc/mc-device.c | 1 + drivers/media/mc/mc-entity.c | 1 + drivers/media/pci/cx18/cx18-alsa.h | 2 ++ drivers/media/pci/ddbridge/ddbridge-core.c | 1 + drivers/media/pci/ivtv/ivtv-alsa.h | 2 ++ drivers/media/pci/ivtv/ivtv-fileops.c | 2 ++ drivers/media/pci/ivtv/ivtv-ioctl.c | 3 ++ drivers/media/pci/ivtv/ivtv-yuv.c | 3 ++ drivers/media/platform/amphion/vpu_v4l2.c | 3 ++ .../platform/chips-media/coda/coda-jpeg.c | 1 + .../mediatek/vcodec/decoder/mtk_vcodec_dec.c | 2 ++ .../vcodec/decoder/mtk_vcodec_dec_pm.c | 2 ++ .../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 2 ++ .../media/platform/nvidia/tegra-vde/h264.c | 5 +++ drivers/media/platform/nvidia/tegra-vde/vde.c | 2 ++ .../platform/samsung/exynos4-is/media-dev.h | 2 ++ .../media/platform/samsung/s5p-mfc/s5p_mfc.c | 2 ++ drivers/media/platform/st/sti/hva/hva-hw.c | 1 + drivers/media/platform/ti/omap3isp/ispvideo.c | 2 ++ .../test-drivers/vivid/vivid-kthread-cap.c | 1 + drivers/media/usb/dvb-usb-v2/mxl111sf.c | 2 ++ drivers/media/usb/dvb-usb/cxusb-analog.c | 1 + drivers/media/usb/dvb-usb/cxusb.c | 1 + drivers/media/usb/go7007/go7007-i2c.c | 3 ++ drivers/media/usb/gspca/finepix.c | 1 + drivers/media/usb/gspca/jl2005bcd.c | 1 + drivers/media/usb/gspca/sn9c20x.c | 1 + drivers/media/usb/gspca/sonixj.c | 1 + drivers/media/usb/gspca/sq905.c | 2 ++ drivers/media/usb/gspca/sq905c.c | 1 + drivers/media/usb/gspca/vicam.c | 1 + drivers/media/usb/gspca/zc3xx.c | 1 + drivers/media/usb/hdpvr/hdpvr-video.c | 1 + drivers/media/usb/pvrusb2/pvrusb2-context.c | 2 ++ drivers/media/usb/uvc/uvc_ctrl.c | 1 + drivers/media/v4l2-core/v4l2-event.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + drivers/media/v4l2-core/v4l2-mem2mem.c | 1 + drivers/media/v4l2-core/v4l2-subdev.c | 1 + drivers/message/fusion/mptctl.c | 11 +++++-- drivers/mfd/88pm860x-core.c | 2 ++ drivers/mfd/atc260x-core.c | 2 ++ drivers/mfd/kempld-core.c | 2 ++ drivers/mfd/lp8788-irq.c | 2 ++ drivers/mfd/max8925-core.c | 2 ++ drivers/mfd/max8997-irq.c | 2 ++ drivers/mfd/max8998-irq.c | 2 ++ drivers/mfd/mc13xxx-core.c | 2 ++ drivers/mfd/mt6358-irq.c | 2 ++ drivers/mfd/mt6397-irq.c | 2 ++ drivers/mfd/rc5t583-irq.c | 2 ++ drivers/mfd/stmfx.c | 2 ++ drivers/mfd/stmpe.c | 2 ++ drivers/mfd/tps65217.c | 2 ++ drivers/mfd/tps6586x.c | 2 ++ drivers/mfd/twl4030-irq.c | 2 ++ drivers/mfd/wm831x-irq.c | 2 ++ drivers/mfd/wm8350-irq.c | 2 ++ drivers/misc/cardreader/rtsx_usb.c | 2 ++ drivers/misc/mei/client.c | 7 +++++ drivers/misc/mei/hbm.c | 1 + drivers/misc/mei/hw-me.c | 9 ++++++ drivers/misc/mei/hw-txe.c | 4 +++ drivers/misc/mei/main.c | 1 + drivers/misc/ntsync.c | 2 ++ drivers/misc/sgi-gru/grufault.c | 3 ++ drivers/misc/sgi-gru/grumain.c | 1 + drivers/misc/vmw_vmci/vmci_queue_pair.c | 2 ++ drivers/mmc/host/vub300.c | 2 ++ drivers/mtd/chips/cfi_cmdset_0001.c | 4 +++ drivers/mtd/chips/cfi_cmdset_0002.c | 6 ++++ drivers/mtd/lpddr/lpddr_cmds.c | 4 +++ drivers/mtd/nand/ecc-mtk.c | 2 ++ drivers/mtd/nand/ecc-mxic.c | 2 ++ drivers/mtd/nand/raw/atmel/pmecc.c | 2 ++ drivers/mtd/nand/raw/nand_base.c | 4 +++ drivers/mtd/spi-nor/controllers/hisi-sfc.c | 2 ++ drivers/mtd/spi-nor/core.c | 6 ++++ drivers/net/can/softing/softing_main.c | 1 + drivers/net/dsa/microchip/ksz_common.c | 2 ++ drivers/net/dsa/microchip/ksz_common.h | 2 ++ drivers/net/dsa/microchip/ksz_ptp.c | 2 ++ drivers/net/dsa/mt7530-mdio.c | 2 ++ drivers/net/dsa/mt7530.c | 2 ++ drivers/net/dsa/mv88e6xxx/chip.c | 3 ++ drivers/net/dsa/mv88e6xxx/chip.h | 2 ++ drivers/net/dsa/mv88e6xxx/global2.c | 2 ++ drivers/net/dsa/mv88e6xxx/pcs-6352.c | 2 ++ drivers/net/dsa/mv88e6xxx/phy.c | 2 ++ drivers/net/dsa/qca/ar9331.c | 2 ++ drivers/net/dsa/realtek/rtl83xx.c | 2 ++ drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 2 ++ .../net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 ++ .../net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 2 ++ .../net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c | 2 ++ .../net/ethernet/broadcom/bnxt/bnxt_hwrm.c | 2 ++ drivers/net/ethernet/broadcom/tg3.c | 1 + drivers/net/ethernet/davicom/dm9000.c | 1 + drivers/net/ethernet/davicom/dm9051.c | 2 ++ drivers/net/ethernet/emulex/benet/be_cmds.c | 2 ++ .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 ++ drivers/net/ethernet/hisilicon/hns3/hnae3.c | 2 ++ .../hisilicon/hns3/hns3pf/hclge_main.c | 1 + drivers/net/ethernet/intel/e1000e/82571.c | 3 ++ drivers/net/ethernet/intel/e1000e/ich8lan.c | 2 ++ drivers/net/ethernet/intel/iavf/iavf_main.c | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 1 + drivers/net/ethernet/intel/ice/ice_ddp.c | 2 ++ drivers/net/ethernet/intel/ice/ice_ethtool.c | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 1 + drivers/net/ethernet/intel/ice/ice_vf_lib.c | 1 + drivers/net/ethernet/intel/idpf/idpf.h | 2 ++ .../ethernet/marvell/octeontx2/af/rvu_nix.c | 3 ++ .../marvell/octeontx2/af/rvu_npc_fs.c | 1 + .../net/ethernet/marvell/octeontx2/nic/rep.c | 1 + .../marvell/prestera/prestera_counter.c | 4 +++ .../ethernet/marvell/prestera/prestera_pci.c | 2 ++ drivers/net/ethernet/mellanox/mlx4/cmd.c | 2 ++ drivers/net/ethernet/mellanox/mlx4/port.c | 5 +++ .../ethernet/mellanox/mlx5/core/en/mod_hdr.c | 1 + .../mellanox/mlx5/core/en/reporter_rx.c | 2 ++ .../mellanox/mlx5/core/en/tc/ct_fs_hmfs.c | 1 + .../mellanox/mlx5/core/en/tc/ct_fs_smfs.c | 1 + .../mellanox/mlx5/core/en/tc/int_port.c | 1 + .../mellanox/mlx5/core/en/tc_tun_encap.c | 3 ++ .../net/ethernet/mellanox/mlx5/core/en_tc.c | 1 + .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 2 ++ .../net/ethernet/mellanox/mlx5/core/main.c | 2 ++ .../mellanox/mlx5/core/steering/hws/bwc.c | 2 ++ .../mlx5/core/steering/sws/dr_types.h | 6 ++++ drivers/net/ethernet/micrel/ks8851_spi.c | 2 ++ .../ethernet/microchip/encx24j600-regmap.c | 2 ++ .../net/ethernet/microchip/vcap/vcap_api.c | 4 +++ .../netronome/nfp/nfpcore/nfp_cppcore.c | 2 ++ drivers/net/ethernet/qlogic/qed/qed_ll2.c | 1 + drivers/net/ethernet/qlogic/qed/qed_vf.c | 4 ++- drivers/net/ethernet/qlogic/qede/qede_main.c | 7 +++++ drivers/net/ethernet/sfc/ef10_sriov.c | 1 + drivers/net/ethernet/sfc/efx_common.c | 5 +++ drivers/net/ethernet/sfc/falcon/efx.c | 2 ++ drivers/net/ethernet/sfc/mcdi_filters.c | 1 + drivers/net/ethernet/sfc/siena/efx_common.c | 3 ++ drivers/net/ethernet/xilinx/xilinx_axienet.h | 2 ++ drivers/net/macsec.c | 1 + drivers/net/mctp/mctp-i3c.c | 2 ++ drivers/net/phy/dp83640.c | 2 ++ drivers/net/phy/phy-core.c | 3 ++ drivers/net/phy/phy_device.c | 1 + drivers/net/phy/sfp-bus.c | 1 + drivers/net/pse-pd/pse_core.c | 2 +- drivers/net/team/team_core.c | 2 ++ drivers/net/tun.c | 1 + drivers/net/usb/hso.c | 2 ++ drivers/net/usb/lan78xx.c | 2 ++ drivers/net/wireless/ath/ath6kl/sdio.c | 1 + drivers/net/wireless/ath/ath9k/hif_usb.c | 1 + drivers/net/wireless/ath/wil6210/main.c | 1 + drivers/net/wireless/ath/wil6210/p2p.c | 2 ++ drivers/net/wireless/broadcom/b43/main.c | 1 + .../net/wireless/broadcom/b43legacy/main.c | 1 + .../broadcom/brcm80211/brcmfmac/fwvid.c | 2 ++ drivers/net/wireless/intel/iwlwifi/dvm/lib.c | 1 + drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 3 ++ drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 3 ++ .../wireless/intel/iwlwifi/mvm/time-event.c | 2 ++ drivers/net/wireless/intersil/p54/p54pci.c | 1 + drivers/net/wireless/intersil/p54/p54usb.c | 1 + drivers/net/wireless/marvell/mwl8k.c | 2 ++ .../wireless/mediatek/mt76/mt7615/testmode.c | 1 + .../net/wireless/mediatek/mt76/mt76_connac.h | 2 ++ .../net/wireless/mediatek/mt76/mt7915/main.c | 1 + .../wireless/mediatek/mt76/mt7915/testmode.c | 5 +++ .../net/wireless/microchip/wilc1000/wlan.c | 2 ++ drivers/net/wireless/quantenna/qtnfmac/bus.h | 2 ++ drivers/net/wireless/realtek/rtw88/main.c | 1 + drivers/net/wireless/realtek/rtw89/core.c | 1 + drivers/net/wireless/realtek/rtw89/mac80211.c | 2 ++ drivers/net/wireless/realtek/rtw89/wow.c | 4 +++ drivers/net/wireless/realtek/rtw89/wow.h | 2 +- drivers/net/wireless/rsi/rsi_91x_hal.c | 1 + drivers/net/wireless/st/cw1200/pm.c | 2 ++ drivers/net/wireless/ti/wl12xx/main.c | 1 + drivers/net/wireless/ti/wlcore/main.c | 4 +++ drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 2 ++ drivers/nvdimm/bus.c | 1 + drivers/nvdimm/core.c | 2 ++ drivers/nvdimm/namespace_devs.c | 1 + drivers/nvme/host/core.c | 2 ++ drivers/nvme/host/pci.c | 1 + drivers/nvmem/sc27xx-efuse.c | 2 ++ drivers/nvmem/sprd-efuse.c | 2 ++ drivers/of/dynamic.c | 4 +++ drivers/of/overlay.c | 2 ++ drivers/opp/core.c | 2 ++ drivers/pci/pci.c | 10 ++++++ drivers/pci/pcie/bwctrl.c | 1 + drivers/pci/probe.c | 2 ++ drivers/pci/switch/switchtec.c | 1 + drivers/pcmcia/rsrc_nonstatic.c | 1 + drivers/perf/arm-cci.c | 1 + drivers/pinctrl/pinctrl-aw9523.c | 2 ++ drivers/pinctrl/pinctrl-cy8c95x0.c | 2 ++ drivers/pinctrl/pinctrl-mcp23s08.c | 2 ++ drivers/pinctrl/pinctrl-stmfx.c | 2 ++ drivers/pinctrl/pinctrl-sx150x.c | 2 ++ drivers/platform/chrome/cros_ec_lpc_mec.c | 2 ++ .../platform/cznic/turris-omnia-mcu-gpio.c | 2 ++ .../platform/x86/intel/crystal_cove_charger.c | 2 ++ drivers/pmdomain/core.c | 4 +++ drivers/pmdomain/rockchip/pm-domains.c | 2 ++ drivers/pnp/isapnp/core.c | 2 ++ drivers/power/supply/da9150-fg.c | 2 ++ drivers/power/supply/power_supply_core.c | 1 + drivers/pwm/core.c | 8 +++++ drivers/regulator/core.c | 2 ++ drivers/remoteproc/mtk_scp_ipi.c | 2 ++ drivers/scsi/aacraid/commctrl.c | 1 + drivers/scsi/fnic/fnic_scsi.c | 1 + drivers/scsi/libfc/fc_disc.c | 6 +++- drivers/scsi/libiscsi.c | 1 + drivers/scsi/megaraid/megaraid_sas.h | 3 +- drivers/scsi/megaraid/megaraid_sas_base.c | 20 +++++++++--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 2 ++ drivers/scsi/scsi_transport_iscsi.c | 1 + drivers/scsi/sg.c | 1 + drivers/scsi/smartpqi/smartpqi_init.c | 18 +++++++++++ drivers/siox/siox-core.c | 2 ++ drivers/soc/qcom/qcom_pd_mapper.c | 1 + drivers/soc/tegra/pmc.c | 1 + drivers/soundwire/stream.c | 3 ++ drivers/spi/spi-mem.c | 2 ++ drivers/spi/spi.c | 3 ++ drivers/ssb/main.c | 2 ++ drivers/staging/greybus/light.c | 2 ++ .../interface/vchiq_arm/vchiq_core.c | 1 + drivers/target/iscsi/iscsi_target_tpg.c | 1 + drivers/target/target_core_device.c | 1 + drivers/tee/amdtee/core.c | 1 + drivers/thermal/mediatek/auxadc_thermal.c | 2 ++ drivers/thermal/tegra/soctherm.c | 2 ++ drivers/thermal/thermal_debugfs.c | 4 +++ drivers/tty/n_tty.c | 1 + drivers/tty/serial/sc16is7xx.c | 2 ++ drivers/tty/tty_buffer.c | 2 ++ drivers/tty/tty_io.c | 2 ++ drivers/tty/tty_mutex.c | 5 +++ drivers/ufs/core/ufshcd.c | 4 +++ drivers/usb/class/cdc-wdm.c | 3 ++ drivers/usb/class/usblp.c | 3 +- drivers/usb/class/usbtmc.c | 3 ++ drivers/usb/core/devio.c | 7 +++++ drivers/usb/core/hcd-pci.c | 2 ++ drivers/usb/core/hub.c | 7 +++++ drivers/usb/gadget/configfs.c | 6 ++++ drivers/usb/gadget/function/f_fs.c | 14 ++++++--- drivers/usb/gadget/function/u_fs.h | 2 ++ drivers/usb/gadget/legacy/inode.c | 1 + drivers/usb/serial/mos7720.c | 2 ++ drivers/usb/serial/usb-serial.c | 3 ++ drivers/usb/storage/transport.c | 1 + drivers/usb/storage/usb.c | 2 ++ drivers/usb/typec/tcpm/tcpm.c | 16 ++++++++++ drivers/usb/usbip/stub_main.c | 1 + drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 2 ++ drivers/vfio/group.c | 1 + drivers/vfio/pci/mlx5/cmd.h | 3 +- drivers/vfio/pci/virtio/migrate.c | 1 + drivers/vfio/vfio_iommu_type1.c | 1 + drivers/vhost/vhost.c | 3 ++ drivers/video/fbdev/core/fb_procfs.c | 2 ++ drivers/video/fbdev/smscufx.c | 1 + drivers/video/fbdev/udlfb.c | 1 + drivers/virt/vboxguest/vboxguest_linux.c | 2 ++ drivers/virtio/virtio_mem.c | 5 +++ drivers/w1/slaves/w1_therm.c | 9 ++++++ drivers/w1/w1.c | 3 ++ drivers/w1/w1_netlink.c | 1 + drivers/xen/balloon.c | 2 ++ drivers/xen/xen-pciback/passthrough.c | 1 + drivers/xen/xen-pciback/vpci.c | 1 + drivers/xen/xenbus/xenbus_comms.c | 1 + drivers/xen/xenbus/xenbus_xs.c | 4 +++ fs/affs/affs.h | 6 ++++ fs/afs/validation.c | 1 + fs/autofs/waitq.c | 3 ++ fs/bcachefs/alloc_foreground.c | 4 +++ fs/bcachefs/alloc_foreground.h | 1 + fs/bcachefs/btree_locking.c | 1 + fs/bcachefs/btree_write_buffer.c | 4 +++ fs/bcachefs/debug.c | 2 ++ fs/bcachefs/ec.c | 3 ++ fs/bcachefs/fs-ioctl.c | 1 + fs/bcachefs/fs.c | 4 +++ fs/bcachefs/io_write.c | 3 ++ fs/bcachefs/journal.c | 2 ++ fs/bcachefs/quota.c | 2 ++ fs/bcachefs/seqmutex.h | 4 +++ fs/btrfs/block-group.c | 2 ++ fs/btrfs/delayed-ref.c | 4 +++ fs/btrfs/delayed-ref.h | 1 + fs/btrfs/extent-tree.c | 1 + fs/btrfs/free-space-cache.c | 1 + fs/btrfs/ioctl.c | 2 ++ fs/btrfs/qgroup.c | 1 + fs/btrfs/scrub.c | 2 ++ fs/btrfs/tests/delayed-refs-tests.c | 1 + fs/btrfs/tree-log.c | 2 ++ fs/btrfs/volumes.c | 4 +++ fs/btrfs/zoned.h | 4 +++ fs/ceph/caps.c | 4 +++ fs/ceph/mds_client.c | 1 + fs/coda/upcall.c | 1 + fs/dcache.c | 1 + fs/dlm/recoverd.c | 2 ++ fs/ecryptfs/main.c | 1 + fs/ecryptfs/messaging.c | 1 + fs/erofs/zdata.c | 3 ++ fs/eventpoll.c | 3 ++ fs/exec.c | 4 +++ fs/ext4/fast_commit.c | 1 + fs/ext4/mballoc.c | 2 ++ fs/f2fs/data.c | 1 + fs/fat/fatent.c | 2 ++ fs/fat/inode.c | 2 ++ fs/file.c | 2 ++ fs/fuse/inode.c | 2 ++ fs/gfs2/rgrp.c | 2 ++ fs/gfs2/util.c | 1 + fs/hfs/bfind.c | 2 ++ fs/hfsplus/bfind.c | 2 ++ fs/hfsplus/extents.c | 2 ++ fs/hpfs/hpfs_fn.h | 2 ++ fs/jbd2/checkpoint.c | 2 ++ fs/jbd2/commit.c | 1 + fs/jbd2/journal.c | 5 +++ fs/jbd2/transaction.c | 2 ++ fs/jffs2/dir.c | 4 +++ fs/jffs2/fs.c | 1 + fs/jffs2/gc.c | 1 + fs/jffs2/nodemgmt.c | 2 ++ fs/jffs2/write.c | 2 ++ fs/jfs/namei.c | 1 + fs/kernfs/file.c | 9 ++++++ fs/lockd/host.c | 1 + fs/lockd/svclock.c | 1 + fs/namei.c | 4 +++ fs/netfs/write_issue.c | 2 ++ fs/nfsd/nfs4layouts.c | 2 ++ fs/nfsd/nfs4proc.c | 2 ++ fs/nfsd/nfs4state.c | 11 +++++++ fs/ntfs3/frecord.c | 4 ++- fs/ntfs3/inode.c | 1 + fs/ntfs3/namei.c | 2 ++ fs/ntfs3/ntfs_fs.h | 4 +++ fs/ntfs3/record.c | 1 + fs/ntfs3/xattr.c | 2 ++ fs/ocfs2/cluster/nodemanager.c | 2 ++ fs/ocfs2/dlmglue.c | 2 ++ fs/ocfs2/inode.c | 2 ++ fs/ocfs2/refcounttree.c | 2 ++ fs/orangefs/orangefs-debugfs.c | 2 ++ fs/orangefs/waitqueue.c | 1 + fs/overlayfs/overlayfs.h | 3 ++ fs/pipe.c | 2 ++ fs/proc/proc_tty.c | 2 ++ fs/pstore/zone.c | 1 + fs/smb/client/cifsglob.h | 2 ++ fs/smb/client/connect.c | 3 +- fs/smb/client/fs_context.h | 2 ++ fs/smb/client/smbdirect.c | 2 ++ fs/smb/client/smbdirect.h | 2 +- fs/smb/server/connection.h | 6 ++-- fs/super.c | 6 ++++ fs/ubifs/compress.c | 2 ++ fs/ubifs/dir.c | 4 +++ fs/ubifs/file.c | 6 ++++ fs/ubifs/journal.c | 3 ++ fs/ubifs/misc.h | 2 ++ fs/xfs/scrub/dirtree.c | 2 ++ fs/xfs/scrub/dirtree_repair.c | 3 ++ fs/xfs/scrub/quota.c | 1 + fs/xfs/scrub/quota_repair.c | 3 ++ fs/xfs/scrub/quotacheck_repair.c | 3 ++ fs/xfs/scrub/rmap_repair.c | 1 + fs/xfs/scrub/rtrmap_repair.c | 1 + fs/xfs/xfs_dquot.c | 7 +++++ fs/xfs/xfs_dquot.h | 10 ++++-- fs/xfs/xfs_dquot_item.c | 2 ++ fs/xfs/xfs_qm.c | 3 ++ fs/xfs/xfs_qm_syscalls.c | 1 + fs/xfs/xfs_trans_dquot.c | 3 ++ include/linux/blkdev.h | 11 +++++-- include/linux/cgroup.h | 2 ++ include/linux/fb.h | 2 ++ include/linux/fpga/fpga-bridge.h | 2 +- include/linux/fpga/fpga-mgr.h | 4 +-- include/linux/fsnotify_backend.h | 2 ++ include/linux/gameport.h | 1 + include/linux/memory_hotplug.h | 2 ++ include/linux/mfd/si476x-core.h | 2 ++ include/linux/netdevice.h | 2 ++ include/linux/phy.h | 2 ++ include/linux/usb.h | 3 +- include/media/v4l2-ctrls.h | 2 ++ include/media/v4l2-subdev.h | 5 +++ include/net/bluetooth/l2cap.h | 2 ++ include/net/cfg80211.h | 2 ++ include/sound/emu10k1.h | 12 +++++-- include/sound/i2c.h | 2 ++ include/sound/soc-card.h | 3 ++ include/sound/soc.h | 14 +++++++++ io_uring/cancel.c | 1 + io_uring/fdinfo.c | 1 + io_uring/io_uring.c | 5 +++ io_uring/io_uring.h | 2 ++ io_uring/msg_ring.c | 3 ++ io_uring/register.c | 6 ++++ io_uring/rsrc.c | 3 ++ io_uring/sqpoll.c | 3 ++ io_uring/tctx.c | 1 + kernel/acct.c | 3 ++ kernel/audit.c | 2 ++ kernel/audit_tree.c | 2 ++ kernel/audit_watch.c | 1 + kernel/bpf/btf.c | 1 + kernel/bpf/cgroup_iter.c | 2 ++ kernel/bpf/verifier.c | 1 + kernel/cgroup/cgroup-v1.c | 4 +++ kernel/cgroup/cgroup.c | 18 +++++++++++ kernel/cgroup/cpuset.c | 2 ++ kernel/cpu.c | 2 ++ kernel/events/callchain.c | 1 + kernel/events/core.c | 9 ++++++ kernel/events/hw_breakpoint.c | 2 ++ kernel/fail_function.c | 2 ++ kernel/futex/core.c | 3 ++ kernel/irq/autoprobe.c | 3 ++ kernel/irq/irqdesc.c | 2 ++ kernel/irq/msi.c | 2 ++ kernel/jump_label.c | 2 ++ kernel/kprobes.c | 3 ++ kernel/locking/locktorture.c | 4 +++ kernel/module/main.c | 1 + kernel/module/procfs.c | 2 ++ kernel/params.c | 2 ++ kernel/power/autosleep.c | 2 ++ kernel/power/main.c | 2 ++ kernel/printk/printk.c | 2 ++ kernel/rcu/srcutree.c | 4 ++- kernel/rcu/tree_exp.h | 1 + kernel/sched/core.c | 1 + kernel/seccomp.c | 1 + kernel/static_call_inline.c | 2 ++ kernel/torture.c | 2 ++ kernel/trace/ftrace.c | 7 +++++ kernel/trace/ring_buffer.c | 2 ++ kernel/trace/rv/rv.c | 3 ++ kernel/trace/rv/rv_reactors.c | 2 ++ kernel/trace/trace.c | 12 +++++++ kernel/trace/trace_dynevent.c | 2 ++ kernel/trace/trace_events.c | 10 ++++++ kernel/trace/trace_events_trigger.c | 2 ++ kernel/trace/trace_events_user.c | 1 + kernel/trace/trace_hwlat.c | 2 ++ kernel/trace/trace_osnoise.c | 2 ++ kernel/trace/trace_printk.c | 8 +++++ kernel/trace/trace_recursion_record.c | 2 ++ kernel/trace/trace_stat.c | 2 ++ kernel/trace/trace_uprobe.c | 2 ++ kernel/workqueue.c | 2 ++ lib/Makefile | 2 ++ lib/dynamic_debug.c | 2 ++ lib/error-inject.c | 2 ++ lib/kunit/platform.c | 1 + lib/once.c | 2 ++ mm/damon/sysfs.c | 3 ++ mm/hugetlb.c | 4 +++ mm/kmemleak.c | 2 ++ mm/ksm.c | 1 + mm/oom_kill.c | 1 + mm/page_alloc.c | 4 +++ mm/percpu.c | 1 + mm/slab_common.c | 2 ++ mm/swap_slots.c | 2 ++ mm/swapfile.c | 2 ++ mm/vma.c | 2 ++ mm/zswap.c | 2 ++ net/atm/resources.c | 2 ++ net/bluetooth/l2cap_core.c | 9 ++++++ net/bluetooth/l2cap_sock.c | 2 ++ net/bluetooth/rfcomm/sock.c | 1 + net/bridge/netfilter/ebtables.c | 5 +++ net/caif/caif_socket.c | 2 ++ net/can/j1939/main.c | 2 ++ net/ceph/messenger.c | 3 ++ net/ceph/messenger_v1.c | 2 ++ net/ceph/messenger_v2.c | 14 +++++++++ net/core/dev.c | 4 +++ net/core/drop_monitor.c | 2 ++ net/core/netdev-genl.c | 5 +++ net/core/pktgen.c | 1 + net/core/rtnetlink.c | 12 +++++++ net/core/sock.c | 2 ++ net/devlink/core.c | 3 ++ net/devlink/devl_internal.h | 2 ++ net/ethtool/ioctl.c | 1 + net/ipv6/mcast.c | 1 + net/mac802154/cfg.c | 2 ++ net/mac802154/mib.c | 2 ++ net/netfilter/ipset/ip_set_core.c | 2 ++ net/netfilter/ipvs/ip_vs_app.c | 2 ++ net/netfilter/nf_log.c | 2 ++ net/netfilter/nf_tables_api.c | 5 +++ net/netfilter/nfnetlink.c | 2 ++ net/netfilter/x_tables.c | 8 +++++ net/netfilter/xt_hashlimit.c | 1 + net/netlink/af_netlink.c | 2 ++ net/netlink/genetlink.c | 7 +++++ net/openvswitch/datapath.c | 2 ++ net/phonet/socket.c | 2 ++ net/qrtr/af_qrtr.c | 1 + net/rds/ib_cm.c | 1 + net/rds/rdma_transport.c | 1 + net/rds/tcp_listen.c | 1 + net/rxrpc/af_rxrpc.c | 1 + net/rxrpc/call_object.c | 1 + net/rxrpc/sendmsg.c | 3 ++ net/sched/act_api.c | 1 + net/sched/cls_api.c | 1 + net/shaper/shaper.c | 2 ++ net/smc/af_smc.c | 1 + net/sunrpc/rpc_pipe.c | 2 ++ net/sunrpc/svc_xprt.c | 2 ++ net/unix/af_unix.c | 1 + net/unix/unix_bpf.c | 1 + net/wireless/nl80211.c | 9 ++++++ samples/vfio-mdev/mtty.c | 1 + security/apparmor/apparmorfs.c | 3 ++ security/integrity/ima/ima_main.c | 1 + security/keys/keyring.c | 3 ++ security/tomoyo/gc.c | 3 ++ sound/core/compress_offload.c | 3 ++ sound/core/oss/pcm_oss.c | 9 ++++++ sound/core/pcm_native.c | 8 +++++ sound/core/seq/oss/seq_oss.c | 1 + sound/core/seq/seq_clientmgr.c | 2 ++ sound/core/seq/seq_memory.c | 1 + sound/core/sound.c | 1 + sound/isa/gus/gus_mem.c | 3 ++ sound/pci/ac97/ac97_codec.c | 2 ++ sound/pci/hda/hda_intel.c | 1 + sound/pci/hda/patch_realtek.c | 2 ++ sound/pci/hda/tas2781_hda_i2c.c | 1 + sound/pci/ice1712/ak4xxx.c | 2 ++ sound/pci/ice1712/delta.c | 4 +++ sound/pci/ice1712/ews.c | 6 ++++ sound/pci/ice1712/hoontech.c | 1 + sound/pci/ice1712/ice1712.h | 2 ++ sound/pci/ice1712/prodigy192.c | 2 ++ sound/pci/ice1712/revo.c | 4 +++ sound/pci/pcxhr/pcxhr_core.c | 1 + sound/soc/codecs/rt5677.c | 2 ++ sound/soc/codecs/wcd-mbhc-v2.c | 7 ++++- sound/soc/soc-dapm.c | 9 ++++++ sound/soc/soc-pcm.c | 25 +++++++++++++++ sound/soc/sof/intel/hda-mlink.c | 2 ++ sound/soc/sof/ipc3-control.c | 1 + sound/soc/sof/ipc4-control.c | 1 + sound/synth/emux/soundfont.c | 2 ++ virt/kvm/kvm_main.c | 3 ++ 808 files changed, 2057 insertions(+), 63 deletions(-)
arch/arm64/kvm/arm.c +2 -0
@@ -1886,6 +1886,7 @@ int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)/* unlocks vcpus from @vcpu_lock_idx and smaller */ static void unlock_vcpus (struct kvm *kvm,int vcpu_lock_idx) +NO_THREAD_SAFETY_ANALYSIS /* too complex to be annotated */ {struct kvm_vcpu *tmp_vcpu;
@@ -1904,6 +1905,7 @@ void unlock_all_vcpus(struct kvm *kvm)/* Returns true if all vcpus were locked, false otherwise */ bool lock_all_vcpus (struct kvm *kvm) +NO_THREAD_SAFETY_ANALYSIS /* too complex to be annotated */ {struct kvm_vcpu *tmp_vcpu;unsigned long c;
arch/powerpc/kernel/rtas.c +1 -0
@@ -1884,6 +1884,7 @@ static bool block_rtas_call(const struct rtas_function *func, int nargs,/* We assume to be passed big endian arguments */ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) + NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {const struct rtas_function *func;struct pin_cookie cookie;
arch/powerpc/platforms/powermac/low_i2c.c +6 -0
@@ -381,6 +381,7 @@ static void kw_i2c_timeout(struct timer_list *t) }static int kw_i2c_open (struct pmac_i2c_bus *bus) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct pmac_i2c_host_kw *host = bus->hostdata;mutex_lock (&host->mutex);
@@ -388,6 +389,7 @@ static int kw_i2c_open(struct pmac_i2c_bus *bus) }static void kw_i2c_close (struct pmac_i2c_bus *bus) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct pmac_i2c_host_kw *host = bus->hostdata;mutex_unlock (&host->mutex);
@@ -1092,6 +1094,7 @@ EXPORT_SYMBOL_GPL(pmac_low_i2c_unlock);int pmac_i2c_open (struct pmac_i2c_bus *bus,int polled) + TRY_ACQUIRE(0, bus->mutex) {int rc;
@@ -1109,6 +1112,7 @@ int pmac_i2c_open(struct pmac_i2c_bus *bus, int polled)EXPORT_SYMBOL_GPL (pmac_i2c_open);void pmac_i2c_close (struct pmac_i2c_bus *bus) + RELEASE(bus->mutex) {WARN_ON (!bus->opened);if (bus->close)
@@ -1232,6 +1236,7 @@ struct pmac_i2c_pf_inst };static void *pmac_i2c_do_begin (struct pmf_function *func,struct pmf_args *args) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct pmac_i2c_pf_inst *inst;struct pmac_i2c_bus *bus;
@@ -1265,6 +1270,7 @@ static void* pmac_i2c_do_begin(struct pmf_function *func, struct pmf_args *args) }static void pmac_i2c_do_end (struct pmf_function *func,void *instdata) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct pmac_i2c_pf_inst *inst = instdata;
arch/powerpc/platforms/pseries/papr-vpd.c +2 -0
@@ -234,6 +234,7 @@ struct vpd_sequence {*/ static void vpd_sequence_begin (struct vpd_sequence *seq,const struct papr_location_code *loc_code) +ACQUIRE (rtas_ibm_get_vpd_lock) {/* * Use a static data structure for the location code passed to
@@ -266,6 +267,7 @@ static void vpd_sequence_begin(struct vpd_sequence *seq,* Releases resources obtained by vpd_sequence_begin(). */ static void vpd_sequence_end (struct vpd_sequence *seq) +RELEASE (rtas_ibm_get_vpd_lock) {rtas_work_area_free (seq->params.work_area);mutex_unlock (&rtas_ibm_get_vpd_lock);
arch/x86/events/core.c +1 -0
@@ -422,6 +422,7 @@ int x86_reserve_hardware(void) }void x86_release_hardware (void ) +NO_THREAD_SAFETY_ANALYSIS /* needed because of a clang bug? */ {if (atomic_dec_and_mutex_lock (&pmc_refcount, &pmc_reserve_mutex)) {release_pmc_hardware ();
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +1 -0
@@ -1288,6 +1288,7 @@ static const struct file_operations pseudo_measure_fops = {* on failure. Descriptive error will be written to last_cmd_status buffer. */ int rdtgroup_pseudo_lock_create (struct rdtgroup *rdtgrp) +REQUIRES (rdtgroup_mutex) {struct pseudo_lock_region *plr = rdtgrp->plr;struct task_struct *thread;
arch/x86/kernel/cpu/resctrl/rdtgroup.c +2 -0
@@ -2470,6 +2470,7 @@ static void rdtgroup_kn_put(struct rdtgroup *rdtgrp, struct kernfs_node *kn) }struct rdtgroup *rdtgroup_kn_lock_live (struct kernfs_node *kn) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking + returns a pointer */ {struct rdtgroup *rdtgrp =kernfs_to_rdtgroup (kn);
@@ -2489,6 +2490,7 @@ struct rdtgroup *rdtgroup_kn_lock_live(struct kernfs_node *kn) }void rdtgroup_kn_unlock (struct kernfs_node *kn) +NO_THREAD_SAFETY_ANALYSIS /* to match the lock function */ {struct rdtgroup *rdtgrp =kernfs_to_rdtgroup (kn);
arch/x86/kernel/cpu/sgx/encl.c +2 -0
@@ -606,6 +606,7 @@ static int sgx_encl_debug_write(struct sgx_encl *encl, struct sgx_encl_page *pagstatic struct sgx_encl_page *sgx_encl_reserve_page (struct sgx_encl *encl,unsigned long addr,unsigned long vm_flags) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking + returns a pointer */ {struct sgx_encl_page *entry;
@@ -627,6 +628,7 @@ static struct sgx_encl_page *sgx_encl_reserve_page(struct sgx_encl *encl,static int sgx_vma_access (struct vm_area_struct *vma,unsigned long addr,void *buf,int len,int write) +NO_THREAD_SAFETY_ANALYSIS /* to match the lock function */ {struct sgx_encl *encl = vma->vm_private_data;struct sgx_encl_page *entry =NULL ;
arch/x86/kernel/ftrace.c +2 -0
@@ -40,6 +40,7 @@ static int ftrace_poke_late = 0;void ftrace_arch_code_modify_prepare (void ) __acquires(&text_mutex) +ACQUIRE (text_mutex) {/* * Need to grab text_mutex to prevent a race from module loading
@@ -52,6 +53,7 @@ void ftrace_arch_code_modify_prepare(void)void ftrace_arch_code_modify_post_process (void ) __releases(&text_mutex) +RELEASE (text_mutex) {/* * ftrace_make_{call,nop}() may be called during
arch/x86/kernel/module.c +1 -0
@@ -180,6 +180,7 @@ static int write_relocate_add(Elf64_Shdr *sechdrs,unsigned int relsec, struct module *me, bool apply) + NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ { int ret;bool early = me->state ==MODULE_STATE_UNFORMED ;
arch/x86/kvm/svm/sev.c +6 -0
@@ -1857,6 +1857,8 @@ static bool is_cmd_allowed_from_mirror(u32 cmd_id) }static int sev_lock_two_vms (struct kvm *dst_kvm,struct kvm *src_kvm) + TRY_ACQUIRE(0, dst_kvm->lock) + TRY_ACQUIRE(0, src_kvm->lock) {struct kvm_sev_info *dst_sev = &to_kvm_svm (dst_kvm)->sev_info;struct kvm_sev_info *src_sev = &to_kvm_svm (src_kvm)->sev_info;
@@ -1892,6 +1894,8 @@ static int sev_lock_two_vms(struct kvm *dst_kvm, struct kvm *src_kvm) }static void sev_unlock_two_vms (struct kvm *dst_kvm,struct kvm *src_kvm) + RELEASE(&dst_kvm->lock) + RELEASE(&src_kvm->lock) {struct kvm_sev_info *dst_sev = &to_kvm_svm (dst_kvm)->sev_info;struct kvm_sev_info *src_sev = &to_kvm_svm (src_kvm)->sev_info;
@@ -1911,6 +1915,7 @@ enum sev_migration_role {static int sev_lock_vcpus_for_migration (struct kvm *kvm,enum sev_migration_role role) +NO_THREAD_SAFETY_ANALYSIS /* too complex for annotations */ {struct kvm_vcpu *vcpu;unsigned long i, j;
@@ -1950,6 +1955,7 @@ static int sev_lock_vcpus_for_migration(struct kvm *kvm, }static void sev_unlock_vcpus_for_migration (struct kvm *kvm) +NO_THREAD_SAFETY_ANALYSIS /* too complex for annotations */ {struct kvm_vcpu *vcpu;unsigned long i;
block/bdev.c +3 -0
@@ -241,6 +241,7 @@ EXPORT_SYMBOL(sync_blockdev_range);* Return: On success zero is returned, negative error code on failure. */ int bdev_freeze (struct block_device *bdev) +NO_THREAD_SAFETY_ANALYSIS /* too complex */ {int error =0 ;
@@ -277,6 +278,7 @@ EXPORT_SYMBOL(bdev_freeze);* Return: On success zero is returned, negative error code on failure. */ int bdev_thaw (struct block_device *bdev) +NO_THREAD_SAFETY_ANALYSIS /* too complex */ {int error = -EINVAL , nr_freeze;
@@ -1194,6 +1196,7 @@ EXPORT_SYMBOL(lookup_bdev);* the file system. In addition we also invalidate the block device mapping. */ void bdev_mark_dead (struct block_device *bdev,bool surprise) +NO_THREAD_SAFETY_ANALYSIS /* too complex */ {mutex_lock (&bdev->bd_holder_lock);if (bdev->bd_holder_ops && bdev->bd_holder_ops->mark_dead)
block/blk-cgroup.c +2 -0
@@ -779,6 +779,7 @@ EXPORT_SYMBOL_GPL(blkg_conf_init);* of @ctx->input. Returns -errno on error. */ int blkg_conf_open_bdev (struct blkg_conf_ctx *ctx) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {char *input = ctx->input;unsigned int major, minor;
@@ -956,6 +957,7 @@ EXPORT_SYMBOL_GPL(blkg_conf_prep);void blkg_conf_exit (struct blkg_conf_ctx *ctx) __releases(&ctx->bdev->bd_queue->queue_lock) __releases(&ctx->bdev->bd_queue->rq_qos_mutex) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {if (ctx->blkg) {spin_unlock_irq (&bdev_get_queue (ctx->bdev)->queue_lock);
block/ioctl.c +1 -0
@@ -417,6 +417,7 @@ static int blkdev_pr_clear(struct block_device *bdev, blk_mode_t mode,static int blkdev_flushbuf (struct block_device *bdev,unsigned cmd,unsigned long arg) + TRY_ACQUIRE(0, bdev->bd_holder_lock) {if (!capable (CAP_SYS_ADMIN ))return -EACCES ;
drivers/accel/amdxdna/aie2_error.c +3 -2
@@ -290,15 +290,16 @@ int aie2_error_async_events_send(struct amdxdna_dev_hdl *ndev) }void aie2_error_async_events_free (struct amdxdna_dev_hdl *ndev) + REQUIRES(ndev->xdna->dev_lock) {struct amdxdna_dev *xdna = ndev->xdna;struct async_events *events; events = ndev->async_events; -mutex_unlock (&xdna->dev_lock); +mutex_unlock (&ndev->xdna->dev_lock);destroy_workqueue (events->wq); -mutex_lock (&xdna->dev_lock); +mutex_lock (&ndev->xdna->dev_lock);dma_free_noncoherent (xdna->ddev.dev, events->size, events->buf, events->addr,DMA_FROM_DEVICE );
drivers/accel/qaic/qaic_control.c +1 -0
@@ -1014,6 +1014,7 @@ static int decode_message(struct qaic_device *qdev, struct manage_msg *user_msg,static void *msg_xfer (struct qaic_device *qdev,struct wrapper_list *wrappers,u32 seq_num,bool ignore_signal) + RELEASE(qdev->cntl_mutex) {struct xfer_queue_elem elem;struct wire_msg *out_buf;
drivers/acpi/scan.c +5 -0
@@ -50,23 +50,27 @@ static DEFINE_MUTEX(acpi_hp_context_lock);static u64 spcr_uart_addr;void acpi_scan_lock_acquire (void ) +ACQUIRE (acpi_scan_lock) {mutex_lock (&acpi_scan_lock); }EXPORT_SYMBOL_GPL (acpi_scan_lock_acquire);void acpi_scan_lock_release (void ) +RELEASE (acpi_scan_lock) {mutex_unlock (&acpi_scan_lock); }EXPORT_SYMBOL_GPL (acpi_scan_lock_release);void acpi_lock_hp_context (void ) +ACQUIRE (acpi_hp_context_lock) {mutex_lock (&acpi_hp_context_lock); }void acpi_unlock_hp_context (void ) +RELEASE (acpi_hp_context_lock) {mutex_unlock (&acpi_hp_context_lock); }
@@ -1867,6 +1871,7 @@ static void acpi_scan_init_status(struct acpi_device *adev)static int acpi_add_single_object (struct acpi_device **child,acpi_handle handle,int type,bool dep_init) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct acpi_device *device;bool release_dep_lock = false;
drivers/ata/libata-core.c +29 -2
@@ -1492,6 +1492,7 @@ unsigned int ata_exec_internal(struct ata_device *dev, struct ata_taskfile *tf, const u8 *cdb, enum dma_data_direction dma_dir, void *buf, unsigned int buflen, unsigned int timeout) + REQUIRES(dev->link->ap->host->eh_mutex) { struct ata_link *link = dev->link;struct ata_port *ap = link->ap;
@@ -1572,11 +1573,11 @@ unsigned int ata_exec_internal(struct ata_device *dev, struct ata_taskfile *tf, } } -ata_eh_release (ap); +ata_eh_release (dev->link->ap); rc =wait_for_completion_timeout (&wait,msecs_to_jiffies (timeout)); -ata_eh_acquire (ap); +ata_eh_acquire (dev->link->ap);ata_sff_flush_pio_task (ap);
@@ -1702,6 +1703,7 @@ static u32 ata_pio_mask_no_iordy(const struct ata_device *adev)*/ unsigned int ata_do_dev_read_id (struct ata_device *dev,struct ata_taskfile *tf,__le16 *id) + REQUIRES(dev->link->ap->host->eh_mutex) {return ata_exec_internal (dev, tf,NULL ,DMA_FROM_DEVICE , id,sizeof (id[0 ]) *ATA_ID_WORDS ,0 );
@@ -1731,6 +1733,7 @@ EXPORT_SYMBOL_GPL(ata_do_dev_read_id);*/ int ata_dev_read_id (struct ata_device *dev,unsigned int *p_class,unsigned int flags,u16 *id) + REQUIRES(dev->link->ap->host->eh_mutex) {struct ata_port *ap = dev->link->ap;unsigned int class = *p_class;
@@ -1945,6 +1948,7 @@ bool ata_dev_power_init_tf(struct ata_device *dev, struct ata_taskfile *tf, }static bool ata_dev_power_is_active (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {struct ata_taskfile tf;unsigned int err_mask;
@@ -1982,6 +1986,7 @@ static bool ata_dev_power_is_active(struct ata_device *dev)* Kernel thread context (may sleep). */ void ata_dev_power_set_standby (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {unsigned long ap_flags = dev->link->ap->flags;struct ata_taskfile tf;
@@ -2029,6 +2034,7 @@ void ata_dev_power_set_standby(struct ata_device *dev)* Kernel thread context (may sleep). */ void ata_dev_power_set_active (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {struct ata_taskfile tf;unsigned int err_mask;
@@ -2073,6 +2079,7 @@ void ata_dev_power_set_active(struct ata_device *dev)*/ unsigned int ata_read_log_page (struct ata_device *dev,u8 log,u8 page,void *buf,unsigned int sectors) + REQUIRES(dev->link->ap->host->eh_mutex) {unsigned long ap_flags = dev->link->ap->flags;struct ata_taskfile tf;
@@ -2124,6 +2131,7 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log, }static int ata_log_supported (struct ata_device *dev,u8 log) + REQUIRES(dev->link->ap->host->eh_mutex) {if (dev->quirks &ATA_QUIRK_NO_LOG_DIR )return 0 ;
@@ -2134,6 +2142,7 @@ static int ata_log_supported(struct ata_device *dev, u8 log) }static bool ata_identify_page_supported (struct ata_device *dev,u8 page) + REQUIRES(dev->link->ap->host->eh_mutex) {unsigned int err, i;
@@ -2214,6 +2223,7 @@ static inline bool ata_dev_knobble(struct ata_device *dev) }static void ata_dev_config_ncq_send_recv (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {unsigned int err_mask;
@@ -2238,6 +2248,7 @@ static void ata_dev_config_ncq_send_recv(struct ata_device *dev) }static void ata_dev_config_ncq_non_data (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {unsigned int err_mask;
@@ -2254,6 +2265,7 @@ static void ata_dev_config_ncq_non_data(struct ata_device *dev) }static void ata_dev_config_ncq_prio (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {unsigned int err_mask;
@@ -2300,6 +2312,7 @@ static bool ata_dev_check_adapter(struct ata_device *dev,static int ata_dev_config_ncq (struct ata_device *dev,char *desc,size_t desc_sz) + REQUIRES(dev->link->ap->host->eh_mutex) {struct ata_port *ap = dev->link->ap;int hdepth =0 , ddepth =ata_id_queue_depth (dev->id);
@@ -2382,6 +2395,7 @@ static void ata_dev_config_sense_reporting(struct ata_device *dev) }static void ata_dev_config_zac (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {unsigned int err_mask;u8 *identify_buf = dev->sector_buf;
@@ -2435,6 +2449,7 @@ static void ata_dev_config_zac(struct ata_device *dev) }static void ata_dev_config_trusted (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {u64 trusted_cap;unsigned int err;
@@ -2471,6 +2486,7 @@ void ata_dev_cleanup_cdl_resources(struct ata_device *dev) }static int ata_dev_init_cdl_resources (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {struct ata_cdl *cdl = dev->cdl;unsigned int err_mask;
@@ -2494,6 +2510,7 @@ static int ata_dev_init_cdl_resources(struct ata_device *dev) }static void ata_dev_config_cdl (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {unsigned int err_mask;bool cdl_enabled;
@@ -2610,6 +2627,7 @@ static void ata_dev_config_cdl(struct ata_device *dev) }static int ata_dev_config_lba (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {const u16 *id = dev->id;const char *lba_desc;
@@ -2689,6 +2707,7 @@ static void ata_dev_config_fua(struct ata_device *dev) }static void ata_dev_config_devslp (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {u8 *sata_setting = dev->sector_buf;unsigned int err_mask;
@@ -2717,6 +2736,7 @@ static void ata_dev_config_devslp(struct ata_device *dev) }static void ata_dev_config_cpr (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {unsigned int err_mask;size_t buf_len;
@@ -2801,6 +2821,7 @@ static void ata_dev_print_features(struct ata_device *dev)* 0 on success, -errno otherwise */ int ata_dev_configure (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {struct ata_port *ap = dev->link->ap;bool print_info =ata_dev_print_info (dev);
@@ -3758,6 +3779,7 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,* 0 on success, negative errno otherwise */ int ata_dev_reread_id (struct ata_device *dev,unsigned int readid_flags) + REQUIRES(dev->link->ap->host->eh_mutex) {unsigned int class = dev->class;u16 *id = (void *)dev->sector_buf;
@@ -3793,6 +3815,7 @@ int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags)*/ int ata_dev_revalidate (struct ata_device *dev,unsigned int new_class,unsigned int readid_flags) + REQUIRES(dev->link->ap->host->eh_mutex) {u64 n_sectors = dev->n_sectors;u64 n_native_sectors = dev->n_native_sectors;
@@ -4416,6 +4439,7 @@ static void ata_dev_xfermask(struct ata_device *dev)*/ static unsigned int ata_dev_set_xfermode (struct ata_device *dev) + REQUIRES(dev->link->ap->host->eh_mutex) {struct ata_taskfile tf;
@@ -4461,6 +4485,7 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev)* 0 on success, AC_ERR_* mask otherwise. */ unsigned int ata_dev_set_feature (struct ata_device *dev,u8 subcmd,u8 action) + REQUIRES(dev->link->ap->host->eh_mutex) {struct ata_taskfile tf;unsigned int timeout =0 ;
@@ -4497,6 +4522,7 @@ EXPORT_SYMBOL_GPL(ata_dev_set_feature);*/ static unsigned int ata_dev_init_params (struct ata_device *dev,u16 heads,u16 sectors) + REQUIRES(dev->link->ap->host->eh_mutex) {struct ata_taskfile tf;unsigned int err_mask;
@@ -6549,6 +6575,7 @@ EXPORT_SYMBOL_GPL(ata_ratelimit);* Might sleep. */ void ata_msleep (struct ata_port *ap,unsigned int msecs) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {bool owns_eh = ap && ap->host->eh_owner == current;
drivers/ata/libata-eh.c +2 -0
@@ -2613,6 +2613,7 @@ static int ata_eh_followup_srst_needed(struct ata_link *link, int rc)int ata_eh_reset (struct ata_link *link,int classify,ata_prereset_fn_t prereset,ata_reset_fn_t softreset,ata_reset_fn_t hardreset,ata_postreset_fn_t postreset) +NO_THREAD_SAFETY_ANALYSIS /*REQUIRES(link->ap->host->eh_mutex)*/ {struct ata_port *ap = link->ap;struct ata_link *slave = ap->slave_link;
@@ -3730,6 +3731,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, ata_reset_fn_t softreset, ata_reset_fn_t hardreset, ata_postreset_fn_t postreset, struct ata_link **r_failed_link) + NO_THREAD_SAFETY_ANALYSIS /*REQUIRES(link->ap->host->eh_mutex)*/ { struct ata_link *link;struct ata_device *dev;
drivers/ata/libata.h +4 -2
@@ -157,8 +157,10 @@ int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, struct ata_device *dev);/* libata-eh.c */ extern unsigned int ata_internal_cmd_timeout (struct ata_device *dev,u8 cmd);extern void ata_internal_cmd_timed_out (struct ata_device *dev,u8 cmd); -extern void ata_eh_acquire (struct ata_port *ap); -extern void ata_eh_release (struct ata_port *ap); +extern void ata_eh_acquire(struct ata_port *ap) + ACQUIRE(ap->host->eh_mutex); +extern void ata_eh_release(struct ata_port *ap) + RELEASE(ap->host->eh_mutex);extern void ata_scsi_error (struct Scsi_Host *host);extern void ata_eh_fastdrain_timerfn (struct timer_list *t);extern void ata_qc_schedule_eh (struct ata_queued_cmd *qc);
drivers/base/bus.c +1 -0
@@ -760,6 +760,7 @@ void bus_remove_driver(struct device_driver *drv)/* Helper for bus_rescan_devices's iter */ static int __must_check bus_rescan_devices_helper (struct device *dev,void *data) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {int ret =0 ;
drivers/base/core.c +7 -0
@@ -239,11 +239,13 @@ static DEFINE_MUTEX(device_links_lock);DEFINE_STATIC_SRCU (device_links_srcu);static inline void device_links_write_lock (void ) +ACQUIRE (device_links_lock) {mutex_lock (&device_links_lock); }static inline void device_links_write_unlock (void ) +RELEASE (device_links_lock) {mutex_unlock (&device_links_lock); }
@@ -1160,6 +1162,7 @@ static void __device_links_queue_sync_state(struct device *dev,*/ static void device_links_flush_sync_list (struct list_head *list,struct device *dont_lock_dev) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct device *dev, *tmp;
@@ -2343,16 +2346,19 @@ static struct kobject *sysfs_dev_block_kobj;static DEFINE_MUTEX (device_hotplug_lock);void lock_device_hotplug (void ) +NO_THREAD_SAFETY_ANALYSIS /* function declaration has been annotated */ {mutex_lock (&device_hotplug_lock); }void unlock_device_hotplug (void ) +NO_THREAD_SAFETY_ANALYSIS /* function declaration has been annotated */ {mutex_unlock (&device_hotplug_lock); }int lock_device_hotplug_sysfs (void ) +NO_THREAD_SAFETY_ANALYSIS /* function declaration has been annotated */ {if (mutex_trylock (&device_hotplug_lock))return 0 ;
@@ -4763,6 +4769,7 @@ EXPORT_SYMBOL_GPL(device_change_owner);* device_shutdown - call ->shutdown() on each device to shutdown. */ void device_shutdown (void ) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct device *dev, *parent;
drivers/base/dd.c +2 -0
@@ -1089,6 +1089,7 @@ void device_initial_probe(struct device *dev)* interface, @parent lock will be held as well. */ static void __device_driver_lock (struct device *dev,struct device *parent) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {if (parent && dev->bus->need_parent_lock)device_lock (parent);
@@ -1105,6 +1106,7 @@ static void __device_driver_lock(struct device *dev, struct device *parent)* USB interface, @parent lock will be released as well. */ static void __device_driver_unlock (struct device *dev,struct device *parent) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {device_unlock (dev);if (parent && dev->bus->need_parent_lock)
drivers/base/power/clock_ops.c +4 -0
@@ -51,6 +51,7 @@ struct pm_clock_entry {*/ static void pm_clk_list_lock (struct pm_subsys_data *psd) __acquires(&psd->lock) + ACQUIRE(psd->clock_mutex) {mutex_lock (&psd->clock_mutex);spin_lock_irq (&psd->lock);
@@ -63,6 +64,7 @@ static void pm_clk_list_lock(struct pm_subsys_data *psd)*/ static void pm_clk_list_unlock (struct pm_subsys_data *psd) __releases(&psd->lock) + RELEASE(psd->clock_mutex) {spin_unlock_irq (&psd->lock);mutex_unlock (&psd->clock_mutex);
@@ -86,6 +88,7 @@ static void pm_clk_list_unlock(struct pm_subsys_data *psd)static int pm_clk_op_lock (struct pm_subsys_data *psd,unsigned long *flags,const char *fn)/* sparse annotations don't work here as exit state isn't static */ +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {bool atomic_context =in_atomic () ||irqs_disabled ();
@@ -129,6 +132,7 @@ static int pm_clk_op_lock(struct pm_subsys_data *psd, unsigned long *flags,*/ static void pm_clk_op_unlock (struct pm_subsys_data *psd,unsigned long *flags)/* sparse annotations don't work here as entry state isn't static */ +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {if (psd->clock_op_might_sleep) {mutex_unlock (&psd->clock_mutex);
drivers/base/power/main.c +2 -0
@@ -109,6 +109,7 @@ void device_pm_sleep_init(struct device *dev)* device_pm_lock - Lock the list of active devices used by the PM core. */ void device_pm_lock (void ) +ACQUIRE (dpm_list_mtx) {mutex_lock (&dpm_list_mtx); }
@@ -117,6 +118,7 @@ void device_pm_lock(void)* device_pm_unlock - Unlock the list of active devices used by the PM core. */ void device_pm_unlock (void ) +RELEASE (dpm_list_mtx) {mutex_unlock (&dpm_list_mtx); }
drivers/base/regmap/regmap-irq.c +2 -0
@@ -70,6 +70,7 @@ static bool regmap_irq_can_bulk_read_status(struct regmap_irq_chip_data *data) }static void regmap_irq_lock (struct irq_data *data) +NO_THREAD_SAFETY_ANALYSIS /* mutex is not a member of an argument */ {struct regmap_irq_chip_data *d =irq_data_get_irq_chip_data (data);
@@ -77,6 +78,7 @@ static void regmap_irq_lock(struct irq_data *data) }static void regmap_irq_sync_unlock (struct irq_data *data) +NO_THREAD_SAFETY_ANALYSIS /* mutex is not a member of an argument */ {struct regmap_irq_chip_data *d =irq_data_get_irq_chip_data (data);struct regmap *map = d->map;
drivers/base/regmap/regmap.c +2 -0
@@ -440,12 +440,14 @@ static void regmap_lock_unlock_none(void *__map) }static void regmap_lock_mutex (void *__map) +NO_THREAD_SAFETY_ANALYSIS /* mutex is not a member of an argument */ {struct regmap *map = __map;mutex_lock (&map->mutex); }static void regmap_unlock_mutex (void *__map) +NO_THREAD_SAFETY_ANALYSIS /* mutex is not a member of an argument */ {struct regmap *map = __map;mutex_unlock (&map->mutex);
drivers/block/drbd/drbd_bitmap.c +2 -0
@@ -122,6 +122,7 @@ static void __bm_print_lock_info(struct drbd_device *device, const char *func) }void drbd_bm_lock (struct drbd_device *device,char *why,enum bm_flag flags) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct drbd_bitmap *b = device->bitmap;int trylock_failed;
@@ -149,6 +150,7 @@ void drbd_bm_lock(struct drbd_device *device, char *why, enum bm_flag flags) }void drbd_bm_unlock (struct drbd_device *device) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct drbd_bitmap *b = device->bitmap;if (!b) {
drivers/block/drbd/drbd_main.c +7 -0
@@ -598,6 +598,7 @@ static void *__conn_prepare_command(struct drbd_connection *connection, }void *conn_prepare_command (struct drbd_connection *connection,struct drbd_socket *sock) +NO_THREAD_SAFETY_ANALYSIS /* returns a pointer */ {void *p;
@@ -655,6 +656,7 @@ static int __conn_send_command(struct drbd_connection *connection, struct drbd_sint conn_send_command (struct drbd_connection *connection,struct drbd_socket *sock,enum drbd_packet cmd,unsigned int header_size,void *data,unsigned int size) +NO_THREAD_SAFETY_ANALYSIS /* to match the mutex_lock() caller */ {int err;
@@ -666,6 +668,7 @@ int conn_send_command(struct drbd_connection *connection, struct drbd_socket *soint drbd_send_command (struct drbd_peer_device *peer_device,struct drbd_socket *sock,enum drbd_packet cmd,unsigned int header_size,void *data,unsigned int size) +NO_THREAD_SAFETY_ANALYSIS /* to match the mutex_lock() caller */ {int err;
@@ -1649,6 +1652,7 @@ static u32 bio_flags_to_wire(struct drbd_connection *connection,* R_PRIMARY -> Peer (P_DATA, P_TRIM) */ int drbd_send_dblock (struct drbd_peer_device *peer_device,struct drbd_request *req) +NO_THREAD_SAFETY_ANALYSIS /* to match the mutex_lock() caller */ {struct drbd_device *device = peer_device->device;struct drbd_socket *sock;
@@ -1742,6 +1746,7 @@ int drbd_send_dblock(struct drbd_peer_device *peer_device, struct drbd_request **/ int drbd_send_block (struct drbd_peer_device *peer_device,enum drbd_packet cmd,struct drbd_peer_request *peer_req) +NO_THREAD_SAFETY_ANALYSIS /* to match the mutex_lock() caller */ {struct drbd_device *device = peer_device->device;struct drbd_socket *sock;
@@ -3705,6 +3710,7 @@ int drbd_wait_misc(struct drbd_device *device, struct drbd_interval *i) }void lock_all_resources (void ) +ACQUIRE (resources_mutex) {struct drbd_resource *resource;int __maybe_unused i =0 ;
@@ -3716,6 +3722,7 @@ void lock_all_resources(void) }void unlock_all_resources (void ) +RELEASE (resources_mutex) {struct drbd_resource *resource;
drivers/block/drbd/drbd_nl.c +1 -0
@@ -3432,6 +3432,7 @@ int drbd_adm_dump_connections_done(struct netlink_callback *cb)enum {SINGLE_RESOURCE ,ITERATE_RESOURCES };int drbd_adm_dump_connections (struct sk_buff *skb,struct netlink_callback *cb) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct nlattr *resource_filter;struct drbd_resource *resource =NULL , *next_resource;
drivers/block/drbd/drbd_receiver.c +1 -0
@@ -921,6 +921,7 @@ int drbd_connected(struct drbd_peer_device *peer_device)* -2 We do not have a network config... */ static int conn_connect (struct drbd_connection *connection) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct drbd_socket sock, msock;struct drbd_peer_device *peer_device;
drivers/block/drbd/drbd_state.c +4 -0
@@ -562,6 +562,7 @@ _req_st_cond(struct drbd_device *device, union drbd_state mask,static enum drbd_state_rv drbd_req_state (struct drbd_device *device,union drbd_state mask,union drbd_state val,enum chg_state_flags f) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct completion done;unsigned long flags;
@@ -699,6 +700,7 @@ int drbd_request_detach_interruptible(struct drbd_device *device)enum drbd_state_rv _drbd_request_state_holding_state_mutex (struct drbd_device *device,union drbd_state mask,union drbd_state val,enum chg_state_flags f) + REQUIRES(device->state_mutex) {enum drbd_state_rv rv;
@@ -2292,6 +2294,7 @@ _conn_rq_cond(struct drbd_connection *connection, union drbd_state mask, union denum drbd_state_rv _conn_request_state (struct drbd_connection *connection,union drbd_state mask,union drbd_state val,enum chg_state_flags flags) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {enum drbd_state_rv rv =SS_SUCCESS ;struct after_conn_state_chg_work *acscw;
@@ -2386,6 +2389,7 @@ _conn_request_state(struct drbd_connection *connection, union drbd_state mask, uenum drbd_state_rv conn_request_state (struct drbd_connection *connection,union drbd_state mask,union drbd_state val,enum chg_state_flags flags) + REQUIRES(connection->cstate_mutex) {enum drbd_state_rv rv;
drivers/block/loop.c +2 -0
@@ -108,6 +108,7 @@ static DEFINE_MUTEX(loop_validate_mutex);* loop_configure()/loop_change_fd()/__loop_clr_fd() calls. */ static int loop_global_lock_killable (struct loop_device *lo,bool global) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {int err;
@@ -129,6 +130,7 @@ static int loop_global_lock_killable(struct loop_device *lo, bool global)* @global: true if @lo was about to bind another "struct loop_device", false otherwise */ static void loop_global_unlock (struct loop_device *lo,bool global) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {mutex_unlock (&lo->lo_mutex);if (global)
drivers/block/nbd.c +3 -0
@@ -1419,6 +1419,7 @@ static void nbd_clear_sock(struct nbd_device *nbd) }static void nbd_config_put (struct nbd_device *nbd) +NO_THREAD_SAFETY_ANALYSIS /* because of a clang bug */ {if (refcount_dec_and_mutex_lock (&nbd->config_refs, &nbd->config_lock)) {
@@ -1520,6 +1521,7 @@ static int nbd_start_device(struct nbd_device *nbd) }static int nbd_start_device_ioctl (struct nbd_device *nbd) + REQUIRES(nbd->config_lock) {struct nbd_config *config = nbd->config;int ret;
@@ -1571,6 +1573,7 @@ static void nbd_set_cmd_timeout(struct nbd_device *nbd, u64 timeout)/* Must be called with config_lock held */ static int __nbd_ioctl (struct block_device *bdev,struct nbd_device *nbd,unsigned int cmd,unsigned long arg) + REQUIRES(nbd->config_lock) {struct nbd_config *config = nbd->config;loff_t bytesize;
drivers/block/null_blk/zoned.c +2 -0
@@ -32,6 +32,7 @@ static inline void null_init_zone_lock(struct nullb_device *dev,static inline void null_lock_zone (struct nullb_device *dev,struct nullb_zone *zone) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {if (!dev->memory_backed)spin_lock_irq (&zone->spinlock);
@@ -41,6 +42,7 @@ static inline void null_lock_zone(struct nullb_device *dev,static inline void null_unlock_zone (struct nullb_device *dev,struct nullb_zone *zone) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {if (!dev->memory_backed)spin_unlock_irq (&zone->spinlock);
drivers/block/rnbd/rnbd-clt.c +2 -0
@@ -831,6 +831,7 @@ static int wait_for_rtrs_connection(struct rnbd_clt_session *sess)static void wait_for_rtrs_disconnection (struct rnbd_clt_session *sess) __releases(&sess_lock) __acquires(&sess_lock) +REQUIRES (sess_lock) {DEFINE_WAIT (wait);
@@ -853,6 +854,7 @@ static void wait_for_rtrs_disconnection(struct rnbd_clt_session *sess)static struct rnbd_clt_session *__find_and_get_sess (const char *sessname) __releases(&sess_lock) __acquires(&sess_lock) +REQUIRES (sess_lock) {struct rnbd_clt_session *sess, *sn;int err;
drivers/bus/fsl-mc/mc-sys.c +1 -0
@@ -243,6 +243,7 @@ static int mc_polling_wait_atomic(struct fsl_mc_io *mc_io,* Returns '0' on Success; Error code otherwise. */ int mc_send_command (struct fsl_mc_io *mc_io,struct fsl_mc_command *cmd) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {int error;enum mc_cmd_status status;
drivers/bus/vexpress-config.c +2 -0
@@ -78,11 +78,13 @@ static void vexpress_config_set_master(u32 site) }static void vexpress_config_lock (void *arg) +ACQUIRE (vexpress_config_mutex) {mutex_lock (&vexpress_config_mutex); }static void vexpress_config_unlock (void *arg) +RELEASE (vexpress_config_mutex) {mutex_unlock (&vexpress_config_mutex); }
drivers/cdx/cdx_msi.c +2 -0
@@ -29,6 +29,7 @@ static void cdx_msi_write_msg(struct irq_data *irq_data, struct msi_msg *msg) }static void cdx_msi_write_irq_lock (struct irq_data *irq_data) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct msi_desc *msi_desc =irq_data_get_msi_desc (irq_data);struct cdx_device *cdx_dev =to_cdx_device (msi_desc->dev);
@@ -37,6 +38,7 @@ static void cdx_msi_write_irq_lock(struct irq_data *irq_data) }static void cdx_msi_write_irq_unlock (struct irq_data *irq_data) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct msi_desc *msi_desc =irq_data_get_msi_desc (irq_data);struct cdx_device *cdx_dev =to_cdx_device (msi_desc->dev);
drivers/char/ipmi/ipmi_msghandler.c +1 -0
@@ -3103,6 +3103,7 @@ static void ipmi_bmc_unregister(struct ipmi_smi *intf)static int __ipmi_bmc_register (struct ipmi_smi *intf,struct ipmi_device_id *id,bool guid_set,guid_t *guid,int intf_num) + REQUIRES(&intf->bmc_reg_mutex) {int rv;struct bmc_device *bmc;
drivers/char/misc.c +2 -0
@@ -101,6 +101,7 @@ static void misc_minor_free(int minor)#ifdef CONFIG_PROC_FS static void *misc_seq_start (struct seq_file *seq,loff_t *pos) +ACQUIRE (misc_mtx) {mutex_lock (&misc_mtx);return seq_list_start (&misc_list, *pos);
@@ -112,6 +113,7 @@ static void *misc_seq_next(struct seq_file *seq, void *v, loff_t *pos) }static void misc_seq_stop (struct seq_file *seq,void *v) +RELEASE (misc_mtx) {mutex_unlock (&misc_mtx); }
drivers/char/powernv-op-panel.c +2 -0
@@ -113,6 +113,7 @@ static ssize_t oppanel_write(struct file *filp, const char __user *userbuf, }static int oppanel_open (struct inode *inode,struct file *filp) +TRY_ACQUIRE (0 , oppanel_mutex) {if (!mutex_trylock (&oppanel_mutex)) {pr_debug ("Device Busy\n" );
@@ -122,6 +123,7 @@ static int oppanel_open(struct inode *inode, struct file *filp) }static int oppanel_release (struct inode *inode,struct file *filp) +RELEASE (oppanel_mutex) {mutex_unlock (&oppanel_mutex);return 0 ;
drivers/char/tpm/tpm-chip.c +3 -0
@@ -155,6 +155,7 @@ EXPORT_SYMBOL_GPL(tpm_chip_stop);* Returns -ERRNO if the chip could not be got. */ int tpm_try_get_ops (struct tpm_chip *chip) +NO_THREAD_SAFETY_ANALYSIS /* to match tpm_find_get_ops() */ {int rc = -EIO ;
@@ -190,6 +191,7 @@ EXPORT_SYMBOL_GPL(tpm_try_get_ops);* be kfree'd. */ void tpm_put_ops (struct tpm_chip *chip) +NO_THREAD_SAFETY_ANALYSIS /* to match tpm_find_get_ops() */ {tpm_chip_stop (chip);mutex_unlock (&chip->tpm_mutex);
@@ -241,6 +243,7 @@ EXPORT_SYMBOL_GPL(tpm_default_chip);* %NULL if the chip is not available. */ struct tpm_chip *tpm_find_get_ops (struct tpm_chip *chip) +NO_THREAD_SAFETY_ANALYSIS /* returns a pointer */ {int rc;
drivers/char/xillybus/xillybus_core.c +1 -0
@@ -1425,6 +1425,7 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, }static int xillybus_open (struct inode *inode,struct file *filp) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {int rc;unsigned long flags;
drivers/clk/clk.c +4 -0
@@ -143,6 +143,7 @@ static void clk_pm_runtime_put(struct clk_core *core)* Return: 0 on success, negative errno otherwise. */ static int clk_pm_runtime_get_all (void ) +TRY_ACQUIRE (0 , clk_rpm_list_lock) {int ret;struct clk_core *core, *failed;
@@ -189,6 +190,7 @@ static int clk_pm_runtime_get_all(void)* the 'clk_rpm_list_lock'. */ static void clk_pm_runtime_put_all (void ) +RELEASE (clk_rpm_list_lock) {struct clk_core *core;
@@ -212,6 +214,7 @@ static void clk_pm_runtime_init(struct clk_core *core)/*** locking ***/ static void clk_prepare_lock (void ) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {if (!mutex_trylock (&prepare_lock)) {if (prepare_owner == current) {
@@ -227,6 +230,7 @@ static void clk_prepare_lock(void) }static void clk_prepare_unlock (void ) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {WARN_ON_ONCE (prepare_owner != current);WARN_ON_ONCE (prepare_refcnt ==0 );
drivers/comedi/comedi_fops.c +2 -0
@@ -3250,6 +3250,7 @@ EXPORT_SYMBOL_GPL(comedi_event);/* Note: the ->mutex is pre-locked on successful return */ struct comedi_device *comedi_alloc_board_minor (struct device *hardware_device) +NO_THREAD_SAFETY_ANALYSIS /* returns a pointer */ {struct comedi_device *dev;struct device *csdev;
@@ -3370,6 +3371,7 @@ static void comedi_cleanup_board_minors(void) }static int __init comedi_init (void ) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {int i;int retval;
drivers/comedi/drivers.c +1 -0
@@ -1031,6 +1031,7 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it)*/ int comedi_auto_config (struct device *hardware_device,struct comedi_driver *driver,unsigned long context) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct comedi_device *dev;int ret;
drivers/comedi/drivers/usbduxsigma.c +1 -0
@@ -823,6 +823,7 @@ static int usbduxsigma_ao_inttrig(struct comedi_device *dev,static int usbduxsigma_ao_cmdtest (struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_cmd *cmd) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct usbduxsigma_private *devpriv = dev->private;unsigned int tmp;
drivers/counter/rz-mtu3-cnt.c +3 -0
@@ -124,6 +124,7 @@ static int rz_mtu3_lock_if_counter_is_valid(struct counter_device *counter,struct rz_mtu3_channel *const ch, struct rz_mtu3_cnt *const priv, int id) + TRY_ACQUIRE(0, priv->lock) { mutex_lock(&priv->lock);
@@ -143,6 +144,7 @@ static int rz_mtu3_lock_if_counter_is_valid(struct counter_device *counter,static int rz_mtu3_lock_if_count_is_enabled (struct rz_mtu3_channel *const ch,struct rz_mtu3_cnt *const priv,int id) + TRY_ACQUIRE(0, priv->lock) {mutex_lock (&priv->lock);
@@ -518,6 +520,7 @@ static int rz_mtu3_count_enable_write(struct counter_device *counter, }static int rz_mtu3_lock_if_ch0_is_enabled (struct rz_mtu3_cnt *const priv) + TRY_ACQUIRE(0, priv->lock) {mutex_lock (&priv->lock); if (priv->ch->is_busy && !(priv->count_is_enabled[RZ_MTU3_16_BIT_MTU1_CH] ||
drivers/cpuidle/cpuidle.c +2 -0
@@ -491,6 +491,7 @@ void cpuidle_uninstall_idle_handler(void)* cpuidle_pause_and_lock - temporarily disables CPUIDLE */ void cpuidle_pause_and_lock (void ) +ACQUIRE (cpuidle_lock) {mutex_lock (&cpuidle_lock);cpuidle_uninstall_idle_handler ();
@@ -502,6 +503,7 @@ EXPORT_SYMBOL_GPL(cpuidle_pause_and_lock);* cpuidle_resume_and_unlock - resumes CPUIDLE operation */ void cpuidle_resume_and_unlock (void ) +RELEASE (cpuidle_lock) {cpuidle_install_idle_handler ();mutex_unlock (&cpuidle_lock);
drivers/crypto/exynos-rng.c +1 -0
@@ -170,6 +170,7 @@ static int exynos_rng_get_random(struct exynos_rng_dev *rng,/* Re-seed itself from time to time */ static void exynos_rng_reseed (struct exynos_rng_dev *rng) + REQUIRES(rng->lock) {unsigned long next_seeding = rng->last_seeding + \msecs_to_jiffies (EXYNOS_RNG_RESEED_TIME );
drivers/crypto/hisilicon/qm.c +4 -0
@@ -1847,6 +1847,7 @@ static int qm_set_msi_v3(struct hisi_qm *qm, bool set) }static int qm_set_ifc_begin_v3 (struct hisi_qm *qm,enum qm_ifc_cmd cmd,u32 data,u32 fun_num) + ACQUIRE(qm->mailbox_lock) {struct qm_mailbox mailbox;u64 msg;
@@ -1859,6 +1860,7 @@ static int qm_set_ifc_begin_v3(struct hisi_qm *qm, enum qm_ifc_cmd cmd, u32 data }static void qm_set_ifc_end_v3 (struct hisi_qm *qm) + RELEASE(qm->mailbox_lock) {mutex_unlock (&qm->mailbox_lock); }
@@ -1881,6 +1883,7 @@ static int qm_get_ifc_v3(struct hisi_qm *qm, enum qm_ifc_cmd *cmd, u32 *data, u3 }static int qm_set_ifc_begin_v4 (struct hisi_qm *qm,enum qm_ifc_cmd cmd,u32 data,u32 fun_num) + ACQUIRE(qm->ifc_lock) {uintptr_t offset;u64 msg;
@@ -1899,6 +1902,7 @@ static int qm_set_ifc_begin_v4(struct hisi_qm *qm, enum qm_ifc_cmd cmd, u32 data }static void qm_set_ifc_end_v4 (struct hisi_qm *qm) + RELEASE(qm->ifc_lock) {mutex_unlock (&qm->ifc_lock); }
drivers/crypto/intel/qat/qat_common/adf_cfg.c +2 -0
@@ -11,6 +11,7 @@static DEFINE_MUTEX (qat_cfg_read_lock);static void *qat_dev_cfg_start (struct seq_file *sfile,loff_t *pos) +ACQUIRE (qat_cfg_read_lock) {struct adf_cfg_device_data *dev_cfg = sfile->private;
@@ -41,6 +42,7 @@ static void *qat_dev_cfg_next(struct seq_file *sfile, void *v, loff_t *pos) }static void qat_dev_cfg_stop (struct seq_file *sfile,void *v) +RELEASE (qat_cfg_read_lock) {mutex_unlock (&qat_cfg_read_lock); }
drivers/crypto/intel/qat/qat_common/adf_transport_debug.c +4 -0
@@ -11,6 +11,7 @@ static DEFINE_MUTEX(ring_read_lock);static DEFINE_MUTEX (bank_read_lock);static void *adf_ring_start (struct seq_file *sfile,loff_t *pos) +ACQUIRE (ring_read_lock) {struct adf_etr_ring_data *ring = sfile->private;
@@ -74,6 +75,7 @@ static int adf_ring_show(struct seq_file *sfile, void *v) }static void adf_ring_stop (struct seq_file *sfile,void *v) +RELEASE (ring_read_lock) {mutex_unlock (&ring_read_lock); }
@@ -117,6 +119,7 @@ void adf_ring_debugfs_rm(struct adf_etr_ring_data *ring) }static void *adf_bank_start (struct seq_file *sfile,loff_t *pos) +ACQUIRE (bank_read_lock) {struct adf_etr_bank_data *bank = sfile->private;u8 num_rings_per_bank =GET_NUM_RINGS_PER_BANK (bank->accel_dev);
@@ -175,6 +178,7 @@ static int adf_bank_show(struct seq_file *sfile, void *v) }static void adf_bank_stop (struct seq_file *sfile,void *v) +RELEASE (bank_read_lock) {mutex_unlock (&bank_read_lock); }
drivers/cxl/core/port.c +2 -0
@@ -1082,12 +1082,14 @@ static int add_dport(struct cxl_port *port, struct cxl_dport *dport)* port lock in that case. */ static void cond_cxl_root_lock (struct cxl_port *port) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {if (is_cxl_root (port))device_lock (&port->dev); }static void cond_cxl_root_unlock (struct cxl_port *port) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {if (is_cxl_root (port))device_unlock (&port->dev);
drivers/devfreq/devfreq.c +1 -0
@@ -290,6 +290,7 @@ static struct devfreq_governor *find_devfreq_governor(const char *name)* governor's pointer or an error pointer. */ static struct devfreq_governor *try_then_request_governor (const char *name) +REQUIRES (devfreq_list_lock) {struct devfreq_governor *governor;int err =0 ;
drivers/dpll/dpll_netlink.c +6 -0
@@ -1575,6 +1575,7 @@ int dpll_nl_device_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)int dpll_pre_doit (const struct genl_split_ops *ops,struct sk_buff *skb,struct genl_info *info) +TRY_ACQUIRE (0 , dpll_lock) {u32 id;
@@ -1596,6 +1597,7 @@ int dpll_pre_doit(const struct genl_split_ops *ops, struct sk_buff *skb,void dpll_post_doit (const struct genl_split_ops *ops,struct sk_buff *skb,struct genl_info *info) +RELEASE (dpll_lock) {mutex_unlock (&dpll_lock); }
@@ -1603,6 +1605,7 @@ void dpll_post_doit(const struct genl_split_ops *ops, struct sk_buff *skb,int dpll_lock_doit (const struct genl_split_ops *ops,struct sk_buff *skb,struct genl_info *info) +ACQUIRE (dpll_lock) {mutex_lock (&dpll_lock);
@@ -1612,12 +1615,14 @@ dpll_lock_doit(const struct genl_split_ops *ops, struct sk_buff *skb,void dpll_unlock_doit (const struct genl_split_ops *ops,struct sk_buff *skb,struct genl_info *info) +RELEASE (dpll_lock) {mutex_unlock (&dpll_lock); }int dpll_pin_pre_doit (const struct genl_split_ops *ops,struct sk_buff *skb,struct genl_info *info) +TRY_ACQUIRE (0 , dpll_lock) {int ret;
@@ -1644,6 +1649,7 @@ int dpll_pin_pre_doit(const struct genl_split_ops *ops, struct sk_buff *skb,void dpll_pin_post_doit (const struct genl_split_ops *ops,struct sk_buff *skb,struct genl_info *info) +RELEASE (dpll_lock) {mutex_unlock (&dpll_lock); }
drivers/firmware/arm_ffa/driver.c +1 -0
@@ -689,6 +689,7 @@ ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize, }static int ffa_memory_ops (u32 func_id,struct ffa_mem_ops_args *args) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {int ret;void *buffer;
drivers/firmware/arm_scmi/notify.c +1 -0
@@ -1264,6 +1264,7 @@ static bool scmi_put_handler_unlocked(struct scmi_notify_instance *ni,static void scmi_put_handler (struct scmi_notify_instance *ni,struct scmi_event_handler *hndl) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {bool freed;u8 protocol_id;
drivers/firmware/arm_scmi/transports/mailbox.c +2 -0
@@ -270,6 +270,7 @@ static int mailbox_chan_free(int id, void *p, void *data)static int mailbox_send_message (struct scmi_chan_info *cinfo,struct scmi_xfer *xfer) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct scmi_mailbox *smbox = cinfo->transport_info;int ret;
@@ -295,6 +296,7 @@ static int mailbox_send_message(struct scmi_chan_info *cinfo,static void mailbox_mark_txdone (struct scmi_chan_info *cinfo,int ret,struct scmi_xfer *__unused) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct scmi_mailbox *smbox = cinfo->transport_info;
drivers/firmware/arm_scmi/transports/optee.c +2 -0
@@ -455,6 +455,7 @@ static int scmi_optee_chan_free(int id, void *p, void *data)static int scmi_optee_send_message (struct scmi_chan_info *cinfo,struct scmi_xfer *xfer) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct scmi_optee_channel *channel = cinfo->transport_info;int ret;
@@ -492,6 +493,7 @@ static void scmi_optee_fetch_response(struct scmi_chan_info *cinfo,static void scmi_optee_mark_txdone (struct scmi_chan_info *cinfo,int ret,struct scmi_xfer *__unused) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct scmi_optee_channel *channel = cinfo->transport_info;
drivers/firmware/qcom/qcom_qseecom_uefisecapp.c +2 -0
@@ -713,6 +713,7 @@ static int qcuefi_set_reference(struct qcuefi_client *qcuefi) }static struct qcuefi_client *qcuefi_acquire (void ) +NO_THREAD_SAFETY_ANALYSIS /* returns a pointer */ {mutex_lock (&__qcuefi_lock);if (!__qcuefi) {
@@ -723,6 +724,7 @@ static struct qcuefi_client *qcuefi_acquire(void) }static void qcuefi_release (void ) +NO_THREAD_SAFETY_ANALYSIS /* to match qcuefi_acquire() */ {mutex_unlock (&__qcuefi_lock); }
drivers/fpga/fpga-bridge.c +2 -0
@@ -57,6 +57,7 @@ EXPORT_SYMBOL_GPL(fpga_bridge_disable);static struct fpga_bridge *__fpga_bridge_get (struct device *bridge_dev,struct fpga_image_info *info) +NO_THREAD_SAFETY_ANALYSIS /* TRY_ACQUIRE() does not support pointers */ {struct fpga_bridge *bridge;
@@ -211,6 +212,7 @@ EXPORT_SYMBOL_GPL(fpga_bridges_disable);* If list is empty, do nothing. */ void fpga_bridges_put (struct list_head *bridge_list) +NO_THREAD_SAFETY_ANALYSIS /* mutex operation inside a loop */ {struct fpga_bridge *bridge, *next;unsigned long flags;
drivers/fpga/fpga-region.c +3 -0
@@ -44,6 +44,7 @@ EXPORT_SYMBOL_GPL(fpga_region_class_find);* * -ENODEV if can't take parent driver module refcount. */ static struct fpga_region *fpga_region_get (struct fpga_region *region) +NO_THREAD_SAFETY_ANALYSIS /* TRY_ACQUIRE() does not support pointers */ {struct device *dev = ®ion->dev;
@@ -70,6 +71,7 @@ static struct fpga_region *fpga_region_get(struct fpga_region *region)* @region: FPGA region */ static void fpga_region_put (struct fpga_region *region) + RELEASE(region->mutex) {struct device *dev = ®ion->dev;
@@ -95,6 +97,7 @@ static void fpga_region_put(struct fpga_region *region)* Return: 0 for success or negative error code. */ int fpga_region_program_fpga (struct fpga_region *region) +NO_THREAD_SAFETY_ANALYSIS /* TRY_ACQUIRE() does not support pointers */ {struct device *dev = ®ion->dev;struct fpga_image_info *info = region->info;
drivers/gpio/gpio-adnp.c +2 -0
@@ -352,6 +352,7 @@ static int adnp_irq_set_type(struct irq_data *d, unsigned int type) }static void adnp_irq_bus_lock (struct irq_data *d) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct adnp *adnp =gpiochip_get_data (gc);
@@ -360,6 +361,7 @@ static void adnp_irq_bus_lock(struct irq_data *d) }static void adnp_irq_bus_unlock (struct irq_data *d) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct adnp *adnp =gpiochip_get_data (gc);
drivers/gpio/gpio-crystalcove.c +2 -0
@@ -212,6 +212,7 @@ static int crystalcove_irq_type(struct irq_data *data, unsigned int type) }static void crystalcove_bus_lock (struct irq_data *data) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct crystalcove_gpio *cg =gpiochip_get_data (irq_data_get_irq_chip_data (data));
@@ -219,6 +220,7 @@ static void crystalcove_bus_lock(struct irq_data *data) }static void crystalcove_bus_sync_unlock (struct irq_data *data) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct crystalcove_gpio *cg =gpiochip_get_data (irq_data_get_irq_chip_data (data));irq_hw_number_t hwirq =irqd_to_hwirq (data);
drivers/gpio/gpio-dln2.c +2 -0
@@ -349,6 +349,7 @@ static int dln2_irq_set_type(struct irq_data *irqd, unsigned type) }static void dln2_irq_bus_lock (struct irq_data *irqd) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (irqd);struct dln2_gpio *dln2 =gpiochip_get_data (gc);
@@ -357,6 +358,7 @@ static void dln2_irq_bus_lock(struct irq_data *irqd) }static void dln2_irq_bus_unlock (struct irq_data *irqd) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (irqd);struct dln2_gpio *dln2 =gpiochip_get_data (gc);
drivers/gpio/gpio-ljca.c +2 -0
@@ -357,6 +357,7 @@ static int ljca_irq_set_type(struct irq_data *irqd, unsigned int type) }static void ljca_irq_bus_lock (struct irq_data *irqd) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (irqd);struct ljca_gpio_dev *ljca_gpio =gpiochip_get_data (gc);
@@ -365,6 +366,7 @@ static void ljca_irq_bus_lock(struct irq_data *irqd) }static void ljca_irq_bus_unlock (struct irq_data *irqd) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (irqd);struct ljca_gpio_dev *ljca_gpio =gpiochip_get_data (gc);
drivers/gpio/gpio-max77620.c +2 -0
@@ -96,6 +96,7 @@ static int max77620_gpio_set_irq_type(struct irq_data *data, unsigned int type) }static void max77620_gpio_bus_lock (struct irq_data *data) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *chip =irq_data_get_irq_chip_data (data);struct max77620_gpio *gpio =gpiochip_get_data (chip);
@@ -104,6 +105,7 @@ static void max77620_gpio_bus_lock(struct irq_data *data) }static void max77620_gpio_bus_sync_unlock (struct irq_data *data) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *chip =irq_data_get_irq_chip_data (data);struct max77620_gpio *gpio =gpiochip_get_data (chip);
drivers/gpio/gpio-mlxbf2.c +2 -0
@@ -128,6 +128,7 @@ static int mlxbf2_gpio_get_lock_res(struct platform_device *pdev)* mode. If the lock_active bit is already set, return an error. */ static int mlxbf2_gpio_lock_acquire (struct mlxbf2_gpio_context *gs) + TRY_ACQUIRE(0, yu_arm_gpio_lock_param.lock) {u32 arm_gpio_lock_val;
@@ -156,6 +157,7 @@ static int mlxbf2_gpio_lock_acquire(struct mlxbf2_gpio_context *gs)static void mlxbf2_gpio_lock_release (struct mlxbf2_gpio_context *gs) __releases(&gs->gc.bgpio_lock) __releases(yu_arm_gpio_lock_param.lock) + RELEASE(yu_arm_gpio_lock_param.lock) {writel (YU_ARM_GPIO_LOCK_RELEASE , yu_arm_gpio_lock_param.io);raw_spin_unlock (&gs->gc.bgpio_lock);
drivers/gpio/gpio-pca953x.c +2 -0
@@ -742,6 +742,7 @@ static int pca953x_irq_set_wake(struct irq_data *d, unsigned int on) }static void pca953x_irq_bus_lock (struct irq_data *d) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct pca953x_chip *chip =gpiochip_get_data (gc);
@@ -750,6 +751,7 @@ static void pca953x_irq_bus_lock(struct irq_data *d) }static void pca953x_irq_bus_sync_unlock (struct irq_data *d) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct pca953x_chip *chip =gpiochip_get_data (gc);
drivers/gpio/gpio-pcf857x.c +2 -0
@@ -241,6 +241,7 @@ static void pcf857x_irq_disable(struct irq_data *data) }static void pcf857x_irq_bus_lock (struct irq_data *data) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct pcf857x *gpio =irq_data_get_irq_chip_data (data);
@@ -248,6 +249,7 @@ static void pcf857x_irq_bus_lock(struct irq_data *data) }static void pcf857x_irq_bus_sync_unlock (struct irq_data *data) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct pcf857x *gpio =irq_data_get_irq_chip_data (data);
drivers/gpio/gpio-pmic-eic-sprd.c +2 -0
@@ -199,6 +199,7 @@ static int sprd_pmic_eic_irq_set_type(struct irq_data *data, }static void sprd_pmic_eic_bus_lock (struct irq_data *data) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *chip =irq_data_get_irq_chip_data (data);struct sprd_pmic_eic *pmic_eic =gpiochip_get_data (chip);
@@ -207,6 +208,7 @@ static void sprd_pmic_eic_bus_lock(struct irq_data *data) }static void sprd_pmic_eic_bus_sync_unlock (struct irq_data *data) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *chip =irq_data_get_irq_chip_data (data);struct sprd_pmic_eic *pmic_eic =gpiochip_get_data (chip);
drivers/gpio/gpio-stmpe.c +2 -0
@@ -167,6 +167,7 @@ static int stmpe_gpio_irq_set_type(struct irq_data *d, unsigned int type) }static void stmpe_gpio_irq_lock (struct irq_data *d) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct stmpe_gpio *stmpe_gpio =gpiochip_get_data (gc);
@@ -175,6 +176,7 @@ static void stmpe_gpio_irq_lock(struct irq_data *d) }static void stmpe_gpio_irq_sync_unlock (struct irq_data *d) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct stmpe_gpio *stmpe_gpio =gpiochip_get_data (gc);
drivers/gpio/gpio-tc3589x.c +2 -0
@@ -183,6 +183,7 @@ static int tc3589x_gpio_irq_set_type(struct irq_data *d, unsigned int type) }static void tc3589x_gpio_irq_lock (struct irq_data *d) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct tc3589x_gpio *tc3589x_gpio =gpiochip_get_data (gc);
@@ -191,6 +192,7 @@ static void tc3589x_gpio_irq_lock(struct irq_data *d) }static void tc3589x_gpio_irq_sync_unlock (struct irq_data *d) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct tc3589x_gpio *tc3589x_gpio =gpiochip_get_data (gc);
drivers/gpio/gpio-virtio.c +2 -0
@@ -318,6 +318,7 @@ static int virtio_gpio_irq_set_type(struct irq_data *d, unsigned int type) }static void virtio_gpio_irq_bus_lock (struct irq_data *d) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct virtio_gpio *vgpio =gpiochip_get_data (gc);
@@ -326,6 +327,7 @@ static void virtio_gpio_irq_bus_lock(struct irq_data *d) }static void virtio_gpio_irq_bus_sync_unlock (struct irq_data *d) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct virtio_gpio *vgpio =gpiochip_get_data (gc);
drivers/gpio/gpio-wcove.c +2 -0
@@ -268,6 +268,7 @@ static int wcove_irq_type(struct irq_data *data, unsigned int type) }static void wcove_bus_lock (struct irq_data *data) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *chip =irq_data_get_irq_chip_data (data);struct wcove_gpio *wg =gpiochip_get_data (chip);
@@ -276,6 +277,7 @@ static void wcove_bus_lock(struct irq_data *data) }static void wcove_bus_sync_unlock (struct irq_data *data) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct gpio_chip *chip =irq_data_get_irq_chip_data (data);struct wcove_gpio *wg =gpiochip_get_data (chip);
drivers/gpu/drm/amd/amdgpu/aldebaran.c +1 -0
@@ -136,6 +136,7 @@ static int aldebaran_mode2_reset(struct amdgpu_device *adev)static int aldebaran_mode2_perform_reset (struct amdgpu_reset_control *reset_ctl,struct amdgpu_reset_context *reset_context) +NO_THREAD_SAFETY_ANALYSIS /* mutex operation inside a loop */ {struct amdgpu_device *adev = (struct amdgpu_device *)reset_ctl->handle;struct list_head *reset_device_list = reset_context->reset_device_list;
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c +4 -0
@@ -43,12 +43,14 @@ enum hqd_dequeue_request_type {static void lock_srbm (struct amdgpu_device *adev,uint32_t mec,uint32_t pipe,uint32_t queue,uint32_t vmid) + ACQUIRE(adev->srbm_mutex) {mutex_lock (&adev->srbm_mutex);nv_grbm_select (adev, mec, pipe, queue, vmid); }static void unlock_srbm (struct amdgpu_device *adev) + RELEASE(adev->srbm_mutex) {nv_grbm_select (adev,0 ,0 ,0 ,0 );mutex_unlock (&adev->srbm_mutex);
@@ -56,6 +58,7 @@ static void unlock_srbm(struct amdgpu_device *adev)static void acquire_queue (struct amdgpu_device *adev,uint32_t pipe_id,uint32_t queue_id) + ACQUIRE(adev->srbm_mutex) {uint32_t mec = (pipe_id / adev->gfx.mec.num_pipe_per_mec) +1 ;uint32_t pipe = (pipe_id % adev->gfx.mec.num_pipe_per_mec);
@@ -73,6 +76,7 @@ static uint64_t get_queue_mask(struct amdgpu_device *adev, }static void release_queue (struct amdgpu_device *adev) + RELEASE(adev->srbm_mutex) {unlock_srbm (adev); }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c +4 -0
@@ -43,12 +43,14 @@ enum hqd_dequeue_request_type {static void lock_srbm (struct amdgpu_device *adev,uint32_t mec,uint32_t pipe,uint32_t queue,uint32_t vmid) + ACQUIRE(adev->srbm_mutex) {mutex_lock (&adev->srbm_mutex);nv_grbm_select (adev, mec, pipe, queue, vmid); }static void unlock_srbm (struct amdgpu_device *adev) + RELEASE(adev->srbm_mutex) {nv_grbm_select (adev,0 ,0 ,0 ,0 );mutex_unlock (&adev->srbm_mutex);
@@ -56,6 +58,7 @@ static void unlock_srbm(struct amdgpu_device *adev)static void acquire_queue (struct amdgpu_device *adev,uint32_t pipe_id,uint32_t queue_id) + ACQUIRE(adev->srbm_mutex) {uint32_t mec = (pipe_id / adev->gfx.mec.num_pipe_per_mec) +1 ;uint32_t pipe = (pipe_id % adev->gfx.mec.num_pipe_per_mec);
@@ -73,6 +76,7 @@ static uint64_t get_queue_mask(struct amdgpu_device *adev, }static void release_queue (struct amdgpu_device *adev) + RELEASE(adev->srbm_mutex) {unlock_srbm (adev); }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c +4 -0
@@ -41,12 +41,14 @@ enum hqd_dequeue_request_type {static void lock_srbm (struct amdgpu_device *adev,uint32_t mec,uint32_t pipe,uint32_t queue,uint32_t vmid) + ACQUIRE(adev->srbm_mutex) {mutex_lock (&adev->srbm_mutex);soc21_grbm_select (adev, mec, pipe, queue, vmid); }static void unlock_srbm (struct amdgpu_device *adev) + RELEASE(adev->srbm_mutex) {soc21_grbm_select (adev,0 ,0 ,0 ,0 );mutex_unlock (&adev->srbm_mutex);
@@ -54,6 +56,7 @@ static void unlock_srbm(struct amdgpu_device *adev)static void acquire_queue (struct amdgpu_device *adev,uint32_t pipe_id,uint32_t queue_id) + ACQUIRE(adev->srbm_mutex) {uint32_t mec = (pipe_id / adev->gfx.mec.num_pipe_per_mec) +1 ;uint32_t pipe = (pipe_id % adev->gfx.mec.num_pipe_per_mec);
@@ -71,6 +74,7 @@ static uint64_t get_queue_mask(struct amdgpu_device *adev, }static void release_queue (struct amdgpu_device *adev) + RELEASE(adev->srbm_mutex) {unlock_srbm (adev); }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12.c +4 -0
@@ -29,12 +29,14 @@static void lock_srbm (struct amdgpu_device *adev,uint32_t mec,uint32_t pipe,uint32_t queue,uint32_t vmid) + ACQUIRE(adev->srbm_mutex) {mutex_lock (&adev->srbm_mutex);soc24_grbm_select (adev, mec, pipe, queue, vmid); }static void unlock_srbm (struct amdgpu_device *adev) + RELEASE(adev->srbm_mutex) {soc24_grbm_select (adev,0 ,0 ,0 ,0 );mutex_unlock (&adev->srbm_mutex);
@@ -42,6 +44,7 @@ static void unlock_srbm(struct amdgpu_device *adev)static void acquire_queue (struct amdgpu_device *adev,uint32_t pipe_id,uint32_t queue_id) + ACQUIRE(adev->srbm_mutex) {uint32_t mec = (pipe_id / adev->gfx.mec.num_pipe_per_mec) +1 ;uint32_t pipe = (pipe_id % adev->gfx.mec.num_pipe_per_mec);
@@ -50,6 +53,7 @@ static void acquire_queue(struct amdgpu_device *adev, uint32_t pipe_id, }static void release_queue (struct amdgpu_device *adev) + RELEASE(adev->srbm_mutex) {unlock_srbm (adev); }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c +4 -0
@@ -47,6 +47,7 @@ enum {static void lock_srbm (struct amdgpu_device *adev,uint32_t mec,uint32_t pipe,uint32_t queue,uint32_t vmid) + ACQUIRE(adev->srbm_mutex) {uint32_t value =PIPEID (pipe) |MEID (mec) |VMID (vmid) |QUEUEID (queue);
@@ -55,6 +56,7 @@ static void lock_srbm(struct amdgpu_device *adev, uint32_t mec, uint32_t pipe, }static void unlock_srbm (struct amdgpu_device *adev) + RELEASE(adev->srbm_mutex) {WREG32 (mmSRBM_GFX_CNTL,0 );mutex_unlock (&adev->srbm_mutex);
@@ -62,6 +64,7 @@ static void unlock_srbm(struct amdgpu_device *adev)static void acquire_queue (struct amdgpu_device *adev,uint32_t pipe_id,uint32_t queue_id) + ACQUIRE(adev->srbm_mutex) {uint32_t mec = (pipe_id / adev->gfx.mec.num_pipe_per_mec) +1 ;uint32_t pipe = (pipe_id % adev->gfx.mec.num_pipe_per_mec);
@@ -70,6 +73,7 @@ static void acquire_queue(struct amdgpu_device *adev, uint32_t pipe_id, }static void release_queue (struct amdgpu_device *adev) + RELEASE(adev->srbm_mutex) {unlock_srbm (adev); }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c +4 -0
@@ -41,6 +41,7 @@ enum hqd_dequeue_request_type {static void lock_srbm (struct amdgpu_device *adev,uint32_t mec,uint32_t pipe,uint32_t queue,uint32_t vmid) + ACQUIRE(adev->srbm_mutex) {uint32_t value =PIPEID (pipe) |MEID (mec) |VMID (vmid) |QUEUEID (queue);
@@ -49,6 +50,7 @@ static void lock_srbm(struct amdgpu_device *adev, uint32_t mec, uint32_t pipe, }static void unlock_srbm (struct amdgpu_device *adev) + RELEASE(adev->srbm_mutex) {WREG32 (mmSRBM_GFX_CNTL,0 );mutex_unlock (&adev->srbm_mutex);
@@ -56,6 +58,7 @@ static void unlock_srbm(struct amdgpu_device *adev)static void acquire_queue (struct amdgpu_device *adev,uint32_t pipe_id,uint32_t queue_id) + ACQUIRE(adev->srbm_mutex) {uint32_t mec = (pipe_id / adev->gfx.mec.num_pipe_per_mec) +1 ;uint32_t pipe = (pipe_id % adev->gfx.mec.num_pipe_per_mec);
@@ -64,6 +67,7 @@ static void acquire_queue(struct amdgpu_device *adev, uint32_t pipe_id, }static void release_queue (struct amdgpu_device *adev) + RELEASE(adev->srbm_mutex) {unlock_srbm (adev); }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +8 -0
@@ -49,12 +49,14 @@ enum hqd_dequeue_request_type {static void kgd_gfx_v9_lock_srbm (struct amdgpu_device *adev,uint32_t mec,uint32_t pipe,uint32_t queue,uint32_t vmid,uint32_t inst) + ACQUIRE(adev->srbm_mutex) {mutex_lock (&adev->srbm_mutex);soc15_grbm_select (adev, mec, pipe, queue, vmid,GET_INST (GC , inst)); }static void kgd_gfx_v9_unlock_srbm (struct amdgpu_device *adev,uint32_t inst) + RELEASE(adev->srbm_mutex) {soc15_grbm_select (adev,0 ,0 ,0 ,0 ,GET_INST (GC , inst));mutex_unlock (&adev->srbm_mutex);
@@ -62,6 +64,7 @@ static void kgd_gfx_v9_unlock_srbm(struct amdgpu_device *adev, uint32_t inst)void kgd_gfx_v9_acquire_queue (struct amdgpu_device *adev,uint32_t pipe_id,uint32_t queue_id,uint32_t inst) + ACQUIRE(adev->srbm_mutex) {uint32_t mec = (pipe_id / adev->gfx.mec.num_pipe_per_mec) +1 ;uint32_t pipe = (pipe_id % adev->gfx.mec.num_pipe_per_mec);
@@ -79,6 +82,7 @@ uint64_t kgd_gfx_v9_get_queue_mask(struct amdgpu_device *adev, }void kgd_gfx_v9_release_queue (struct amdgpu_device *adev,uint32_t inst) + RELEASE(adev->srbm_mutex) {kgd_gfx_v9_unlock_srbm (adev, inst); }
@@ -925,6 +929,8 @@ void kgd_gfx_v9_set_vm_context_page_table_base(struct amdgpu_device *adev, }static void lock_spi_csq_mutexes (struct amdgpu_device *adev) + ACQUIRE(adev->srbm_mutex) + ACQUIRE(adev->grbm_idx_mutex) {mutex_lock (&adev->srbm_mutex);mutex_lock (&adev->grbm_idx_mutex);
@@ -932,6 +938,8 @@ static void lock_spi_csq_mutexes(struct amdgpu_device *adev) }static void unlock_spi_csq_mutexes (struct amdgpu_device *adev) + RELEASE(adev->grbm_idx_mutex) + RELEASE(adev->srbm_mutex) {mutex_unlock (&adev->grbm_idx_mutex);mutex_unlock (&adev->srbm_mutex);
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3 -0
@@ -837,6 +837,7 @@ static int amdgpu_cs_bo_validate(void *param, struct amdgpu_bo *bo)static int amdgpu_cs_parser_bos (struct amdgpu_cs_parser *p,union drm_amdgpu_cs *cs) + TRY_ACQUIRE(0, p->bo_list->bo_list_mutex) {struct amdgpu_fpriv *fpriv = p->filp->driver_priv;struct ttm_operation_ctx ctx = { true, false };
@@ -1275,6 +1276,7 @@ static void amdgpu_cs_post_dependencies(struct amdgpu_cs_parser *p)static int amdgpu_cs_submit (struct amdgpu_cs_parser *p,union drm_amdgpu_cs *cs) +NO_THREAD_SAFETY_ANALYSIS /* conditional unlock */ {struct amdgpu_fpriv *fpriv = p->filp->driver_priv;struct amdgpu_job *leader = p->gang_leader;
@@ -1408,6 +1410,7 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser) }int amdgpu_cs_ioctl (struct drm_device *dev,void *data,struct drm_file *filp) +NO_THREAD_SAFETY_ANALYSIS /* conditional unlock */ {struct amdgpu_device *adev =drm_to_adev (dev);struct amdgpu_cs_parser parser;
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +2 -0
@@ -71,6 +71,7 @@*/ static int amdgpu_debugfs_process_reg_op (bool read,struct file *f,char __user *buf,size_t size,loff_t *pos) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct amdgpu_device *adev =file_inode (f)->i_private;ssize_t result =0 ;
@@ -228,6 +229,7 @@ static int amdgpu_debugfs_regs2_release(struct inode *inode, struct file *file) }static ssize_t amdgpu_debugfs_regs2_op (struct file *f,char __user *buf,u32 offset,size_t size,int write_en) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct amdgpu_debugfs_regs2_data *rd = f->private_data;struct amdgpu_device *adev = rd->adev;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
@@ -5854,6 +5854,7 @@ static int amdgpu_device_health_check(struct list_head *device_list_handle)int amdgpu_device_gpu_recover (struct amdgpu_device *adev,struct amdgpu_job *job,struct amdgpu_reset_context *reset_context) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct list_head device_list, *device_list_handle =NULL ;bool job_signaled = false;
drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c +2 -0
@@ -38,6 +38,7 @@/* bit banging i2c */ static int amdgpu_i2c_pre_xfer (struct i2c_adapter *i2c_adap) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct amdgpu_i2c_chan *i2c =i2c_get_adapdata (i2c_adap);struct amdgpu_device *adev =drm_to_adev (i2c->dev);
@@ -80,6 +81,7 @@ static int amdgpu_i2c_pre_xfer(struct i2c_adapter *i2c_adap) }static void amdgpu_i2c_post_xfer (struct i2c_adapter *i2c_adap) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct amdgpu_i2c_chan *i2c =i2c_get_adapdata (i2c_adap);struct amdgpu_device *adev =drm_to_adev (i2c->dev);
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -0
@@ -50,6 +50,7 @@ static void amdgpu_job_do_core_dump(struct amdgpu_device *adev,static void amdgpu_job_core_dump (struct amdgpu_device *adev,struct amdgpu_job *job) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct list_head device_list, *device_list_handle =NULL ;struct amdgpu_device *tmp_adev =NULL ;
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +1 -0
@@ -566,6 +566,7 @@ static int amdgpu_mes_queue_alloc_mqd(struct amdgpu_device *adev,static void amdgpu_mes_queue_init_mqd (struct amdgpu_device *adev,struct amdgpu_mes_queue *q,struct amdgpu_mes_queue_properties *p) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct amdgpu_mqd *mqd_mgr = &adev->mqds[p->queue_type];struct amdgpu_mqd_prop mqd_prop = {0 };
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +2 -0
@@ -521,12 +521,14 @@ int amdgpu_mes_doorbell_process_slice(struct amdgpu_device *adev);* to prevent deadlocks when an MMU notifier runs in reclaim-FS context. */ static inline void amdgpu_mes_lock (struct amdgpu_mes *mes) + ACQUIRE(mes->mutex_hidden) {mutex_lock (&mes->mutex_hidden); mes->saved_flags =memalloc_noreclaim_save (); }static inline void amdgpu_mes_unlock (struct amdgpu_mes *mes) + RELEASE(mes->mutex_hidden) {memalloc_noreclaim_restore (mes->saved_flags);mutex_unlock (&mes->mutex_hidden);
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -0
@@ -748,6 +748,7 @@ psp_cmd_submit_buf(struct psp_context *psp, }static struct psp_gfx_cmd_resp *acquire_psp_cmd_buf (struct psp_context *psp) + ACQUIRE(psp->mutex) {struct psp_gfx_cmd_resp *cmd = psp->cmd;
@@ -759,6 +760,7 @@ static struct psp_gfx_cmd_resp *acquire_psp_cmd_buf(struct psp_context *psp) }static void release_psp_cmd_buf (struct psp_context *psp) + RELEASE(psp->mutex) {mutex_unlock (&psp->mutex); }
drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c +1 -0
@@ -99,6 +99,7 @@ static int amdgpu_reset_xgmi_reset_on_init_restore_hwctxt(static int amdgpu_reset_xgmi_reset_on_init_perform_reset (struct amdgpu_reset_control *reset_ctl,struct amdgpu_reset_context *reset_context) +NO_THREAD_SAFETY_ANALYSIS /* locking inside a loop */ {struct amdgpu_device *adev = (struct amdgpu_device *)reset_ctl->handle;struct list_head *reset_device_list = reset_context->reset_device_list;
drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.h +2 -0
@@ -232,11 +232,13 @@ void amdgpu_umsch_fwlog_init(struct amdgpu_umsch_mm *umsch_mm); ((umsch)->funcs->ring_fini ? (umsch)->funcs->ring_fini((umsch)) : 0)static inline void amdgpu_umsch_mm_lock (struct amdgpu_umsch_mm *umsch) + ACQUIRE(umsch->mutex_hidden) {mutex_lock (&umsch->mutex_hidden); }static inline void amdgpu_umsch_mm_unlock (struct amdgpu_umsch_mm *umsch) + RELEASE(umsch->mutex_hidden) {mutex_unlock (&umsch->mutex_hidden); }
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -0
@@ -2184,6 +2184,7 @@ void amdgpu_vm_bo_del(struct amdgpu_device *adev,* Check if it is possible to evict a VM. */ bool amdgpu_vm_evictable (struct amdgpu_bo *bo) +NO_THREAD_SAFETY_ANALYSIS /* clang bug? */ {struct amdgpu_vm_bo_base *bo_base = bo->vm_bo;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +3 -0
@@ -644,12 +644,14 @@ static inline uint64_t amdgpu_vm_tlb_seq(struct amdgpu_vm *vm)* an MMU notifier runs in reclaim-FS context. */ static inline void amdgpu_vm_eviction_lock (struct amdgpu_vm *vm) + ACQUIRE(vm->eviction_lock) {mutex_lock (&vm->eviction_lock); vm->saved_flags =memalloc_noreclaim_save (); }static inline bool amdgpu_vm_eviction_trylock (struct amdgpu_vm *vm) + TRY_ACQUIRE(true, vm->eviction_lock) {if (mutex_trylock (&vm->eviction_lock)) { vm->saved_flags =memalloc_noreclaim_save ();
@@ -659,6 +661,7 @@ static inline bool amdgpu_vm_eviction_trylock(struct amdgpu_vm *vm) }static inline void amdgpu_vm_eviction_unlock (struct amdgpu_vm *vm) + RELEASE(vm->eviction_lock) {memalloc_noreclaim_restore (vm->saved_flags);mutex_unlock (&vm->eviction_lock);
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +2 -0
@@ -494,6 +494,7 @@ static int amdgpu_vm_pt_alloc(struct amdgpu_device *adev,struct amdgpu_vm *vm, struct amdgpu_vm_pt_cursor *cursor, bool immediate) + REQUIRES(vm->eviction_lock) { struct amdgpu_vm_bo_base *entry = cursor->entry;struct amdgpu_bo *pt_bo;
@@ -820,6 +821,7 @@ static void amdgpu_vm_pte_fragment(struct amdgpu_vm_update_params *params,int amdgpu_vm_ptes_update (struct amdgpu_vm_update_params *params,uint64_t start,uint64_t end,uint64_t dst,uint64_t flags) + REQUIRES(params->vm->eviction_lock) {struct amdgpu_device *adev = params->adev;struct amdgpu_vm_pt_cursor cursor;
drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c +1 -0
@@ -216,6 +216,7 @@ int amdgpu_xcp_restore_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr) }int amdgpu_xcp_query_partition_mode (struct amdgpu_xcp_mgr *xcp_mgr,u32 flags) +NO_THREAD_SAFETY_ANALYSIS /* conditinal locking */ {int mode;
drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c +2 -1
@@ -602,12 +602,13 @@ static void jpeg_v1_0_set_irq_funcs(struct amdgpu_device *adev) }static void jpeg_v1_0_ring_begin_use (struct amdgpu_ring *ring) + ACQUIRE(ring->adev->vcn.vcn1_jpeg1_workaround) {struct amdgpu_device *adev = ring->adev;bool set_clocks = !cancel_delayed_work_sync (&adev->vcn.idle_work);int cnt =0 ; -mutex_lock (&adev->vcn.vcn1_jpeg1_workaround); +mutex_lock (&ring->adev->vcn.vcn1_jpeg1_workaround);if (amdgpu_fence_wait_empty (&adev->vcn.inst->ring_dec))DRM_ERROR ("JPEG dec: vcn dec ring may not be empty\n" );
drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c +2 -0
@@ -607,6 +607,7 @@ static uint32_t smu_v11_0_i2c_write_data(struct i2c_adapter *control, }static void lock_bus (struct i2c_adapter *i2c,unsigned int flags) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct amdgpu_smu_i2c_bus *smu_i2c =i2c_get_adapdata (i2c);struct amdgpu_device *adev = smu_i2c->adev;
@@ -625,6 +626,7 @@ static int trylock_bus(struct i2c_adapter *i2c, unsigned int flags) }static void unlock_bus (struct i2c_adapter *i2c,unsigned int flags) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct amdgpu_smu_i2c_bus *smu_i2c =i2c_get_adapdata (i2c);struct amdgpu_device *adev = smu_i2c->adev;
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +3 -1
@@ -1867,11 +1867,12 @@ static void vcn_v1_0_idle_work_handler(struct work_struct *work) }static void vcn_v1_0_ring_begin_use (struct amdgpu_ring *ring) + ACQUIRE(ring->adev->vcn.vcn1_jpeg1_workaround) {struct amdgpu_device *adev = ring->adev;bool set_clocks = !cancel_delayed_work_sync (&adev->vcn.idle_work); -mutex_lock (&adev->vcn.vcn1_jpeg1_workaround); +mutex_lock (&ring->adev->vcn.vcn1_jpeg1_workaround);if (amdgpu_fence_wait_empty (ring->adev->jpeg.inst->ring_dec))DRM_ERROR ("VCN dec: jpeg dec ring may not be empty\n" );
@@ -1920,6 +1921,7 @@ void vcn_v1_0_set_pg_for_begin_use(struct amdgpu_ring *ring, bool set_clocks) }void vcn_v1_0_ring_end_use (struct amdgpu_ring *ring) + RELEASE(ring->adev->vcn.vcn1_jpeg1_workaround) {schedule_delayed_work (&ring->adev->vcn.idle_work,VCN_IDLE_TIMEOUT );mutex_unlock (&ring->adev->vcn.vcn1_jpeg1_workaround);
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +4 -0
@@ -68,6 +68,7 @@ static const struct class kfd_class = { };static inline struct kfd_process_device *kfd_lock_pdd_by_id (struct kfd_process *p,__u32 gpu_id) +NO_THREAD_SAFETY_ANALYSIS /* returns a pointer */ {struct kfd_process_device *pdd;
@@ -82,6 +83,7 @@ static inline struct kfd_process_device *kfd_lock_pdd_by_id(struct kfd_process * }static inline void kfd_unlock_pdd (struct kfd_process_device *pdd) +NO_THREAD_SAFETY_ANALYSIS /* to match the locking function */ {mutex_unlock (&pdd->process->mutex); }
@@ -2749,6 +2751,7 @@ static int kfd_ioctl_criu(struct file *filep, struct kfd_process *p, void *data)static int runtime_enable (struct kfd_process *p,uint64_t r_debug,bool enable_ttmp_setup) + REQUIRES(p->mutex) {int i =0 , ret =0 ;
@@ -2817,6 +2820,7 @@ static int runtime_enable(struct kfd_process *p, uint64_t r_debug, }static int runtime_disable (struct kfd_process *p) + REQUIRES(p->mutex) {int i =0 , ret;bool was_enabled = p->runtime_info.runtime_state ==DEBUG_RUNTIME_STATE_ENABLED ;
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +5 -0
@@ -2383,6 +2383,8 @@ static int execute_queues_cpsch(struct device_queue_manager *dqm,static int wait_on_destroy_queue (struct device_queue_manager *dqm,struct queue *q) + REQUIRES(dqm->lock_hidden) + REQUIRES(q->process->mutex) {struct kfd_process_device *pdd =kfd_get_process_device_data (q->device, q->process);
@@ -2412,6 +2414,7 @@ static int wait_on_destroy_queue(struct device_queue_manager *dqm,static int destroy_queue_cpsch (struct device_queue_manager *dqm,struct qcm_process_device *qpd,struct queue *q) + REQUIRES(q->process->mutex) {int retval;struct mqd_manager *mqd_mgr;
@@ -3545,6 +3548,7 @@ void set_queue_snapshot_entry(struct queue *q, }int debug_lock_and_unmap (struct device_queue_manager *dqm) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct device *dev = dqm->dev->adev->dev;int r;
@@ -3567,6 +3571,7 @@ int debug_lock_and_unmap(struct device_queue_manager *dqm) }int debug_map_and_unlock (struct device_queue_manager *dqm) +NO_THREAD_SAFETY_ANALYSIS /* conditional unlock */ {struct device *dev = dqm->dev->adev->dev;int r;
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +2 -0
@@ -344,11 +344,13 @@ get_sh_mem_bases_nybble_64(struct kfd_process_device *pdd)* an MMU notifier runs in reclaim-FS context. */ static inline void dqm_lock (struct device_queue_manager *dqm) + ACQUIRE(dqm->lock_hidden) {mutex_lock (&dqm->lock_hidden); dqm->saved_flags =memalloc_noreclaim_save (); }static inline void dqm_unlock (struct device_queue_manager *dqm) + RELEASE(dqm->lock_hidden) {memalloc_noreclaim_restore (dqm->saved_flags);mutex_unlock (&dqm->lock_hidden);
drivers/gpu/drm/amd/amdkfd/kfd_svm.h +2 -0
@@ -141,12 +141,14 @@ struct svm_range { };static inline void svm_range_lock (struct svm_range *prange) + ACQUIRE(prange->lock) {mutex_lock (&prange->lock); prange->saved_flags =memalloc_noreclaim_save (); }static inline void svm_range_unlock (struct svm_range *prange) + RELEASE(prange->lock) {memalloc_noreclaim_restore (prange->saved_flags);mutex_unlock (&prange->lock);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
@@ -3042,6 +3042,7 @@ static void hpd_rx_irq_work_suspend(struct amdgpu_display_manager *dm) }static int dm_suspend (struct amdgpu_ip_block *ip_block) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct amdgpu_device *adev = ip_block->adev;struct amdgpu_display_manager *dm = &adev->dm;
@@ -3233,6 +3234,7 @@ static void dm_gpureset_commit_state(struct dc_state *dc_state, }static int dm_resume (struct amdgpu_ip_block *ip_block) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct amdgpu_device *adev = ip_block->adev;struct drm_device *ddev =adev_to_drm (adev);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +1 -0
@@ -150,6 +150,7 @@ static void process_output(struct hdcp_workqueue *hdcp_work) }static void link_lock (struct hdcp_workqueue *work,bool lock) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {int i =0 ;
drivers/gpu/drm/ast/ast_ddc.c +2 -0
@@ -70,6 +70,7 @@ static void ast_ddc_algo_bit_data_setscl(void *data, int state) }static int ast_ddc_algo_bit_data_pre_xfer (struct i2c_adapter *adapter) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct ast_ddc *ddc =i2c_get_adapdata (adapter);struct ast_device *ast = ddc->ast;
@@ -84,6 +85,7 @@ static int ast_ddc_algo_bit_data_pre_xfer(struct i2c_adapter *adapter) }static void ast_ddc_algo_bit_data_post_xfer (struct i2c_adapter *adapter) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct ast_ddc *ddc =i2c_get_adapdata (adapter);struct ast_device *ast = ddc->ast;
drivers/gpu/drm/bridge/lontium-lt9611uxc.c +2 -0
@@ -122,12 +122,14 @@ static struct lt9611uxc *bridge_to_lt9611uxc(struct drm_bridge *bridge) }static void lt9611uxc_lock (struct lt9611uxc *lt9611uxc) + ACQUIRE(lt9611uxc->ocm_lock) {mutex_lock (<9611uxc->ocm_lock);regmap_write (lt9611uxc->regmap,0x80ee ,0x01 ); }static void lt9611uxc_unlock (struct lt9611uxc *lt9611uxc) + RELEASE(lt9611uxc->ocm_lock) {regmap_write (lt9611uxc->regmap,0x80ee ,0x00 );msleep (50 );
drivers/gpu/drm/clients/drm_log.c +2 -0
@@ -363,6 +363,7 @@ static void drm_log_write_thread(struct console *con, struct nbcon_write_context }static void drm_log_lock (struct console *con,unsigned long *flags) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct drm_log *dlog =console_to_drm_log (con);
@@ -371,6 +372,7 @@ static void drm_log_lock(struct console *con, unsigned long *flags) }static void drm_log_unlock (struct console *con,unsigned long flags) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct drm_log *dlog =console_to_drm_log (con);
drivers/gpu/drm/display/drm_dp_helper.c +3 -0
@@ -2089,16 +2089,19 @@ static struct drm_dp_aux *i2c_to_aux(struct i2c_adapter *i2c) }static void lock_bus (struct i2c_adapter *i2c,unsigned int flags) + ACQUIRE(i2c_to_aux(i2c)->hw_mutex) {mutex_lock (&i2c_to_aux (i2c)->hw_mutex); }static int trylock_bus (struct i2c_adapter *i2c,unsigned int flags) + TRY_ACQUIRE(1, i2c_to_aux(i2c)->hw_mutex) {return mutex_trylock (&i2c_to_aux (i2c)->hw_mutex); }static void unlock_bus (struct i2c_adapter *i2c,unsigned int flags) + RELEASE(i2c_to_aux(i2c)->hw_mutex) {mutex_unlock (&i2c_to_aux (i2c)->hw_mutex); }
drivers/gpu/drm/display/drm_dp_mst_topology.c +2 -0
@@ -1666,12 +1666,14 @@ save_port_topology_ref(struct drm_dp_mst_port *port,static inline void topology_ref_history_lock (struct drm_dp_mst_topology_mgr *mgr) + ACQUIRE(mgr->topology_ref_history_lock) {mutex_lock (&mgr->topology_ref_history_lock); }static inline void topology_ref_history_unlock (struct drm_dp_mst_topology_mgr *mgr) + RELEASE(mgr->topology_ref_history_lock) {mutex_unlock (&mgr->topology_ref_history_lock); }
drivers/gpu/drm/drm_atomic_helper.c +3 -0
@@ -3374,6 +3374,7 @@ EXPORT_SYMBOL(drm_atomic_helper_disable_all);* and it is the atomic version of drm_helper_force_disable_all(). */ void drm_atomic_helper_shutdown (struct drm_device *dev) +NO_THREAD_SAFETY_ANALYSIS /* DRM_MODESET_LOCK */ {struct drm_modeset_acquire_ctx ctx;int ret;
@@ -3507,6 +3508,7 @@ EXPORT_SYMBOL(drm_atomic_helper_duplicate_state);* drm_atomic_helper_resume(), drm_atomic_helper_commit_duplicated_state() */ struct drm_atomic_state *drm_atomic_helper_suspend (struct drm_device *dev) +NO_THREAD_SAFETY_ANALYSIS /* DRM_MODESET_LOCK */ {struct drm_modeset_acquire_ctx ctx;struct drm_atomic_state *state;
@@ -3600,6 +3602,7 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_duplicated_state);*/ int drm_atomic_helper_resume (struct drm_device *dev,struct drm_atomic_state *state) +NO_THREAD_SAFETY_ANALYSIS /* DRM_MODESET_LOCK */ {struct drm_modeset_acquire_ctx ctx;int err;
drivers/gpu/drm/drm_auth.c +2 -0
@@ -448,6 +448,7 @@ EXPORT_SYMBOL(drm_master_put);/* Used by drm_client and drm_fb_helper */ bool drm_master_internal_acquire (struct drm_device *dev) + TRY_ACQUIRE(true, dev->master_mutex) {mutex_lock (&dev->master_mutex);if (dev->master) {
@@ -461,6 +462,7 @@ EXPORT_SYMBOL(drm_master_internal_acquire);/* Used by drm_client and drm_fb_helper */ void drm_master_internal_release (struct drm_device *dev) + RELEASE(dev->master_mutex) {mutex_unlock (&dev->master_mutex); }
drivers/gpu/drm/drm_client_modeset.c +1 -0
@@ -1214,6 +1214,7 @@ int drm_client_modeset_commit(struct drm_client_dev *client)EXPORT_SYMBOL (drm_client_modeset_commit);static void drm_client_modeset_dpms_legacy (struct drm_client_dev *client,int dpms_mode) +NO_THREAD_SAFETY_ANALYSIS /* DRM_MODESET_LOCK */ {struct drm_device *dev = client->dev;struct drm_connector *connector;
drivers/gpu/drm/drm_color_mgmt.c +1 -0
@@ -358,6 +358,7 @@ static int drm_crtc_legacy_gamma_set(struct drm_crtc *crtc,*/ int drm_mode_gamma_set_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv) +NO_THREAD_SAFETY_ANALYSIS /* DRM_MODESET_LOCK */ {struct drm_mode_crtc_lut *crtc_lut = data;struct drm_crtc *crtc;
drivers/gpu/drm/drm_crtc.c +1 -0
@@ -691,6 +691,7 @@ EXPORT_SYMBOL(drm_crtc_check_viewport);*/ int drm_mode_setcrtc (struct drm_device *dev,void *data,struct drm_file *file_priv) +NO_THREAD_SAFETY_ANALYSIS /* DRM_MODESET_LOCK */ {struct drm_mode_config *config = &dev->mode_config;struct drm_mode_crtc *crtc_req = data;
drivers/gpu/drm/drm_drv.c +1 -0
@@ -929,6 +929,7 @@ static void remove_compat_control_link(struct drm_device *dev)* 0 on success, negative error code on failure. */ int drm_dev_register (struct drm_device *dev,unsigned long flags) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {const struct drm_driver *driver = dev->driver;int ret;
drivers/gpu/drm/drm_fb_helper.c +1 -0
@@ -1808,6 +1808,7 @@ static void drm_setup_crtcs_fb(struct drm_fb_helper *fb_helper)/* Note: Drops fb_helper->lock before returning. */ static int __drm_fb_helper_initial_config_and_unlock (struct drm_fb_helper *fb_helper) + RELEASE(fb_helper->lock) {struct drm_device *dev = fb_helper->dev;struct fb_info *info;
drivers/gpu/drm/drm_file.c +4 -0
@@ -355,6 +355,7 @@ int drm_open_helper(struct file *filp, struct drm_minor *minor)* 0 on success or negative errno value on failure. */ int drm_open (struct inode *inode,struct file *filp) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct drm_device *dev;struct drm_minor *minor;
@@ -413,6 +414,7 @@ static void drm_lastclose(struct drm_device *dev)* Always succeeds and returns 0. */ int drm_release (struct inode *inode,struct file *filp) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct drm_file *file_priv = filp->private_data;struct drm_minor *minor = file_priv->minor;
@@ -483,6 +485,7 @@ void drm_file_update_pid(struct drm_file *filp)* Always succeeds and returns 0. */ int drm_release_noglobal (struct inode *inode,struct file *filp) +NO_THREAD_SAFETY_ANALYSIS /* needed because of a clang bug? */ {struct drm_file *file_priv = filp->private_data;struct drm_minor *minor = file_priv->minor;
@@ -527,6 +530,7 @@ EXPORT_SYMBOL(drm_release_noglobal);*/ ssize_t drm_read (struct file *filp,char __user *buffer,size_t count,loff_t *offset) +NO_THREAD_SAFETY_ANALYSIS /* clang bug? */ {struct drm_file *file_priv = filp->private_data;struct drm_device *dev = file_priv->minor->dev;
drivers/gpu/drm/drm_gem.c +3 -1
@@ -383,6 +383,7 @@ int drm_gem_handle_create_tail(struct drm_file *file_priv, struct drm_gem_object *obj, u32 *handlep) + RELEASE(obj->dev->object_name_lock) { struct drm_device *dev = obj->dev;u32 handle;
@@ -404,7 +405,7 @@ drm_gem_handle_create_tail(struct drm_file *file_priv,spin_unlock (&file_priv->table_lock);idr_preload_end (); -mutex_unlock (&dev->object_name_lock); +mutex_unlock (&obj->dev->object_name_lock);if (ret <0 ) goto err_unref;
@@ -902,6 +903,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,int drm_gem_open_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv) +NO_THREAD_SAFETY_ANALYSIS /* requires alias analysis */ {struct drm_gem_open *args = data;struct drm_gem_object *obj;
drivers/gpu/drm/drm_mode_object.c +2 -0
@@ -435,6 +435,7 @@ int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,*/ int drm_mode_obj_get_properties_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv) +NO_THREAD_SAFETY_ANALYSIS /* DRM_MODESET_LOCK */ {struct drm_mode_obj_get_properties *arg = data;struct drm_mode_object *obj;
@@ -484,6 +485,7 @@ EXPORT_SYMBOL_FOR_TESTS_ONLY(drm_mode_obj_find_prop_id);static int set_property_legacy (struct drm_mode_object *obj,struct drm_property *prop,uint64_t prop_value) +NO_THREAD_SAFETY_ANALYSIS /* DRM_MODESET_LOCK */ {struct drm_device *dev = prop->dev;struct drm_mode_object *ref;
drivers/gpu/drm/drm_modeset_lock.c +2 -0
@@ -141,6 +141,7 @@ static void __drm_stack_depot_init(void)* drm_modeset_lock_all_ctx() function and pass in the context explicitly. */ void drm_modeset_lock_all (struct drm_device *dev) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct drm_mode_config *config = &dev->mode_config;struct drm_modeset_acquire_ctx *ctx;
@@ -195,6 +196,7 @@ EXPORT_SYMBOL(drm_modeset_lock_all);* directly to the drm_modeset_drop_locks() function. */ void drm_modeset_unlock_all (struct drm_device *dev) +NO_THREAD_SAFETY_ANALYSIS /* conditional unlocking */ {struct drm_mode_config *config = &dev->mode_config;struct drm_modeset_acquire_ctx *ctx = config->acquire_ctx;
drivers/gpu/drm/drm_plane.c +1 -0
@@ -1084,6 +1084,7 @@ static int setplane_internal(struct drm_plane *plane,/* src_{x,y,w,h} values are 16.16 fixed point */ uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h) + NO_THREAD_SAFETY_ANALYSIS /* DRM_MODESET_LOCK */ { struct drm_modeset_acquire_ctx ctx;int ret;
drivers/gpu/drm/drm_prime.c +1 -0
@@ -295,6 +295,7 @@ EXPORT_SYMBOL(drm_gem_dmabuf_release);int drm_gem_prime_fd_to_handle (struct drm_device *dev,struct drm_file *file_priv,int prime_fd,uint32_t *handle) +NO_THREAD_SAFETY_ANALYSIS /* requires alias analysis */ {struct dma_buf *dma_buf;struct drm_gem_object *obj;
drivers/gpu/drm/i915/display/intel_cdclk.c +1 -0
@@ -2520,6 +2520,7 @@ static void intel_pcode_notify(struct intel_display *display,static void intel_set_cdclk (struct intel_display *display,const struct intel_cdclk_config *cdclk_config,enum pipe pipe,const char *context) +NO_THREAD_SAFETY_ANALYSIS /* mutex calls inside a loop */ {struct drm_i915_private *dev_priv =to_i915 (display->drm);struct intel_encoder *encoder;
drivers/gpu/drm/i915/display/intel_display_reset.c +2 -0
@@ -20,6 +20,7 @@ static bool gpu_reset_clobbers_display(struct drm_i915_private *dev_priv) }void intel_display_reset_prepare (struct drm_i915_private *dev_priv) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct drm_modeset_acquire_ctx *ctx = &dev_priv->display.restore.reset_ctx;struct drm_atomic_state *state;
@@ -82,6 +83,7 @@ void intel_display_reset_prepare(struct drm_i915_private *dev_priv) }void intel_display_reset_finish (struct drm_i915_private *i915) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct intel_display *display = &i915->display;struct drm_modeset_acquire_ctx *ctx = &display->restore.reset_ctx;
drivers/gpu/drm/i915/display/intel_gmbus.c +3 -0
@@ -838,6 +838,7 @@ static const struct i2c_algorithm gmbus_algorithm = {static void gmbus_lock_bus (struct i2c_adapter *adapter,unsigned int flags) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct intel_gmbus *bus =to_intel_gmbus (adapter);struct intel_display *display = bus->display;
@@ -847,6 +848,7 @@ static void gmbus_lock_bus(struct i2c_adapter *adapter,static int gmbus_trylock_bus (struct i2c_adapter *adapter,unsigned int flags) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct intel_gmbus *bus =to_intel_gmbus (adapter);struct intel_display *display = bus->display;
@@ -856,6 +858,7 @@ static int gmbus_trylock_bus(struct i2c_adapter *adapter,static void gmbus_unlock_bus (struct i2c_adapter *adapter,unsigned int flags) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct intel_gmbus *bus =to_intel_gmbus (adapter);struct intel_display *display = bus->display;
drivers/gpu/drm/i915/display/intel_pps.c +2 -0
@@ -63,6 +63,7 @@ static const char *pps_name(struct intel_dp *intel_dp) }intel_wakeref_t intel_pps_lock (struct intel_dp *intel_dp) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct intel_display *display =to_intel_display (intel_dp);struct drm_i915_private *dev_priv =to_i915 (display->drm);
@@ -79,6 +80,7 @@ intel_wakeref_t intel_pps_lock(struct intel_dp *intel_dp)intel_wakeref_t intel_pps_unlock (struct intel_dp *intel_dp,intel_wakeref_t wakeref) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct intel_display *display =to_intel_display (intel_dp);struct drm_i915_private *dev_priv =to_i915 (display->drm);
drivers/gpu/drm/i915/display/intel_psr.c +3 -0
@@ -2938,6 +2938,7 @@ void intel_psr_wait_for_idle_locked(const struct intel_crtc_state *new_crtc_stat }static bool __psr_wait_for_idle_locked (struct intel_dp *intel_dp) + REQUIRES(intel_dp->psr.lock) {struct intel_display *display =to_intel_display (intel_dp);enum transcoder cpu_transcoder = intel_dp->psr.transcoder;
@@ -3567,6 +3568,7 @@ bool intel_psr_link_ok(struct intel_dp *intel_dp)* before it to avoid vblank evasion. */ void intel_psr_lock (const struct intel_crtc_state *crtc_state) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct intel_display *display =to_intel_display (crtc_state);struct intel_encoder *encoder;
@@ -3590,6 +3592,7 @@ void intel_psr_lock(const struct intel_crtc_state *crtc_state)* Release the PSR lock that was held during pipe update. */ void intel_psr_unlock (const struct intel_crtc_state *crtc_state) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct intel_display *display =to_intel_display (crtc_state);struct intel_encoder *encoder;
drivers/gpu/drm/i915/display/intel_tc.c +4 -0
@@ -1773,6 +1773,7 @@ void intel_tc_port_link_cancel_reset_work(struct intel_digital_port *dig_port)static void __intel_tc_port_lock (struct intel_tc_port *tc,int required_lanes) + ACQUIRE(tc->lock) {struct drm_i915_private *i915 =tc_to_i915 (tc);
@@ -1790,6 +1791,7 @@ static void __intel_tc_port_lock(struct intel_tc_port *tc, }void intel_tc_port_lock (struct intel_digital_port *dig_port) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {__intel_tc_port_lock (to_tc_port (dig_port),1 ); }
@@ -1832,6 +1834,7 @@ void intel_tc_port_suspend(struct intel_digital_port *dig_port) }void intel_tc_port_unlock (struct intel_digital_port *dig_port) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct intel_tc_port *tc =to_tc_port (dig_port);
@@ -1852,6 +1855,7 @@ bool intel_tc_port_ref_held(struct intel_digital_port *dig_port)void intel_tc_port_get_link (struct intel_digital_port *dig_port,int required_lanes) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct intel_tc_port *tc =to_tc_port (dig_port);
drivers/gpu/drm/i915/gem/i915_gem_context.h +2 -0
@@ -190,6 +190,7 @@ i915_gem_context_engines(struct i915_gem_context *ctx)static inline struct i915_gem_engines *i915_gem_context_lock_engines (struct i915_gem_context *ctx) __acquires(&ctx->engines_mutex) + ACQUIRE(ctx->engines_mutex) {mutex_lock (&ctx->engines_mutex);return i915_gem_context_engines (ctx);
@@ -198,6 +199,7 @@ i915_gem_context_lock_engines(struct i915_gem_context *ctx)static inline void i915_gem_context_unlock_engines (struct i915_gem_context *ctx) __releases(&ctx->engines_mutex) + RELEASE(ctx->engines_mutex) {mutex_unlock (&ctx->engines_mutex); }
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +1 -0
@@ -3081,6 +3081,7 @@ static void retire_requests(struct intel_timeline *tl, struct i915_request *end)static int eb_request_add (struct i915_execbuffer *eb,struct i915_request *rq,int err,bool last_parallel) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct intel_timeline *const tl =i915_request_timeline (rq);struct i915_sched_attr attr = {};
drivers/gpu/drm/i915/gt/intel_context.h +4 -0
@@ -105,6 +105,7 @@ void intel_context_bind_parent_child(struct intel_context *parent,*/ static inline int intel_context_lock_pinned (struct intel_context *ce) __acquires(ce->pin_mutex) + TRY_ACQUIRE(0, ce->pin_mutex) {return mutex_lock_interruptible (&ce->pin_mutex); }
@@ -139,6 +140,7 @@ static inline void intel_context_cancel_request(struct intel_context *ce,*/ static inline void intel_context_unlock_pinned (struct intel_context *ce) __releases(ce->pin_mutex) + RELEASE(ce->pin_mutex) {mutex_unlock (&ce->pin_mutex); }
@@ -247,6 +249,7 @@ static inline void intel_context_put(struct intel_context *ce)static inline struct intel_timeline *__must_check intel_context_timeline_lock (struct intel_context *ce) __acquires(&ce->timeline->mutex) +NO_THREAD_SAFETY_ANALYSIS /* returns a pointer */ {struct intel_timeline *tl = ce->timeline;int err;
@@ -266,6 +269,7 @@ intel_context_timeline_lock(struct intel_context *ce)static inline void intel_context_timeline_unlock (struct intel_timeline *tl) __releases(&tl->mutex) +NO_THREAD_SAFETY_ANALYSIS /* to match the corresponding lock function */ {mutex_unlock (&tl->mutex); }
drivers/gpu/drm/i915/gt/selftest_context.c +1 -0
@@ -13,6 +13,7 @@#include "selftests/mock_drm.h" static int request_sync (struct i915_request *rq) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct intel_timeline *tl =i915_request_timeline (rq);long timeout;
drivers/gpu/drm/i915/gt/selftest_timeline.c +1 -0
@@ -856,6 +856,7 @@ static int setup_watcher(struct hwsp_watcher *w, struct intel_gt *gt, }static void switch_tl_lock (struct i915_request *from,struct i915_request *to) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {/* some light mutex juggling required; think co-routines */
drivers/gpu/drm/i915/gvt/vgpu.c +1 -0
@@ -434,6 +434,7 @@ int intel_gvt_create_vgpu(struct intel_vgpu *vgpu,*/ void intel_gvt_reset_vgpu_locked (struct intel_vgpu *vgpu,bool dmlr,intel_engine_mask_t engine_mask) + REQUIRES(vgpu->vgpu_lock) {struct intel_gvt *gvt = vgpu->gvt;struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler;
drivers/gpu/drm/i915/i915_request.c +1 -0
@@ -1843,6 +1843,7 @@ void __i915_request_queue(struct i915_request *rq, }void i915_request_add (struct i915_request *rq) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct intel_timeline *const tl =i915_request_timeline (rq);struct i915_sched_attr attr = {};
drivers/gpu/drm/i915/i915_vma.c +2 -1
@@ -2179,7 +2179,7 @@ int i915_vma_unbind(struct i915_vma *vma)/* XXX not always required: nop_clear_range */ wakeref =intel_runtime_pm_get (&vm->i915->runtime_pm); - err =mutex_lock_interruptible_nested (&vma->vm->mutex, !wakeref); + err =mutex_lock_interruptible_nested (&vm->mutex, !wakeref);if (err) goto out_rpm;
@@ -2193,6 +2193,7 @@ int i915_vma_unbind(struct i915_vma *vma) }int i915_vma_unbind_async (struct i915_vma *vma,bool trylock_vm) +NO_THREAD_SAFETY_ANALYSIS /* clang bug? */ {struct drm_i915_gem_object *obj = vma->obj;struct i915_address_space *vm = vma->vm;
drivers/gpu/drm/i915/intel_sbi.c +2 -0
@@ -58,11 +58,13 @@ static int intel_sbi_rw(struct drm_i915_private *i915, u16 reg, }void intel_sbi_lock (struct drm_i915_private *i915) + ACQUIRE(i915->sbi_lock) {mutex_lock (&i915->sbi_lock); }void intel_sbi_unlock (struct drm_i915_private *i915) + RELEASE(i915->sbi_lock) {mutex_unlock (&i915->sbi_lock); }
drivers/gpu/drm/i915/intel_wakeref.c +2 -0
@@ -51,6 +51,7 @@ int __intel_wakeref_get_first(struct intel_wakeref *wf) }static void ____intel_wakeref_put_last (struct intel_wakeref *wf) + RELEASE(wf->mutex) {intel_wakeref_t wakeref =NULL ;
@@ -86,6 +87,7 @@ void __intel_wakeref_put_last(struct intel_wakeref *wf, unsigned long flags) }static void __intel_wakeref_put_work (struct work_struct *wrk) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct intel_wakeref *wf =container_of (wrk,typeof (*wf), work.work);
drivers/gpu/drm/i915/intel_wakeref.h +2 -0
@@ -204,6 +204,7 @@ intel_wakeref_might_put(struct intel_wakeref *wf)static inline void intel_wakeref_lock (struct intel_wakeref *wf) __acquires(wf->mutex) + ACQUIRE(wf->mutex) {mutex_lock (&wf->mutex); }
@@ -217,6 +218,7 @@ intel_wakeref_lock(struct intel_wakeref *wf)static inline void intel_wakeref_unlock (struct intel_wakeref *wf) __releases(wf->mutex) + RELEASE(wf->mutex) {mutex_unlock (&wf->mutex); }
drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c +1 -0
@@ -81,6 +81,7 @@ static u32 *pxp_emit_wait(u32 *cs)#define WAIT_LEN 2static void pxp_request_commit (struct i915_request *rq) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct i915_sched_attr attr = { .priority =I915_PRIORITY_MAX };struct intel_timeline *const tl =i915_request_timeline (rq);
drivers/gpu/drm/i915/vlv_sideband.c +2 -0
@@ -58,6 +58,7 @@ static void __vlv_punit_put(struct drm_i915_private *i915) }void vlv_iosf_sb_get (struct drm_i915_private *i915,unsigned long ports) + ACQUIRE(i915->vlv_iosf_sb.lock) {if (ports &BIT (VLV_IOSF_SB_PUNIT ))__vlv_punit_get (i915);
@@ -66,6 +67,7 @@ void vlv_iosf_sb_get(struct drm_i915_private *i915, unsigned long ports) }void vlv_iosf_sb_put (struct drm_i915_private *i915,unsigned long ports) + RELEASE(i915->vlv_iosf_sb.lock) {mutex_unlock (&i915->vlv_iosf_sb.lock);
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +1 -0
@@ -213,6 +213,7 @@ static inline dma_addr_t dma_hwdesc_addr(const struct ingenic_drm *priv,static int ingenic_drm_update_pixclk (struct notifier_block *nb,unsigned long action,void *data) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct ingenic_drm *priv =drm_nb_get_priv (nb);
drivers/gpu/drm/mgag200/mgag200_ddc.c +2 -0
@@ -100,6 +100,7 @@ static int mgag200_ddc_algo_bit_data_getscl(void *data) }static int mgag200_ddc_algo_bit_data_pre_xfer (struct i2c_adapter *adapter) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct mgag200_ddc *ddc =i2c_get_adapdata (adapter);struct mga_device *mdev = ddc->mdev;
@@ -114,6 +115,7 @@ static int mgag200_ddc_algo_bit_data_pre_xfer(struct i2c_adapter *adapter) }static void mgag200_ddc_algo_bit_data_post_xfer (struct i2c_adapter *adapter) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct mgag200_ddc *ddc =i2c_get_adapdata (adapter);struct mga_device *mdev = ddc->mdev;
drivers/gpu/drm/msm/msm_atomic.c +2 -0
@@ -41,6 +41,7 @@ static void vblank_put(struct msm_kms *kms, unsigned crtc_mask) }static void lock_crtcs (struct msm_kms *kms,unsigned int crtc_mask) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {int crtc_index;struct drm_crtc *crtc;
@@ -52,6 +53,7 @@ static void lock_crtcs(struct msm_kms *kms, unsigned int crtc_mask) }static void unlock_crtcs (struct msm_kms *kms,unsigned int crtc_mask) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct drm_crtc *crtc;
drivers/gpu/drm/nouveau/dispnv50/disp.c +2 -0
@@ -2159,6 +2159,7 @@ nv50_disp_atomic_commit_wndw(struct drm_atomic_state *state, u32 *interlock)static void nv50_disp_atomic_commit_tail (struct drm_atomic_state *state) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct drm_device *dev = state->dev;struct drm_crtc_state *new_crtc_state, *old_crtc_state;
@@ -2757,6 +2758,7 @@ nv50_display_read_hw_or_state(struct drm_device *dev, struct nv50_disp *disp,/* Read back the currently programmed display state */ static void nv50_display_read_hw_state (struct nouveau_drm *drm) +NO_THREAD_SAFETY_ANALYSIS /* DRM_MODESET_LOCK */ {struct drm_device *dev = drm->dev;struct drm_encoder *encoder;
drivers/gpu/drm/nouveau/nouveau_abi16.c +2 -0
@@ -56,6 +56,7 @@ nouveau_abi16(struct drm_file *file_priv)struct nouveau_abi16 *nouveau_abi16_get (struct drm_file *file_priv) +NO_THREAD_SAFETY_ANALYSIS /* returns a pointer */ {struct nouveau_cli *cli =nouveau_cli (file_priv);mutex_lock (&cli->mutex);
@@ -67,6 +68,7 @@ nouveau_abi16_get(struct drm_file *file_priv)int nouveau_abi16_put (struct nouveau_abi16 *abi16,int ret) +NO_THREAD_SAFETY_ANALYSIS /* to match the previous function */ {struct nouveau_cli *cli = abi16->cli;mutex_unlock (&cli->mutex);
drivers/gpu/drm/nouveau/nouveau_uvmm.h +2 -0
@@ -86,11 +86,13 @@ int nouveau_uvmm_ioctl_vm_bind(struct drm_device *dev, void *data, struct drm_file *file_priv);static inline void nouveau_uvmm_lock (struct nouveau_uvmm *uvmm) + ACQUIRE(uvmm->mutex) {mutex_lock (&uvmm->mutex); }static inline void nouveau_uvmm_unlock (struct nouveau_uvmm *uvmm) + RELEASE(uvmm->mutex) {mutex_unlock (&uvmm->mutex); }
drivers/gpu/drm/nouveau/nvkm/core/subdev.c +1 -0
@@ -184,6 +184,7 @@ nvkm_subdev_oneinit(struct nvkm_subdev *subdev)void nvkm_subdev_unref (struct nvkm_subdev *subdev) +NO_THREAD_SAFETY_ANALYSIS /* because of a clang bug */ {if (refcount_dec_and_mutex_lock (&subdev->use.refcount, &subdev->use.mutex)) {nvkm_subdev_fini (subdev, false);
drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c +2 -1
@@ -70,6 +70,7 @@ nvkm_chan_cctx_bind(struct nvkm_chan *chan, struct nvkm_engn *engn, struct nvkm_void nvkm_chan_cctx_put (struct nvkm_chan *chan,struct nvkm_cctx **pcctx) +NO_THREAD_SAFETY_ANALYSIS /* needed because of a clang bug? */ {struct nvkm_cctx *cctx = *pcctx;
@@ -104,7 +105,7 @@ nvkm_chan_cctx_get(struct nvkm_chan *chan, struct nvkm_engn *engn, struct nvkm_cif (cctx) {refcount_inc (&cctx->refs); *pcctx = cctx; -mutex_unlock (&chan->cgrp->mutex); +mutex_unlock (&cgrp->mutex);return 0 ; }
drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c +1 -0
@@ -73,6 +73,7 @@ struct nvkm_uobj {static int nvkm_uchan_object_fini_1 (struct nvkm_oproxy *oproxy,bool suspend) +NO_THREAD_SAFETY_ANALYSIS /* needed because of a clang bug? */ {struct nvkm_uobj *uobj =container_of (oproxy,typeof (*uobj), oproxy);struct nvkm_chan *chan = uobj->chan;
drivers/gpu/drm/nouveau/nvkm/falcon/cmdq.c +3 -0
@@ -69,6 +69,7 @@ nvkm_falcon_cmdq_rewind(struct nvkm_falcon_cmdq *cmdq)static int nvkm_falcon_cmdq_open (struct nvkm_falcon_cmdq *cmdq,u32 size) + TRY_ACQUIRE(0, cmdq->mutex) {struct nvkm_falcon *falcon = cmdq->qmgr->falcon;bool rewind = false;
@@ -91,6 +92,7 @@ nvkm_falcon_cmdq_open(struct nvkm_falcon_cmdq *cmdq, u32 size)static void nvkm_falcon_cmdq_close (struct nvkm_falcon_cmdq *cmdq) + RELEASE(cmdq->mutex) {nvkm_falcon_wr32 (cmdq->qmgr->falcon, cmdq->head_reg, cmdq->position);mutex_unlock (&cmdq->mutex);
@@ -98,6 +100,7 @@ nvkm_falcon_cmdq_close(struct nvkm_falcon_cmdq *cmdq)static int nvkm_falcon_cmdq_write (struct nvkm_falcon_cmdq *cmdq,struct nvfw_falcon_cmd *cmd) +NO_THREAD_SAFETY_ANALYSIS /* clang bug? */ {static unsigned timeout =2000 ;unsigned long end_jiffies = jiffies +msecs_to_jiffies (timeout);
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxch.c +2 -0
@@ -106,6 +106,7 @@ nvkm_i2c_aux_monitor(struct nvkm_i2c_aux *aux, bool monitor)void nvkm_i2c_aux_release (struct nvkm_i2c_aux *aux) + RELEASE(aux->mutex) {struct nvkm_i2c_pad *pad = aux->pad;AUX_TRACE (aux,"release" );
@@ -115,6 +116,7 @@ nvkm_i2c_aux_release(struct nvkm_i2c_aux *aux)int nvkm_i2c_aux_acquire (struct nvkm_i2c_aux *aux) + TRY_ACQUIRE(0, aux->mutex) {struct nvkm_i2c_pad *pad = aux->pad;int ret;
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c +2 -0
@@ -127,6 +127,7 @@ nvkm_i2c_bus_fini(struct nvkm_i2c_bus *bus)void nvkm_i2c_bus_release (struct nvkm_i2c_bus *bus) + RELEASE(bus->mutex) {struct nvkm_i2c_pad *pad = bus->pad;BUS_TRACE (bus,"release" );
@@ -136,6 +137,7 @@ nvkm_i2c_bus_release(struct nvkm_i2c_bus *bus)int nvkm_i2c_bus_acquire (struct nvkm_i2c_bus *bus) + TRY_ACQUIRE(0, bus->mutex) {struct nvkm_i2c_pad *pad = bus->pad;int ret;
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c +2 -0
@@ -44,6 +44,7 @@ nvkm_i2c_pad_mode(struct nvkm_i2c_pad *pad, enum nvkm_i2c_pad_mode mode)void nvkm_i2c_pad_release (struct nvkm_i2c_pad *pad) + RELEASE(pad->mutex) {PAD_TRACE (pad,"release" );if (pad->mode ==NVKM_I2C_PAD_OFF )
@@ -53,6 +54,7 @@ nvkm_i2c_pad_release(struct nvkm_i2c_pad *pad)int nvkm_i2c_pad_acquire (struct nvkm_i2c_pad *pad,enum nvkm_i2c_pad_mode mode) + TRY_ACQUIRE(0, pad->mutex) {PAD_TRACE (pad,"acquire" );mutex_lock (&pad->mutex);
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c +13 -11
@@ -119,6 +119,7 @@ nv50_instobj_fast = {static void nv50_instobj_kmap (struct nv50_instobj *iobj,struct nvkm_vmm *vmm) + REQUIRES(iobj->imem->base.mutex) {struct nv50_instmem *imem = iobj->imem;struct nv50_instobj *eobj;
@@ -134,12 +135,12 @@ nv50_instobj_kmap(struct nv50_instobj *iobj, struct nvkm_vmm *vmm)* into it. The lock has to be dropped while doing this due * to the possibility of recursion for page table allocation. */ -mutex_unlock (&imem->base.mutex); +mutex_unlock (&iobj->imem->base.mutex);while ((ret =nvkm_vmm_get (vmm,12 , size, &bar))) {/* Evict unused mappings, and keep retrying until we either * succeed,or there's no more objects left on the LRU. */ -mutex_lock (&imem->base.mutex); +mutex_lock (&iobj->imem->base.mutex); eobj =list_first_entry_or_null (&imem->lru,typeof (*eobj), lru);if (eobj) { nvkm_debug(subdev, "evict %016llx %016llx @ %016llx\n",
@@ -152,7 +153,7 @@ nv50_instobj_kmap(struct nv50_instobj *iobj, struct nvkm_vmm *vmm) emap = eobj->map; eobj->map =NULL ; } -mutex_unlock (&imem->base.mutex); +mutex_unlock (&iobj->imem->base.mutex);if (!eobj)break ;iounmap (emap);
@@ -161,12 +162,12 @@ nv50_instobj_kmap(struct nv50_instobj *iobj, struct nvkm_vmm *vmm)if (ret ==0 ) ret =nvkm_memory_map (memory,0 , vmm, bar,NULL ,0 ); -mutex_lock (&imem->base.mutex); +mutex_lock (&iobj->imem->base.mutex);if (ret || iobj->bar) {/* We either failed, or another thread beat us. */ -mutex_unlock (&imem->base.mutex); +mutex_unlock (&iobj->imem->base.mutex);nvkm_vmm_put (vmm, &bar); -mutex_lock (&imem->base.mutex); +mutex_lock (&iobj->imem->base.mutex);return ; }
@@ -190,6 +191,7 @@ nv50_instobj_map(struct nvkm_memory *memory, u64 offset, struct nvkm_vmm *vmm,static void nv50_instobj_release (struct nvkm_memory *memory) +NO_THREAD_SAFETY_ANALYSIS /* needed because of a clang bug? */ {struct nv50_instobj *iobj =nv50_instobj (memory);struct nv50_instmem *imem = iobj->imem;
@@ -231,9 +233,9 @@ nv50_instobj_acquire(struct nvkm_memory *memory)/* Take the lock, and re-check that another thread hasn't * already mapped the object in the meantime. */ -mutex_lock (&imem->mutex); +mutex_lock (&iobj->imem->base.mutex);if (refcount_inc_not_zero (&iobj->maps)) { -mutex_unlock (&imem->mutex); +mutex_unlock (&iobj->imem->base.mutex);return iobj->map; }
@@ -258,7 +260,7 @@ nv50_instobj_acquire(struct nvkm_memory *memory)refcount_set (&iobj->maps,1 ); } -mutex_unlock (&imem->mutex); +mutex_unlock (&iobj->imem->base.mutex);return map; }
@@ -271,7 +273,7 @@ nv50_instobj_boot(struct nvkm_memory *memory, struct nvkm_vmm *vmm)/* Exclude bootstrapped objects (ie. the page tables for the * instmem BAR itself) from eviction. */ -mutex_lock (&imem->mutex); +mutex_lock (&iobj->imem->base.mutex);if (likely (iobj->lru.next)) {list_del_init (&iobj->lru); iobj->lru.next =NULL ;
@@ -279,7 +281,7 @@ nv50_instobj_boot(struct nvkm_memory *memory, struct nvkm_vmm *vmm)nv50_instobj_kmap (iobj, vmm);nvkm_instmem_boot (imem); -mutex_unlock (&imem->mutex); +mutex_unlock (&iobj->imem->base.mutex); } static u64
drivers/gpu/drm/panthor/panthor_mmu.c +1 -0
@@ -813,6 +813,7 @@ int panthor_vm_active(struct panthor_vm *vm)* and other AS updates). */ void panthor_vm_idle (struct panthor_vm *vm) +NO_THREAD_SAFETY_ANALYSIS /* clang bug? */ {struct panthor_device *ptdev = vm->ptdev;
drivers/gpu/drm/qxl/qxl_cmd.c +1 -0
@@ -576,6 +576,7 @@ void qxl_surface_evict(struct qxl_device *qdev, struct qxl_bo *surf, bool do_upd }static int qxl_reap_surf (struct qxl_device *qdev,struct qxl_bo *surf,bool stall) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {long ret;
drivers/gpu/drm/qxl/qxl_display.c +2 -0
@@ -165,6 +165,7 @@ static void qxl_update_offset_props(struct qxl_device *qdev) }void qxl_display_read_client_monitors_config (struct qxl_device *qdev) +NO_THREAD_SAFETY_ANALYSIS /* DRM_MODESET_LOCK */ {struct drm_device *dev = &qdev->ddev;struct drm_modeset_acquire_ctx ctx;
@@ -408,6 +409,7 @@ static int qxl_framebuffer_surface_dirty(struct drm_framebuffer *fb, unsigned int flags, unsigned int color, struct drm_clip_rect *clips, unsigned int num_clips) + NO_THREAD_SAFETY_ANALYSIS /* DRM_MODESET_LOCK */ { /* TODO: vmwgfx where this was cribbed from had locking. Why? */ struct qxl_device *qdev = to_qxl(fb->dev);
drivers/gpu/drm/radeon/radeon_i2c.c +2 -0
@@ -83,6 +83,7 @@ bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool use_aux)/* bit banging i2c */ static int pre_xfer (struct i2c_adapter *i2c_adap) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct radeon_i2c_chan *i2c =i2c_get_adapdata (i2c_adap);struct radeon_device *rdev = i2c->dev->dev_private;
@@ -153,6 +154,7 @@ static int pre_xfer(struct i2c_adapter *i2c_adap) }static void post_xfer (struct i2c_adapter *i2c_adap) +NO_THREAD_SAFETY_ANALYSIS /* mutex not a member of an argument */ {struct radeon_i2c_chan *i2c =i2c_get_adapdata (i2c_adap);struct radeon_device *rdev = i2c->dev->dev_private;
drivers/gpu/drm/radeon/radeon_ring.c +3 -0
@@ -143,6 +143,7 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *ring, unsi* Returns 0 on success, error on failure. */ int radeon_ring_lock (struct radeon_device *rdev,struct radeon_ring *ring,unsigned ndw) + TRY_ACQUIRE(0, rdev->ring_lock) {int r;
@@ -199,6 +200,7 @@ void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *ring,*/ void radeon_ring_unlock_commit (struct radeon_device *rdev,struct radeon_ring *ring,bool hdp_flush) + RELEASE(rdev->ring_lock) {radeon_ring_commit (rdev, ring, hdp_flush);mutex_unlock (&rdev->ring_lock);
@@ -225,6 +227,7 @@ void radeon_ring_undo(struct radeon_ring *ring)* Call radeon_ring_undo() then unlock the ring (all asics). */ void radeon_ring_unlock_undo (struct radeon_device *rdev,struct radeon_ring *ring) + RELEASE(rdev->ring_lock) {radeon_ring_undo (ring);mutex_unlock (&rdev->ring_lock);
drivers/gpu/drm/rockchip/cdn-dp-core.c +1 -0
@@ -906,6 +906,7 @@ static int cdn_dp_audio_codec_init(struct cdn_dp_device *dp, }static int cdn_dp_request_firmware (struct cdn_dp_device *dp) + REQUIRES(dp->lock) {int ret;unsigned long timeout = jiffies +msecs_to_jiffies (CDN_FW_TIMEOUT_MS );
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +2 -0
@@ -283,11 +283,13 @@ static struct vop2_win *to_vop2_win(struct drm_plane *p) }static void vop2_lock (struct vop2 *vop2) + ACQUIRE(vop2->vop2_lock) {mutex_lock (&vop2->vop2_lock); }static void vop2_unlock (struct vop2 *vop2) + RELEASE(vop2->vop2_lock) {mutex_unlock (&vop2->vop2_lock); }
drivers/gpu/drm/tegra/hdmi.c +2 -0
@@ -372,12 +372,14 @@ static const struct tmds_config tegra124_tmds_config[] = { };static void tegra_hdmi_audio_lock (struct tegra_hdmi *hdmi) + ACQUIRE(hdmi->audio_lock) {mutex_lock (&hdmi->audio_lock);disable_irq (hdmi->irq); }static void tegra_hdmi_audio_unlock (struct tegra_hdmi *hdmi) + RELEASE(hdmi->audio_lock) {enable_irq (hdmi->irq);mutex_unlock (&hdmi->audio_lock);
drivers/gpu/drm/ttm/tests/ttm_bo_test.c +1 -0
@@ -137,6 +137,7 @@ static void ttm_bo_reserve_double_resv(struct kunit *test)* propagates that error. */ static void ttm_bo_reserve_deadlock (struct kunit *test) +NO_THREAD_SAFETY_ANALYSIS /* intentional lock/unlock mismatch */ {struct ttm_buffer_object *bo1, *bo2;struct ww_acquire_ctx ctx1, ctx2;
drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c +6 -1
@@ -276,6 +276,7 @@ static int vmw_fifo_wait(struct vmw_private *dev_priv,*/ static void *vmw_local_fifo_reserve (struct vmw_private *dev_priv,uint32_t bytes) +NO_THREAD_SAFETY_ANALYSIS /* returns a pointer */ {struct vmw_fifo_state *fifo_state = dev_priv->fifo;u32 *fifo_mem = dev_priv->fifo_mem;
@@ -425,6 +426,8 @@ static void vmw_fifo_slow_copy(struct vmw_fifo_state *fifo_state, }static void vmw_local_fifo_commit (struct vmw_private *dev_priv,uint32_t bytes) + RELEASE(dev_priv->fifo->fifo_mutex) + RELEASE(dev_priv->fifo->fifo_mutex) {struct vmw_fifo_state *fifo_state = dev_priv->fifo;uint32_t next_cmd =vmw_fifo_mem_read (dev_priv,SVGA_FIFO_NEXT_CMD );
@@ -466,10 +469,11 @@ static void vmw_local_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes)mb ();up_write (&fifo_state->rwsem);vmw_fifo_ping_host (dev_priv,SVGA_SYNC_GENERIC ); -mutex_unlock (&fifo_state->fifo_mutex); +mutex_unlock (&dev_priv->fifo->fifo_mutex); }void vmw_cmd_commit (struct vmw_private *dev_priv,uint32_t bytes) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {if (dev_priv->cman)vmw_cmdbuf_commit (dev_priv->cman, bytes,NULL , false);
@@ -485,6 +489,7 @@ void vmw_cmd_commit(struct vmw_private *dev_priv, uint32_t bytes)* @bytes: Number of bytes to commit. */ void vmw_cmd_commit_flush (struct vmw_private *dev_priv,uint32_t bytes) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {if (dev_priv->cman)vmw_cmdbuf_commit (dev_priv->cman, bytes,NULL , true);
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c +5 -0
@@ -204,6 +204,7 @@ static int vmw_cmdbuf_preempt(struct vmw_cmdbuf_man *man, u32 context);* @interruptible: Whether to wait interruptible when locking. */ static int vmw_cmdbuf_cur_lock (struct vmw_cmdbuf_man *man,bool interruptible) + TRY_ACQUIRE(0, &man->cur_mutex) {if (interruptible) {if (mutex_lock_interruptible (&man->cur_mutex))
@@ -221,6 +222,7 @@ static int vmw_cmdbuf_cur_lock(struct vmw_cmdbuf_man *man, bool interruptible)* @man: The range manager. */ static void vmw_cmdbuf_cur_unlock (struct vmw_cmdbuf_man *man) + RELEASE(&man->cur_mutex) {mutex_unlock (&man->cur_mutex); }
@@ -999,6 +1001,7 @@ static void *vmw_cmdbuf_reserve_cur(struct vmw_cmdbuf_man *man,size_t size, int ctx_id, bool interruptible) + NO_THREAD_SAFETY_ANALYSIS /* returns a pointer */ { struct vmw_cmdbuf_header *cur;void *ret;
@@ -1043,6 +1046,7 @@ static void *vmw_cmdbuf_reserve_cur(struct vmw_cmdbuf_man *man,*/ static void vmw_cmdbuf_commit_cur (struct vmw_cmdbuf_man *man,size_t size,bool flush) + RELEASE(man->cur_mutex) {struct vmw_cmdbuf_header *cur = man->cur;
@@ -1100,6 +1104,7 @@ void *vmw_cmdbuf_reserve(struct vmw_cmdbuf_man *man, size_t size,*/ void vmw_cmdbuf_commit (struct vmw_cmdbuf_man *man,size_t size,struct vmw_cmdbuf_header *header,bool flush) +NO_THREAD_SAFETY_ANALYSIS /* conditional unlock */ {if (!header) {vmw_cmdbuf_commit_cur (man, size, flush);
drivers/gpu/drm/vmwgfx/vmwgfx_validation.c +3 -0
@@ -692,6 +692,7 @@ void vmw_validation_unref_lists(struct vmw_validation_context *ctx)int vmw_validation_prepare (struct vmw_validation_context *ctx,struct mutex *mutex,bool intr) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {int ret =0 ;
@@ -743,6 +744,7 @@ int vmw_validation_prepare(struct vmw_validation_context *ctx,* The caller still needs to unref resources after a call to this function. */ void vmw_validation_revert (struct vmw_validation_context *ctx) +NO_THREAD_SAFETY_ANALYSIS /* conditional unlock */ {vmw_validation_bo_backoff (ctx);vmw_validation_res_unreserve (ctx, true);
@@ -762,6 +764,7 @@ void vmw_validation_revert(struct vmw_validation_context *ctx)*/ void vmw_validation_done (struct vmw_validation_context *ctx,struct vmw_fence_obj *fence) +NO_THREAD_SAFETY_ANALYSIS /* conditional unlock */ {vmw_validation_bo_fence (ctx, fence);vmw_validation_res_unreserve (ctx, false);
drivers/gpu/drm/xe/xe_migrate.c +1 -0
@@ -1308,6 +1308,7 @@ static struct dma_fence * __xe_migrate_update_pgtables(struct xe_migrate *m, struct xe_migrate_pt_update *pt_update, struct xe_vm_pgtable_update_ops *pt_update_ops) + NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ { const struct xe_migrate_pt_update_ops *ops = pt_update->ops;struct xe_tile *tile = m->tile;
drivers/gpu/drm/xe/xe_pcode.c +1 -0
@@ -268,6 +268,7 @@ int xe_pcode_init_min_freq_table(struct xe_tile *tile, u32 min_gt_freq,* Returns 0 on success, and -error number on failure. */ int xe_pcode_ready (struct xe_device *xe,bool locked) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {u32 status, request =DGFX_GET_INIT_STATUS ;struct xe_tile *tile =xe_device_get_root_tile (xe);
drivers/gpu/host1x/bus.c +2 -0
@@ -884,6 +884,7 @@ EXPORT_SYMBOL(host1x_client_resume);struct host1x_bo_mapping *host1x_bo_pin (struct device *dev,struct host1x_bo *bo,enum dma_data_direction dir,struct host1x_bo_cache *cache) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct host1x_bo_mapping *mapping;
@@ -943,6 +944,7 @@ static void __host1x_bo_unpin(struct kref *ref) }void host1x_bo_unpin (struct host1x_bo_mapping *mapping) +NO_THREAD_SAFETY_ANALYSIS /* conditional locking */ {struct host1x_bo_cache *cache = mapping->cache;
drivers/gpu/host1x/cdma.c +6 -0
@@ -184,6 +184,7 @@ static u32 host1x_pushbuffer_space(struct push_buffer *pb)*/ unsigned int host1x_cdma_wait_locked (struct host1x_cdma *cdma,enum cdma_event event) + REQUIRES(cdma->lock) {for (;;) {struct push_buffer *pb = &cdma->push_buffer;
@@ -235,6 +236,7 @@ unsigned int host1x_cdma_wait_locked(struct host1x_cdma *cdma,static int host1x_cdma_wait_pushbuffer_space (struct host1x *host1x,struct host1x_cdma *cdma,unsigned int needed) + REQUIRES(cdma->lock) {while (true) {struct push_buffer *pb = &cdma->push_buffer;
@@ -546,6 +548,7 @@ int host1x_cdma_deinit(struct host1x_cdma *cdma)* Begin a cdma submit */ int host1x_cdma_begin (struct host1x_cdma *cdma,struct host1x_job *job) + TRY_ACQUIRE(0, cdma->lock) {struct host1x *host1x =cdma_to_host1x (cdma);
@@ -590,6 +593,7 @@ int host1x_cdma_begin(struct host1x_cdma *cdma, struct host1x_job *job)* Blocks as necessary if the push buffer is full. */ void host1x_cdma_push (struct host1x_cdma *cdma,u32 op1,u32 op2) + REQUIRES(cdma->lock) {struct host1x *host1x =cdma_to_host1x (cdma);struct push_buffer *pb = &cdma->push_buffer;
@@ -621,6 +625,7 @@ void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, u32 op2)*/ void host1x_cdma_push_wide (struct host1x_cdma *cdma,u32 op1,u32 op2,u32 op3,u32 op4) + REQUIRES(cdma->lock) {struct host1x_channel *channel =cdma_to_channel (cdma);struct host1x *host1x =cdma_to_host1x (cdma);
@@ -664,6 +669,7 @@ void host1x_cdma_push_wide(struct host1x_cdma *cdma, u32 op1, u32 op2,*/ void host1x_cdma_end (struct host1x_cdma *cdma,struct host1x_job *job) + RELEASE(cdma->lock) {struct host1x *host1x =cdma_to_host1x (cdma);bool idle =list_empty (&cdma->sync_queue);
drivers/gpu/host1x/context.c +1 -0
@@ -165,6 +165,7 @@ void host1x_memory_context_get(struct host1x_memory_context *cd)EXPORT_SYMBOL_GPL (host1x_memory_context_get);void host1x_memory_context_put (struct host1x_memory_context *cd) +NO_THREAD_SAFETY_ANALYSIS /* clang bug? */ {struct host1x_memory_context_list *cdl = &cd->host->context_list;
drivers/gpu/host1x/mipi.c +2 -0
@@ -294,6 +294,7 @@ int tegra_mipi_disable(struct tegra_mipi_device *dev)EXPORT_SYMBOL (tegra_mipi_disable);int tegra_mipi_finish_calibration (struct tegra_mipi_device *device) + RELEASE(device->mipi->lock) {struct tegra_mipi *mipi = device->mipi;void __iomem *status_reg = mipi->regs + (MIPI_CAL_STATUS <<2 );
@@ -312,6 +313,7 @@ int tegra_mipi_finish_calibration(struct tegra_mipi_device *device)EXPORT_SYMBOL (tegra_mipi_finish_calibration);int tegra_mipi_start_calibration (struct tegra_mipi_device *device) + TRY_ACQUIRE(0, device->mipi->lock) {const struct tegra_mipi_soc *soc = device->mipi->soc;unsigned int i;
drivers/hid/hid-wiimote.h +3 -0
@@ -319,11 +319,13 @@ static inline void wiimote_cmd_abort(struct wiimote_data *wdata) }static inline int wiimote_cmd_acquire (struct wiimote_data *wdata) + TRY_ACQUIRE(0, wdata->state.sync) {return mutex_lock_interruptible (&wdata->state.sync) ? -ERESTARTSYS :0 ; }static inline void wiimote_cmd_acquire_noint (struct wiimote_data *wdata) + ACQUIRE(wdata->state.sync) {mutex_lock (&wdata->state.sync); }
@@ -338,6 +340,7 @@ static inline void wiimote_cmd_set(struct wiimote_data *wdata, int cmd, }static inline void wiimote_cmd_release (struct wiimote_data *wdata) + RELEASE(wdata->state.sync) {mutex_unlock (&wdata->state.sync); }
drivers/hv/channel.c +2 -0
@@ -229,6 +229,7 @@ static int send_modifychannel_without_ack(struct vmbus_channel *channel, u32 tar }
Lines of this file are not shown. View the raw message.
drivers/iio/buffer/industrialio-buffer-dma.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/infiniband/hw/hns/hns_roce_hem.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/md/dm-vdo/indexer/index-session.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/md/dm-vdo/indexer/volume-index.c +3 -0
Lines of this file are not shown. View the raw message.
drivers/media/common/videobuf2/videobuf2-core.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/media/common/videobuf2/videobuf2-v4l2.c +7 -0
Lines of this file are not shown. View the raw message.
drivers/media/pci/ddbridge/ddbridge-core.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/media/platform/amphion/vpu_v4l2.c +3 -0
Lines of this file are not shown. View the raw message.
drivers/media/platform/chips-media/coda/coda-jpeg.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_pm.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/media/platform/nvidia/tegra-vde/h264.c +5 -0
Lines of this file are not shown. View the raw message.
drivers/media/platform/nvidia/tegra-vde/vde.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/media/platform/samsung/exynos4-is/media-dev.h +2 -0
Lines of this file are not shown. View the raw message.
drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/media/platform/st/sti/hva/hva-hw.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/media/platform/ti/omap3isp/ispvideo.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/media/test-drivers/vivid/vivid-kthread-cap.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/media/usb/dvb-usb-v2/mxl111sf.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/media/usb/dvb-usb/cxusb-analog.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/media/usb/pvrusb2/pvrusb2-context.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/misc/vmw_vmci/vmci_queue_pair.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/mtd/spi-nor/controllers/hisi-sfc.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/emulex/benet/be_cmds.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/hisilicon/hns3/hnae3.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/intel/e1000e/82571.c +3 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/intel/e1000e/ich8lan.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/intel/ice/ice_common.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/intel/ice/ice_ddp.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/intel/ice/ice_ethtool.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/intel/ice/ice_main.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/intel/ice/ice_vf_lib.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +3 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/marvell/octeontx2/nic/rep.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/marvell/prestera/prestera_counter.c +4 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/marvell/prestera/prestera_pci.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx4/cmd.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx4/port.c +5 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/en/mod_hdr.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_hmfs.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c +3 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/main.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_types.h +6 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/micrel/ks8851_spi.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/microchip/encx24j600-regmap.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/microchip/vcap/vcap_api.c +4 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/qlogic/qed/qed_ll2.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/qlogic/qed/qed_vf.c +3 -1
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/qlogic/qede/qede_main.c +7 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/sfc/mcdi_filters.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/sfc/siena/efx_common.c +3 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/xilinx/xilinx_axienet.h +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/ath/ath9k/hif_usb.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/ath/wil6210/main.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/broadcom/b43/main.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/broadcom/b43legacy/main.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/intel/iwlwifi/dvm/lib.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +3 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +3 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/intersil/p54/p54pci.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/intersil/p54/p54usb.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/mediatek/mt76/mt7615/testmode.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/mediatek/mt76/mt76_connac.h +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/mediatek/mt76/mt7915/main.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/mediatek/mt76/mt7915/testmode.c +5 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/microchip/wilc1000/wlan.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/quantenna/qtnfmac/bus.h +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/realtek/rtw88/main.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/realtek/rtw89/core.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/realtek/rtw89/mac80211.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/realtek/rtw89/wow.c +4 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/realtek/rtw89/wow.h +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/wireless/zydas/zd1211rw/zd_usb.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/platform/chrome/cros_ec_lpc_mec.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/platform/cznic/turris-omnia-mcu-gpio.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/platform/x86/intel/crystal_cove_charger.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/power/supply/power_supply_core.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/scsi/megaraid/megaraid_sas_base.c +16 -4
Lines of this file are not shown. View the raw message.
drivers/scsi/megaraid/megaraid_sas_fusion.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/target/iscsi/iscsi_target_tpg.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/thermal/mediatek/auxadc_thermal.c +2 -0
Lines of this file are not shown. View the raw message.
drivers/virt/vboxguest/vboxguest_linux.c +2 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Bart Van Assche
maintainerRFC PATCH 33/33 kbuild: clang: Unconditionally enable thread-safety checking
In reply to Bart Van AsscheEnable thread-safety checks for arm64 and x86. Do not enable it for other architectures yet - this will be done later. Disable thread-safety checking for staging drivers. Fixing thread-safety bugs in staging drivers will have to be done when these drivers come out of staging.
--- drivers/staging/Makefile | 2 ++ scripts/Makefile.clang | 3 +++ 2 files changed, 5 insertions(+)
drivers/staging/Makefile +2 -0
@@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for staging directory +KBUILD_CFLAGS += -Wno-thread-safety + obj-y += media/ obj-$(CONFIG_RTL8723BS) += rtl8723bs/ obj-$(CONFIG_OCTEON_ETHERNET) += octeon/
scripts/Makefile.clang +3 -0
@@ -36,5 +36,8 @@ CLANG_FLAGS += -Werror=unknown-warning-option CLANG_FLAGS += -Werror=ignored-optimization-argument CLANG_FLAGS += -Werror=option-ignored CLANG_FLAGS += -Werror=unused-command-line-argument + +CLANG_FLAGS += -Wthread-safety + KBUILD_CPPFLAGS += $(CLANG_FLAGS) export CLANG_FLAGS
Quoted 34 lines · Bart Van Assche
Hi Peter,
As you may know the Clang compiler can perform certain thread-safety checks at compile time. This includes checking whether locking calls in a function match the function attributes and also whether annotated structure members are protected by the synchronization objects declared with
GUARDED_BY(). As one can see this patch series includes a significant number of fixes for locking bugs. All these locking bugs have been discovered by the Clang thread-safety checker. I think this shows that it is useful to enable compile-time thread-safety checks.The Clang thread-safety infrastructure is not new. Some user space code in the kernel tree already uses it. See also the header file
tools/perf/util/mutex.h. There are other projects that started using this infrastructure a while ago, e.g. Qemu. The header fileinclude/qemu/clang-tsa.hwas added more than two years ago to the Qemu project.This patch series has been posted as an RFC because at this stage my goal is to gather feedback about the following:
- Whether or not to enable compile-time thread-safety checking in the Linux kernel.
- The names of the macros in header fileinclude/linux/thread_safety.h. The proposed names come from the Clang documentation (ACQUIRE(),RELEASE(),REQUIRES(), ...). In the Qemu header file for thread-safety support these macros have a prefix (TSA_= Thread-Safety Analysis).
- The changes made in header fileinclude/linux/cleanup.hthat support annotating constructor functions with function attributes.
- Whether or not to split the two treewide patches in this series into one patch per kernel driver.
- How to merge this patch series. The second last patch in this series modifies 888 source files. If it is split into one patch per driver, this patch series will become too large to be posted as a single patch series.
Quoted 8 lines
Annotating struct mutex is a first step. Once struct mutex is annotated, driver contributors and/or maintainers can annotate structure members with
GUARDED_BY()where this is considered useful.There are more synchronization objects that can be annotated with thread-safety attributes, e.g. spinlocks. This patch series only annotates struct mutex because annotating other synchronization objects too would have made this patch series too large.
Thanks Bart, for posting your approach.
I will also discuss my approach, as it will give everyone a clearer picture of the design space here.
Bart and I have concurrently been working on this feature, and only in recent days learned we both have been working on bringing -Wthread-safety (aka. Clang's ThreadSafety Analysis [1], aka. Capability analysis) to the Linux kernel. I have heard there have been prior attempts, but only recently did Clang make -Wthread-safety properly work with C code [2].
[1] https://clang.llvm.org/docs/ThreadSafetyAnalysis.html
[2] https://github.com/llvm/llvm-project/issues/20777
However, we also realized there are 2 ways to bring this feature to the kernel:
1. Tree-wide all-or-nothing approach (this RFC). Adding support for more "capabilities" - initially primarily synchronization primitives - becomes incredibly hard after the first capability (currently "mutex" only). This approach comes with all the known caveats of adding a new tree-wide static analysis to the kernel.
In fact, what it really is, is yet another dialect of C with a "capability system", with its own constraints. I dislike Clang's naming and the notion this is about "thread safety only" - it's not. It's a simple capability system, that can do much more.
In that vein, because we can't change the programming language (even if from one C dialect to another) of the kernel overnight, a different approach might cause less friction.
2. A selective, incremental, and much less intrusive approach. Maintainers of subsystems opt in their modules or directories into "capability analysis" (via Makefile directive "CAPABILITY_ANALYSIS_foo.o := y" or "CAPABILITY_ANALYSIS := y"). Most (eventually all) synchronization primitives and more capabilities (including ones that could track "irq disabled", "preemption" disabled, etc.) could be supported.
A prototype of approach #2 can be found here:
https://git.kernel.org/pub/scm/linux/kernel/git/melver/linux.git/log/?h=cap-analysis
Here's the RFC:
https://lore.kernel.org/all/[email protected]/T/#u
Combining approach #1 and #2 may somehow be possible, but it is currently eluding me. Clearly, based on the bugs that Bart found, some way to do tree-wide analysis is very useful!
One idea was to have "capability-selective tree-wide analysis" (such as mutex only) be controllable via a Kconfig option - the implementation of that (without excessive ifdefs sprinkled everywhere), however, most likely requires compiler support.
Depending on the feedback that results from these RFCs, I think we will be able to plan better which direction things should go.
Thanks,
-- Marco
Bart Van Assche
maintainerQuoted 10 lines · Marco Elver
Combining approach #1 and #2 may somehow be possible, but it is currently eluding me. Clearly, based on the bugs that Bart found, some way to do tree-wide analysis is very useful!
One idea was to have "capability-selective tree-wide analysis" (such as mutex only) be controllable via aKconfigoption - the implementation of that (without excessive ifdefs sprinkled everywhere), however, most likely requires compiler support.Depending on the feedback that results from these RFCs, I think we will be able to plan better which direction things should go.
Thank you Marco for having explained clearly and in detail what the possible paths are for enabling thread-safety support in the Linux kernel. I agree that there are at least two possible approaches (maybe there are even more possible approaches?). I'm interested in enabling the Clang compiler flag -Wthread-safety across the entire kernel. Hence the choice to start with annotating struct mutex only and to make the necessary changes across the entire kernel tree.
I'm looking forward to the feedback from others about what their opinion is about how to enable thread-safety checking in the Linux kernel.
Thanks,
Bart.
Peter Zijlstra
maintainerQuoted 2 lines · Bart Van Assche
I'm looking forward to the feedback from others about what their opinion is about how to enable thread-safety checking in the Linux kernel.
So Bart's patches are rather SHOUTING A LOT:-(, which I find really jarring to look at.
Also, however much I despise the sparse thing, that is something we already have some of, so we might as well adapt that.
But I should probably go read up on the whole clang feature first.
I've seen both have a __guarded_by() variant for structure members, can you stack those?
Eg. perf has locking where a structure has both a raw_spinlock_t and a mutex and modification requires holding both, but holding either is sufficient for reading.
Quoted 11 lines · Peter Zijlstra
Quoted 2 lines · Bart Van Assche
I'm looking forward to the feedback from others about what their opinion is about how to enable thread-safety checking in the Linux kernel.
So Bart's patches are rather SHOUTING A LOT:-(, which I find really jarring to look at.
Also, however much I despise the sparse thing, that is something we already have some of, so we might as well adapt that.
Quoted 8 lines
But I should probably go read up on the whole clang feature first.
I've seen both have a
__guarded_by()variant for structure members, can you stack those?Eg. perf has locking where a structure has both a
raw_spinlock_tand a mutex and modification requires holding both, but holding either is sufficient for reading.
Yes, you can add multiple guarded_by. But it's just going to enforce that you need to hold both locks before you access the member. If you want the rules to be more complex, the best way to express that is with some helpers. E.g. something like this (tested on top my series)
lib/test_capability-analysis.c +50 -0
@@ -479,3 +479,53 @@ static void __used test_local_lock_guard(void) {guard (local_lock_irqsave)(&test_local_lock_data.lock);this_cpu_add (test_local_lock_data.counter,1 ); } {guard (local_lock_nested_bh)(&test_local_lock_data.lock);this_cpu_add (test_local_lock_data.counter,1 ); } } + +struct some_data { +spinlock_t lock; +struct mutex mtx; + int counter __var_guarded_by(&lock) __var_guarded_by(&mtx); +}; + +static void some_data_read_lock_via_lock (struct some_data *d) + __acquires(&d->lock) __acquires_shared(&d->mtx) +{ +spin_lock (&d->lock); +__acquire_shared (&d->mtx); +} + +static void some_data_read_unlock_via_lock (struct some_data *d) + __releases(&d->lock) __releases_shared(&d->mtx) +{ +__release_shared (&d->mtx); +spin_unlock (&d->lock); +} + +static void some_data_read_lock_via_mtx (struct some_data *d) + __acquires(&d->mtx) __acquires_shared(&d->lock) +{ +mutex_lock (&d->mtx); +__acquire_shared (&d->lock); +} + +static void some_data_read_unlock_via_mtx (struct some_data *d) + __releases(&d->mtx) __releases_shared(&d->lock) +{ +__release_shared (&d->lock); +mutex_unlock (&d->mtx); +} + +static void __used foo_1 (struct some_data *d) +{ +some_data_read_lock_via_lock (d); + (void )d->counter; +// d->counter++; // error, because mtx only held shared +some_data_read_unlock_via_lock (d); +} + +static void __used foo_2 (struct some_data *d) +{ +some_data_read_lock_via_mtx (d); + (void )d->counter; +// d->counter++; // error, because lock only held shared +some_data_read_unlock_via_mtx (d); +}
Peter Zijlstra
maintainerQuoted 4 lines · Marco Elver
Yes, you can add multiple
guarded_by. But it's just going to enforce that you need to hold both locks before you access the member. If you want the rules to be more complex, the best way to express that is with some helpers. E.g. something like this (tested on top my series)
Oh gawd, this is going to be a pain, isn't it :/
Quoted 9 lines · Peter Zijlstra
Quoted 4 lines · Marco Elver
Yes, you can add multiple
guarded_by. But it's just going to enforce that you need to hold both locks before you access the member. If you want the rules to be more complex, the best way to express that is with some helpers. E.g. something like this (tested on top my series)Oh gawd, this is going to be a pain, isn't it :/
For complex locking patterns, yes. :-/
Which is why I'm proposing it to be opt-in but relatively complete (most primitives supported), so that either we have time to work out how to deal with more complex patterns, or just leave some things opted-out.
Bart Van Assche
maintainerQuoted 7 lines · Peter Zijlstra
Quoted 4 lines · Marco Elver
Yes, you can add multiple
guarded_by. But it's just going to enforce that you need to hold both locks before you access the member. If you want the rules to be more complex, the best way to express that is with some helpers. E.g. something like this (tested on top my series)Oh gawd, this is going to be a pain, isn't it :/
The Clang thread-safety annotations are used widely so behavior of existing attributes must be preserved. I propose to introduce new thread-safety attributes when useful to annotate kernel code. As an example, the Clang try_acquire_capability function attribute does not support functions that return pointers although this is a common pattern in the Linux kernel. I think that introducing a new function attribute to support functions that return pointers is a better solution than trying to annotate such functions with any of the existing Clang thread-safety attributes.
Thanks,
Bart.
Quoted 8 lines · Bart Van Assche
Quoted 6 lines · Peter Zijlstra
Quoted 4 lines · Marco Elver
Yes, you can add multiple
guarded_by. But it's just going to enforce that you need to hold both locks before you access the member. If you want the rules to be more complex, the best way to express that is with some helpers. E.g. something like this (tested on top my series)
Quoted 5 lines
Quoted 1 line
Oh gawd, this is going to be a pain, isn't it :/
The Clang thread-safety annotations are used widely so behavior of existing attributes must be preserved. I propose to introduce new thread-safety attributes when useful to annotate kernel code.
Agreed - we can't change the existing semantics, but if absolutely necessary we could think about extensions (which I already started for something else: https://github.com/llvm/llvm-project/pull/123063)
Quoted 7 lines
As an
example, the Clangtry_acquire_capabilityfunction attribute does not support functions that return pointers although this is a common pattern in the Linux kernel. I think that introducing a new function attribute to support functions that return pointers is a better solution than trying to annotate such functions with any of the existing Clang thread-safety attributes.
try_acquire_capability / __cond_acquires(cond, capability) is happy with pointer-returning functions when using int-literals for "cond" i.e. 0 or 1 (Clang's documentation says it only wants bool, but that's wrong). I just tested this on a pointer-returning function, and it works.
Bart Van Assche
maintainerQuoted 9 lines · Marco Elver
Quoted 7 lines · Bart Van Assche
As an
example, the Clangtry_acquire_capabilityfunction attribute does not support functions that return pointers although this is a common pattern in the Linux kernel. I think that introducing a new function attribute to support functions that return pointers is a better solution than trying to annotate such functions with any of the existing Clang thread-safety attributes.
Quoted 5 lines
try_acquire_capability/__cond_acquires(cond, capability)is happy with pointer-returning functions when using int-literals for "cond" i.e. 0 or 1 (Clang's documentation says it only wants bool, but that's wrong). I just tested this on a pointer-returning function, and it works.
The first argument of the try_acquire_capability function annotation must be the value that indicates that the capability has been acquired. I'm not aware of any function in the Linux kernel that returns a pointer and where returning a NULL pointer indicates success. Additionally, return ERR_PTR() is used widely. Neither pattern can be annotated with try_acquire_capability today. This is why I wrote that we need a new function attribute for functions that return a pointer.
Thanks,
Bart.
Quoted 17 lines · Bart Van Assche
Quoted 9 lines · Marco Elver
Quoted 7 lines · Bart Van Assche
As an
example, the Clangtry_acquire_capabilityfunction attribute does not support functions that return pointers although this is a common pattern in the Linux kernel. I think that introducing a new function attribute to support functions that return pointers is a better solution than trying to annotate such functions with any of the existing Clang thread-safety attributes.Quoted 5 lines
try_acquire_capability/__cond_acquires(cond, capability)is happy with pointer-returning functions when using int-literals for "cond" i.e. 0 or 1 (Clang's documentation says it only wants bool, but that's wrong). I just tested this on a pointer-returning function, and it works.
Quoted 7 lines
The first argument of the
try_acquire_capabilityfunction annotation must be the value that indicates that the capability has been acquired. I'm not aware of any function in the Linux kernel that returns a pointer and where returning a NULL pointer indicates success. Additionally, returnERR_PTR()is used widely. Neither pattern can be annotated withtry_acquire_capabilitytoday. This is why I wrote that we need a new function attribute for functions that return a pointer.
The static analysis doesn't care about the precise value. If a non-null pointer indicates successful acquisition, then using the literal "1" works. ERR_PTR() is a problem given that non-null may indicate error and success. Type-safety of ERR_PTR() is debatable, and by that fact alone it's unclear to me how to teach that to the static analysis, because it doesn't operate on concrete values, but an abstract state. In this case, it just cares if the branch was taken or not based on the value of a try_acquire_capability-annotated function, and the hint on try_acquire_capability tells it which branch is the one that will have the capability acquired. Code is around here:
https://github.com/llvm/llvm-project/blob/5a0075adbb623c8661862b9af1272b8f430d9e5c/clang/lib/Analysis/ThreadSafety.cpp#L1381
Christoph Hellwig
maintainerQuoted 10 lines · Marco Elver
Combining approach #1 and #2 may somehow be possible, but it is currently eluding me. Clearly, based on the bugs that Bart found, some way to do tree-wide analysis is very useful!
One idea was to have "capability-selective tree-wide analysis" (such as mutex only) be controllable via aKconfigoption - the implementation of that (without excessive ifdefs sprinkled everywhere), however, most likely requires compiler support.Depending on the feedback that results from these RFCs, I think we will be able to plan better which direction things should go.
Opt-in just means some code will never get it. So I think we'll need to eventually force all the useful capabilities everywhere.
Doing that step by step by opt-in/opt-out for early adopters sounds fine.