Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[i915kms] i2c non-recursive mutex used recursively while querying EDID (on an ancient GMA 950 Mac mini) #134

Closed
valpackett opened this issue Mar 2, 2019 · 4 comments

Comments

@valpackett
Copy link
Contributor

valpackett commented Mar 2, 2019

(4.16)

panic: _sx_xlock_hard: recursed on non-recursive sx i2c_core @ /disk/src/github.com/FreeBSDDesktop/kms-drm/linuxkpi/gplv2/src/linux_i2c.c:565

cpuid = 1
time = 1551474449
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0026d1c380
vpanic() at vpanic+0x1b4/frame 0xfffffe0026d1c3e0
panic() at panic+0x43/frame 0xfffffe0026d1c440
_sx_xlock_hard() at _sx_xlock_hard+0x95f/frame 0xfffffe0026d1c4e0
_sx_xlock() at _sx_xlock+0xc1/frame 0xfffffe0026d1c520
i2c_transfer() at i2c_transfer+0x64/frame 0xfffffe0026d1c570
__intel_sdvo_write_cmd() at __intel_sdvo_write_cmd+0x3c3/frame 0xfffffe0026d1c6f0
intel_sdvo_ddc_proxy_xfer() at intel_sdvo_ddc_proxy_xfer+0x33/frame 0xfffffe0026d1c720
i2c_transfer() at i2c_transfer+0x90/frame 0xfffffe0026d1c770
drm_do_probe_ddc_edid() at drm_do_probe_ddc_edid+0x8f/frame 0xfffffe0026d1c7e0
drm_get_edid() at drm_get_edid+0x42/frame 0xfffffe0026d1c850
intel_sdvo_detect() at intel_sdvo_detect+0x108/frame 0xfffffe0026d1c8a0
drm_helper_probe_single_connector_modes() at drm_helper_probe_single_connector_modes+0x18e/frame 0xfffffe0026d1c940
drm_setup_crtcs() at drm_setup_crtcs+0x17b/frame 0xfffffe0026d1ca10
__drm_fb_helper_initial_config_and_unlock() at __drm_fb_helper_initial_config_and_unlock+0x30/frame 0xfffffe0026d1ca80
intel_fbdev_initial_config() at intel_fbdev_initial_config+0x14/frame 0xfffffe0026d1caa0
async_run_entry_fn() at async_run_entry_fn+0x27/frame 0xfffffe0026d1cac0
linux_work_fn() at linux_work_fn+0xe7/frame 0xfffffe0026d1cb20
taskqueue_run_locked() at taskqueue_run_locked+0x10c/frame 0xfffffe0026d1cb80
taskqueue_thread_loop() at taskqueue_thread_loop+0x88/frame 0xfffffe0026d1cbb0
fork_exit() at fork_exit+0x84/frame 0xfffffe0026d1cbf0
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0026d1cbf0

dmesg:

