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 X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1185AC2BB1D for ; Tue, 7 Apr 2020 09:29:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7D1420719 for ; Tue, 7 Apr 2020 09:29:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="c1qYPIEX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728075AbgDGJ3Z (ORCPT ); Tue, 7 Apr 2020 05:29:25 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:36802 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726353AbgDGJ3Z (ORCPT ); Tue, 7 Apr 2020 05:29:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586251764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uteT5CFC0ScoT4i6H3tKfQeIZCuHYw280ur+UXR7ZIM=; b=c1qYPIEXF6fEjvp3x9wZj5QK8o3nX51vaB5uQLiaOyLtdqM2WlpO+R4WOsCjGbdazlTLwa IiwFPvp/AsZiNDcFSKxf+7kaDFx/Fup2BcvQaeSD4lZ2jA6QvOF9rgXb+Y7NYqUccExoIa GkiER+nSQXGWICWrewH6exBvnLnVyPE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-42-0kQyVJY3N-i4ED4lciJqWg-1; Tue, 07 Apr 2020 05:29:22 -0400 X-MC-Unique: 0kQyVJY3N-i4ED4lciJqWg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 08D781005509; Tue, 7 Apr 2020 09:29:21 +0000 (UTC) Received: from localhost (ovpn-8-23.pek2.redhat.com [10.72.8.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1401192F83; Tue, 7 Apr 2020 09:29:19 +0000 (UTC) From: Ming Lei To: Jens Axboe Cc: linux-block@vger.kernel.org, Ming Lei , Bart Van Assche , Hannes Reinecke , Christoph Hellwig , Thomas Gleixner , John Garry Subject: [PATCH V6 2/8] blk-mq: add new state of BLK_MQ_S_INACTIVE Date: Tue, 7 Apr 2020 17:28:55 +0800 Message-Id: <20200407092901.314228-3-ming.lei@redhat.com> In-Reply-To: <20200407092901.314228-1-ming.lei@redhat.com> References: <20200407092901.314228-1-ming.lei@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Content-Transfer-Encoding: quoted-printable Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Add a new hw queue state of BLK_MQ_S_INACTIVE, which is set when all CPUs of this hctx are offline. Prepares for stopping hw queue when all CPUs of this hctx become offline. Cc: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Thomas Gleixner Cc: John Garry Signed-off-by: Ming Lei --- block/blk-mq-debugfs.c | 1 + block/blk-mq.h | 3 ++- include/linux/blk-mq.h | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index b3f2ba483992..d6de4f7f38cb 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -213,6 +213,7 @@ static const char *const hctx_state_name[] =3D { HCTX_STATE_NAME(STOPPED), HCTX_STATE_NAME(TAG_ACTIVE), HCTX_STATE_NAME(SCHED_RESTART), + HCTX_STATE_NAME(INACTIVE), }; #undef HCTX_STATE_NAME =20 diff --git a/block/blk-mq.h b/block/blk-mq.h index d25429a4932c..1f4a794ddeb7 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -168,7 +168,8 @@ static inline struct blk_mq_tags *blk_mq_tags_from_da= ta(struct blk_mq_alloc_data =20 static inline bool blk_mq_hctx_stopped(struct blk_mq_hw_ctx *hctx) { - return test_bit(BLK_MQ_S_STOPPED, &hctx->state); + return test_bit(BLK_MQ_S_STOPPED, &hctx->state) || + test_bit(BLK_MQ_S_INACTIVE, &hctx->state); } =20 static inline bool blk_mq_hw_queue_mapped(struct blk_mq_hw_ctx *hctx) diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 11cfd6470b1a..b669e776d4cb 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -397,6 +397,9 @@ enum { BLK_MQ_S_TAG_ACTIVE =3D 1, BLK_MQ_S_SCHED_RESTART =3D 2, =20 + /* hw queue is inactive after all its CPUs become offline */ + BLK_MQ_S_INACTIVE =3D 3, + BLK_MQ_MAX_DEPTH =3D 10240, =20 BLK_MQ_CPU_WORK_BATCH =3D 8, --=20 2.25.2