Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5483946rwi; Sun, 23 Oct 2022 06:55:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4RQSEK8Wg9GP4oUPyRdKYTLktIVTCu3t0AHCAkrW2F14mJ6enaTIiSz4jV/BRX5PrZDPYv X-Received: by 2002:a17:907:a062:b0:78d:d4c3:caf9 with SMTP id ia2-20020a170907a06200b0078dd4c3caf9mr24436331ejc.704.1666533346536; Sun, 23 Oct 2022 06:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666533346; cv=none; d=google.com; s=arc-20160816; b=HiRN7D6Sght6X38YeX4fLlgq2Eln77tVJKL4RJpW5Qfyz2NDpbsxF2uXuWnsGNNMw9 zt93MKwyqCnSe04UqnWLU0N8DcJHvgBb+Qqt9KFJ9fkQnArYsse80MLD8L6x/VH8iqam hg57dgYJmeCsglqy0M2FMisLL59EPgpOEYbYQNxcR73qYy4YzezCxw+1EpZhYNVB4g7/ UVapiVp55pfKD0EWyElGZUqvazPkO0rxfwtPN5ceu1cC/EyL4E4c6KwSsDVWb829ezIS dtQc6qRqzAvNyPhKCgmBcTJ7ikqOnPzYJep/x9ToKFbAV+Nx0YoMmxVjtvP/BEvL0la1 mj+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ElBoOb/aaEQguEnJtsaOEHzPiqut+It2HNHz/IrkdQs=; b=PPi7VahDNgdCCTfqp2/mbGzk4e0mxdE6S8kQs0aR3KbVfNj5OlHAEDBAKuQFJahqoL P9WGbwgvjeuFqq6QMver+SOKurKBf0pCd1wv9Z0N0uXNOU1GUrvOeaJC9DRrwAIm8R98 EWgyv3bGTTiMe6OwCV1BD6O8Dg6SYidm33O81JBVBP9xgjir+alDpiAnr4UiLJszD86L wLg+xCUye3POYgDgqAVxTK5GMhmKFWW7PT6YoJkvnm1Jn1gPQb/eiJ/nYTWWaVlFMpJ0 yqRwk9XkHboqmLud/1F9zqJXu+LOeiVCq6RMMUZk3gQNgYjwjwf7e33UV8yfXmy/25+e NEMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZPE0yUuT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr21-20020a170906d55500b0073dcb2ec4d2si25423131ejc.889.2022.10.23.06.55.20; Sun, 23 Oct 2022 06:55:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZPE0yUuT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230405AbiJWNOP (ORCPT + 99 others); Sun, 23 Oct 2022 09:14:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230378AbiJWNOM (ORCPT ); Sun, 23 Oct 2022 09:14:12 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AA80792E5 for ; Sun, 23 Oct 2022 06:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666530781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ElBoOb/aaEQguEnJtsaOEHzPiqut+It2HNHz/IrkdQs=; b=ZPE0yUuTWQInL/cs1+yP1Wn0kszL9Ia/+NWClfQCQFbah2PlaA008RKrDNICP5nh+m9gKh BQgCagaT7REtC4bqNNnUvnKdBULJ/SGzVoNmTuhvYWX6ENZlGQKTV6UYvDJVpJ32MXfTED iyQSBeU6pqNPbWftuvOBnreBjZD3v14= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-341-3zwIAvp5OTSJZF2inzbzNA-1; Sun, 23 Oct 2022 09:12:56 -0400 X-MC-Unique: 3zwIAvp5OTSJZF2inzbzNA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2E4686E91C; Sun, 23 Oct 2022 13:12:55 +0000 (UTC) Received: from T590 (ovpn-8-19.pek2.redhat.com [10.72.8.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 73E834A9255; Sun, 23 Oct 2022 13:12:50 +0000 (UTC) Date: Sun, 23 Oct 2022 21:12:44 +0800 From: Ming Lei To: John Garry Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, hch@lst.de Subject: Re: [PATCH] blk-mq: Properly init bios from blk_mq_alloc_request_hctx() Message-ID: References: <1666454846-11749-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1666454846-11749-1-git-send-email-john.garry@huawei.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 23, 2022 at 12:07:26AM +0800, John Garry wrote: > Function blk_mq_alloc_request_hctx() is missing zeroing/init of rq->bio, > biotail, __sector, and __data_len members, which blk_mq_alloc_request() > has. > > Move init'ing of those members to common blk_mq_rq_ctx_init(). > > Fixes: 1f5bd336b9150 ("blk-mq: add blk_mq_alloc_request_hctx") > Suggested-by: Bart Van Assche > Signed-off-by: John Garry > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index 8070b6c10e8d..260adeb2e455 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -402,6 +402,10 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data, > } > } > > + rq->__data_len = 0; > + rq->__sector = (sector_t) -1; > + rq->bio = rq->biotail = NULL; > + > return rq; > } > > @@ -591,9 +595,6 @@ struct request *blk_mq_alloc_request(struct request_queue *q, blk_opf_t opf, > if (!rq) > goto out_queue_exit; > } > - rq->__data_len = 0; > - rq->__sector = (sector_t) -1; > - rq->bio = rq->biotail = NULL; This patch looks not good, why do you switch to initialize the three fields twice in fast path? BTW, we know blk_mq_alloc_request_hctx() has big trouble, so please avoid to extend it to other use cases. Thanks, Ming