public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Mike Christie <michaelc@cs.wisc.edu>
Cc: Grant Grundler <grundler@google.com>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	mike.miller@hp.com, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	hare@novell.com, iss_storagedev@hp.com, iss.sbteam@hp.com
Subject: Re: [PATCH] hpsa: SCSI driver for HP Smart Array controllers
Date: Mon, 2 Mar 2009 19:36:49 +0100	[thread overview]
Message-ID: <20090302183649.GB11787@kernel.dk> (raw)
In-Reply-To: <49AC237A.7060005@cs.wisc.edu>

On Mon, Mar 02 2009, Mike Christie wrote:
> Grant Grundler wrote:
>> On Sun, Mar 1, 2009 at 10:32 PM, FUJITA Tomonori
>> <fujita.tomonori@lab.ntt.co.jp> wrote:
>> ...
>>>> +/*
>>>> + * For operations that cannot sleep, a command block is allocated at init,
>>>> + * and managed by cmd_alloc() and cmd_free() using a simple bitmap to track
>>>> + * which ones are free or in use.  Lock must be held when calling this.
>>>> + * cmd_free() is the complement.
>>>> + */
>>>> +static struct CommandList_struct *cmd_alloc(struct ctlr_info *h)
>>>> +{
>>>> +     struct CommandList_struct *c;
>>>> +     int i;
>>>> +     union u64bit temp64;
>>>> +     dma_addr_t cmd_dma_handle, err_dma_handle;
>>>> +
>>>> +     do {
>>>> +             i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
>>>> +             if (i == h->nr_cmds)
>>>> +                     return NULL;
>>>> +     } while (test_and_set_bit
>>>> +              (i & (BITS_PER_LONG - 1),
>>>> +               h->cmd_pool_bits + (i / BITS_PER_LONG)) != 0);
>>> Using bitmap to manage free commands looks too complicated a bit to
>>> me. Can we just use lists for command management?
>>
>> Bit maps are generally more efficient than lists since we touch less data.
>> For both search and moving elements from free<->busy lists. This probably
>> won't matter if we are talking less than 10K IOPS. And willy demonstrated
>> other layers have pretty high overhead (block, libata and SCSI midlayer)
>> at high transaction rates.
>>
>
> If it was just needing this for the queuecommand path it would be  
> simple. For the queuecommand path we could just use the scsi host  
> tagging code for the index. You do not need a lock in the queuecommand  
> path for getting a index and command, and you do not need to duplicate  
> the tag/index allocation code in the block/scsi code
>
> A problem with the host tagging is what to do if you need a tag/index  
> for a internal command. In the slow path like the device reset and cache  
> flush case you could use a list or preallocated command or whatever  
> other drivers are using that makes you happy.
>
> Or for the reset/shutdown/internal path could we come up with a  
> extension to the existing API. Maybe just add some wrapper around some  
> of blk_queue_start_tag that takes a the bqt (the bqt would come from the  
> host wide one) and allocates the tag (need a something similar for the  
> release side).

This is precisely what I did for libata, here is is interleaved with
some other stuff:

http://git.kernel.dk/?p=linux-2.6-block.git;a=commitdiff;h=f557570ec6042370333b6b9c33bbbae175120a89

It needs a little more polish and so on, but the concept is identical to
what you describe for this case. And I agree, it's much better to use
the same index instead of generating/maintaining seperate bitmaps for
this type of thing.

-- 
Jens Axboe

  reply	other threads:[~2009-03-02 18:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-27 23:09 [PATCH] hpsa: SCSI driver for HP Smart Array controllers Mike Miller
2009-03-01 13:49 ` Rolf Eike Beer
2009-03-02  6:32 ` FUJITA Tomonori
2009-03-02 17:19   ` Grant Grundler
2009-03-02 18:20     ` Mike Christie
2009-03-02 18:36       ` Jens Axboe [this message]
2009-03-02 20:33         ` Mike Christie
2009-03-02 20:37           ` Mike Christie
2009-03-03  9:43           ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2009-03-02 14:56 scameron
2009-03-03  6:35 ` FUJITA Tomonori
2009-03-03 16:28   ` scameron
2009-03-05  5:48     ` FUJITA Tomonori
2009-03-05 14:21       ` scameron
2009-03-05 16:54         ` Andrew Patterson
2009-03-06  8:55         ` Jens Axboe
2009-03-06  9:13           ` FUJITA Tomonori
2009-03-06  9:21             ` Jens Axboe
2009-03-06  9:27               ` FUJITA Tomonori
2009-03-06  9:35                 ` Jens Axboe
2009-03-06 14:38                   ` scameron
2009-03-06 19:06                     ` Jens Axboe
2009-03-06 20:59                     ` Grant Grundler
2009-03-06 21:18                       ` scameron
2009-03-06 21:55                         ` Grant Grundler
2009-03-06 21:59                         ` James Bottomley
2009-03-05 14:55       ` Miller, Mike (OS Dev)
2009-03-03 16:49 ` Mike Christie
2009-03-03 21:28   ` scameron

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=20090302183649.GB11787@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=grundler@google.com \
    --cc=hare@novell.com \
    --cc=iss.sbteam@hp.com \
    --cc=iss_storagedev@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=mike.miller@hp.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