All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: linux-scsi@vger.kernel.org, martin.petersen@oracle.com,
	ejb@linux.ibm.com, tglx@linutronix.de,
	Kashyap Desai <kashyap.desai@broadcom.com>,
	Sumit Saxena <sumit.saxena@broadcom.com>,
	Shivasharan S <shivasharan.srikanteshwara@broadcom.com>,
	megaraidlinux.pdl@broadcom.com
Subject: Re: [PATCH 03/10] scsi/megaraid_sas: Replace instance->tasklet with threaded irq
Date: Thu, 2 Jun 2022 12:11:33 +0200	[thread overview]
Message-ID: <YpiM1dNxZTh0NLM7@linutronix.de> (raw)
In-Reply-To: <20220530231512.9729-4-dave@stgolabs.net>

On 2022-05-30 16:15:05 [-0700], Davidlohr Bueso wrote:
> Tasklets have long been deprecated as being too heavy on the system
> by running in irq context - and this is not a performance critical
> path. If a higher priority process wants to run, it must wait for
> the tasklet to finish before doing so. A more suitable equivalent
> is to converted to threaded irq instead and deal with the command
> completion in task context.
> 
> While tasklets do not run concurrently amongst themselves, the
> callback can compete vs megasas_wait_for_outstanding() so any races
> with threads will also be present with the async thread completing
> the command.

So that fusion part of the driver has a different tasklet/isr so we have
always the same callback except in the one case…
The s/tasklet/irqthread/ looks okay but that fusion part of the driver
which also does some eye brow raising:
The way irqpoll is scheduled does not look promising. We have:
|         if (!irq_context->irq_poll_scheduled) {
|                 irq_context->irq_poll_scheduled = true;
|                 irq_context->irq_line_enable = true;
|                 irq_poll_sched(&irq_context->irqpoll);
|         }

so we lack disabling the interrupt source. This means the interrupt will
continue trigger except on edge-trigger devices. Here however it might
also trigger if "another work item" is added. This might be reason why
|         if (irq_context->irq_poll_scheduled)
|                 return IRQ_HANDLED;

was added to megasas_isr_fusion() to skip that case. We also have this
piece:
|         if (irq_ctx->irq_line_enable) {
|                 disable_irq_nosync(irq_ctx->os_irq);
|                 irq_ctx->irq_line_enable = false;
|         }

in megasas_irqpoll(). It might have not been enough. But this a bold
move if this is not an MSI interrupt but an actual shared interrupt.
Without any proof I would say that disabling the interrupt source in HW
is cheaper than invoking disable_irq_nosync(). Also invoking
disable_irq_nosync() from the point where it should be disabled looks
late.

I would suggest to get rid of irqpoll, disable the interrupt source
before returning IRQ_WAKE_THREAD. I have currently no idea how to deal
with
|	if (threshold_reply_count >= instance->threshold_reply_count)

within the threaded-IRQ. It runs at SCHED_FIFO/50 so a cond_resched()
won't do a thing. It might not be a issue, it might…

So the while the s/tasklet/irqthread/ part look okay, the part where the
interrupt source seems not to be deactivated looks bad.

> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>

Sebastian

  reply	other threads:[~2022-06-02 10:11 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-30 23:15 [PATCH 00/10] scsi: Replace tasklets as BH Davidlohr Bueso
2022-05-30 23:15 ` [PATCH 01/10] scsi/mvsas: Kill CONFIG_SCSI_MVSAS_TASKLET Davidlohr Bueso
2022-05-31  8:05   ` John Garry
2022-05-31 14:52     ` Davidlohr Bueso
2022-05-31 15:12       ` John Garry
2022-05-31 15:17         ` Sebastian Andrzej Siewior
2022-05-31 15:26           ` John Garry
2022-05-31 15:31             ` Sebastian Andrzej Siewior
2022-06-01  1:04           ` Davidlohr Bueso
2022-06-01  8:12             ` John Garry
2022-05-30 23:15 ` [PATCH 02/10] scsi/megaraid: Replace adapter->dpc_h tasklet with threaded irq Davidlohr Bueso
2022-06-02  8:36   ` Sebastian Andrzej Siewior
2022-05-30 23:15 ` [PATCH 03/10] scsi/megaraid_sas: Replace instance->tasklet " Davidlohr Bueso
2022-06-02 10:11   ` Sebastian Andrzej Siewior [this message]
2022-05-30 23:15 ` [PATCH 04/10] scsi/aic94xx: Replace the donelist tasklet " Davidlohr Bueso
2022-06-02 10:31   ` Sebastian Andrzej Siewior
2022-05-30 23:15 ` [PATCH 05/10] scsi/isci: Replace completion_tasklet " Davidlohr Bueso
2022-06-02 18:19   ` Sebastian Andrzej Siewior
2022-06-06 10:24   ` Artur Paszkiewicz
2022-06-07  9:13     ` Sebastian Andrzej Siewior
2022-05-30 23:15 ` [PATCH 06/10] scsi/ibmvscsi_tgt: Replace work tasklet " Davidlohr Bueso
2022-05-30 23:15   ` Davidlohr Bueso
2022-06-03 11:05   ` Sebastian Andrzej Siewior
2022-06-03 11:05     ` Sebastian Andrzej Siewior
2022-05-30 23:15 ` [PATCH 07/10] scsi/esas2r: Replace tasklet with workqueue Davidlohr Bueso
2022-06-09 12:14   ` Sebastian Andrzej Siewior
2022-05-30 23:15 ` [PATCH 08/10] scsi/ibmvfc: Replace tasklet with work Davidlohr Bueso
2022-05-30 23:15   ` Davidlohr Bueso
2022-06-09 12:30   ` Sebastian Andrzej Siewior
2022-06-09 12:30     ` Sebastian Andrzej Siewior
2022-06-28 15:18     ` Davidlohr Bueso
2022-06-28 15:18       ` Davidlohr Bueso
2022-05-30 23:15 ` [PATCH 09/10] scsi/ibmvscsi: Replace srp " Davidlohr Bueso
2022-05-30 23:15   ` Davidlohr Bueso
2022-06-09 15:02   ` Sebastian Andrzej Siewior
2022-06-09 15:02     ` Sebastian Andrzej Siewior
2022-06-09 15:46     ` David Laight
2022-06-14 13:25       ` 'Sebastian Andrzej Siewior'
2022-06-14 13:25         ` 'Sebastian Andrzej Siewior'
2022-06-14 13:34         ` David Laight
2022-06-14 13:34           ` David Laight
2022-05-30 23:15 ` [PATCH 10/10] scsi/lpfc: Remove bogus references to discovery tasklet Davidlohr Bueso
2022-06-09 15:21   ` Sebastian Andrzej Siewior
2022-06-02  7:57 ` [PATCH 00/10] scsi: Replace tasklets as BH Sebastian Andrzej Siewior
2022-06-07 15:59   ` Davidlohr Bueso
2022-06-07 16:20     ` Sebastian Andrzej Siewior

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=YpiM1dNxZTh0NLM7@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=dave@stgolabs.net \
    --cc=ejb@linux.ibm.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=megaraidlinux.pdl@broadcom.com \
    --cc=shivasharan.srikanteshwara@broadcom.com \
    --cc=sumit.saxena@broadcom.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
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.