On 26/11/2019 17:56, Bart Van Assche wrote:
Add a boolean member 'share_tags' in struct blk_mq_tag_set. If that member
variable is set, make all hctx->tags[] pointers identical. Implement the
necessary changes in the functions that allocate, free and resize tag sets.
Modify blk_mq_tagset_busy_iter() such that it continues to call the
callback function once per request. Modify blk_mq_queue_tag_busy_iter()
such that the callback function is only called with the correct hctx
as first argument. Modify the debugfs code such that it keeps showing only
matching tags per hctx.
Hi Bart,
> This patch has been tested by running blktests on top of a kernel that
> includes the following change to enable shared tags for all block drivers
> except the NVMe drivers:
Could something be broken here with this approach, see ***:
static int
nvme_init_request(struct blk_mq_tag_set *set, struct request *req,
unsigned int hctx_idx, unsigned int numa_node)
{
struct nvme_dev *dev = set->driver_data;
struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
int queue_idx = (set == &dev->tagset) ? hctx_idx + 1 : 0;
struct nvme_queue *nvmeq = &dev->queues[queue_idx];
BUG_ON(!nvmeq);
iod->nvmeq = nvmeq; ***
nvme_req(req)->ctrl = &dev->ctrl;
return 0;
}
All iods are from hctx0, but could use different hctx's and nvme queues.
Obviously NVMe would not want shared tags, but I am just trying to
illustrate a potential problem in how requests are associated with
queues. I haven't audited all users.
Thanks,
John