Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Peter Hurley <peter@hurleysoftware.com>
Cc: Taichi Kageyama <t-kageyama@cp.jp.nec.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"jiang.liu@linux.intel.com" <jiang.liu@linux.intel.com>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jslaby@suse.cz" <jslaby@suse.cz>,
	"prarit@redhat.com" <prarit@redhat.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [RFC PATCH v2 0/3] genirq, serial: 8250: Workaround to avoid irq=0 for console
Date: Wed, 29 Jul 2015 15:35:42 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1507291534350.3825@nanos> (raw)
In-Reply-To: <55B8D26A.7000402@hurleysoftware.com>

On Wed, 29 Jul 2015, Peter Hurley wrote:
> On 07/29/2015 07:53 AM, Thomas Gleixner wrote:
> > On Wed, 29 Jul 2015, Peter Hurley wrote:
> >> On 07/29/2015 06:32 AM, Thomas Gleixner wrote:
> >>> On Wed, 29 Jul 2015, Taichi Kageyama wrote:
> >>>> - Keep interrupt disabled on the CPU which is used to detect 
> >>>>   an interrupt during the timeout of autoconfig_irq().
> >>>>      + Kick printk() on the CPU which detects interrupt 
> >>>>        from a console serial port.
> >>>
> >>> This is wrong to begin with. How is that supposed to work on an UP
> >>> machine? Not at all.
> >>>
> >>> So no, fix the code which has interrupts disabled accross autoprobing
> >>> and do not try to apply bandaids somewhere else.
> >>
> >> Like printk() from some unrelated driver?
> > 
> > If that's the cause for the wreckage then yes, we need a way to tell
> > the printk code not to call into the driver until that initialization
> > step is done. It's that simple.
> 
> Like this?

Looks about right.
 
> --- >% --
> Subject: [PATCH] genirq: Disable printk() during irq probe
> 
> printk() disables interrupts for extended periods of time while
> outputting to console drivers. This breaks irq probing since the
> triggered irq may not be serviced (in time) if scheduled on the
> printk() cpu.
> 
> Claim the console_lock() which effectively disables console output.
> 
> Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
> ---
>  kernel/irq/autoprobe.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
> index 0119b9d..47535d2 100644
> --- a/kernel/irq/autoprobe.c
> +++ b/kernel/irq/autoprobe.c
> @@ -39,6 +39,13 @@ unsigned long probe_irq_on(void)
>  	 */
>  	async_synchronize_full();
>  	mutex_lock(&probing_active);
> +
> +	/*
> +	 * printk() breaks irq probing - disable printk output until probe
> +	 * completes
> +	 */
> +	console_lock();
> +
>  	/*
>  	 * something may have generated an irq long ago and we want to
>  	 * flush such a longstanding irq before considering it as spurious.
> @@ -132,6 +139,7 @@ unsigned int probe_irq_mask(unsigned long val)
>  		}
>  		raw_spin_unlock_irq(&desc->lock);
>  	}
> +	console_unlock();
>  	mutex_unlock(&probing_active);
>  
>  	return mask & val;
> @@ -174,6 +182,7 @@ int probe_irq_off(unsigned long val)
>  		}
>  		raw_spin_unlock_irq(&desc->lock);
>  	}
> +	console_unlock();
>  	mutex_unlock(&probing_active);
>  
>  	if (nr_of_irqs > 1)
> -- 
> 2.5.0
> 
> 

  reply	other threads:[~2015-07-29 13:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-29  8:12 [RFC PATCH v2 0/3] genirq, serial: 8250: Workaround to avoid irq=0 for console Taichi Kageyama
2015-07-29  8:12 ` [RFC PATCH v2 1/3] serial: 8250: Fix autoconfig_irq() to avoid race conditions Taichi Kageyama
2015-08-06 12:53   ` Peter Hurley
2015-07-29  8:12 ` [RFC PATCH v2 2/3] genirq: Add a function to set irq affinity of candidate IRQs Taichi Kageyama
2015-07-29  8:13 ` [RFC PATCH v2 3/3] serial: 8250: Fix autoconfig_irq() to reduce the risk of failure Taichi Kageyama
2015-07-29 10:32 ` [RFC PATCH v2 0/3] genirq, serial: 8250: Workaround to avoid irq=0 for console Thomas Gleixner
2015-07-29 11:51   ` Peter Hurley
2015-07-29 11:53     ` Thomas Gleixner
2015-07-29 13:17       ` Peter Hurley
2015-07-29 13:35         ` Thomas Gleixner [this message]
2015-07-30  1:41           ` Taichi Kageyama
2015-07-30 10:12             ` Thomas Gleixner
2015-07-30 13:43               ` Peter Hurley
2015-07-30 22:12                 ` Thomas Gleixner
2015-07-30 23:43                   ` Peter Hurley
2015-07-31  7:02                     ` Taichi Kageyama
2015-08-02  9:52                       ` Thomas Gleixner

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=alpine.DEB.2.11.1507291534350.3825@nanos \
    --to=tglx@linutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jiang.liu@linux.intel.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=peter@hurleysoftware.com \
    --cc=peterz@infradead.org \
    --cc=prarit@redhat.com \
    --cc=t-kageyama@cp.jp.nec.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox