linux_dsm_epyc7002/drivers/tty/hvc
Paul Gortmaker f76a1cbed1 hvc: ensure hvc_init is only ever called once in hvc_console.c
Commit 3e6c6f630a ("Delay creation of
khcvd thread") moved the call of hvc_init from being a device_initcall
into hvc_alloc, and used a non-null hvc_driver as indication of whether
hvc_init had already been called.

The problem with this is that hvc_driver is only assigned a value
at the bottom of hvc_init, and so there is a window where multiple
hvc_alloc calls can be in progress at the same time and hence try
and call hvc_init multiple times.  Previously the use of device_init
guaranteed that hvc_init was only called once.

This manifests itself as sporadic instances of two hvc_init calls
racing each other, and with the loser of the race getting -EBUSY
from tty_register_driver() and hence that virtual console fails:

    Couldn't register hvc console driver
    virtio-ports vport0p1: error -16 allocating hvc for port

Here we add an atomic_t to guarantee we'll never run hvc_init twice.

Cc: stable@vger.kernel.org  # v2.6.24+
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes: 3e6c6f630a ("Delay creation of khcvd thread")
Reported-by: Jim Somerville <Jim.Somerville@windriver.com>
Tested-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-13 10:41:47 -08:00
..
hvc_beat.c serial: Kill off NO_IRQ 2012-01-26 17:14:50 -08:00
hvc_bfin_jtag.c hvc: add Blackfin JTAG console support 2011-02-17 11:12:40 -08:00
hvc_console.c hvc: ensure hvc_init is only ever called once in hvc_console.c 2014-02-13 10:41:47 -08:00
hvc_console.h tty/hvc_console: Add DTR/RTS callback to handle HUPCL control 2013-07-24 15:21:13 -07:00
hvc_dcc.c TTY: hvc_dcc: probe for a JTAG connection before registering 2013-09-25 18:10:56 -07:00
hvc_irq.c TTY: irq: Remove IRQF_DISABLED 2011-09-22 16:08:57 -07:00
hvc_iucv.c s390/hvc_iucv: Automatically assign free HVC terminal devices 2014-01-22 14:02:13 +01:00
hvc_opal.c drivers/tty/hvc: don't use module_init in non-modular hyp. console code 2014-02-07 08:40:54 -08:00
hvc_rtas.c drivers/tty/hvc: don't use module_init in non-modular hyp. console code 2014-02-07 08:40:54 -08:00
hvc_tile.c tile: various console improvements 2013-08-12 14:46:18 -04:00
hvc_udbg.c drivers/tty/hvc: don't use module_init in non-modular hyp. console code 2014-02-07 08:40:54 -08:00
hvc_vio.c hvc_vio: Do not override preferred console set by kernel parameter 2013-09-26 15:56:15 -07:00
hvc_xen.c drivers/tty/hvc: don't use module_init in non-modular hyp. console code 2014-02-07 08:40:54 -08:00
hvcs.c drivers/tty/hvc: Use strlcpy instead of strncpy 2013-03-05 16:56:27 +11:00
hvsi_lib.c tty: delete non-required instances of include <linux/init.h> 2014-01-07 17:05:21 -08:00
hvsi.c TTY: add tty_port_tty_wakeup helper 2013-03-18 16:19:45 -07:00
Kconfig tty: Added a CONFIG_TTY option to allow removal of TTY 2013-01-18 16:15:27 -08:00
Makefile tty: powerpc: remove hvc_iseries 2012-03-09 10:35:17 +11:00