All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Cristian Ciocaltea <cristian.ciocaltea@gmail.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	Jiri Slaby <jslaby@suse.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"open list:SERIAL DRIVERS" <linux-serial@vger.kernel.org>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-actions@lists.infradead.org
Subject: Re: [PATCH 1/1] tty: serial: owl: Initialize lock before registering port
Date: Fri, 29 May 2020 15:03:50 +0300	[thread overview]
Message-ID: <CAHp75Vcz0a87LSnb6Ubt5_bSF3wUcs21GbP119trXER5KBDxbQ@mail.gmail.com> (raw)
In-Reply-To: <4c40d6c1-47e8-b4ec-f2fd-e9767b03630c@suse.de>

On Fri, May 29, 2020 at 2:56 PM Andreas Färber <afaerber@suse.de> wrote:
>
> Am 29.05.20 um 13:34 schrieb Greg Kroah-Hartman:
> > On Fri, May 29, 2020 at 02:06:47PM +0300, Cristian Ciocaltea wrote:
> >> Running a lockdep-enabled kernel leads to the following splat when
> >> probing the owl-uart driver:

...

> >> Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
> >> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>

> >> +    spin_lock_init(&owl_port->port.lock);
> >> +
> >>      ret = uart_add_one_port(&owl_uart_driver, &owl_port->port);
> >>      if (ret)
> >>              owl_uart_ports[pdev->id] = NULL;
> >
> > Ugh, another one :(
> >
> > Thanks for this, will queue this up now.
>
> Thanks. If this is the expected pattern now, I'll also have to update
> in-flight patches, such as Sunplus.

Expected is to register properly console via register_console() call.
If you do so, you also need to initialize spin lock before coming to
uart_add_one_port().
It seems drivers (ab)used that feature.

$ git grep -n -w register_console -- drivers/tty/serial/ | cut -f1 -d:
| sort -u | wc -l
    37
$ git grep -n _CONSOLE -- drivers/tty/serial/ | cut -f1 -d:  | sort -u | wc -l
    77

But as a quick fix this initialization is okay.

-- 
With Best Regards,
Andy Shevchenko

WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	linux-actions@lists.infradead.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Cristian Ciocaltea <cristian.ciocaltea@gmail.com>,
	"open list:SERIAL DRIVERS" <linux-serial@vger.kernel.org>,
	Jiri Slaby <jslaby@suse.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/1] tty: serial: owl: Initialize lock before registering port
Date: Fri, 29 May 2020 15:03:50 +0300	[thread overview]
Message-ID: <CAHp75Vcz0a87LSnb6Ubt5_bSF3wUcs21GbP119trXER5KBDxbQ@mail.gmail.com> (raw)
In-Reply-To: <4c40d6c1-47e8-b4ec-f2fd-e9767b03630c@suse.de>

On Fri, May 29, 2020 at 2:56 PM Andreas Färber <afaerber@suse.de> wrote:
>
> Am 29.05.20 um 13:34 schrieb Greg Kroah-Hartman:
> > On Fri, May 29, 2020 at 02:06:47PM +0300, Cristian Ciocaltea wrote:
> >> Running a lockdep-enabled kernel leads to the following splat when
> >> probing the owl-uart driver:

...

> >> Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
> >> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>

> >> +    spin_lock_init(&owl_port->port.lock);
> >> +
> >>      ret = uart_add_one_port(&owl_uart_driver, &owl_port->port);
> >>      if (ret)
> >>              owl_uart_ports[pdev->id] = NULL;
> >
> > Ugh, another one :(
> >
> > Thanks for this, will queue this up now.
>
> Thanks. If this is the expected pattern now, I'll also have to update
> in-flight patches, such as Sunplus.

Expected is to register properly console via register_console() call.
If you do so, you also need to initialize spin lock before coming to
uart_add_one_port().
It seems drivers (ab)used that feature.

$ git grep -n -w register_console -- drivers/tty/serial/ | cut -f1 -d:
| sort -u | wc -l
    37
$ git grep -n _CONSOLE -- drivers/tty/serial/ | cut -f1 -d:  | sort -u | wc -l
    77

But as a quick fix this initialization is okay.

-- 
With Best Regards,
Andy Shevchenko

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-05-29 12:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 11:06 [PATCH 1/1] tty: serial: owl: Initialize lock before registering port Cristian Ciocaltea
2020-05-29 11:06 ` Cristian Ciocaltea
2020-05-29 11:34 ` Greg Kroah-Hartman
2020-05-29 11:34   ` Greg Kroah-Hartman
2020-05-29 11:53   ` Andreas Färber
2020-05-29 11:53     ` Andreas Färber
2020-05-29 12:03     ` Andy Shevchenko [this message]
2020-05-29 12:03       ` Andy Shevchenko
2020-07-10 12:05   ` Cristian Ciocaltea
2020-07-10 12:05     ` Cristian Ciocaltea
2020-07-10 13:35     ` Greg Kroah-Hartman
2020-07-10 13:35       ` Greg Kroah-Hartman
2020-07-10 15:58       ` Cristian Ciocaltea
2020-07-10 15:58         ` Cristian Ciocaltea
2020-07-10 16:30         ` Andy Shevchenko
2020-07-10 16:30           ` Andy Shevchenko
2020-07-11  6:30           ` Greg Kroah-Hartman
2020-07-11  6:30             ` Greg Kroah-Hartman
2020-07-11 13:55             ` Andy Shevchenko
2020-07-11 13:55               ` Andy Shevchenko
2020-05-29 11:35 ` Andy Shevchenko
2020-05-29 11:35   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHp75Vcz0a87LSnb6Ubt5_bSF3wUcs21GbP119trXER5KBDxbQ@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=afaerber@suse.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=cristian.ciocaltea@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-actions@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.