From patchwork Mon Dec 7 13:30:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 339166 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp2807864jai; Mon, 7 Dec 2020 05:35:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLofurM7pLjSjUwAYirCGLuNewjPjpv6W9F3vWcPPvonUeF3XiYomYIG1+KFa9YO0q2Ykx X-Received: by 2002:aa7:c98d:: with SMTP id c13mr20764644edt.188.1607348144957; Mon, 07 Dec 2020 05:35:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607348144; cv=none; d=google.com; s=arc-20160816; b=T9uQQQtzu/EzfWfO6V2lbX0myNNbMNRjf9UJypkhXvIKbe8sEcQu+1aPBoD2foojrw e4up6qSxy2dkExyPoGioBXbbsinlZN09wvXaEwc0yQsNvOxx9HMnvc14mWKQ0NMXrH5/ FRITxbRuw9juduSBJm+YqJSnFywZOvxYbVQh/qd1QhkGx2X4AUeiCdweMWHZ+DwKMfzF 76eoFe+1TVR2mPof2QhiXtzJRW/4Dep+5r06cM/bFgInjBBaNgjXv6TD/FyWo8W6x7k8 SoQM2Af/oUOk2Ycjy2l8wJoGyzcDNqZwpvcYB+HTrExccN/lTmNmuhIPF8l4ZbDFZpVa p5gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=vmLBeWGb4xP+RRmqIvkEQy3Zvhbm4T84Fem7spvAe2U=; b=qiE8jOnKnH4h2YIS2XUVgBpXD97ed1suw4MDlLXcHKBguB5xDySIgBDNdvv2UMJfB6 t8hQl+8BnGB6I7VUVyvWuGpoEpHj1pE50frMGP67504mAv4TNBo6pAyLY7UtwWOpjVz0 S81Ez4B1bB0wi+gZerUe6P82iP17O5PUjPMslqsJtWC5XX8nhcKOawzF+R5JupxhdDhR APejsimeTxmODRPjZhoeC/3R0hC/XI++TbIF40r+HsNLNL+RX5Ouy0BLeHPRlQvZ6fh4 QfixQprxkt6zr8wpxxWxWvHfxsmuj7oftFFcakGWL94ECchxvUjkSSxt/iKqQWDGCDBL 1PZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-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 d64si8338073edd.257.2020.12.07.05.35.44 for ; Mon, 07 Dec 2020 05:35:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726167AbgLGNf0 (ORCPT ); Mon, 7 Dec 2020 08:35:26 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:9028 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725803AbgLGNfY (ORCPT ); Mon, 7 Dec 2020 08:35:24 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CqPRR6nj6zhnrV; Mon, 7 Dec 2020 21:34:11 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Mon, 7 Dec 2020 21:34:34 +0800 From: John Garry To: , CC: , , , , Xiang Chen , John Garry Subject: [PATCH] scsi: hisi_sas: Select a suitable queue for internal IOs Date: Mon, 7 Dec 2020 21:30:55 +0800 Message-ID: <1607347855-59091-1-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Xiang Chen For when managed interrupts are used (and shost->nr_hw_queues is set), a fixed queue - set per-device - is still used for internal IOs. If all the CPUs mapped to that queue are offlined, then the completions for that queue are not serviced and any internal IOs will timeout. Fix by selecting a queue for internal IOs from the queue mapped from the current CPU in this scenario. This is still not ideal, as it does not deal with CPU hotplug for inflight internal IOs, and needs proper support from [0]. [0] https://lore.kernel.org/linux-scsi/20200703130122.111448-1-hare@suse.de/T/#m7d77d049b18f33a24ef206af69ebb66d07440556 Fixes: 8d98416a55eb ("scsi: hisi_sas: Switch v3 hw to MQ") Signed-off-by: Xiang Chen Signed-off-by: John Garry --- Hi Martin, James, This is based on mkp 5.10/scsi-fixes, and please try to include for v5.10, sorry for the lateness, thanks! -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index c8dd8588f800..274ccf18ce2d 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -452,6 +452,12 @@ static int hisi_sas_task_prep(struct sas_task *task, blk_tag = blk_mq_unique_tag(scmd->request); dq_index = blk_mq_unique_tag_to_hwq(blk_tag); *dq_pointer = dq = &hisi_hba->dq[dq_index]; + } else if (hisi_hba->shost->nr_hw_queues) { + struct Scsi_Host *shost = hisi_hba->shost; + struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; + int queue = qmap->mq_map[raw_smp_processor_id()]; + + *dq_pointer = dq = &hisi_hba->dq[queue]; } else { *dq_pointer = dq = sas_dev->dq; } diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 7133ca859b5e..960de375ce69 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -2452,6 +2452,11 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba) rc = -ENOENT; goto free_irq_vectors; } + cq->irq_mask = pci_irq_get_affinity(pdev, i + BASE_VECTORS_V3_HW); + if (!cq->irq_mask) { + dev_err(dev, "could not get cq%d irq affinity!\n", i); + return -ENOENT; + } } return 0;