vgapci0: <VGA-compatible display> port 0x20f0-0x20f7 mem 0x90380000-0x903fffff,0x80000000-0x8fffffff,0x90400000-0x9043ffff at device 2.0 on pci0
agp0: <Intel 82945GM (945GM GMCH) SVGA controller> on vgapci0
agp0: aperture size is 256M, detected 16124k stolen memory
vgapci0: Boot video device
vgapci1: <VGA-compatible display> mem 0x90300000-0x9037ffff at device 2.1 on pci0
[…]
drmn0: <drmn> on vgapci0
vgapci0: child drmn0 requested pci_enable_io
vgapci0: child drmn0 requested pci_enable_io
[drm] Unable to create a private tmpfs mount, hugepage support will be disabled(-19).
__pm_runtime_resume not implemented -- see your local kernel hacker
Successfully added WC MTRR for [0x80000000-0x8fffffff]: 0; 
[drm] Got stolen memory base 0x7f000000, size 0x1000000
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] Driver supports precise vblank timestamp query.
Mar  2 00:07:28 pinepeak kernel: __pm_runtime_resume not implemented -- see your local kernel hacker
Mar  2 00:07:28 pinepeak kernel: Successfully added WC MTRR for [0x80000000-0x8fffffff]: 0; 
[drm] Failed to find VBIOS tables (VBT)
[drm] applying backlight present quirk
[drm] Connector LVDS-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.LVDS-1
[drm]   - kern.vt.fb.default_mode
pm_runtime_mark_last_busy not implemented -- see your local kernel hacker
__pm_runtime_suspend not implemented -- see your local kernel hacker
pm_runtime_get_if_in_use not implemented -- see your local kernel hacker
[drm] Connector VGA-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.VGA-1
[drm]   - kern.vt.fb.default_mode
[drm] Connector DVI-D-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.DVI-D-1
[drm]   - kern.vt.fb.default_mode
[drm] Connector SVIDEO-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.SVIDEO-1
[drm]   - kern.vt.fb.default_mode
sched_setscheduler_nocheck not implemented -- see your local kernel hacker
[drm] RC6 disabled, disabling runtime PM support
[drm] initialized overlay support
register_oom_notifier not implemented -- see your local kernel hacker
[drm] Initialized i915 1.6.0 20171222 for drmn0 on minor 0
async_schedule is dodgy -- see your local kernel hacker
pm_runtime_set_autosuspend_delay not implemented -- see your local kernel hacker
__pm_runtime_use_autosuspend not implemented -- see your local kernel hacker
Mar  2 00:07:29 pinepeak kernel: pm_runtime_mark_last_busy not implemented -- see your local kernel hacker
Mar  2 00:07:29 pinepeak kernel: __pm_runtime_suspend not implemented -- see your local kernel hacker
Mar  2 00:07:29 pinepeak kernel: pm_runtime_get_if_in_use not implemented -- see your local kernel hacker
Mar  2 00:07:29 pinepeak kernel: sched_setscheduler_nocheck not implemented -- see your local kernel hacker
Mar  2 00:07:29 pinepeak kernel: register_oom_notifier not implemented -- see your local kernel hacker
Mar  2 00:07:29 pinepeak kernel: async_schedule is dodgy -- see your local kernel hacker
Mar  2 00:07:29 pinepeak kernel: pm_runtime_set_autosuspend_delay not implemented -- see your local kernel hacker
Mar  2 00:07:29 pinepeak kernel: __pm_runtime_use_autosuspend not implemented -- see your local kernel hacker

Workaround:

diff --git i/linuxkpi/gplv2/src/linux_i2c.c w/linuxkpi/gplv2/src/linux_i2c.c
index 3db2d36d6..c379d99da 100644
--- i/linuxkpi/gplv2/src/linux_i2c.c
+++ w/linuxkpi/gplv2/src/linux_i2c.c
@@ -562,9 +562,9 @@ i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
 	if (adap->algo->master_xfer == NULL)
 		return (-EOPNOTSUPP);
 
-	mutex_lock(&i2c_core);
+	//mutex_lock(&i2c_core);
 	rc = linux_i2c_transfer(adap, msgs, num);
