Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1608670

Re: [PATCH 1/2] serial: pl010: Move uart_register_driver call to device probe

From Russell King - ARM Linux <linux@armlinux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] serial: pl010: Move uart_register_driver call to device probe
Date 2017-03-24 17:50 +0100
Message-ID <toAzx-4jh-31@gated-at.bofh.it> (permalink)
References <toAga-4c4-5@gated-at.bofh.it> <toAgc-4c4-53@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] Move uart_register_driver call to device probe for pl010 and sh-sci Sjoerd Simons <sjoerd.simons@collabora.co.uk> - 2017-03-24 17:30 +0100
  [PATCH 1/2] serial: pl010: Move uart_register_driver call to device probe Sjoerd Simons <sjoerd.simons@collabora.co.uk> - 2017-03-24 17:30 +0100
    Re: [PATCH 1/2] serial: pl010: Move uart_register_driver call to  device probe Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-03-24 17:50 +0100
  [PATCH 2/2] serial: sh-sci: Move uart_register_driver call to device probe Sjoerd Simons <sjoerd.simons@collabora.co.uk> - 2017-03-24 17:30 +0100
  Re: [PATCH 0/2] Move uart_register_driver call to device probe for  pl010 and sh-sci Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-03-24 17:50 +0100
    Re: [PATCH 0/2] Move uart_register_driver call to device probe for  pl010 and sh-sci Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-26 11:30 +0200
      Re: [PATCH 0/2] Move uart_register_driver call to device probe for  pl010 and sh-sci Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-03-26 12:10 +0200

csiph-web