Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4211875pxv; Tue, 29 Jun 2021 01:27:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQW+v3A+4u+c/nwVOEh9YRp8LrOpAU1j6AJeyjzTIYlcSNHWMZ4RsQVcdgN0j1TpL/TLdD X-Received: by 2002:a92:1948:: with SMTP id e8mr20723185ilm.77.1624955254349; Tue, 29 Jun 2021 01:27:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624955254; cv=none; d=google.com; s=arc-20160816; b=BfVzXC+uu3y1wo5XHRTYrwAY8MK/Vyq+Xzs71j+azDsgOPUOLrb5bojXOGNelYAHYW M2cXlEsXrHPKpmYXI30+4ioKhEGYC9LXwh1us1JQNtK4qSF1TSAp4/2wNzau/2rjvQj+ UeWSjIi/5v80oTKweMRHVqzNzPJQFgZT38tD4kpX8UyrXuPcNk5Pz15xfrtG7sjUEFGH feDviOL5prNxUixrqr/JgYJXnhNplHmSBODQrBmEp9C8HDoZ+Cqxyqz/wd3xFXzq1+Gd oNivwj/WwEpA6/yivqvSsEX5Zb+Z/srhpxSXwyuUytoP3AgC58AlG6+prNWQRFOMIKU9 EOJQ== 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 :dkim-signature:dkim-signature:dkim-signature; bh=cbMPs8lfp7DAJiGmeNL7OnW/w+tsl+PEThIBkrDu+7k=; b=kwuNUYXmIjMSDo+x9SWtLGMU9G87cqzE3CNdzR5G5eWJlmJxRNY+Fr7/xJNL8/clZo T7ROA4/s1hfRVY8NzzTo2ihH5d6OuYOPXkvHjThK/yOoCoCbSHtN0VjiQOn5JzcNC7Zc ouMPlB8PzeCWn/KKFqLRJFj2/jZNTIbd/GmQPqtZnqa1ZURxnihVIGPIf9pu3dCiG7Nn flOmzWK/SvMi3GsDBYCdYMXlDgBgvEdA4EGAeaFCmulOFNgy6I8vJlw9+6t/gCQI2t+C RDbwvKIAeOJossnbwVAjOr+6qlESTD2jEOYbfzTb4Wf1hLbOY1/79TfBAi35GSMihYt+ DGbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YHP9hlZf; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YHP9hlZf; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=tvOENhi0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si7862743ilj.44.2021.06.29.01.27.16; Tue, 29 Jun 2021 01:27:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YHP9hlZf; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YHP9hlZf; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=tvOENhi0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232416AbhF2I2L (ORCPT + 99 others); Tue, 29 Jun 2021 04:28:11 -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/