From: Kashyap Desai <kashyap.desai@broadcom.com>
To: Hannes Reinecke <hare@suse.de>, linux-scsi@vger.kernel.org
Cc: Sumit Saxena <sumit.saxena@broadcom.com>,
Chandrakanth Patil <chandrakanth.patil@broadcom.com>,
linux-block@vger.kernel.org
Subject: RE: [PATCH v3 2/4] megaraid_sas: iouring iopoll support
Date: Tue, 2 Feb 2021 17:00:05 +0530 [thread overview]
Message-ID: <b930e147c940c6e1d2bbb94a5d854bd2@mail.gmail.com> (raw)
In-Reply-To: <698414dc-401c-10ea-30a9-0aeedc9b1349@suse.de>
[-- Attachment #1: Type: text/plain, Size: 2171 bytes --]
> >
> > +int megasas_blk_mq_poll(struct Scsi_Host *shost, unsigned int
> > +queue_num) {
> > +
> > + struct megasas_instance *instance;
> > + int num_entries = 0;
> > + struct fusion_context *fusion;
> > +
> > + instance = (struct megasas_instance *)shost->hostdata;
> > +
> > + fusion = instance->ctrl_context;
> > +
> > + queue_num = queue_num + instance->low_latency_index_start;
> > +
> > + if (!atomic_add_unless(&fusion->busy_mq_poll[queue_num], 1, 1))
> > + return 0;
> > +
> > + num_entries = complete_cmd_fusion(instance, queue_num, NULL);
> > + atomic_dec(&fusion->busy_mq_poll[queue_num]);
> > +
> > + return num_entries;
> > +}
> > +
> > /**
> > * megasas_enable_irq_poll() - enable irqpoll
> > * @instance: Adapter soft state
>
> I really wonder if we need the atomic counter here.
> complete_cmd_fusion() will already return the number of completed
> commands, so the only benefit we're getting is to avoid calling
> complete_cmd_fusion() if no commands are pending.
> But if no commands are pending we are necessarily off the hot path anyway,
> so calling complete_cmd_fusion() here (and have it return 0) should matter
> much.
> Am I wrong?
Hannes -
I think you are talking about busy_mq_poll atomic counter. This counter
avoid race condition of having complete_cmd_fusion() (for specific
queue_number) called from multiple context.
It is possible that we have hctx0 (which is in polled mode) with multiple
cpu_mask. Without this counter, more than one poll thread can attempt to
poll on hctx0 and we will end up in panic or some other issues. This counter
will make sure poll is executed from only one context and if poll on
specific hctx is active, another poll will simply return as very first poll
will take care the completion.
Kashyap
>
> Otherwise: All thumbs up for this work. Very good job.
>
> Cheers,
>
> Hannes
> --
> Dr. Hannes Reinecke Kernel Storage Architect
> hare@suse.de +49 911 74053 688
> SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809
> (AG Nürnberg), Geschäftsführer: Felix Imendörffer
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4169 bytes --]
next prev parent reply other threads:[~2021-02-02 11:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210201051619.19909-1-kashyap.desai@broadcom.com>
2021-02-01 5:16 ` [PATCH v3 1/4] add io_uring with IOPOLL support in scsi layer Kashyap Desai
2021-02-01 5:16 ` [PATCH v3 2/4] megaraid_sas: iouring iopoll support Kashyap Desai
2021-02-01 15:06 ` Hannes Reinecke
2021-02-02 11:30 ` Kashyap Desai [this message]
2021-02-01 5:16 ` [PATCH v3 3/4] scsi_debug : " Kashyap Desai
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=b930e147c940c6e1d2bbb94a5d854bd2@mail.gmail.com \
--to=kashyap.desai@broadcom.com \
--cc=chandrakanth.patil@broadcom.com \
--cc=hare@suse.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sumit.saxena@broadcom.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
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;
as well as URLs for NNTP newsgroup(s).