Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp453596pxv; Fri, 9 Jul 2021 01:39:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlIWFm4nRnaSP/byXM5YzJO221UdDdY5gcZTIxz9nbfbq8MPnxWh++Mv8pcDZCF2eQU1kt X-Received: by 2002:a17:906:615:: with SMTP id s21mr750762ejb.218.1625819981657; Fri, 09 Jul 2021 01:39:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625819981; cv=none; d=google.com; s=arc-20160816; b=MtY/AD8qVl3Qt3Bxuys8EFaPlXTgJ3tIUl1OhMg5CKupcGTFcoHG2ihTl7s3lKKXV6 nsDK7qeTd4zH5Ubds7Pykn6yMVzpEkS71qgBkYyxlyScXUfX8NHvuXrQ+hXypKrWGps4 m9Pthz1BldtJeW35X7JMGZakkrg/5yJT6ialVjXcNbnDdGnc71leU7E4XF1CFPm3mH3f ySpeihVtjZY01rdd3mmtPaIzEWORx/gcO8j7Zkwxdu7TrqZT+kA75IikuumpRAhjfLdb 2i75/yHD0JjgfOVIMcB1HN9dxrlBWYLRZxkzufZN5624ETFaEp3l/xPbhUnKhGQKyJH2 hxxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=z6Hk4bJ8S8lcwyhof3193pL12mlYl2MQc8nr7rUonLc=; b=0vbfxh0rbphMGHL6SN8IcGCnxcohOEVP9NQxXhT+VCiKIuqx3ywXKjF0/VPeTM+UUk 6DoCbmXNCxLlXFJpu7M37v1X4pOI+DL1M/f1SXX4TO7AQsnBJ1d7aNKIR5mURW7lUVRm sPOvBrPGTcclHb+luaPfYQB8rUq3dOVH7AAvIrY6PkgXj4DxAN1s3cz/jI9P4UTX0BWH /8nLK3CFaWp19c7Lik6kBGJOgdB8B18ZFsjta+HOAzkbUACE2FWvjXIMCVR/bDW81X6W dhOpp8N8btmgOZ5x9odHUvIgXOVg1E+qQiLKnDqW5qW0PrSBdBG2OEt6+q6mnd13Fj5w 4hgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I4oKiRbB; 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 m19si4687441ejn.748.2021.07.09.01.39.18; Fri, 09 Jul 2021 01:39:41 -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=I4oKiRbB; 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 S231512AbhGIIlG (ORCPT + 99 others); Fri, 9 Jul 2021 04:41:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:21661 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231361AbhGIIlF (ORCPT ); Fri, 9 Jul 2021 04:41:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625819902; 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; bh=z6Hk4bJ8S8lcwyhof3193pL12mlYl2MQc8nr7rUonLc=; b=I4oKiRbBfwQ5/0j7WJZ48Wc4jyciMQIR50WnjUoqyYoT+F6TMR6vS076yv+oYTO+f/ZvkI pKFQjVKE5nOyITagK49QcakAS+BZM44oKlmREiLwHaw4uz+Yo7p5NORMVJlXse0KuUKJLj 3mNyQbWA3taBXd2dKl7eAtnYGffqAts= 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-442-kW-M2W2pOPeYf3W8V_w2gA-1; Fri, 09 Jul 2021 04:38:21 -0400 X-MC-Unique: kW-M2W2pOPeYf3W8V_w2gA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3EA461018720; Fri, 9 Jul 2021 08:38:20 +0000 (UTC) Received: from T590 (ovpn-13-13.pek2.redhat.com [10.72.13.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C27E5C1A3; Fri, 9 Jul 2021 08:38:13 +0000 (UTC) Date: Fri, 9 Jul 2021 16:38:09 +0800 From: Ming Lei To: linux-nvme@lists.infradead.org, Will Deacon , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org Subject: [bug report] iommu_dma_unmap_sg() is very slow then running IO from remote numa node Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, I observed that NVMe performance is very bad when running fio on one CPU(aarch64) in remote numa node compared with the nvme pci numa node. Please see the test result[1] 327K vs. 34.9K. Latency trace shows that one big difference is in iommu_dma_unmap_sg(), 1111 nsecs vs 25437 nsecs. [1] fio test & results 1) fio test result: - run fio on local CPU taskset -c 0 ~/git/tools/test/nvme/io_uring 10 1 /dev/nvme1n1 4k + fio --bs=4k --ioengine=io_uring --fixedbufs --registerfiles --hipri --iodepth=64 --iodepth_batch_submit=16 --iodepth_batch_complete_min=16 --filename=/dev/nvme1n1 --direct=1 --runtime=10 --numjobs=1 --rw=randread --name=test --group_reporting IOPS: 327K avg latency of iommu_dma_unmap_sg(): 1111 nsecs - run fio on remote CPU taskset -c 80 ~/git/tools/test/nvme/io_uring 10 1 /dev/nvme1n1 4k + fio --bs=4k --ioengine=io_uring --fixedbufs --registerfiles --hipri --iodepth=64 --iodepth_batch_submit=16 --iodepth_batch_complete_min=16 --filename=/dev/nvme1n1 --direct=1 --runtime=10 --numjobs=1 --rw=randread --name=test --group_reporting IOPS: 34.9K avg latency of iommu_dma_unmap_sg(): 25437 nsecs 2) system info [root@ampere-mtjade-04 ~]# lscpu | grep NUMA NUMA node(s): 2 NUMA node0 CPU(s): 0-79 NUMA node1 CPU(s): 80-159 lspci | grep NVMe 0003:01:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983 [root@ampere-mtjade-04 ~]# cat /sys/block/nvme1n1/device/device/numa_node 0 Thanks, Ming