Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3985819pxv; Mon, 28 Jun 2021 18:34:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydMl9zf7Tbxod4mdd8XVB5uWvC9xLeL1tK4hIRw3tqHoJeKaX7TuySG6lUzBZnRTwqL20y X-Received: by 2002:a17:906:2cca:: with SMTP id r10mr729997ejr.298.1624930477441; Mon, 28 Jun 2021 18:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624930477; cv=none; d=google.com; s=arc-20160816; b=gPTQHygwdU1JKO1chs8S43/faxSa6PFxHNMMKE8JQWklmJo8gcnOze09RPeMJ25Y9j t7sRnrt7Paj2PnDU98XXtmBbkfjhONHTYWR5KSE8yWjS8CvFUx3AVJqzBjqd4EOwZBUA Ao747C7Nc7BM8UpbZVS5qgl29oCKvIaqviZmUgHpIv1WXNRrdCEFyjABRpZcmZMON7Cc hDKU3VGE0u2m1dNKApuIxntZwJp9/oFhO+5tnl6dEcVP1xCIO7U9MekuFSnTStu4PHFs LVRI0r4xi8K9bQ5YWS1qNwaXYSsUa4c6UWZEYTET7BPGqajJD59By2MVrXGhW+Gq1vsW BKSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=J83aztfmcvGFx3aprS25WPTJKUaIP1R/fWg4KY+Lskk=; b=HleEJR3AbhokLZTj8glounR9rudPZYHN7wu+dH46ZXBKR/7LrtDVUFyDh5xHSzhoJ1 kx7BNucJZg6dGBcqhGcXfKjXKyIQ/FBO5oBv4LAIo3RiYhmIoDrErFT+e7TZ0L04j/qc BPx+PLYzVNyaHSWZCW1z3bdi3rTO2Kf19CVvVYAP/HdAgJgOcCEGFjQ1YU0+jWv1F8nb HpOi4IhJYlPBa7tXooTO3VpXhIfzVkoDj47qpm+3qzOhEOZv0bwh0CN/90HS522fhULJ fLNduf92cCUszM2rgcSV4Il7ekGxZCMKQfrt+WelRV21XgVT4EMh3nTdq/tcrVdB92zo CtdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CXhgH1LG; 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 z26si18781681ejc.46.2021.06.28.18.34.14; Mon, 28 Jun 2021 18:34: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=CXhgH1LG; 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 S232073AbhF2Bdp (ORCPT + 99 others); Mon, 28 Jun 2021 21:33:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27309 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231947AbhF2Bdn (ORCPT ); Mon, 28 Jun 2021 21:33:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624930276; 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=J83aztfmcvGFx3aprS25WPTJKUaIP1R/fWg4KY+Lskk=; b=CXhgH1LG7wy4eu7LtEGLDT8J6RfayxYou5IkQbyr0bQ9Nr31DIOHzYVPprWVwrHhQ6gfUv uZcTfxagG2kkczmD3Ut+RVSG9Qi8Fx/OfSTSwnhl6Y6rbgtmLwtT5BLffioSCmcJL2g7EJ vyvVbSYXwJMWW4CpOBubk3tXWncKTao= Received: from mail-yb1-f197.google.com (mail-yb1-f197.google.com [209.85.219.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-232-yIZL55dFNP6U5f--yE9sgw-1; Mon, 28 Jun 2021 21:31:15 -0400 X-MC-Unique: yIZL55dFNP6U5f--yE9sgw-1 Received: by mail-yb1-f197.google.com with SMTP id a7-20020a5b00070000b02904ed415d9d84so18690041ybp.0 for ; Mon, 28 Jun 2021 18:31:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=J83aztfmcvGFx3aprS25WPTJKUaIP1R/fWg4KY+Lskk=; b=qwKccsEq1K80HDDsOOhu9eecHVrtGhqIDOQWSgI+KJBKIUx6ZAIXxalnxhles/Azrc dbCHTsw/ZeR6fp/e65emecl3zRoEKxDzRST7spM4VLc1sag0NfHrpnAx92grt+1BHvMO Xr1o6P8NyplCEm+cB1NOKs3X/P5k8/MmDBcCXzNEg5dLKaCeQOJIr/Jb+Vl+/7I+iAF6 Wgwc/LqV0p1OM9V1d+jCeIDWMXzz7ac86bM/nyGBst+hjKDZ+Wfb0pA5QcNuv2EtCWEt ngUGjcjxt5oijro88JiHjyhd/koRy8QePFRMASC+ANTteI3aFlOSBf6dLBJ678+X//1G rokQ== X-Gm-Message-State: AOAM532BgASjUYFcckf7nCaZcGN3gg9VqB6yushhCeqfnOWalaspv0K2 paDlQPgmkU2meYHKcUlF6b9KkuephKJsZzwETxQKgZdUGOcuPyYrRa4rAw1OrybqZUCz4cHDHXp FSvwQ4lT6Law/JPZTEGjzMeeZXVG9G5aY7F6l/Lhb X-Received: by 2002:a25:cccb:: with SMTP id l194mr33056352ybf.310.1624930275042; Mon, 28 Jun 2021 18:31:15 -0700 (PDT) X-Received: by 2002:a25:cccb:: with SMTP id l194mr33056341ybf.310.1624930274874; Mon, 28 Jun 2021 18:31:14 -0700 (PDT) MIME-Version: 1.0 References: <20210625101649.49296-1-dwagner@suse.de> <20210625122156.x5yzoobuaaec5hss@beryllium.lan> In-Reply-To: From: Ming Lei Date: Tue, 29 Jun 2021 09:31:03 +0800 Message-ID: Subject: Re: [PATCH 0/2] Handle update hardware queues and queue freeze more carefully To: Daniel Wagner Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, James Smart , Keith Busch , Jens Axboe , Sagi Grimberg Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 25, 2021 at 9:00 PM Ming Lei wrote: > > On Fri, Jun 25, 2021 at 02:21:56PM +0200, Daniel Wagner wrote: > > On Fri, Jun 25, 2021 at 12:16:47PM +0200, Daniel Wagner wrote: > > > this is a followup on the crash I reported in > > > > > > https://lore.kernel.org/linux-block/20210608183339.70609-1-dwagner@suse.de/ > > > > > > By moving the hardware check up the crash was gone. Unfortuntatly, I > > > don't understand why this fixes the crash. The per-cpu access is > > > crashing but I can't see why the blk_mq_update_nr_hw_queues() is > > > fixing this problem. > > > > > > Even though I can't explain why it fixes it, I think it makes sense to > > > update the hardware queue mapping bevore we recreate the IO > > > queues. Thus I avoided in the commit message to say it fixes > > > something. > > > > I just discussed this with Hannes and we figured out how the crash is > > fixed by moving the blk_mq_update_nr_hw_queues() before the > > nvme_fc_create_hw_io_queues()/nvme_fc_connect_io_queues(). > > > > First of all, blk_mq_update_nr_hw_queues() operates on the normal > > tag_set and not the admin_tag_set. That means when we move the > > blk_mq_update_nr_hw_queues() before the nvme_fc_connect_io_queues(), we > > update the mapping to only CPUs and hwctx which are available. When we > > then do the connect call nvmf_connect_io_queue() we will only allocate > > tags from queues which are not in the BLK_MQ_S_INACTIVE anymore. Hence > > we skip the blk_mq_put_tag() call. > > Your patch just reduces the race window, what if all cpus in > hctx->cpumask become offline when calling blk_mq_alloc_request_hctx()? connect io queues after updating nr_hw_queues can cause correct hctx_idx to be passed to blk_mq_alloc_request_hctx(), so this patch is good, so the patch looks good. Yeah, there is still other issue not covered during cpu hotplug, but that is different with this one. Thanks,