Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5268950ybl; Tue, 27 Aug 2019 01:57:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzaksjBg+NyHiKfLAPczgv4yBvbx5pCBwuOTGlRHOjmNVTR5EqFTMgSRmx/vMf4WW4MKy6M X-Received: by 2002:a65:6102:: with SMTP id z2mr193305pgu.391.1566896226410; Tue, 27 Aug 2019 01:57:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566896226; cv=none; d=google.com; s=arc-20160816; b=bWlvXjf/EaLOIgYkxVrNt5p2JULKoViILrS6LzY/+fGM7cubVDTuObf5HwlA1zZ+Hi H9anEaGTocjnwURHUDlZySSxad9eo5/5+QDrxxoWm2/xFI9YmiFctGhjNGX5LkbCAqZy 33sunkLoi0qfjeKr6Dv6aXwSx8UXMg6Jjkdm6fVA51/FP3WvKpNTqUSJMdP7o1azLi8S CvER2lOEa+g99/Om4NmgUwShqu4KVMC0+0Z3UyZJm7SszwuvBrRIfsNYrc8lecNMKh5N rjs0donOLSXLfHsPFVKJ1s21TRfTrFlwtXGnm2JrhEE2AiMdRUx7iATG5vDRaoOFfkJs yg3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lmJhV9+JeJBtLCUjcPQK8xAWG+GSIUaWOGTBarELFpA=; b=gfRfS293A6lME6d4seB6LOjjDV+I9COGBmuLIBhEMgTgwHaml45pCtqmjiPkxIEqd2 Ya5PEUQGUMeGFzKbBNyOZFQ18HruDWkFtxvvMTLCaUPt6yitLN/YWkceiMwV5gP1GHJH GVc/OM42QQbWOcLcSYt/UXdEFpUlyBjz1YTKuHR7Sod8migZrn1Eza/vhdm3aS8tAEtT +7yxpucGrGrFkpbAOXI1PKqk8mC23BtV/DUd2m5e0YHAoa+PsJwXOlKLQo/RbCml8KVG 8KJu1DNuno1VxpI5jCpZjfwAOauAUR8Lo6dUL8cOVjRsQ3Pm28N/OFpZ/Pu93Um0UeA2 CKtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1si11967178pld.28.2019.08.27.01.56.50; Tue, 27 Aug 2019 01:57:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729874AbfH0IyW (ORCPT + 99 others); Tue, 27 Aug 2019 04:54:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49554 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729783AbfH0IyT (ORCPT ); Tue, 27 Aug 2019 04:54:19 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4495D8BA2DA; Tue, 27 Aug 2019 08:54:19 +0000 (UTC) Received: from localhost (ovpn-8-27.pek2.redhat.com [10.72.8.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D0CF5DA8B; Tue, 27 Aug 2019 08:54:18 +0000 (UTC) From: Ming Lei To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Ming Lei , Long Li , Ingo Molnar , Peter Zijlstra , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , John Garry , Hannes Reinecke , linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org Subject: [PATCH 3/4] nvme: pci: pass IRQF_RESCURE_THREAD to request_threaded_irq Date: Tue, 27 Aug 2019 16:53:43 +0800 Message-Id: <20190827085344.30799-4-ming.lei@redhat.com> In-Reply-To: <20190827085344.30799-1-ming.lei@redhat.com> References: <20190827085344.30799-1-ming.lei@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.68]); Tue, 27 Aug 2019 08:54:19 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If one vector is spread on several CPUs, usually the interrupt is only handled on one of these CPUs. Meantime, IO can be issued to the single hw queue from different CPUs concurrently, this way is easy to cause IRQ flood and CPU lockup. Pass IRQF_RESCURE_THREAD in above case for asking genirq to handle interrupt in the rescurd thread when irq flood is detected. Cc: Long Li Cc: Ingo Molnar , Cc: Peter Zijlstra Cc: Keith Busch Cc: Jens Axboe Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: John Garry Cc: Thomas Gleixner Cc: Hannes Reinecke Cc: linux-nvme@lists.infradead.org Cc: linux-scsi@vger.kernel.org Signed-off-by: Ming Lei --- drivers/nvme/host/pci.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 45a80b708ef4..0b8d49470230 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1501,8 +1501,21 @@ static int queue_request_irq(struct nvme_queue *nvmeq) return pci_request_irq(pdev, nvmeq->cq_vector, nvme_irq_check, nvme_irq, nvmeq, "nvme%dq%d", nr, nvmeq->qid); } else { - return pci_request_irq(pdev, nvmeq->cq_vector, nvme_irq, - NULL, nvmeq, "nvme%dq%d", nr, nvmeq->qid); + char *devname; + const struct cpumask *mask; + unsigned long irqflags = IRQF_SHARED; + int vector = pci_irq_vector(pdev, nvmeq->cq_vector); + + devname = kasprintf(GFP_KERNEL, "nvme%dq%d", nr, nvmeq->qid); + if (!devname) + return -ENOMEM; + + mask = pci_irq_get_affinity(pdev, nvmeq->cq_vector); + if (mask && cpumask_weight(mask) > 1) + irqflags |= IRQF_RESCUE_THREAD; + + return request_threaded_irq(vector, nvme_irq, NULL, irqflags, + devname, nvmeq); } } -- 2.20.1