Replace deprecated function drm_modeset_lock/unlock_all with
helper function DRM_MODESET_LOCK_ALL_BEGIN/END.
Signed-off-by: Sidong Yang <[email protected]>
---
drivers/gpu/drm/drm_crtc_helper.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index a4d36aca45ea..c7379c719952 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -217,11 +217,14 @@ static void __drm_helper_disable_unused_functions(struct drm_device *dev)
*/
void drm_helper_disable_unused_functions(struct drm_device *dev)
{
+ struct drm_modeset_acquire_ctx ctx;
+ int ret;
+
WARN_ON(drm_drv_uses_atomic_modeset(dev));
- drm_modeset_lock_all(dev);
+ DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret);
__drm_helper_disable_unused_functions(dev);
- drm_modeset_unlock_all(dev);
+ DRM_MODESET_LOCK_ALL_END(ctx, ret);
}
EXPORT_SYMBOL(drm_helper_disable_unused_functions);
@@ -938,13 +941,14 @@ void drm_helper_resume_force_mode(struct drm_device *dev)
{
struct drm_crtc *crtc;
struct drm_encoder *encoder;
+ struct drm_modeset_acquire_ctx ctx;
const struct drm_crtc_helper_funcs *crtc_funcs;
int encoder_dpms;
- bool ret;
+ int ret;
WARN_ON(drm_drv_uses_atomic_modeset(dev));
- drm_modeset_lock_all(dev);
+ DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret);
drm_for_each_crtc(crtc, dev) {
if (!crtc->enabled)
@@ -979,7 +983,7 @@ void drm_helper_resume_force_mode(struct drm_device *dev)
/* disable the unused connectors while restoring the modesetting */
__drm_helper_disable_unused_functions(dev);
- drm_modeset_unlock_all(dev);
+ DRM_MODESET_LOCK_ALL_END(ctx, ret);
}
EXPORT_SYMBOL(drm_helper_resume_force_mode);
@@ -999,9 +1003,10 @@ EXPORT_SYMBOL(drm_helper_resume_force_mode);
int drm_helper_force_disable_all(struct drm_device *dev)
{
struct drm_crtc *crtc;
+ struct drm_modeset_acquire_ctx ctx;
int ret = 0;
- drm_modeset_lock_all(dev);
+ DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret);
drm_for_each_crtc(crtc, dev)
if (crtc->enabled) {
struct drm_mode_set set = {
@@ -1013,7 +1018,7 @@ int drm_helper_force_disable_all(struct drm_device *dev)
goto out;
}
out:
- drm_modeset_unlock_all(dev);
+ DRM_MODESET_LOCK_ALL_END(ctx, ret);
return ret;
}
EXPORT_SYMBOL(drm_helper_force_disable_all);
--
2.17.1
Greeting,
FYI, we noticed the following commit (built with gcc-7):
commit: 8e984da3e5752f18c24c39240338fec8c8c9c971 ("[PATCH] drm: Replace deprecated function in drm_crtc_helper")
url: https://github.com/0day-ci/linux/commits/Sidong-Yang/drm-Replace-deprecated-function-in-drm_crtc_helper/20200521-021130
in testcase: rcutorture
with following parameters:
runtime: 300s
test: default
torture_type: tasks
test-description: rcutorture is rcutorture kernel module load/unload test.
test-url: https://www.kernel.org/doc/Documentation/RCU/torture.txt
on test machine: 32 threads AMD Opteron(TM) Processor 6276 with 128G memory
caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):
If you fix the issue, kindly add following tag
Reported-by: kernel test robot <[email protected]>
[ 25.591666] WARNING: CPU: 0 PID: 351 at drivers/gpu/drm/drm_modeset_lock.c:185 drm_warn_on_modeset_not_all_locked+0x6c/0x80 [drm]
[ 25.605759] Modules linked in: kvm mgag200(+) irqbypass fjes(-) drm_vram_helper drm_ttm_helper crct10dif_pclmul ttm crc32_pclmul crc32c_intel drm_kms_helper syscopyarea ghash_clmulni_intel ata_generic sysfillrect snd_pcm ahci pata_acpi sysimgblt libahci aesni_intel pata_atiixp fb_sys_fops snd_timer ipmi_si crypto_simd ipmi_devintf cryptd snd uas drm libata soundcore glue_helper sp5100_tco ipmi_msghandler usb_storage pcspkr serio_raw fam15h_power k10temp i2c_piix4 joydev acpi_cpufreq ip_tables
[ 25.649431] CPU: 0 PID: 351 Comm: kworker/0:3 Not tainted 5.7.0-rc6-00038-g8e984da3e5752 #1
[ 25.657779] Hardware name: Supermicro H8DGU/H8DGU, BIOS 2.0 09/08/11
[ 25.664920] Workqueue: events work_for_cpu_fn
[ 25.669316] RIP: 0010:drm_warn_on_modeset_not_all_locked+0x6c/0x80 [drm]
[ 25.676642] Code: 01 00 00 e8 e6 c2 cb c0 84 c0 74 1a 49 8d bc 24 78 01 00 00 e8 d5 c2 cb c0 84 c0 74 0d 5b 5d 41 5c c3 0f 0b eb c8 0f 0b eb e2 <0f> 0b 5b 5d 41 5c c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 0f 1f
[ 25.695432] RSP: 0018:ffffc90006b7bce8 EFLAGS: 00010246
[ 25.700671] RAX: 0000000000000000 RBX: ffff88a01cb65ad8 RCX: 0000000000000000
[ 25.707804] RDX: ffff88a01cb67050 RSI: ffffc90006b7bd48 RDI: ffff88a01cb65978
[ 25.710825] ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[ 25.714940] RBP: ffff88a01cb65ae8 R08: ffff88a01cb67050 R09: ffff888107c06d80
[ 25.714942] R10: ffffc90006aebca8 R11: 00000000000001c6 R12: ffff88a01cb65800
[ 25.714944] R13: ffff8887ef4ae000 R14: ffffc90022000000 R15: ffff88a01cb65800
[ 25.714947] FS: 0000000000000000(0000) GS:ffff8887ffc00000(0000) knlGS:0000000000000000
[ 25.714949] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 25.714952] CR2: 00007f98040d8000 CR3: 0000000feeb20000 CR4: 00000000000406f0
[ 25.714958] Call Trace:
[ 25.766039] __drm_helper_disable_unused_functions+0x18/0xe0 [drm_kms_helper]
[ 25.773197] drm_helper_disable_unused_functions+0x68/0xb0 [drm_kms_helper]
[ 25.780172] drm_fbdev_client_hotplug+0x159/0x1b0 [drm_kms_helper]
[ 25.786378] drm_fbdev_generic_setup+0x9b/0x110 [drm_kms_helper]
[ 25.792402] mgag200_driver_load+0x377/0x4c0 [mgag200]
[ 25.797550] mga_pci_probe+0x79/0xd0 [mgag200]
[ 25.802004] local_pci_probe+0x42/0x90
[ 25.805769] work_for_cpu_fn+0x16/0x20
[ 25.809550] process_one_work+0x1b0/0x3e0
[ 25.813580] ? move_linked_works+0x6e/0xa0
[ 25.817713] worker_thread+0x1e5/0x3b0
[ 25.821467] ? process_one_work+0x3e0/0x3e0
[ 25.825653] kthread+0x12c/0x150
[ 25.828886] ? kthread_park+0x90/0x90
[ 25.832581] ret_from_fork+0x22/0x40
[ 25.836166] ---[ end trace 29e2fb1609eae123 ]---
To reproduce:
git clone https://github.com/intel/lkp-tests.git
cd lkp-tests
bin/lkp install job.yaml # job file is attached in this email
bin/lkp run job.yaml
Thanks,
Rong Chen