From: Mike Christie <michaelc@cs.wisc.edu>
To: Christoph Hellwig <hch@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>,
James Bottomley <JBottomley@Parallels.com>,
Nicholas Bellinger <nab@linux-iscsi.org>,
linux-scsi@vger.kernel.org
Subject: Re: [PATCH 06/17] scsi: add support for per-host cmd pools
Date: Fri, 07 Feb 2014 15:43:55 -0600 [thread overview]
Message-ID: <52F5539B.8090202@cs.wisc.edu> (raw)
In-Reply-To: <20140207124640.GC30510@infradead.org>
[-- Attachment #1: Type: text/plain, Size: 2183 bytes --]
On 02/07/2014 06:46 AM, Christoph Hellwig wrote:
> On Fri, Feb 07, 2014 at 03:35:00AM -0600, Mike Christie wrote:
>> It seems there is a issue with using the cmd_size to indicate the driver
>> has its own cmd pool and also using that for scsi mq enabled drivers to
>> indicate that we want the LLD's struct allocated by blk/scsi mq.
>>
>> If a driver sets cmd_size for only the scsi/blk mq purpose, this patch
>> wants the driver to also setup a cmd pool which I do not think is used
>> when doing scsi/blk mq.
>
> I don't quite understand what you mean. cmd_size means that each
> scsi_cmnd passed to the driver will have additional per-driver data.
>
> For the old path it's implemented by creating a slab cache and storing
> it in the host template to easily find it, for blk-mq it is used to
> increase the allocation in the block core as scsi doesn't do it's own
> allocations in this case.
>
Ah ok. There is a bug then. I thought you were doing something crazy and
trying to do both at the same time for the same host, and that is why in
the other thread I was asking for a way to figure out where per-driver
data is.
The problem is that if a driver is using scsi-mq and sets cmd_size,
scsi-ml is trying to also setup a shost->cmd_pool. We do:
scsi_add_host_with_dma->scsi_setup_command_freelist->scsi_get_host_cmd_pool->
scsi_find_host_cmd_pool
and that function uses cmd_size to determine if we are using the driver
allocated hostt->cmd_pool or the scsi-ml caches. In the case of where we
are setting cmd_size because we want the mq code to setup the per driver
data we do not want any cmd_pool and have not set one up. The problem is
that scsi_find_host_cmd_pool then returns NULL and
scsi_get_host_cmd_pool does scsi_alloc_host_cmd_pool.
Later when scsi_destroy_command_freelist calls scsi_put_host_cmd_pool,
scsi_find_host_cmd_pool returns NULL again and we oops when we access
the pool in there.
We need something like the attached patch which just prevents scsi-ml
from creating a host pool when mq is used. Note that when
scsi_destroy_command_freelist is called shost->cmd_pool will be NULL so
it will return immediately so no extra check is needed in there.
[-- Attachment #2: dont-setup-host-list.patch --]
[-- Type: text/plain, Size: 529 bytes --]
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index f28ea07..2924252 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -213,9 +213,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
goto fail;
}
- error = scsi_setup_command_freelist(shost);
- if (error)
- goto fail;
+ if (!sht->use_blk_mq) {
+ error = scsi_setup_command_freelist(shost);
+ if (error)
+ goto fail;
+ }
if (!shost->shost_gendev.parent)
shost->shost_gendev.parent = dev ? dev : &platform_bus;
next prev parent reply other threads:[~2014-02-07 21:44 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-05 12:39 [PATCH 00/17] SCSI data path micro-optimizations Christoph Hellwig
2014-02-05 12:39 ` [PATCH 01/17] scsi: handle command allocation failure in scsi_reset_provider Christoph Hellwig
2014-02-05 12:39 ` [PATCH 02/17] megaraid: simplify internal command handling Christoph Hellwig
2014-02-06 16:40 ` Christoph Hellwig
2014-02-05 12:39 ` [PATCH 03/17] scsi: remove scsi_allocate_command/scsi_free_command Christoph Hellwig
2014-02-05 12:39 ` [PATCH 04/17] scsi: avoid useless free_list lock roundtrips Christoph Hellwig
2014-02-05 23:44 ` James Bottomley
2014-02-06 16:22 ` Christoph Hellwig
2014-02-07 9:05 ` Paolo Bonzini
2014-02-05 12:39 ` [PATCH 05/17] scsi: simplify command allocation and freeing a bit Christoph Hellwig
2014-02-05 23:51 ` James Bottomley
2014-02-06 16:21 ` Christoph Hellwig
2014-02-05 12:39 ` [PATCH 06/17] scsi: add support for per-host cmd pools Christoph Hellwig
2014-02-07 9:13 ` Paolo Bonzini
2014-02-07 12:44 ` Christoph Hellwig
2014-02-07 9:35 ` Mike Christie
2014-02-07 12:46 ` Christoph Hellwig
2014-02-07 21:43 ` Mike Christie [this message]
2014-02-10 12:20 ` Christoph Hellwig
2014-02-05 12:39 ` [PATCH 07/17] virtio_scsi: use cmd_size Christoph Hellwig
2014-02-07 9:13 ` Paolo Bonzini
2014-02-05 12:39 ` [PATCH 08/17] scsi: do not manipulate device reference counts in scsi_get/put_command Christoph Hellwig
2014-02-05 12:39 ` [PATCH 09/17] scsi: micro-optimize scsi_request_fn() Christoph Hellwig
2014-02-05 12:39 ` [PATCH 10/17] scsi: micro-optimize scsi_next_command() Christoph Hellwig
2014-02-05 12:39 ` [PATCH 11/17] scsi: micro-optimize scsi_requeue_command() Christoph Hellwig
2014-02-05 12:39 ` [PATCH 12/17] scsi: avoid taking host_lock in scsi_run_queue unless nessecary Christoph Hellwig
2014-02-05 23:54 ` James Bottomley
2014-02-06 16:19 ` Christoph Hellwig
2014-02-05 12:39 ` [PATCH 13/17] scsi: push host_lock down into scsi_{host,target}_queue_ready Christoph Hellwig
2014-02-06 16:56 ` James Bottomley
2014-02-06 17:10 ` Bart Van Assche
2014-02-06 18:41 ` James Bottomley
2014-02-07 10:42 ` Bart Van Assche
2014-02-06 21:58 ` Nicholas A. Bellinger
2014-02-07 10:32 ` Bart Van Assche
2014-02-07 19:30 ` Nicholas A. Bellinger
2014-02-08 11:00 ` Bart Van Assche
2014-02-09 8:26 ` Nicholas A. Bellinger
2014-02-10 12:09 ` Christoph Hellwig
2014-02-10 19:53 ` Nicholas A. Bellinger
2014-02-10 11:39 ` Christoph Hellwig
2014-02-10 20:09 ` Jens Axboe
2014-02-17 9:36 ` Bart Van Assche
2014-02-17 22:00 ` Christoph Hellwig
2014-02-26 15:39 ` Bart Van Assche
2014-02-10 21:10 ` James Bottomley
2014-02-05 12:39 ` [PATCH 14/17] scsi: convert target_busy to an atomic_t Christoph Hellwig
2014-02-05 12:39 ` [PATCH 15/17] scsi: convert host_busy to atomic_t Christoph Hellwig
2014-02-05 12:39 ` [PATCH 16/17] scsi: convert device_busy " Christoph Hellwig
2014-02-05 12:39 ` [PATCH 17/17] scsi: fix the {host,target,device}_blocked counter mess Christoph Hellwig
2014-02-05 23:41 ` [PATCH 00/17] SCSI data path micro-optimizations James Bottomley
2014-02-06 16:29 ` Christoph Hellwig
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=52F5539B.8090202@cs.wisc.edu \
--to=michaelc@cs.wisc.edu \
--cc=JBottomley@Parallels.com \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@linux-iscsi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.