lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bbbe1889-38e8-4ab9-bce5-a4371b976433@linux.ibm.com>
Date: Fri, 15 Aug 2025 17:29:01 +0530
From: Nilay Shroff <nilay@...ux.ibm.com>
To: Yu Kuai <yukuai1@...weicloud.com>, axboe@...nel.dk, bvanassche@....org,
        hare@...e.de, ming.lei@...hat.com
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        yi.zhang@...wei.com, yangerkun@...wei.com, johnny.chenyi@...wei.com,
        "yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH 03/16] blk-mq: remove useless checkings from
 blk_mq_update_nr_requests()



On 8/15/25 7:02 AM, Yu Kuai wrote:
> Hi,
> 
> 在 2025/08/14 20:23, Nilay Shroff 写道:
>>
>>
>> On 8/14/25 9:05 AM, Yu Kuai wrote:
>>> From: Yu Kuai <yukuai3@...wei.com>
>>>
>>> 1) queue_requests_store() is the only caller of
>>> blk_mq_update_nr_requests(), where queue is already freezed, no need to
>>> check mq_freeze_depth;
>>> 2) q->tag_set must be set for request_based device, and queue_is_mq() is
>>> already checked in blk_mq_queue_attr_visible(), no need to check
>>> q->tag_set.
>>> 3) During initialization, hctx->tags in initialized before queue
>>> kobject, and during del_gendisk, queue kobject is deleted before
>>> exiting hctx, hence checking hctx->tags is useless.
>>>
>>> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
>>> ---
>>>   block/blk-mq.c | 11 +----------
>>>   1 file changed, 1 insertion(+), 10 deletions(-)
>>>
>>> diff --git a/block/blk-mq.c b/block/blk-mq.c
>>> index b67d6c02eceb..3a219b7b3688 100644
>>> --- a/block/blk-mq.c
>>> +++ b/block/blk-mq.c
>>> @@ -4921,24 +4921,15 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr)
>>>   {
>>>       struct blk_mq_tag_set *set = q->tag_set;
>>>       struct blk_mq_hw_ctx *hctx;
>>> -    int ret;
>>> +    int ret = 0;
>>>       unsigned long i;
>>>   -    if (WARN_ON_ONCE(!q->mq_freeze_depth))
>>> -        return -EINVAL;
>>> -
>>> -    if (!set)
>>> -        return -EINVAL;
>>> -
>>>       if (q->nr_requests == nr)
>>>           return 0;
>>>         blk_mq_quiesce_queue(q);
>>>   -    ret = 0;
>>>       queue_for_each_hw_ctx(q, hctx, i) {
>>> -        if (!hctx->tags)
>>> -            continue;
>> It's possible that hctx->tags is set to NULL in case no software
>> queues are mapped to the hardware queue. So it seems that this
>> check is valid. Please see blk_mq_map_swqueue().
> 
> Ok, thanks for the reviw.
> 
> I didn't notice this, just wonder how can this happen?
> nr_hw_queues > NR_CPUS?
> 
I think typically having nr_hw_queues > NR_CPUS is not allowed. 
But it's possible to have no software queues are mapped to hctx.
Check this commit 4412efecf7fd ("Revert "blk-mq: remove code for
dealing with remapping queue")

Thanks,
--Nilay





Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