Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/sunxi Defer call to drmfb_attach, otherwise we ...



details:   https://anonhg.NetBSD.org/src/rev/1daacdd57c4a
branches:  trunk
changeset: 1028602:1daacdd57c4a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:25:25 2021 +0000

description:
Defer call to drmfb_attach, otherwise we lock against ourselves

Mutex error: mutex_vector_enter,542: locking against myself

lockdebug_abort() at ffffffc0004ba3ec netbsd:lockdebug_abort+0xcc
mutex_enter() at ffffffc000476af4 netbsd:mutex_enter+0x3d4
drm_fb_helper_restore_fbdev_mode_unlocked() at ffffffc0003432a8
netbsd:drm_fb_helper_restore_fbdev_mode_unlocked+0x60
drmfb_genfb_setmode() at ffffffc00031c428
netbsd:drmfb_genfb_setmode+0x18
genfb_attach() at ffffffc000377b04 netbsd:genfb_attach+0x10c
drmfb_attach() at ffffffc00031c808 netbsd:drmfb_attach+0x1d0
sunxi_fb_attach() at ffffffc00005a648 netbsd:sunxi_fb_attach+0xd0
config_attach_loc() at ffffffc0004a7174 netbsd:config_attach_loc+0x184
config_found_sm_loc() at ffffffc0004a72a0
netbsd:config_found_sm_loc+0x58
sunxi_drm_fb_probe() at ffffffc00005a078 netbsd:sunxi_drm_fb_probe+0x250
__drm_fb_helper_initial_config_and_unlock() at ffffffc000342bdc
netbsd:__drm_fb_helper_initial_config_and_unlock+0x2a4
sunxi_drm_load() at ffffffc00005a384 netbsd:sunxi_drm_load+0x154
drm_dev_register() at ffffffc00033b728 netbsd:drm_dev_register+0xe0
sunxi_drm_init() at ffffffc000059d40 netbsd:sunxi_drm_init+0x20
config_process_deferred() at ffffffc0004a6efc
netbsd:config_process_deferred+0xac
config_attach_loc() at ffffffc0004a7190 netbsd:config_attach_loc+0x1a0
config_found_sm_loc() at ffffffc0004a72a0
netbsd:config_found_sm_loc+0x58
arm_fdt_attach() at ffffffc000061e34 netbsd:arm_fdt_attach+0x64
config_attach_loc() at ffffffc0004a7174 netbsd:config_attach_loc+0x184
cpu_configure() at ffffffc00005dab4 netbsd:cpu_configure+0x44
main() at ffffffc000605284 netbsd:main+0x2b4
aarch64_start() at ffffffc000001854 netbsd:aarch64_start+0x1054


Author: Maya Rashish <maya%NetBSD.org@localhost>
Committer: Taylor R Campbell <riastradh%NetBSD.org@localhost>

diffstat:

 sys/arch/arm/sunxi/sunxi_fb.c |  23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diffs (72 lines):

diff -r 68c7dc370a01 -r 1daacdd57c4a sys/arch/arm/sunxi/sunxi_fb.c
--- a/sys/arch/arm/sunxi/sunxi_fb.c     Sun Dec 19 11:25:17 2021 +0000
+++ b/sys/arch/arm/sunxi/sunxi_fb.c     Sun Dec 19 11:25:25 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_fb.c,v 1.5 2021/12/19 11:01:10 riastradh Exp $ */
+/* $NetBSD: sunxi_fb.c,v 1.6 2021/12/19 11:25:25 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015-2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_wsdisplay_compat.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_fb.c,v 1.5 2021/12/19 11:01:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_fb.c,v 1.6 2021/12/19 11:25:25 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -45,6 +45,8 @@
 static int     sunxi_fb_match(device_t, cfdata_t, void *);
 static void    sunxi_fb_attach(device_t, device_t, void *);
 
+static void    sunxi_fb_init(device_t);
+
 static bool    sunxi_fb_shutdown(device_t, int);
 
 struct sunxi_fb_softc {
@@ -80,7 +82,6 @@
        struct sunxi_fb_softc * const sc = device_private(self);
        struct sunxi_drm_softc * const drmsc = device_private(parent);
        struct sunxi_drmfb_attach_args * const sfa = aux;
-       int error;
 
        sc->sc_dev = self;
        sc->sc_drm = drmsc;
@@ -95,9 +96,18 @@
        const bool is_console = true;
        prop_dictionary_set_bool(dict, "is_console", is_console);
 #endif
+       config_defer(self, sunxi_fb_init);
+}
+
+static void
+sunxi_fb_init(device_t dev)
+{
+       struct sunxi_fb_softc * const sc = device_private(dev);
+       struct sunxi_drmfb_attach_args * const sfa = &sc->sc_sfa;
+       int error;
 
        const struct drmfb_attach_args da = {
-               .da_dev = self,
+               .da_dev = dev,
                .da_fb_helper = sfa->sfa_fb_helper,
                .da_fb_sizes = &sfa->sfa_fb_sizes,
                .da_fb_vaddr = sc->sc_fb->obj->vaddr,
@@ -105,13 +115,14 @@
                .da_params = &sunxifb_drmfb_params,
        };
 
+
        error = drmfb_attach(&sc->sc_drmfb, &da);
        if (error) {
-               aprint_error_dev(self, "failed to attach drmfb: %d\n", error);
+               aprint_error_dev(dev, "failed to attach drmfb: %d\n", error);
                return;
        }
 
-       pmf_device_register1(self, NULL, NULL, sunxi_fb_shutdown);
+       pmf_device_register1(dev, NULL, NULL, sunxi_fb_shutdown);
 }
 
 static bool



Home | Main Index | Thread Index | Old Index