Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3364104pxv; Mon, 28 Jun 2021 03:00:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNOfUWHtkS5t/c55jTlbc8eOKQWYvJvhuew9zxBcIVuG1VzP++XeYn3wh2GMvBk5m8qztL X-Received: by 2002:a05:6e02:1313:: with SMTP id g19mr17712712ilr.169.1624874437324; Mon, 28 Jun 2021 03:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624874437; cv=none; d=google.com; s=arc-20160816; b=qWsV25eCy5nDpwzI+qUeDqDGNX7/dR3kjq3oZSNnjB4gw7NDfmnu+LOOKS53f7FF4A qPXW/WR8gIS+BYiyZiaryWPyLiuEGEMa9Kad4aChxjGP5r+0DtefD1WG7o+uwtsgj/iF lHs+5jpIgItzm1QObAQfkordLBEE8ajOe1LDv2QkQh7VZcjIhg8DJaHRLd9Txg8MtC5q MJ2AvJjsWLIzHtiWouaZ01icPCagcaYzWWhic5THSZfHmAoFh9dZJz9wsYAzeR6ZE8y6 0v2rJAtt+yE8vhDWXflhDMrzy6NfbxbY0OhqToYaq3Q0Q7OQvPPdGpWOI4b12GaQGyHa Dgvg== 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=IrFn/tUBdgM6buRsp2WnmFGO1M+EA//1O4IdXwAzE9Q=; b=auoXwYPveAmwlFtod29Oo6n+KjtlWnPAPXrbulYtnydLeJ1UQAkBF/RJs2dIPRciNy s9z+zypPKEOfqWn+P2haHmEo+K54+iErmCvOrPBIDXbrGqgamygX/puudkYx9wZN3G0n wj3TXW5gzXI0pRvb/2Vl7wB+H7sADU0BXovIaVTbKj6qGPdjkvoimFDh52qj4X+ILSC1 y4IGRalsHZPn7NxskQ34DgSuQv6sbJpYrcxHtVRrQFEFQ1KhFx1J6U6rby6gSiOaKYxg yTtnQry8DJzBaNV8k75eR82qAcFkqAraNyoWn1EryGPjx7C6Aq09D7OKeQETx4IWO+c/ bFpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Njk2JfV5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si13451986jaj.24.2021.06.28.03.00.24; Mon, 28 Jun 2021 03:00:37 -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=@redhat.com header.s=mimecast20190719 header.b=Njk2JfV5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232556AbhF1KCS (ORCPT + 99 others); Mon, 28 Jun 2021 06:02:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34589 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232517AbhF1KCR (ORCPT ); Mon, 28 Jun 2021 06:02:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624874391; 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=IrFn/tUBdgM6buRsp2WnmFGO1M+EA//1O4IdXwAzE9Q=; b=Njk2JfV5L+CNSxNOiZTVIjoXLEGCjxGFBqH7D/8YUAs1b3BwYnlbB7EsP979h1rnQHM2f/ V5r4+i4jGzhdDBClAwgiZ/X2KO2L4S96EOaScaKN72KGOeyAu+lSDrUkkV8HN/7PRFEIRC rDZe/wiZZ5lNsEE085/D2JLe5npvSyI= 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-470-nRHq3ep7PdmnzFwgmWsjDA-1; Mon, 28 Jun 2021 05:59:48 -0400 X-MC-Unique: nRHq3ep7PdmnzFwgmWsjDA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 73385100CEC3; Mon, 28 Jun 2021 09:59:46 +0000 (UTC) Received: from T590 (ovpn-12-150.pek2.redhat.com [10.72.12.150]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E6DCC100760F; Mon, 28 Jun 2021 09:59:39 +0000 (UTC) Date: Mon, 28 Jun 2021 17:59:34 +0800 From: Ming Lei To: Daniel Wagner Cc: wenxiong@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, james.smart@broadcom.com, wenxiong@us.ibm.com, sagi@grimberg.me Subject: Re: [PATCH 1/1] block: System crashes when cpu hotplug + bouncing port Message-ID: References: <1624850072-17776-1-git-send-email-wenxiong@linux.vnet.ibm.com> <20210628090703.apaowrsazl53lza4@beryllium.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210628090703.apaowrsazl53lza4@beryllium.lan> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 28, 2021 at 11:07:03AM +0200, Daniel Wagner wrote: > Hi Wen, > > On Sun, Jun 27, 2021 at 10:14:32PM -0500, wenxiong@linux.vnet.ibm.com wrote: > > @@ -468,8 +467,7 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, > > data.hctx = q->queue_hw_ctx[hctx_idx]; > > if (!blk_mq_hw_queue_mapped(data.hctx)) > > goto out_queue_exit; > > - cpu = cpumask_first_and(data.hctx->cpumask, cpu_online_mask); > > - data.ctx = __blk_mq_get_ctx(q, cpu); > > + data.ctx = __blk_mq_get_ctx(q, hctx_idx); > > hctx_idx is just an index, not a CPU id. In this scenario, the hctx_idx > used to lookup the context happens to be valid. I am still a bit > confused why [1] doesn't work for this scenario. [1] is fine from blk-mq viewpoint, but nvme needs to improve the failure handling, otherwise no io queues may be connected in the worst case. > > As Ming pointed out in [2] we need to update cpumask for CPU hotplug I mention there is still hole with your patch, not mean we need to update cpumask. The root cause is that blk-mq doesn't work well on tag allocation from specified hctx(blk_mq_alloc_request_hctx), and blk-mq assumes that any request allocation can't cross hctx inactive/offline, see blk_mq_hctx_notify_offline() and blk_mq_get_tag(). Either the allocated request is completed or new allocation is prevented before the current hctx becomes inactive(any CPU in hctx->cpumask is offline). I tried[1] to move connecting io queue into driver and kill blk_mq_alloc_request_hctx() for addressing this issue, but there is corner case(timeout) not covered. I understand that NVMe's requirement is that connect io queue should be done successfully no matter if the hctx is inactive or not. Sagi, connect me if I am wrong. [1] https://lore.kernel.org/linux-block/fda43a50-a484-dde7-84a1-94ccf9346bdd@broadcom.com/T/#m1e902f69e8503f5e6202945b8b79e5b7252e3689 Thanks, Ming