Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp19818pxb; Wed, 30 Mar 2022 21:41:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDk0MKKMa6ashqb2peKzK6IscduSHc9H1zopqNEkXQHAtgVBzblRJGbmAEHg2bq/+ZbVTP X-Received: by 2002:a05:6a00:885:b0:4f4:17d8:be31 with SMTP id q5-20020a056a00088500b004f417d8be31mr3330009pfj.57.1648701683451; Wed, 30 Mar 2022 21:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648701683; cv=none; d=google.com; s=arc-20160816; b=RK00GFpp9S7PKmLmkpj9CHiZWpU6v3UVlN6DzJ2KbrEB8j/ySNNmagloTvdrbf3ACV ALFgUAbQsskIzn7qPUo+HVPybqiRo8OJeN0YgBEME7UYcCUweg1Bc8JRof5adQpFIC/A Q1hiQIqGAoTHP4YH71/+qcq9bdQs+YRrhHB0SZpoW08z118c5vqKG7PCGhDT2Gkt9xRt cItFizEu5xMiPW+AfHmYBRHH8Lm2TzlT9OGwXAwfMjUPeGla9M0o3XCOlxZ3YF/3ZMRt Dd57zDdnBRJarYArYVKpxm9vJkFDm0/Zuc1gVpYMGWcN0ru73nxGkWGk9/hYsQ5cxRuL RNlg== 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=BRGeuGdupcWZGRGMql1f0NRNcq9Bxr+9k6E13r9VMQI=; b=0dhSOnk4J9oaSQ7rCQ7JLYRLFbRsrEsgUPvJAUnYwRuq1OS5GNXkhS3WickztTp03X eRyQXad5dt8J//JhItmgFC7zxF2myBlskglsTpYWG9I+7HMfmmpcRVmw1oQZFoOvOg7Z mm4mLcbW0ZI0BYh2csC0YkzNaEYju38RVzJCApzr7tcAVVEqEJc7XSBXYkXDMycWycup Ux3Oo/d3zYJfi7wnBZegC0gjuUM6zbvXc55dC+0AF8kqOfllAXx7tWVfo5a1Fy8BH8Xw Dg8OpP8+m+1/Dg+ogoLBBbRL3K3nLIRtW99pcGzA54bemubKEpVnp39S49uiYsglWcBX 5QMg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t11-20020a63b70b000000b003816043f03dsi25286212pgf.562.2022.03.30.21.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 21:41:23 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 558672359EF; Wed, 30 Mar 2022 20:35:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343723AbiC3LqD (ORCPT + 99 others); Wed, 30 Mar 2022 07:46:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343715AbiC3LqC (ORCPT ); Wed, 30 Mar 2022 07:46:02 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98BDC25DA80; Wed, 30 Mar 2022 04:44:15 -0700 (PDT) Received: from fraeml743-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4KT4Jx1ZJdz67MgZ; Wed, 30 Mar 2022 19:41:37 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml743-chm.china.huawei.com (10.206.15.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 30 Mar 2022 13:44:12 +0200 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 30 Mar 2022 12:44:10 +0100 From: John Garry To: , CC: , , John Garry Subject: [PATCH v2] scsi: core: Refine how we set tag_set NUMA node Date: Wed, 30 Mar 2022 19:38:35 +0800 Message-ID: <1648640315-21419-1-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For SCSI hosts which enable host_tagset the NUMA node returned from blk_mq_hw_queue_to_node() is NUMA_NO_NODE always. Then, since in scsi_mq_setup_tags() the default we choose for the tag_set NUMA node is NUMA_NO_NODE, we always evaluate the NUMA node as NUMA_NO_NODE in functions like blk_mq_alloc_rq_map(). The reason we get NUMA_NO_NODE from blk_mq_hw_queue_to_node() is that the hctx_idx passed is BLK_MQ_NO_HCTX_IDX - so we can't match against a (HW) queue mapping index. Improve this by defaulting the tag_set NUMA node to the same NUMA node of the SCSI host DMA dev. Signed-off-by: John Garry --- Difference to v1: - use dev_to_node() diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index f69b77cbf538..8352f90d997d 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -229,10 +229,6 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, if (error) goto fail; - error = scsi_mq_setup_tags(shost); - if (error) - goto fail; - if (!shost->shost_gendev.parent) shost->shost_gendev.parent = dev ? dev : &platform_bus; if (!dma_dev) @@ -240,6 +236,10 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, shost->dma_dev = dma_dev; + error = scsi_mq_setup_tags(shost); + if (error) + goto fail; + /* * Increase usage count temporarily here so that calling * scsi_autopm_put_host() will trigger runtime idle if there is diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index a7788184908e..e14ad193a9c8 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1977,7 +1977,7 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost) tag_set->nr_maps = shost->nr_maps ? : 1; tag_set->queue_depth = shost->can_queue; tag_set->cmd_size = cmd_size; - tag_set->numa_node = NUMA_NO_NODE; + tag_set->numa_node = dev_to_node(shost->dma_dev); tag_set->flags = BLK_MQ_F_SHOULD_MERGE; tag_set->flags |= BLK_ALLOC_POLICY_TO_MQ_FLAG(shost->hostt->tag_alloc_policy); -- 2.26.2