From: Johannes Thumshirn <jthumshirn@suse.de>
To: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@pmcs.com>,
JBottomley@Parallels.com, linux-scsi@vger.kernel.org
Cc: Mahesh.Rajashekhara@pmcs.com, Murthy.Bhat@pmcs.com,
Santosh.Akula@pmcs.com, Gana.Sridaran@pmcs.com,
aacraid@pmc-sierra.com, Rich.Bono@pmcs.com
Subject: Re: [PATCH 02/10] aacraid: Fix RRQ overload
Date: Wed, 02 Dec 2015 10:26:41 +0100 [thread overview]
Message-ID: <1449048401.3103.42.camel@suse.de> (raw)
In-Reply-To: <1448973589-9216-3-git-send-email-RaghavaAditya.Renukunta@pmcs.com>
On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote:
> From: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>
>
> The driver utilizes an array of atomic variables to keep track of
> IO submissions to each vector. To submit an IO multiple threads
> iterate through the array to find a vector which has empty slots
> to send an IO. The reading and updating of the variable is not atomic,
> causing race conditions when a thread uses a full vector to
> submit an IO.
>
> Fixed by mapping each FIB to a vector, the submission path then uses
> said vector to submit IO thereby removing the possibly of a race
> condition.The vector assignment is started from 1 since vector 0 is
> reserved for the use of AIF management FIBS.If the number of MSIx
> vectors is 1 (MSI or INTx mode) then all the fibs are allocated to
> vector 0.
>
> Signed-off-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>
> ---
> drivers/scsi/aacraid/aacraid.h | 1 +
> drivers/scsi/aacraid/commsup.c | 12 ++++++++++++
> drivers/scsi/aacraid/src.c | 30 +++++++-----------------------
> 3 files changed, 20 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
> index da227e8..d133c4a 100644
> --- a/drivers/scsi/aacraid/aacraid.h
> +++ b/drivers/scsi/aacraid/aacraid.h
> @@ -944,6 +944,7 @@ struct fib {
> */
> struct list_head fiblink;
> void *data;
> + u32 vector_no;
> struct hw_fib *hw_fib_va; /* Actual
> shared object */
> dma_addr_t hw_fib_pa; /* physical
> address of hw_fib*/
> };
> diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
> index b5b653c..b257d3b 100644
> --- a/drivers/scsi/aacraid/commsup.c
> +++ b/drivers/scsi/aacraid/commsup.c
> @@ -104,6 +104,7 @@ int aac_fib_setup(struct aac_dev * dev)
> struct hw_fib *hw_fib;
> dma_addr_t hw_fib_pa;
> int i;
> + u32 vector = 1;
>
> while (((i = fib_map_alloc(dev)) == -ENOMEM)
> && (dev->scsi_host_ptr->can_queue > (64 - AAC_NUM_MGT_FIB))) {
> @@ -150,6 +151,17 @@ int aac_fib_setup(struct aac_dev * dev)
> dev->max_fib_size + sizeof(struct
> aac_fib_xporthdr));
> hw_fib_pa = hw_fib_pa +
> dev->max_fib_size + sizeof(struct aac_fib_xporthdr);
> +
> + if ((dev->max_msix == 1) ||
> + (i > ((dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB -
> 1)
> + - dev->vector_cap))) {
> + fibptr->vector_no = 0;
> + } else {
> + fibptr->vector_no = vector;
> + vector++;
> + if (vector == dev->max_msix)
> + vector = 1;
> + }
> }
> /*
> * Add the fib chain to the free list
> diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
> index 2aa34ea..bc0203f 100644
> --- a/drivers/scsi/aacraid/src.c
> +++ b/drivers/scsi/aacraid/src.c
> @@ -156,8 +156,8 @@ static irqreturn_t aac_src_intr_message(int irq, void
> *dev_id)
> break;
> if (dev->msi_enabled && dev->max_msix > 1)
> atomic_dec(&dev-
> >rrq_outstanding[vector_no]);
> - aac_intr_normal(dev, handle-1, 0, isFastResponse,
> NULL);
> dev->host_rrq[index++] = 0;
> + aac_intr_normal(dev, handle-1, 0, isFastResponse,
> NULL);
> if (index == (vector_no + 1) * dev->vector_cap)
> index = vector_no * dev->vector_cap;
> dev->host_rrq_idx[vector_no] = index;
> @@ -452,36 +452,20 @@ static int aac_src_deliver_message(struct fib *fib)
> #endif
>
> u16 hdr_size = le16_to_cpu(fib->hw_fib_va->header.Size);
> + u16 vector_no;
>
> atomic_inc(&q->numpending);
>
> if (dev->msi_enabled && fib->hw_fib_va->header.Command != AifRequest
> &&
> dev->max_msix > 1) {
> - u_int16_t vector_no, first_choice = 0xffff;
> -
> - vector_no = dev->fibs_pushed_no % dev->max_msix;
> - do {
> - vector_no += 1;
> - if (vector_no == dev->max_msix)
> - vector_no = 1;
> - if (atomic_read(&dev->rrq_outstanding[vector_no]) <
> - dev->vector_cap)
> - break;
> - if (0xffff == first_choice)
> - first_choice = vector_no;
> - else if (vector_no == first_choice)
> - break;
> - } while (1);
> - if (vector_no == first_choice)
> - vector_no = 0;
> - atomic_inc(&dev->rrq_outstanding[vector_no]);
> - if (dev->fibs_pushed_no == 0xffffffff)
> - dev->fibs_pushed_no = 0;
> - else
> - dev->fibs_pushed_no++;
> + vector_no = fib->vector_no;
> fib->hw_fib_va->header.Handle += (vector_no << 16);
> + } else {
> + vector_no = 0;
> }
>
> + atomic_inc(&dev->rrq_outstanding[vector_no]);
> +
> if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2) {
> /* Calculate the amount to the fibsize bits */
> fibsize = (hdr_size + 127) / 128 - 1;
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Fixes: 495c0217 "aacraid: MSI-x support"
Cc: stable@vger.kernel.org # v4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-12-02 9:26 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-01 12:39 [PATCH 00/10] aacraid: Patchset for aacraid driver version 41052 Raghava Aditya Renukunta
2015-12-01 12:39 ` [PATCH 01/10] aacraid: SCSI blk tag support Raghava Aditya Renukunta
2015-12-02 10:49 ` Johannes Thumshirn
2015-12-03 15:52 ` Tomas Henzl
2015-12-03 21:25 ` Raghava Aditya Renukunta
2015-12-01 12:39 ` [PATCH 02/10] aacraid: Fix RRQ overload Raghava Aditya Renukunta
2015-12-02 9:26 ` Johannes Thumshirn [this message]
2015-12-04 14:11 ` Tomas Henzl
2015-12-01 12:39 ` [PATCH 03/10] aacraid: Added EEH support Raghava Aditya Renukunta
2015-12-02 9:41 ` Johannes Thumshirn
2015-12-02 23:14 ` Raghava Aditya Renukunta
2015-12-04 14:20 ` Tomas Henzl
2015-12-01 12:39 ` [PATCH 04/10] aacraid: Fix memory leak in aac_fib_map_free Raghava Aditya Renukunta
2015-12-02 9:44 ` Johannes Thumshirn
2015-12-04 14:34 ` Tomas Henzl
2015-12-05 0:40 ` Raghava Aditya Renukunta
2015-12-07 14:05 ` Tomas Henzl
2015-12-07 19:07 ` Raghava Aditya Renukunta
2015-12-01 12:39 ` [PATCH 05/10] aacraid: Set correct msix count for EEH recovery Raghava Aditya Renukunta
2015-12-02 10:27 ` Johannes Thumshirn
2015-12-02 22:59 ` Raghava Aditya Renukunta
2015-12-04 14:10 ` Tomas Henzl
2015-12-05 0:15 ` Raghava Aditya Renukunta
2015-12-01 12:39 ` [PATCH 06/10] aacraid: Fundamental reset support for Series 7 Raghava Aditya Renukunta
2015-12-02 9:49 ` Johannes Thumshirn
2015-12-01 12:39 ` [PATCH 07/10] aacraid: Fix AIF triggered IOP_RESET Raghava Aditya Renukunta
2015-12-02 10:00 ` Johannes Thumshirn
2015-12-02 22:29 ` Raghava Aditya Renukunta
2015-12-03 8:03 ` Johannes Thumshirn
2015-12-01 12:39 ` [PATCH 08/10] aacraid: Disable device ID wildcard Raghava Aditya Renukunta
2015-12-02 10:02 ` Johannes Thumshirn
2015-12-03 15:54 ` Tomas Henzl
2015-12-03 21:32 ` Raghava Aditya Renukunta
2015-12-04 8:33 ` Christoph Hellwig
2015-12-07 19:07 ` Raghava Aditya Renukunta
2015-12-01 12:39 ` [PATCH 09/10] aacraid: Fix character device re-initialization Raghava Aditya Renukunta
2015-12-02 10:13 ` Johannes Thumshirn
2015-12-02 22:30 ` Raghava Aditya Renukunta
2015-12-01 12:39 ` [PATCH 09/10] aacraid: Fix character device re initialization Raghava Aditya Renukunta
2015-12-02 9:18 ` Johannes Thumshirn
2015-12-02 21:59 ` Raghava Aditya Renukunta
2015-12-01 12:39 ` [PATCH 10/10] aacraid: Update driver version Raghava Aditya Renukunta
2015-12-02 10:14 ` Johannes Thumshirn
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=1449048401.3103.42.camel@suse.de \
--to=jthumshirn@suse.de \
--cc=Gana.Sridaran@pmcs.com \
--cc=JBottomley@Parallels.com \
--cc=Mahesh.Rajashekhara@pmcs.com \
--cc=Murthy.Bhat@pmcs.com \
--cc=RaghavaAditya.Renukunta@pmcs.com \
--cc=Rich.Bono@pmcs.com \
--cc=Santosh.Akula@pmcs.com \
--cc=aacraid@pmc-sierra.com \
--cc=linux-scsi@vger.kernel.org \
/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).