Port-arm archive

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

sunxigpio vs. LOCKDEBUG (PR 54664)



Hi,

sunxi boards can't boot LOCKDEBUG kernels. As I described
in the PR:

> The problem is that sunxi_pinctrl_set_config() calls
> fdtbus_regulator_acquire() with spin mutex
> sunxi_gpio_softc.sc_lock held, but fdtbus_regulator_acquire()
> calls kmem_alloc with flag KM_SLEEP. That's not permitted.

Refactoring sunxi_gpio to not hold it's sc lock seems
not straightforward. Any objections to this patch?
I'm not a fan of using KM_NOSLEEP, but don't have any
better ideas ...

--- sys/dev/fdt/fdt_regulator.c	27 May 2019 23:18:33 -0000	1.8
+++ sys/dev/fdt/fdt_regulator.c	5 Aug 2021 18:29:22 -0000
@@ -99,13 +99,16 @@ fdtbus_regulator_acquire(int phandle, co
 		return NULL;
 	}
 
+	reg = kmem_alloc(sizeof(*reg), KM_NOSLEEP);
+	if (!reg) {
+		return NULL;
+	}
 	error = rc->rc_funcs->acquire(rc->rc_dev);
 	if (error) {
 		aprint_error_dev(rc->rc_dev, "failed to acquire regulator: %d\n", error);
+		kmem_free(reg, sizeof(*reg));
 		return NULL;
 	}
-
-	reg = kmem_alloc(sizeof(*reg), KM_SLEEP);
 	reg->reg_rc = rc;
 
 	return reg;



Home | Main Index | Thread Index | Old Index