All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Jason Wessel <jason.wessel@windriver.com>
Cc: greg@kroah.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] usb,early_printk: unregister early usb before rest_init()
Date: Wed, 6 May 2009 09:34:56 +0200	[thread overview]
Message-ID: <20090506073456.GC17457@elte.hu> (raw)
In-Reply-To: <1241575205-12199-5-git-send-email-jason.wessel@windriver.com>


* Jason Wessel <jason.wessel@windriver.com> wrote:

> The early_printk EHCI debug driver can hang the system or cause
> unpredictable results because two separate APIs will attempt to write
> to the mapped PCI region.
> 
> The safe route is to unregister the early USB console at the end of
> the core kernel init, which is before the PCI initialization.  Later,
> after the USB initialization completes it is then possible to register
> the console against the usb debug device and receive the printk
> messages that were missed in the period between early printk
> availability and the USB console device.
> 
> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
> ---
>  arch/x86/kernel/early_printk.c |   22 ++++++++++++++++++++++
>  1 files changed, 22 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
> index e38c467..ef177d4 100644
> --- a/arch/x86/kernel/early_printk.c
> +++ b/arch/x86/kernel/early_printk.c
> @@ -952,4 +952,26 @@ static int __init setup_early_printk(char *buf)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_EARLY_PRINTK_DBGP
> +/*
> + * The early console must get unregistered prior to the ECHI
> + * controller getting reset else the debug device cannot be used until
> + * a subsequent EHCI reset, or the kernel hangs.
> + */
> +static int __init usb_early_debug_cleanup(void)
> +{
> +	if (early_dbgp_console.index >= 0 &&
> +		early_dbgp_console.flags & CON_PRINTBUFFER) {
> +		console_stop(early_console);
> +		unregister_console(early_console);
> +		early_dbgp_console.index = -1;
> +		early_dbgp_console.flags = 0;
> +		ehci_debug = NULL;
> +		printk(KERN_INFO "Early USB console unregistered\n");
> +	}
> +	return 0;
> +}
> +postcore_initcall(usb_early_debug_cleanup);
> +#endif /* CONFIG_EARLY_PRINTK_DBGP */

We already have CON_BOOT which allows the unregistering of early 
consoles, via disable_boot_consoles() initcall in kernel/printk.c.

The hang should be solved differently: either by calling 
disable_boot_consoles() explicitly after console_init() - or by 
introducing another CON_ flag that marks the console for early 
forced unregistering.

	Ingo

  parent reply	other threads:[~2009-05-06  7:35 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06  2:00 [PATCH 0/5] usb_debug driver improvements Jason Wessel
2009-05-06  2:00 ` [PATCH 1/5] usb_debug: implement multi urb write Jason Wessel
2009-05-06  2:00   ` [PATCH 2/5] usb_debug,usb_generic_serial: implement sysrq and serial break Jason Wessel
2009-05-06  2:00     ` [PATCH 3/5] usb,early_printk: insert cr prior to nl as needed Jason Wessel
2009-05-06  2:00       ` [PATCH 4/5] usb,early_printk: unregister early usb before rest_init() Jason Wessel
2009-05-06  2:00         ` [PATCH 5/5] usb_debug: EXPERIMENTAL - poll hcd device to force writes Jason Wessel
2009-05-06 15:18           ` Alan Stern
2009-05-06 15:25             ` Greg KH
2009-05-06 15:42               ` Alan Cox
2009-05-06 15:59               ` Jason Wessel
2009-05-06 15:41             ` Alan Cox
2009-05-06 15:45               ` Greg KH
2009-05-06 17:17               ` Oliver Neukum
2009-05-06 19:24                 ` Alan Stern
2009-05-06 20:01                   ` Oliver Neukum
2009-05-06 20:24                     ` Alan Stern
2009-05-06 22:24                       ` Oliver Neukum
2009-05-07 14:35                         ` Alan Stern
2009-05-07 15:01                           ` Oliver Neukum
2009-05-07 16:32                             ` Alan Stern
2009-05-06 20:24                     ` Jason Wessel
2009-05-06 20:28                       ` Greg KH
2009-05-06 20:51                         ` [PATCH 5/5] usb_debug: EXPERIMENTAL - poll hcd device to forcewrites Jason Wessel
2009-05-06 21:32                           ` Greg KH
2009-05-07 14:00                             ` Alan Stern
2009-05-07  0:06                   ` [PATCH 5/5] usb_debug: EXPERIMENTAL - poll hcd device to force writes Alan Cox
2009-05-07 14:27                     ` Alan Stern
2009-05-07 14:49                       ` Oliver Neukum
2009-05-06  7:34         ` Ingo Molnar [this message]
2009-05-06 13:02           ` [PATCH 4/5] usb,early_printk: unregister early usb before rest_init() Jason Wessel
2009-05-07 15:09             ` Ingo Molnar
2009-05-06  7:30       ` [PATCH 3/5] usb,early_printk: insert cr prior to nl as needed Ingo Molnar
2009-05-06 15:25         ` Greg KH
2009-05-07 15:04           ` Ingo Molnar
2009-05-06  7:16   ` [PATCH 1/5] usb_debug: implement multi urb write Oliver Neukum
2009-05-06 11:57     ` Jason Wessel
2009-05-06 12:31       ` Oliver Neukum
2009-05-06 15:26   ` Greg KH

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=20090506073456.GC17457@elte.hu \
    --to=mingo@elte.hu \
    --cc=greg@kroah.com \
    --cc=jason.wessel@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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.