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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 E6F5FC11F66 for ; Tue, 29 Jun 2021 08:25:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C21A861D7E for ; Tue, 29 Jun 2021 08:25:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232438AbhF2I2M (ORCPT ); Tue, 29 Jun 2021 04:28:12 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:41596 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232376AbhF2I2K (ORCPT ); Tue, 29 Jun 2021 04:28:10 -0400 Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3582A203A0; Tue, 29 Jun 2021 08:25:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1624955143; h=from:from:reply-to: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=cbMPs8lfp7DAJiGmeNL7OnW/w+tsl+PEThIBkrDu+7k=; b=YHP9hlZf73EaeJtsq0QyZRj9H8/sxB7yFhkQSY/r6pDGQ6cMuV6J6g8qGOmpdMJZ0TyPfG x0WfVJOvUY8E6qYWmI5TH/lqaNZiuqCMoxwZChETGI4dyNaANtLZdJmpwpWwuUAPfX841Z 1yGBdNsBFno+hbqQ806FKwPXSX+dZh8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1624955143; h=from:from:reply-to: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=cbMPs8lfp7DAJiGmeNL7OnW/w+tsl+PEThIBkrDu+7k=; b=tvOENhi0+KLGkTfSsUJfsFXgjGlScE2I4+zjVokj1Ub1Vo0WAPlgO/YL8/Zn7PrrY5Y13w hhUNHmQKCdCubvDQ== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 1B4AA11906; Tue, 29 Jun 2021 08:25:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1624955143; h=from:from:reply-to: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=cbMPs8lfp7DAJiGmeNL7OnW/w+tsl+PEThIBkrDu+7k=; b=YHP9hlZf73EaeJtsq0QyZRj9H8/sxB7yFhkQSY/r6pDGQ6cMuV6J6g8qGOmpdMJZ0TyPfG x0WfVJOvUY8E6qYWmI5TH/lqaNZiuqCMoxwZChETGI4dyNaANtLZdJmpwpWwuUAPfX841Z 1yGBdNsBFno+hbqQ806FKwPXSX+dZh8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1624955143; h=from:from:reply-to: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=cbMPs8lfp7DAJiGmeNL7OnW/w+tsl+PEThIBkrDu+7k=; b=tvOENhi0+KLGkTfSsUJfsFXgjGlScE2I4+zjVokj1Ub1Vo0WAPlgO/YL8/Zn7PrrY5Y13w hhUNHmQKCdCubvDQ== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id SU+wBQfZ2mD+OQAALh3uQQ (envelope-from ); Tue, 29 Jun 2021 08:25:43 +0000 Date: Tue, 29 Jun 2021 10:25:42 +0200 From: Daniel Wagner To: Ming Lei Cc: Wen Xiong , james.smart@broadcom.com, linux-kernel@vger.kernel.org, sagi@grimberg.me, wenxiong@linux.vnet.ibm.com Subject: Re: [PATCH 1/1] block: System crashes when cpu hotplug + bouncing port Message-ID: <20210629082542.vm3yh6k36d2zh3k5@beryllium.lan> References: <1624850072-17776-1-git-send-email-wenxiong@linux.vnet.ibm.com> <20210628090703.apaowrsazl53lza4@beryllium.lan> <71d1ce491ed5056bfa921f0e14fa646d@imap.linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 29, 2021 at 11:47:55AM +0800, Ming Lei wrote: > > >>data.ctx = __blk_mq_get_ctx(q, cpu); > > cpu=2048 if hctx_idx = 4 > > Yeah, that is the issue I mentioned, any CPU in hctx->cpumask becomes > offline, please try the following patch and see if it makes a > difference: Given that cpumask_first_and() will return nr_cpu_ids in this case, can't we just bail out here and have to caller handle the error? I am able to reproduce the crash you reported in [1] and the fix [2] here works for me: --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -469,6 +469,8 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, if (!blk_mq_hw_queue_mapped(data.hctx)) goto out_queue_exit; cpu = cpumask_first_and(data.hctx->cpumask, cpu_online_mask); + if (cpu >= nr_cpu_ids) + goto out_queue_exit; data.ctx = __blk_mq_get_ctx(q, cpu); if (!q->elevator) [1] https://lore.kernel.org/linux-block/20191117041233.GA30615@ming.t460p/ [2] https://lore.kernel.org/linux-block/20210608183339.70609-1-dwagner@suse.de/