Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
To: Bart Van Assche <Bart.VanAssche@wdc.com>,
	"jejb@linux.vnet.ibm.com" <jejb@linux.vnet.ibm.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: dl-esc-Aacraid Linux Driver <aacraid@microsemi.com>,
	"gpiccoli@linux.vnet.ibm.com" <gpiccoli@linux.vnet.ibm.com>,
	Tom White <tom.white@microsemi.com>,
	Scott Benesh <scott.benesh@microsemi.com>
Subject: RE: [PATCH 08/29] scsi: aacraid: Move code to wait for IO completion to shutdown func
Date: Wed, 27 Dec 2017 01:38:02 +0000	[thread overview]
Message-ID: <dc73356f32cc4905ac32e545f11bab72@microsemi.com> (raw)
In-Reply-To: <1513960005.2579.10.camel@wdc.com>



> -----Original Message-----
> From: Bart Van Assche [mailto:Bart.VanAssche@wdc.com]
> Sent: Friday, December 22, 2017 8:27 AM
> To: jejb@linux.vnet.ibm.com; Raghava Aditya Renukunta
> <RaghavaAditya.Renukunta@microsemi.com>; linux-scsi@vger.kernel.org;
> martin.petersen@oracle.com
> Cc: dl-esc-Aacraid Linux Driver <aacraid@microsemi.com>;
> gpiccoli@linux.vnet.ibm.com; Tom White <tom.white@microsemi.com>;
> Scott Benesh <scott.benesh@microsemi.com>
> Subject: Re: [PATCH 08/29] scsi: aacraid: Move code to wait for IO completion
> to shutdown func
> 
> EXTERNAL EMAIL
> 
> 
> On Thu, 2017-12-21 at 17:59 +0000, Bart Van Assche wrote:
> > On Thu, 2017-12-21 at 09:33 -0800, Raghava Aditya Renukunta wrote:
> > > +static void aac_wait_for_io_completion(struct aac_dev *aac)
> > > +{
> > > +   unsigned long flagv = 0;
> > > +   int i = 0;
> > > +
> > > +   for (i = 60; i; --i) {
> > > +           struct scsi_device *dev;
> > > +           struct scsi_cmnd *command;
> > > +           int active = 0;
> > > +
> > > +           __shost_for_each_device(dev, aac->scsi_host_ptr) {
> > > +                   spin_lock_irqsave(&dev->list_lock, flagv);
> > > +                   list_for_each_entry(command, &dev->cmd_list, list) {
> > > +                           if (command->SCp.phase == AAC_OWNER_FIRMWARE) {
> > > +                                   active++;
> > > +                                   break;
> > > +                           }
> > > +                   }
> > > +                   spin_unlock_irqrestore(&dev->list_lock, flagv);
> > > +                   if (active)
> > > +                           break;
> > > +
> > > +           }
> > > +           /*
> > > +            * We can exit If all the commands are complete
> > > +            */
> > > +           if (active == 0)
> > > +                   break;
> > > +           ssleep(1);
> > > +   }
> > > +}
> >
> > Have you considered to call scsi_target_block() and scsi_target_unblock()
> instead
> > of implementing functionality like the above in a SCSI LLD?
> 
> (replying to my own e-mail)
> 
> It seems like I misread your code - calling scsi_target_block() and
> scsi_target_unblock() would not be sufficient. But calling
> blk_mq_freeze_queue()
> and blk_mq_unfreeze_queue() should be sufficient. The following commit
> made these
> functions work not only for scsi-mq but also for legacy scsi queues: commit
> 055f6e18e08f ("block: Make q_usage_counter also track legacy requests").

Hi Bart,
That piece of code is very much legacy  that I removed and placed in a function that would benefit all code paths that shutdown the controller. The 2 functions you mentioned are a god send but I think I will hold off on this patchset and do a full refactor with them in the next patchset. ( I suspect that I will have to touch a bunch of different code paths and perform extensive testing to be fully confident)

Regards,
Raghava Aditya

