From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFED2C7EE22 for ; Wed, 10 May 2023 02:00:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229527AbjEJCAX (ORCPT ); Tue, 9 May 2023 22:00:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbjEJCAW (ORCPT ); Tue, 9 May 2023 22:00:22 -0400 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98D813AAF; Tue, 9 May 2023 19:00:20 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4QGJBk127Nz4f3mJ2; Wed, 10 May 2023 10:00:14 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP2 (Coremail) with SMTP id Syh0CgAXB+Wu+lpkqqwWJA--.63589S3; Wed, 10 May 2023 10:00:15 +0800 (CST) Subject: Re: [bug report] BUG: kernel NULL pointer dereference, address: 0000000000000048 To: Yu Kuai , Guangwu Zhang , linux-block@vger.kernel.org, io-uring@vger.kernel.org, Jeff Moyer , Ming Lei , "yukuai (C)" References: From: Yu Kuai Message-ID: <007af59f-4f4c-f779-a1b6-aaa81ff640b3@huaweicloud.com> Date: Wed, 10 May 2023 10:00:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: Syh0CgA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U= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Hi, 在 2023/05/10 9:49, Yu Kuai 写道: > Hi, > > 在 2023/05/10 9:29, Yu Kuai 写道: >> Hi, >> >> 在 2023/05/10 8:49, Guangwu Zhang 写道: >>> Hi, >>> >>> We found this kernel NULL pointer issue with latest >>> linux-block/for-next, please check it. >>> >>> Kernel repo: >>> https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git >>> >>> >>> [  112.483804] BUG: kernel NULL pointer dereference, address: >>> 0000000000000048 > > Base on this offset, 0x48 match bio->bi_blkg, so I guess this is because > bio is NULL, so the problem is that passthrough request insert into > elevator. > Sorry that attached patch has some problem, please try this one. diff --git a/block/blk-mq.c b/block/blk-mq.c index f6dad0886a2f..bd94d8a5416f 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2712,6 +2712,7 @@ static void blk_mq_dispatch_plug_list(struct blk_plug *plug, bool from_sched) struct request **requeue_lastp = &requeue_list; unsigned int depth = 0; LIST_HEAD(list); + LIST_HEAD(passthrough_list); do { struct request *rq = rq_list_pop(&plug->mq_list); @@ -2723,7 +2724,10 @@ static void blk_mq_dispatch_plug_list(struct blk_plug *plug, bool from_sched) rq_list_add_tail(&requeue_lastp, rq); continue; } - list_add(&rq->queuelist, &list); + if (blk_rq_is_passthrough(rq)) + list_add(&rq->queuelist, &passthrough_list); + else + list_add(&rq->queuelist, &list); depth++; } while (!rq_list_empty(plug->mq_list)); @@ -2731,6 +2735,9 @@ static void blk_mq_dispatch_plug_list(struct blk_plug *plug, bool from_sched) trace_block_unplug(this_hctx->queue, depth, !from_sched); percpu_ref_get(&this_hctx->queue->q_usage_counter); + if (!list_empty(&passthrough_list)) + blk_mq_insert_requests(this_hctx, this_ctx, &passthrough_list, + from_sched); if (this_hctx->queue->elevator) { this_hctx->queue->elevator->type->ops.insert_requests(this_hctx, &list, 0); Thanks, Kuai