From: Mike Christie <michaelc@cs.wisc.edu>
To: scameron@beardog.cca.cpqcorp.net
Cc: linux-kernel@vger.kernel.org, mike.miller@hp.com,
jens.axboe@oracle.com, fujita.tomonori@lab.ntt.co.jp,
akpm@linux-foundation.org, linux-scsi@vger.kernel.org,
coldwell@redhat.com, hare@novell.com, iss_storagedev@hp.com
Subject: Re: [PATCH] hpsa: SCSI driver for HP Smart Array controllers
Date: Tue, 03 Mar 2009 10:49:15 -0600 [thread overview]
Message-ID: <49AD5F8B.8060602@cs.wisc.edu> (raw)
In-Reply-To: <20090302145650.GW15340@beardog.cca.cpqcorp.net>
scameron@beardog.cca.cpqcorp.net 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?
>
> Hmm, this doesn't seem all that complicated to me, and this code snippet
> has been pretty stable for about 10 years. it's nearly identical to what's in
> cpqarray in the 2.2.13 kernel from 1999:
>
> do {
> i = find_first_zero_bit(h->cmd_pool_bits, NR_CMDS);
> if (i == NR_CMDS)
> return NULL;
> } while(test_and_set_bit(i%32, h->cmd_pool_bits+(i/32)) != 0)
>
> It's fast, works well, and has needed very little maintenance over the
> years. Without knowing what you have in mind specifically, I don't see a
> big need to change this.
>
Other drivers have had to convert to and modify the host tagging to get
merged. They too had stable and fast code, and we complained and fought
against changing it :) I have had to convert or help convert libfc and
qla4xxx and I will now convert iscsi, so I feel your pain :)
To create the map call scsi_init_shared_tag_map after you allocate the
scsi host and before you add it. Then in slave_alloc set the
sdev->tag_supported = 1 and call scsi_activate_tcq. Then replace your
bitmap with:
for scsi commands:
c = h->cmd_pool + scsi_cmnd->request->tag
And for the reset path I was thinking you could use my patch in the
other mail and do
tag = blk_map_start_tag(scsi_host->bqt, NULL, 0);
if (tag < 0)
goto fail;
c = h->cmd_pool + tag;
c->cmdindex = tag;
In the completion path you need to do a blk_map_end_tag(scsi_host->bqt,
c->cmdindex);. The scsi/block layer will free the tag for scsi commadns.
next prev parent reply other threads:[~2009-03-03 16:53 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-02 14:56 [PATCH] hpsa: SCSI driver for HP Smart Array controllers 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 [this message]
2009-03-03 21:28 ` scameron
-- strict thread matches above, loose matches on Subject: below --
2009-02-27 23:09 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
2009-03-02 20:33 ` Mike Christie
2009-03-02 20:37 ` Mike Christie
2009-03-03 9:43 ` Jens Axboe
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=49AD5F8B.8060602@cs.wisc.edu \
--to=michaelc@cs.wisc.edu \
--cc=akpm@linux-foundation.org \
--cc=coldwell@redhat.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=hare@novell.com \
--cc=iss_storagedev@hp.com \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mike.miller@hp.com \
--cc=scameron@beardog.cca.cpqcorp.net \
/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