LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: <hpa@zytor.com>, <okuno.kohji@jp.panasonic.com>,
	<bigeasy@linutronix.de>, <linux-kernel@vger.kernel.org>,
	<msmucr@gmail.com>, <nathan.sullivan@ni.com>,
	<tglx@linutronix.de>, <mingo@kernel.org>,
	<linux-tip-commits@vger.kernel.org>
Cc: <hpa@zytor.com>, <okuno.kohji@jp.panasonic.com>,
	<bigeasy@linutronix.de>, <linux-kernel@vger.kernel.org>,
	<msmucr@gmail.com>, <nathan.sullivan@ni.com>, <mingo@kernel.org>,
	<tglx@linutronix.de>
Subject: Re: [tip:irq/core] genirq:  Handle force threading of irqs with primary and thread handler
Date: Tue, 6 Oct 2015 13:59:42 -0500
Message-ID: <87twq3257l.fsf@saruman.tx.rr.com> (raw)
In-Reply-To: <tip-2a1d3ab8986d1b2f598ffc42351d94166fa0f022@git.kernel.org>


[-- Attachment #1: Type: text/plain, Size: 3405 bytes --]


Hi Thomas,

tip-bot for Thomas Gleixner <tipbot@zytor.com> writes:
> Commit-ID:  2a1d3ab8986d1b2f598ffc42351d94166fa0f022
> Gitweb:     http://git.kernel.org/tip/2a1d3ab8986d1b2f598ffc42351d94166fa0f022
> Author:     Thomas Gleixner <tglx@linutronix.de>
> AuthorDate: Mon, 21 Sep 2015 11:01:10 +0200
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Tue, 22 Sep 2015 12:39:57 +0200
>
> genirq: Handle force threading of irqs with primary and thread handler
>
> Force threading of interrupts does not really deal with interrupts
> which are requested with a primary and a threaded handler. The current
> policy is to leave them alone and let the primary handler run in
> interrupt context, but we set the ONESHOT flag for those interrupts as
> well.
>
> Kohji Okuno debugged a problem with the SDHCI driver where the
> interrupt thread waits for a hardware interrupt to trigger, which can't
> work well because the hardware interrupt is masked due to the ONESHOT
> flag being set. He proposed to set the ONESHOT flag only if the
> interrupt does not provide a thread handler.
>
> Though that does not work either because these interrupts can be
> shared. So the other interrupt would rightfully get the ONESHOT flag
> set and therefor the same situation would happen again.
>
> To deal with this proper, we need to force thread the primary handler
> of such interrupts as well. That means that the primary interrupt
> handler is treated as any other primary interrupt handler which is not
> marked IRQF_NO_THREAD. The threaded handler becomes a separate thread
> so the SDHCI flow logic can be handled gracefully.
>
> The same issue was reported against 4.1-rt.
>
> Reported-and-tested-by: Kohji Okuno <okuno.kohji@jp.panasonic.com>
> Reported-By: Michal Smucr <msmucr@gmail.com>
> Reported-and-tested-by: Nathan Sullivan <nathan.sullivan@ni.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1509211058080.5606@nanos
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

this commit causes a performance regression for the USB driver on
several platforms (anybody using drivers/usb/dwc3, basically).

Here's the USB throughput with linux-next in 3 different scenarios:

1) Linux next without threadirqs cmdline

   test  0: sent     256.00 MB read      33.02 MB/s write      30.01 MB/s

2) Linux next with threadirqs on cmdline

   test  0: sent     256.00 MB read      30.70 MB/s write      27.89 MB/s

3) Linux next with threadirqs on cmdline + revert of $subject

   test  0: sent     256.00 MB read      32.93 MB/s write      29.85 MB/s


Considering this is trying to solve an issue found on the SDHCI driver,
shouldn't that be fixed instead ? Another option would be, of course, to
add IRQF_NO_THREAD to dwc3, but I'd like to avoid that if possible.

The way we try to use dwc3 is rather simple, actually. We use the
primary handle *only* to detect is $this device generated the IRQ and if
did we wake up the thread. We also don't make use of ONESHOT because we
mask $this device IRQs in the primary handler and only unmask after the
thread runs.

It's a bit surprising, to me at least, that simply running everything as
a thread would have such a measurable impact, but it does.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

  reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-21  9:01 [PATCH] " Thomas Gleixner
2015-09-22  6:42 ` Kohji Okuno
2015-09-22 10:42 ` [tip:irq/core] " tip-bot for Thomas Gleixner
2015-10-06 18:59   ` Felipe Balbi [this message]
2015-10-09 10:36     ` Thomas Gleixner
2015-10-09 14:01       ` Felipe Balbi

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=87twq3257l.fsf@saruman.tx.rr.com \
    --to=balbi@ti.com \
    --cc=bigeasy@linutronix.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=msmucr@gmail.com \
    --cc=nathan.sullivan@ni.com \
    --cc=okuno.kohji@jp.panasonic.com \
    --cc=tglx@linutronix.de \
    /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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git