> Bart.

  reply	other threads:[~2017-12-27  1:38 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21 17:33 [PATCH 00/28] aacraid: Refactor for sas transport and bug fixes Raghava Aditya Renukunta
2017-12-21 17:33 ` [PATCH 01/29] scsi: aacraid: Fix udev inquiry race condition Raghava Aditya Renukunta
2017-12-21 17:54   ` Bart Van Assche
2017-12-27  1:22     ` Raghava Aditya Renukunta
2017-12-21 17:33 ` [PATCH 02/29] scsi: aacraid: Do not attempt abort when Fw panicked Raghava Aditya Renukunta
2017-12-21 17:33 ` [PATCH 03/29] scsi: aacraid: Fix hang in kdump Raghava Aditya Renukunta
2017-12-21 19:15   ` Guilherme G. Piccoli
2017-12-22 15:13   ` Guilherme G. Piccoli
2017-12-27  1:28     ` Raghava Aditya Renukunta
2017-12-21 17:33 ` [PATCH 04/29] scsi: aacraid: Do not remove offlined devices Raghava Aditya Renukunta
2017-12-21 17:33 ` [PATCH 05/29] scsi: aacraid: Fix ioctl reset hang Raghava Aditya Renukunta
2017-12-21 17:33 ` [PATCH 06/29] scsi: aacraid: Allow reset_host sysfs var to recover Panicked Fw Raghava Aditya Renukunta
2017-12-21 17:33 ` [PATCH 07/29] scsi: aacraid: Refactor reset_host store function Raghava Aditya Renukunta
2017-12-21 17:33 ` [PATCH 08/29] scsi: aacraid: Move code to wait for IO completion to shutdown func Raghava Aditya Renukunta
2017-12-21 17:59   ` Bart Van Assche
2017-12-22 16:26     ` Bart Van Assche
2017-12-27  1:38       ` Raghava Aditya Renukunta [this message]
2017-12-21 17:34 ` [PATCH 09/29] scsi: aacraid: Create bmic submission function from bmic identify Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 10/29] scsi: aacraid: Change phy luns function to use common bmic function Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 11/29] scsi: aacraid: Refactor and rename to make mirror existing changes Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 12/29] scsi: aacraid: Add target setup helper function Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 13/29] scsi: aacraid: Untangle targets setup from report phy luns Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 14/29] scsi: aacraid: Move function around to match existing code Raghava Aditya Renukunta
2017-12-21 18:39   ` Bart Van Assche
2017-12-27  1:23     ` Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 15/29] scsi: aacraid: Create helper functions to get lun info Raghava Aditya Renukunta
2017-12-21 18:40   ` Bart Van Assche
2017-12-27  1:24     ` Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 16/29] scsi: aacraid: Save bmic phy information for each phy Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 17/29] scsi: aacraid: Add helper function to set queue depth Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 18/29] scsi: aacraid: Merge func to get container information Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 19/29] scsi: aacraid: Process hba and container hot plug events in single function Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 20/29] scsi: aacraid: Added macros to help loop through known buses and targets Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 21/29] scsi: aacraid: Refactor resolve luns code and scsi functions Raghava Aditya Renukunta
2017-12-21 18:42   ` Bart Van Assche
2017-12-27  1:25     ` Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 22/29] scsi: aacraid: Merge adapter setup with resolve luns Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 23/29] scsi: aacraid: Block concurrent hotplug event handling Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 24/29] scsi: aacraid: Use hotplug handling function in place of scsi_scan_host Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 25/29] scsi: aacraid: Reschedule host scan in case of failure Raghava Aditya Renukunta
2017-12-21 18:44   ` Bart Van Assche
2017-12-27  1:25     ` Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 26/29] scsi: aacraid: Fix hang while scanning in eh recovery Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 27/29] scsi: aacraid: Skip schedule rescan in case of kdump Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 28/29] scsi: aacraid: Remove unused rescan variable Raghava Aditya Renukunta
2017-12-21 17:34 ` [PATCH 29/29] scsi: aacraid: Remove AAC_HIDE_DISK check in queue command Raghava Aditya Renukunta
2017-12-22 15:06 ` [PATCH 00/28] aacraid: Refactor for sas transport and bug fixes Guilherme G. Piccoli
2017-12-27  1:27   ` Raghava Aditya Renukunta
2017-12-27 12:24     ` Guilherme G. Piccoli

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=dc73356f32cc4905ac32e545f11bab72@microsemi.com \
    --to=raghavaaditya.renukunta@microsemi.com \
    --cc=Bart.VanAssche@wdc.com \
    --cc=aacraid@microsemi.com \
    --cc=gpiccoli@linux.vnet.ibm.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=scott.benesh@microsemi.com \
    --cc=tom.white@microsemi.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