-	mutex_unlock(&i2c_core);
+	//mutex_unlock(&i2c_core);
 	return (rc);
 }
 /*

p.s. full dmesg

@johalun
Copy link
Member

johalun commented Mar 2, 2019

Thanks for the report. So it seems this does matter

// XXX: locked or unlocked, does it matter since we have our own lock
// and don't lock with provided lock_bus function?
#define	__i2c_transfer(a, m, n)	i2c_transfer(a, m, n)

Used here

	if (unlocked)
		ret = i2c_transfer(intel_sdvo->i2c, msgs, i+3);
	else
		ret = __i2c_transfer(intel_sdvo->i2c, msgs, i+3);

I'll add this to my todo list.

@johalun
Copy link
Member

johalun commented Mar 2, 2019

@myfreeweb try this

diff --git a/linuxkpi/gplv2/include/linux/i2c.h b/linuxkpi/gplv2/include/linux/i2c.h
index a31addc169d4..9bd398075144 100644
--- a/linuxkpi/gplv2/include/linux/i2c.h
+++ b/linuxkpi/gplv2/include/linux/i2c.h
@@ -225,11 +225,10 @@ extern int i2c_register_driver(struct module *, struct i2c_driver *);
 extern void i2c_del_driver(struct i2c_driver *);
 
 
+extern int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
+                        int num);
 extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
                         int num);
-// XXX: locked or unlocked, does it matter since we have our own lock
-// and don't lock with provided lock_bus function?
-#define        __i2c_transfer(a, m, n) i2c_transfer(a, m, n)
 
 static inline void
 i2c_unregister_device(struct i2c_client *client)
diff --git a/linuxkpi/gplv2/src/linux_i2c.c b/linuxkpi/gplv2/src/linux_i2c.c
index 3db2d36d6582..2edfbf230544 100644
--- a/linuxkpi/gplv2/src/linux_i2c.c
+++ b/linuxkpi/gplv2/src/linux_i2c.c
@@ -554,6 +554,18 @@ linux_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
        return (rc);
 }
 
+int
+__i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
+{
+       int rc;
+
+       if (adap->algo->master_xfer == NULL)
+               return (-EOPNOTSUPP);
+
+       rc = linux_i2c_transfer(adap, msgs, num);
+       return (rc);
+}
+
 int
 i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
 {

@valpackett
Copy link
Contributor Author

Yes, this works

@johalun johalun closed this as completed in 78e51d0 Mar 2, 2019
johalun added a commit that referenced this issue Mar 4, 2019
@zeising
Copy link
Member

zeising commented Mar 5, 2019

graphics/drm-current-kmod and graphics/drm-fbsd12.0-kmod updated, and MFH done.
https://svnweb.freebsd.org/changeset/ports/494747
https://svnweb.freebsd.org/changeset/ports/494748

uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Mar 5, 2019
Update graphics/drm-current-kmod and graphics/drm-fbsd12.0-kmod to their
respective latest snapshots.

This fixes a bug where a non-recursive mutex was used recursively in certain
conditions.
See FreeBSDDesktop/kms-drm#134 for further details

FreeBSDDesktop issue:	#134
Approved by:		jmd (maintainer, implicit)
MFH:			2019Q1 (implicit approval, drm drivers)
Sponsored by:		B3 Init


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@494747 35697150-7ecd-e111-bb59-0022644237b5
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Mar 5, 2019
This merges all changes done to drm-current-kmod, drm-fbsd12.0-kmod and
drm-fbsd11.2-kmod, in order to avoid merge conflicts.

Update pkg-descr to match reality

Update pkg-descr in drm-kmod ports to match reality in terms of which Linux
kernel version they correspond to and which FreeBSD version they are
supporting.

Noticed by:	Graham Perrin

graphics/drm-current-kmod: Update messges

Update pkg-message and makefile COMMENT to remove references to
drm-devel-kmod and the mention that this is the development version.  It is
the version for FreeBSD CURRENT, so the ride might be a little bumpy, but
it's not the devlopment version.

No changes to package.

FreeBSDDesktop issue:	#129

Reported by:	grahamperrin
Sponsored by:	B3 Init (zeising)

update drm-current and drm-fbsd12.0 snapshots

Update drm-current-kmod and drm-fbsd12.0-kmod to the latest snapshots.
This mutes console chatter about unimplemented stuff, which sometimes is
confusing.

Approved by:	jmd (maintainer, implicit)

graphics/drm-fbsd{11.2,12.0}-kmod: Update pkg-message with new names

PR:		235726
Approved by:	graphics (jmd)
Differential Revision:	https://reviews.freebsd.org/D19189

Update drm kmods for current and FreeBSD 12.0

Update graphics/drm-current-kmod and graphics/drm-fbsd12.0-kmod to their
respective latest snapshots.

This fixes a bug where a non-recursive mutex was used recursively in certain
conditions.
See FreeBSDDesktop/kms-drm#134 for further details

FreeBSDDesktop issue:	#134
Approved by:		jmd (maintainer, implicit)
Sponsored by:		B3 Init

Approved by:	ports-secteam (implicit, drm-kmod ports)
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Mar 5, 2019
Update graphics/drm-current-kmod and graphics/drm-fbsd12.0-kmod to their
respective latest snapshots.

This fixes a bug where a non-recursive mutex was used recursively in certain
conditions.
See FreeBSDDesktop/kms-drm#134 for further details

FreeBSDDesktop issue:	#134
Approved by:		jmd (maintainer, implicit)
MFH:			2019Q1 (implicit approval, drm drivers)
Sponsored by:		B3 Init
Jehops pushed a commit to Jehops/freebsd-ports-legacy that referenced this issue Mar 5, 2019
Update graphics/drm-current-kmod and graphics/drm-fbsd12.0-kmod to their
respective latest snapshots.

This fixes a bug where a non-recursive mutex was used recursively in certain
conditions.
See FreeBSDDesktop/kms-drm#134 for further details

FreeBSDDesktop issue:	#134
Approved by:		jmd (maintainer, implicit)
MFH:			2019Q1 (implicit approval, drm drivers)
Sponsored by:		B3 Init


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@494747 35697150-7ecd-e111-bb59-0022644237b5
swills pushed a commit to swills/freebsd-ports that referenced this issue Mar 6, 2019
Update graphics/drm-current-kmod and graphics/drm-fbsd12.0-kmod to their
respective latest snapshots.

This fixes a bug where a non-recursive mutex was used recursively in certain
conditions.
See FreeBSDDesktop/kms-drm#134 for further details

FreeBSDDesktop issue:	freebsd#134
Approved by:		jmd (maintainer, implicit)
MFH:			2019Q1 (implicit approval, drm drivers)
Sponsored by:		B3 Init
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Apr 1, 2021
This merges all changes done to drm-current-kmod, drm-fbsd12.0-kmod and
drm-fbsd11.2-kmod, in order to avoid merge conflicts.

Update pkg-descr to match reality

Update pkg-descr in drm-kmod ports to match reality in terms of which Linux
kernel version they correspond to and which FreeBSD version they are
supporting.

Noticed by:	Graham Perrin

graphics/drm-current-kmod: Update messges

Update pkg-message and makefile COMMENT to remove references to
drm-devel-kmod and the mention that this is the development version.  It is
the version for FreeBSD CURRENT, so the ride might be a little bumpy, but
it's not the devlopment version.

No changes to package.

FreeBSDDesktop issue:	#129

Reported by:	grahamperrin
Sponsored by:	B3 Init (zeising)

update drm-current and drm-fbsd12.0 snapshots

Update drm-current-kmod and drm-fbsd12.0-kmod to the latest snapshots.
This mutes console chatter about unimplemented stuff, which sometimes is
confusing.

Approved by:	jmd (maintainer, implicit)

graphics/drm-fbsd{11.2,12.0}-kmod: Update pkg-message with new names

PR:		235726
Approved by:	graphics (jmd)
Differential Revision:	https://reviews.freebsd.org/D19189

Update drm kmods for current and FreeBSD 12.0

Update graphics/drm-current-kmod and graphics/drm-fbsd12.0-kmod to their
respective latest snapshots.

This fixes a bug where a non-recursive mutex was used recursively in certain
conditions.
See FreeBSDDesktop/kms-drm#134 for further details

FreeBSDDesktop issue:	#134
Approved by:		jmd (maintainer, implicit)
Sponsored by:		B3 Init

Approved by:	ports-secteam (implicit, drm-kmod ports)
svmhdvn pushed a commit to svmhdvn/freebsd-ports that referenced this issue Jan 10, 2024
Update graphics/drm-current-kmod and graphics/drm-fbsd12.0-kmod to their
respective latest snapshots.

This fixes a bug where a non-recursive mutex was used recursively in certain
conditions.
See FreeBSDDesktop/kms-drm#134 for further details

FreeBSDDesktop issue:	#134
Approved by:		jmd (maintainer, implicit)
MFH:			2019Q1 (implicit approval, drm drivers)
Sponsored by:		B3 Init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants