From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF91015E8B; Mon, 30 Dec 2024 15:50:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735573845; cv=none; b=Rkp1cJ8IIQkrIXJkWtcR0Q9f6NtmeDl1FAj3QJiAYIX+LjEax22P5vdb307N1F3MJ1QYcgZ9jeMgk/MHqolrds3iL+UB+Jtpc45+a0QGmKAkaSCqDi4cQ4B04zdSQ5Zo2Blvu75ct7GPqyhxjd5gNSC3+L3bDQS2LqRappW59Hw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735573845; c=relaxed/simple; bh=GUOEFLm9veyQswotIQh7WKNn60WSvGJ6VBxXtNhwB/o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z+C8rRHLJycuc4qMm07+70hQCOernJENXrudRbspZaglfJobZoC2Kc8LiXCY4RFdHsbW3RoPMTgwg8RoEIP+h6i/ZDgSwn5RUM/PelPi2WOnEksqAjDZpGUmti9u5H77i9tHayg+IU1ypzcR2v5pBphPAy2G1/L7+XKm7gx9qfM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eOG35hkk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eOG35hkk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D404C4CED0; Mon, 30 Dec 2024 15:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1735573844; bh=GUOEFLm9veyQswotIQh7WKNn60WSvGJ6VBxXtNhwB/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eOG35hkksPO+GjNz8hj7t81l52TAZYnqQpGWjcfK4Pdt50ucuXnO04cFGADDIHiu/ x21eaeQgVnEmxOY4kKCN9Gt5AE6GCmM+vjejhuLvS0oxO56YDG2PmE/kv8HCG48KPZ lcKxzk8u+33dq972QeP9VUMhZde4aV6BNpoblFrY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Reinette Chatre , Fenghua Yu , Peter Newman , Babu Moger , Luck Tony , Ming Lei , Jens Axboe , Sasha Levin Subject: [PATCH 6.6 50/86] blk-mq: register cpuhp callback after hctx is added to xarray table Date: Mon, 30 Dec 2024 16:42:58 +0100 Message-ID: <20241230154213.625082685@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230154211.711515682@linuxfoundation.org> References: <20241230154211.711515682@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ming Lei [ Upstream commit 4bf485a7db5d82ddd0f3ad2b299893199090375e ] We need to retrieve 'hctx' from xarray table in the cpuhp callback, so the callback should be registered after this 'hctx' is added to xarray table. Cc: Reinette Chatre Cc: Fenghua Yu Cc: Peter Newman Cc: Babu Moger Cc: Luck Tony Signed-off-by: Ming Lei Tested-by: Tony Luck Link: https://lore.kernel.org/r/20241206111611.978870-2-ming.lei@redhat.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-mq.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 6c71add013bf..f4a9eed1b977 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3708,16 +3708,11 @@ static int blk_mq_init_hctx(struct request_queue *q, { hctx->queue_num = hctx_idx; - if (!(hctx->flags & BLK_MQ_F_STACKING)) - cpuhp_state_add_instance_nocalls(CPUHP_AP_BLK_MQ_ONLINE, - &hctx->cpuhp_online); - cpuhp_state_add_instance_nocalls(CPUHP_BLK_MQ_DEAD, &hctx->cpuhp_dead); - hctx->tags = set->tags[hctx_idx]; if (set->ops->init_hctx && set->ops->init_hctx(hctx, set->driver_data, hctx_idx)) - goto unregister_cpu_notifier; + goto fail; if (blk_mq_init_request(set, hctx->fq->flush_rq, hctx_idx, hctx->numa_node)) @@ -3726,6 +3721,11 @@ static int blk_mq_init_hctx(struct request_queue *q, if (xa_insert(&q->hctx_table, hctx_idx, hctx, GFP_KERNEL)) goto exit_flush_rq; + if (!(hctx->flags & BLK_MQ_F_STACKING)) + cpuhp_state_add_instance_nocalls(CPUHP_AP_BLK_MQ_ONLINE, + &hctx->cpuhp_online); + cpuhp_state_add_instance_nocalls(CPUHP_BLK_MQ_DEAD, &hctx->cpuhp_dead); + return 0; exit_flush_rq: @@ -3734,8 +3734,7 @@ static int blk_mq_init_hctx(struct request_queue *q, exit_hctx: if (set->ops->exit_hctx) set->ops->exit_hctx(hctx, hctx_idx); - unregister_cpu_notifier: - blk_mq_remove_cpuhp(hctx); + fail: return -1; } -- 2.39.5