All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	<linux-scsi@vger.kernel.org>,
	Ketan Mukadam <ketan.mukadam@broadcom.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v2] scsi: be2iscsi: Replace irq_poll with threaded IRQ handler.
Date: Fri, 29 Oct 2021 14:41:53 +0100	[thread overview]
Message-ID: <d5212154-0dd7-58ac-9fc3-25d77fe2a8fa@huawei.com> (raw)
In-Reply-To: <20211029074902.4fayed6mcltifgdz@linutronix.de>

> +static irqreturn_t be_iopoll(struct be_eq_obj *pbe_eq)
> +{
> +	struct beiscsi_hba *phba;
> +	unsigned int ret, io_events;
> +	struct be_eq_entry *eqe = NULL;
> +	struct be_queue_info *eq;
> +
> +	phba = pbe_eq->phba;
> +	if (beiscsi_hba_in_error(phba))
> +		return IRQ_NONE;
> +
> +	io_events = 0;
> +	eq = &pbe_eq->q;
> +	eqe = queue_tail_node(eq);
> +	while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32] &
> +			EQE_VALID_MASK) {
> +		AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
> +		queue_tail_inc(eq);
> +		eqe = queue_tail_node(eq);
> +		io_events++;
> +	}
> +	hwi_ring_eq_db(phba, eq->id, 1, io_events, 0, 1);
> +
> +	ret = beiscsi_process_cq(pbe_eq);
> +	pbe_eq->cq_count += ret;
> +	beiscsi_log(phba, KERN_INFO,
> +		    BEISCSI_LOG_CONFIG | BEISCSI_LOG_IO,
> +		    "BM_%d : rearm pbe_eq->q.id =%d ret %d\n",
> +		    pbe_eq->q.id, ret);
> +	if (!beiscsi_hba_in_error(phba))
> +		hwi_ring_eq_db(phba, pbe_eq->q.id, 0, 0, 1, 1);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static irqreturn_t be_isr_misx_th(int irq, void *dev_id)
> +{
> +	struct be_eq_obj *pbe_eq  = dev_id;
> +
> +	return be_iopoll(pbe_eq);
> +}
> +
>   /**
>    * be_isr_msix - The isr routine of the driver.
>    * @irq: Not used
> @@ -713,9 +752,22 @@ static irqreturn_t be_isr_msix(int irq, void *dev_id)
>   	phba = pbe_eq->phba;
>   	/* disable interrupt till iopoll completes */
>   	hwi_ring_eq_db(phba, eq->id, 1,	0, 0, 1);
> -	irq_poll_sched(&pbe_eq->iopoll);
>   
> -	return IRQ_HANDLED;
> +	return IRQ_WAKE_THREAD;
> +}
> +
> +static irqreturn_t be_isr_thread(int irq, void *dev_id)
> +{
> +	struct beiscsi_hba *phba;
> +	struct hwi_controller *phwi_ctrlr;
> +	struct hwi_context_memory *phwi_context;
> +	struct be_eq_obj *pbe_eq;
> +
> +	phba = dev_id;
> +	phwi_ctrlr = phba->phwi_ctrlr;
> +	phwi_context = phwi_ctrlr->phwi_ctxt;
> +	pbe_eq = &phwi_context->be_eq[0];
> +	return be_iopoll(pbe_eq);
>   }
>   
>   /**
> @@ -735,6 +787,7 @@ static irqreturn_t be_isr(int irq, void *dev_id)
>   	struct be_ctrl_info *ctrl;
>   	struct be_eq_obj *pbe_eq;
>   	int isr, rearm;
> +	irqreturn_t ret;
>   
>   	phba = dev_id;
>   	ctrl = &phba->ctrl;
> @@ -774,10 +827,11 @@ static irqreturn_t be_isr(int irq, void *dev_id)
>   		/* rearm for MCCQ */
>   		rearm = 1;
>   	}
> +	ret = IRQ_HANDLED;
>   	if (io_events)
> -		irq_poll_sched(&pbe_eq->iopoll);
> +		ret = IRQ_WAKE_THREAD;
>   	hwi_ring_eq_db(phba, eq->id, 0, (io_events + mcc_events), rearm, 1);
> -	return IRQ_HANDLED;
> +	return ret;
>   }
>   
>   static void beiscsi_free_irqs(struct beiscsi_hba *phba)
> @@ -819,9 +873,10 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
>   				goto free_msix_irqs;
>   			}
>   
> -			ret = request_irq(pci_irq_vector(pcidev, i),
> -					  be_isr_msix, 0, phba->msi_name[i],
> -					  &phwi_context->be_eq[i]);
> +			ret = request_threaded_irq(pci_irq_vector(pcidev, i),
> +						   be_isr_msix, be_isr_misx_th,
> +						   0, phba->msi_name[i],
> +						   &phwi_context->be_eq[i]);

Would it be sensible to set ONESHOT flag here? I assume that we don't 
want the hard irq handler firing continuously while we poll completions 
in the threaded handler. That's my understanding of how ONESHOT should 
or would work... they currently seem to manually disable in 
be_isr_msix() -> hwi_ring_eq_db() for the same purpose, I guess.

Thanks,
John


  reply	other threads:[~2021-10-29 13:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29  7:49 [PATCH v2] scsi: be2iscsi: Replace irq_poll with threaded IRQ handler Sebastian Andrzej Siewior
2021-10-29 13:41 ` John Garry [this message]
2021-10-29 13:46   ` Sebastian Andrzej Siewior
2021-10-31 20:30 kernel test robot

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=d5212154-0dd7-58ac-9fc3-25d77fe2a8fa@huawei.com \
    --to=john.garry@huawei.com \
    --cc=bigeasy@linutronix.de \
    --cc=jejb@linux.ibm.com \
    --cc=ketan.mukadam@broadcom.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 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.