public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Davidlohr Bueso <dave@stgolabs.net>, <linux-scsi@vger.kernel.org>
Cc: <martin.petersen@oracle.com>, <ejb@linux.ibm.com>,
	<bigeasy@linutronix.de>, <tglx@linutronix.de>
Subject: Re: [PATCH 01/10] scsi/mvsas: Kill CONFIG_SCSI_MVSAS_TASKLET
Date: Tue, 31 May 2022 09:05:42 +0100	[thread overview]
Message-ID: <17747966-ea44-ebe5-3d79-df7c33b6a16e@huawei.com> (raw)
In-Reply-To: <20220530231512.9729-2-dave@stgolabs.net>

On 31/05/2022 00:15, 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.

/s/converted/convert/

> 
> As such remove CONFIG_SCSI_MVSAS_TASKLET (which is horrible to begin
> with) and continue to do the async work, unconditionally now, just
> in task context. Just as with the tasklet version, device interrupts
> (MVS_IRQ_SAS_A/B) continues to be disabled from when the work was

/s/continues/continue/

> putted until it is actually complete. 

Question: Can there be any good reason to do this?

> Because there are no guarantees
> vs ksoftirqd, if this is broken for threaded irqs, then they are
> also broken for tasklets.
> 
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>

Apart some comments/nits:

Reviewed-by: John Garry <john.garry@huawei.com>

