All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Cc: linux-serial@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, Jiri Slaby <jslaby@suse.com>
Subject: Re: [PATCH 1/2] serial: pl010: Move uart_register_driver call to device probe
Date: Fri, 24 Mar 2017 16:47:32 +0000	[thread overview]
Message-ID: <20170324164732.GJ7909@n2100.armlinux.org.uk> (raw)
In-Reply-To: <20170324162634.8880-2-sjoerd.simons@collabora.co.uk>

On Fri, Mar 24, 2017 at 05:26:33PM +0100, Sjoerd Simons wrote:
> uart_register_driver call binds the driver to a specific device
> node through tty_register_driver call. This should typically
> happen during device probe call.
> 
> In a multiplatform scenario, it is possible that multiple serial
> drivers are part of the kernel. Currently the driver registration fails
> if multiple serial drivers with overlapping major/minor numbers are
> included.

This is racy.  The driver model locking is on a _per_ device basis,
it is not on a per driver basis.

It is entirely possible for a driver to be probed by two devices at
once, possibly on two different CPUs.  Checking the state of the
UART driver structure and then registering it means there is a window
where we could end up with two CPUs registering the same UART driver
at the same time, which would cause things to go wrong.

Therefore, this needs some form of locking.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

  reply	other threads:[~2017-03-24 16:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-24 16:26 [PATCH 0/2] Move uart_register_driver call to device probe for pl010 and sh-sci Sjoerd Simons
2017-03-24 16:26 ` [PATCH 1/2] serial: pl010: Move uart_register_driver call to device probe Sjoerd Simons
2017-03-24 16:47   ` Russell King - ARM Linux [this message]
2017-03-24 16:26 ` [PATCH 2/2] serial: sh-sci: " Sjoerd Simons
2017-03-24 16:42 ` [PATCH 0/2] Move uart_register_driver call to device probe for pl010 and sh-sci Russell King - ARM Linux
2017-03-26  9:22   ` Geert Uytterhoeven
2017-03-26 10:01     ` Russell King - ARM Linux
2017-03-31 13:27     ` Greg Kroah-Hartman

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=20170324164732.GJ7909@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sjoerd.simons@collabora.co.uk \
    /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.