On Thu, Apr 23, 2020 at 4:14 PM Valentin Schneider <valentin.schneider@xxxxxxx> wrote: > On 23/04/20 23:00, John Stultz wrote: > > Which seems to be due to the fact that after allocating the uap > > structure, the pl011 code doesn't initialize the spinlock. > > > > This patch fixes it by initializing the spinlock and the warning > > has gone away. > > > > Thanks for having a look. It does seem like the reasonable thing to do, and > I no longer get the warning on h960. > > That said, I got more curious as this doesn't show up on my Juno (same > Image). Digging into it I see that uart_add_one_port() has a call to > uart_port_spin_lock_init() a few lines before uart_configure_port() (in > which the above warning gets triggered). That thing says: > > * Ensure that the serial console lock is initialised early. > * If this port is a console, then the spinlock is already initialised. > > Which requires me to ask: are we doing the right thing here? So I got a little bit of time to look at this before I got pulled off to other things (and now its Friday night, so I figured I'd reply before I forget it on Monday). I did check and lockdep is tripping when we add ttyAMA6 which is the serial console on the board. I wasn't able to trace back to why we hadn't already called spin_lock_init() in the console code, but it seems we haven't. Also I checked on HiKey as well, and there I'm seeing the same lockdep splat and this fix seems to resolve it. So more digging is needed. If anyone has a better idea of what might be awry or if the lock does need to be initialized in the driver (it's a bit inconsistent, I see some drivers do but others don't), let me know. thanks -john