> ---
>   drivers/scsi/mvsas/Kconfig   |  7 ------
>   drivers/scsi/mvsas/mv_init.c | 44 ++++++------------------------------
>   drivers/scsi/mvsas/mv_sas.h  |  1 -
>   3 files changed, 7 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/scsi/mvsas/Kconfig b/drivers/scsi/mvsas/Kconfig
> index 79812b80743b..e9dd8dc84b1c 100644
> --- a/drivers/scsi/mvsas/Kconfig
> +++ b/drivers/scsi/mvsas/Kconfig
> @@ -23,10 +23,3 @@ config SCSI_MVSAS_DEBUG
>   	help
>   		Compiles the 88SE64XX/88SE94XX driver in debug mode.  In debug mode,
>   		the driver prints some messages to the console.
> -config SCSI_MVSAS_TASKLET
> -	bool "Support for interrupt tasklet"
> -	default n
> -	depends on SCSI_MVSAS
> -	help
> -		Compiles the 88SE64xx/88SE94xx driver in interrupt tasklet mode.In this mode,
> -		the interrupt will schedule a tasklet.
> diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
> index 2fde496fff5f..f36b270ba502 100644
> --- a/drivers/scsi/mvsas/mv_init.c
> +++ b/drivers/scsi/mvsas/mv_init.c
> @@ -146,12 +146,10 @@ static void mvs_free(struct mvs_info *mvi)
>   	kfree(mvi);
>   }
>   
> -#ifdef CONFIG_SCSI_MVSAS_TASKLET
> -static void mvs_tasklet(unsigned long opaque)
> +static irqreturn_t mvs_async(int irq, void *opaque)
>   {
>   	u32 stat;
>   	u16 core_nr, i = 0;
> -
>   	struct mvs_info *mvi;
>   	struct sas_ha_struct *sha = (struct sas_ha_struct *)opaque;

nit: you could have dropped this cast

>   
> @@ -172,46 +170,29 @@ static void mvs_tasklet(unsigned long opaque)
>   out:
>   	MVS_CHIP_DISP->interrupt_enable(mvi);
>   
> +	return IRQ_HANDLED;
>   }
> -#endif
>   
>   static irqreturn_t mvs_interrupt(int irq, void *opaque)
>   {
>   	u32 stat;
>   	struct mvs_info *mvi;
>   	struct sas_ha_struct *sha = opaque;
> -#ifndef CONFIG_SCSI_MVSAS_TASKLET
> -	u32 i;
> -	u32 core_nr;
> -
> -	core_nr = ((struct mvs_prv_info *)sha->lldd_ha)->n_host;
> -#endif
>   
>   	mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[0];
>   
>   	if (unlikely(!mvi))
>   		return IRQ_NONE;
> -#ifdef CONFIG_SCSI_MVSAS_TASKLET
> +
>   	MVS_CHIP_DISP->interrupt_disable(mvi);
> -#endif
>   
>   	stat = MVS_CHIP_DISP->isr_status(mvi, irq);
>   	if (!stat) {
> -	#ifdef CONFIG_SCSI_MVSAS_TASKLET
>   		MVS_CHIP_DISP->interrupt_enable(mvi);
> -	#endif
>   		return IRQ_NONE;
>   	}
>   
> -#ifdef CONFIG_SCSI_MVSAS_TASKLET
> -	tasklet_schedule(&((struct mvs_prv_info *)sha->lldd_ha)->mv_tasklet);
> -#else
> -	for (i = 0; i < core_nr; i++) {
> -		mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[i];
> -		MVS_CHIP_DISP->isr(mvi, irq, stat);
> -	}
> -#endif
> -	return IRQ_HANDLED;
> +	return IRQ_WAKE_THREAD;
>   }
>   
>   static int mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost)
> @@ -557,14 +538,6 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent)
>   		}
>   		nhost++;
>   	} while (nhost < chip->n_host);
> -#ifdef CONFIG_SCSI_MVSAS_TASKLET
> -	{
> -	struct mvs_prv_info *mpi = SHOST_TO_SAS_HA(shost)->lldd_ha;
> -
> -	tasklet_init(&(mpi->mv_tasklet), mvs_tasklet,
> -		     (unsigned long)SHOST_TO_SAS_HA(shost));
> -	}
> -#endif
>   
>   	mvs_post_sas_ha_init(shost, chip);
>   
> @@ -575,8 +548,9 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent)
>   	rc = sas_register_ha(SHOST_TO_SAS_HA(shost));
>   	if (rc)
>   		goto err_out_shost;
> -	rc = request_irq(pdev->irq, irq_handler, IRQF_SHARED,
> -		DRV_NAME, SHOST_TO_SAS_HA(shost));
> +	rc = request_threaded_irq(pdev->irq, irq_handler, mvs_async,

any reason not to use devm version?

> +				  IRQF_SHARED, DRV_NAME,
> +				  SHOST_TO_SAS_HA(shost));
>   	if (rc)
>   		goto err_not_sas;
>   
> @@ -607,10 +581,6 @@ static void mvs_pci_remove(struct pci_dev *pdev)
>   	core_nr = ((struct mvs_prv_info *)sha->lldd_ha)->n_host;
>   	mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[0];
>   
> -#ifdef CONFIG_SCSI_MVSAS_TASKLET
> -	tasklet_kill(&((struct mvs_prv_info *)sha->lldd_ha)->mv_tasklet);
> -#endif
> -
>   	sas_unregister_ha(sha);
>   	sas_remove_host(mvi->shost);
>   
> diff --git a/drivers/scsi/mvsas/mv_sas.h b/drivers/scsi/mvsas/mv_sas.h
> index 509d8f32a04f..a0e87fdab98a 100644
> --- a/drivers/scsi/mvsas/mv_sas.h
> +++ b/drivers/scsi/mvsas/mv_sas.h
> @@ -403,7 +403,6 @@ struct mvs_prv_info{
>   	u8 scan_finished;
>   	u8 reserve;
>   	struct mvs_info *mvi[2];
> -	struct tasklet_struct mv_tasklet;
>   };
>   
>   struct mvs_wq {


  reply	other threads:[~2022-05-31  8:05 UTC|newest]

Thread overview: 37+ 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 [this message]
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
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-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-06-09 12:30   ` Sebastian Andrzej Siewior
2022-06-28 15:18     ` Davidlohr Bueso
2022-05-30 23:15 ` [PATCH 09/10] scsi/ibmvscsi: Replace srp " Davidlohr Bueso
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: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=17747966-ea44-ebe5-3d79-df7c33b6a16e@huawei.com \
    --to=john.garry@huawei.com \
    --cc=bigeasy@linutronix.de \
    --cc=dave@stgolabs.net \
    --cc=ejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox