LKML Archive on lore.kernel.org
 help / color / Atom feed
From: "Sebastian A. Siewior" <bigeasy@linutronix.de>
To: "Ahmed S. Darwish" <a.darwish@linutronix.de>
Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>,
	Rohit Maheshwari <rohitm@chelsio.com>,
	Vinay Kumar Yadav <vinay.yadav@chelsio.com>,
	Vishal Kulkarni <vishal@chelsio.com>,
	netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RFC PATCH 2/3] chelsio: cxgb: Move slow interrupt handling to threaded irqs
Date: Mon, 11 Jan 2021 11:38:47 +0100
Message-ID: <20210111103847.cvp7ddd52cga3wuh@linutronix.de> (raw)
In-Reply-To: <20201224131148.300691-3-a.darwish@linutronix.de>

On 2020-12-24 14:11:47 [+0100], Ahmed S. Darwish wrote:
> --- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c
> +++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c
> @@ -211,9 +211,9 @@ static int cxgb_up(struct adapter *adapter)
>  	t1_interrupts_clear(adapter);
>  
>  	adapter->params.has_msi = !disable_msi && !pci_enable_msi(adapter->pdev);
> -	err = request_irq(adapter->pdev->irq, t1_interrupt,
> -			  adapter->params.has_msi ? 0 : IRQF_SHARED,
> -			  adapter->name, adapter);
> +	err = request_threaded_irq(adapter->pdev->irq, t1_irq, t1_irq_thread,
> +				   adapter->params.has_msi ? 0 : IRQF_SHARED,
> +				   adapter->name, adapter);
>  	if (err) {
>  		if (adapter->params.has_msi)
>  			pci_disable_msi(adapter->pdev);
> diff --git a/drivers/net/ethernet/chelsio/cxgb/sge.c b/drivers/net/ethernet/chelsio/cxgb/sge.c
> index d6df1a87db0b..f1c402f6b889 100644
> --- a/drivers/net/ethernet/chelsio/cxgb/sge.c
> +++ b/drivers/net/ethernet/chelsio/cxgb/sge.c
> @@ -1626,11 +1626,10 @@ int t1_poll(struct napi_struct *napi, int budget)
>  	return work_done;
>  }
>  
> -irqreturn_t t1_interrupt(int irq, void *data)
> +irqreturn_t t1_irq(int irq, void *data)
>  {
>  	struct adapter *adapter = data;
>  	struct sge *sge = adapter->sge;
> -	int handled;
>  
>  	if (likely(responses_pending(adapter))) {
>  		writel(F_PL_INTR_SGE_DATA, adapter->regs + A_PL_CAUSE);
> @@ -1645,9 +1644,19 @@ irqreturn_t t1_interrupt(int irq, void *data)
>  				napi_enable(&adapter->napi);
>  			}
>  		}
> +
>  		return IRQ_HANDLED;
>  	}
>  
> +	return IRQ_WAKE_THREAD;
> +}
> +
> +irqreturn_t t1_irq_thread(int irq, void *data)
> +{
> +	struct adapter *adapter = data;
> +	struct sge *sge = adapter->sge;
> +	int handled;
> +
>  	spin_lock(&adapter->async_lock);
>  	handled = t1_slow_intr_handler(adapter);
>  	spin_unlock(&adapter->async_lock);

This does not work in general, it might work in the MSI case but does
not work for the LEVEL interrupt case: The interrupt remains active
because it has not been ACKed. Chances are that the threaded handler
never gets scheduled because interrupt is still pending and t1_irq()
gets invoked right away.
For that reason, the primary must either mask the interrupt source or
use IRQF_ONESHOT to mask the interrupt line until the threaded handler
is done.

If you look at t1_elmer0_ext_intr() it disables F_PL_INTR_EXT before the
worker scheduled so the interrupt does not trigger again.
The worker then does what ever is needed (t1_elmer0_ext_intr_handler)
and then ACKs F_PL_INTR_EXT and enables F_PL_INTR_EXT again so it may
trigger an interrupt again.

Sebastian

  reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-24 13:11 [RFC PATCH 0/3] chelsio: cxgb: Use " Ahmed S. Darwish
2020-12-24 13:11 ` [RFC PATCH 1/3] chelsio: cxgb: Remove ndo_poll_controller() Ahmed S. Darwish
2020-12-24 13:31   ` Ahmed S. Darwish
2020-12-24 13:11 ` [RFC PATCH 2/3] chelsio: cxgb: Move slow interrupt handling to threaded irqs Ahmed S. Darwish
2021-01-11 10:38   ` Sebastian A. Siewior [this message]
2020-12-24 13:11 ` [RFC PATCH 3/3] chelsio: cxgb: Do not schedule a workqueue for external interrupts Ahmed S. Darwish

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=20210111103847.cvp7ddd52cga3wuh@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=a.darwish@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rahul.lakkireddy@chelsio.com \
    --cc=rohitm@chelsio.com \
    --cc=tglx@linutronix.de \
    --cc=vinay.yadav@chelsio.com \
    --cc=vishal@chelsio.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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lkml.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lkml.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lkml.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lkml.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lkml.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lkml.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lkml.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lkml.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lkml.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lkml.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://lkml.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