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

drm: FreeBSD: Make drm_timestamp_precision and drm_vblank_offdelay ac… #7

Merged
merged 2 commits into from
Jun 11, 2020

Conversation

jorgem-seq
Copy link
Contributor

…cessible from drm_sysctl_freebsd.c

Remove the static keyword from drm_timestamp_precision and
drm_vblank_offdelay in drivers/gpu/drm/drm_vblank.c to allow them to be seen
from other files, drivers/gpu/drm/drm_sysctl_freebsd.c in this case.

Signed-off-by: Jorge Maidana jorgem.seq@gmail.com

…cessible from drm_sysctl_freebsd.c

Remove the static keyword from drm_timestamp_precision and
drm_vblank_offdelay in drivers/gpu/drm/drm_vblank.c to allow them to be seen
from other files, drivers/gpu/drm/drm_sysctl_freebsd.c in this case.

Signed-off-by: Jorge Maidana <jorgem.seq@gmail.com>
@jorgem-seq
Copy link
Contributor Author

In drivers/gpu/drm/drm_vblank.c the variables drm_timestamp_precision and drm_vblank_offdelay are declared as static preventing those variables to be seen from other source files:

static unsigned int drm_timestamp_precision = 20; /* Default to 20 usecs. */
static int drm_vblank_offdelay = 5000; /* Default to 5000 msecs. */

In drivers/gpu/drm/drm_sysctl_freebsd.c those 2 variables are declared
as extern meaning that they are defined elsewhere, but you can't access
them because of the static keyword mentioned above:

extern int drm_vblank_offdelay;
extern unsigned int drm_timestamp_precision;

This leads to undefined behavior and random crashes like #6.

@evadot
Copy link
Contributor

evadot commented Jun 11, 2020

Please do another merge request for the COMPAT change.

@evadot evadot merged commit 0f2c6fd into freebsd:master Jun 11, 2020
@jorgem-seq jorgem-seq deleted the fix-sysctl-ub branch June 17, 2020 15:10
lutzbichler pushed a commit to lutzbichler/drm-kmod that referenced this pull request Oct 6, 2024
This reverts commit 3612702852acbded39233b1600c8d9f47e40139f.

This is causing a BUG message during suspend.

[   61.603542] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:283
[   61.603550] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2028, name: kworker/u64:14
[   61.603553] preempt_count: 1, expected: 0
[   61.603555] RCU nest depth: 0, expected: 0
[   61.603557] Preemption disabled at:
[   61.603559] [<ffffffffc08a3261>] amdgpu_gfx_disable_kgq+0x61/0x160 [amdgpu]
[   61.603789] CPU: 9 PID: 2028 Comm: kworker/u64:14 Tainted: G        W          6.8.0+ freebsd#7
[   61.603795] Workqueue: events_unbound async_run_entry_fn
[   61.603801] Call Trace:
[   61.603803]  <TASK>
[   61.603806]  dump_stack_lvl+0x37/0x50
[   61.603811]  ? amdgpu_gfx_disable_kgq+0x61/0x160 [amdgpu]
[   61.604007]  dump_stack+0x10/0x20
[   61.604010]  __might_resched+0x16f/0x1d0
[   61.604016]  __might_sleep+0x43/0x70
[   61.604020]  mutex_lock+0x1f/0x60
[   61.604024]  amdgpu_mes_unmap_legacy_queue+0x6d/0x100 [amdgpu]
[   61.604226]  gfx11_kiq_unmap_queues+0x3dc/0x430 [amdgpu]
[   61.604422]  ? srso_alias_return_thunk+0x5/0xfbef5
[   61.604429]  amdgpu_gfx_disable_kgq+0x122/0x160 [amdgpu]
[   61.604621]  gfx_v11_0_hw_fini+0xda/0x100 [amdgpu]
[   61.604814]  gfx_v11_0_suspend+0xe/0x20 [amdgpu]
[   61.605008]  amdgpu_device_ip_suspend_phase2+0x135/0x1d0 [amdgpu]
[   61.605175]  amdgpu_device_suspend+0xec/0x180 [amdgpu]

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
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

Successfully merging this pull request may close these issues.

2 participants