Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp731066pxv; Thu, 22 Jul 2021 10:42:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrJml3l/b+PlGJmJGZu40/0Q0wcc0hOsbVVZyVcdxxg8hVq2yPupdS54aLftVIfwrBX5Bg X-Received: by 2002:a17:907:6297:: with SMTP id nd23mr957677ejc.62.1626975754621; Thu, 22 Jul 2021 10:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626975754; cv=none; d=google.com; s=arc-20160816; b=fDxRo5OGzhyDaTWwL4Gh7ctEtCsj0IbNbFbrOpwJr+w4Z5FE+CLE53V2QqefWpgMT1 zadEyJe3Q8AUDMwNrfyKK+0tpZKIfi5pI/FdrZFXbFxfD3kNXwL7kTU7Dkgjn96sLOaf 8TliY9VSe07tkGBuGs3ghKW4eIQRmDVt+1MScZqjSJdjBUVdJfO/8JbAiMZsfjT44D/N SjFjAkOtSoORiHveOudohU62DZJMM0k5WX5EknL1KxNiOcRyaa/0w8IEGB2M8x94C0am KAwuexr+adHJPkfaJVGSwEuF0jG6cTkBp9fA+/Vme3+HQVuRsTxRwzRCsKjUTw5IvU/J 7okg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=K8OhZkZfn99/9QTgKneyVW3O0XJ/PQSpzYbC+r67caY=; b=TZMAQxF2tkKSfNKXMxSM+fnf/a8gWu1eDX82J21zUYVlQRGduuw5XLRHWITf57OE3Z bg/31aOd7SQfGCjZhqNp0YTswf3DJsoUrzL0eAyI8wwusT6bch86FPlDpi8L/PhL/jJm xFixMj2wv3o3lxuEbdt2S8+vGJYkR9quL3wsM4AiIsjO0GnMbGi4uuoAz2WXvH2iiuXJ rybbxTBrKaW+x5E7w4G76kIYunGeaphPqqguuiTJFTEO6HY19SnIpB0bTGNKMQ+GkEhp yQBpNlIePbSimGf+U1/kHmKNlJa0jX4SwS68uAiT1ag6cR9sygSErp5vHe5VKkhiFnn5 n/Qw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x7si4001303edd.162.2021.07.22.10.42.09; Thu, 22 Jul 2021 10:42:34 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229514AbhGVQ7w (ORCPT + 99 others); Thu, 22 Jul 2021 12:59:52 -0400 Received: from foss.arm.com ([217.140.110.172]:57742 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbhGVQ7t (ORCPT ); Thu, 22 Jul 2021 12:59:49 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 42693106F; Thu, 22 Jul 2021 10:40:24 -0700 (PDT) Received: from [10.57.36.146] (unknown [10.57.36.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 120373F694; Thu, 22 Jul 2021 10:40:22 -0700 (PDT) Subject: Re: [bug report] iommu_dma_unmap_sg() is very slow then running IO from remote numa node To: Ming Lei , John Garry Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, iommu@lists.linux-foundation.org, Will Deacon , linux-arm-kernel@lists.infradead.org References: <74537f9c-af5f-cd84-60ab-49ca6220310e@huawei.com> <9c929985-4fcb-e65d-0265-34c820b770ea@huawei.com> From: Robin Murphy Message-ID: <0adbe03b-ce26-e4d3-3425-d967bc436ef5@arm.com> Date: Thu, 22 Jul 2021 18:40:18 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-07-22 16:54, Ming Lei wrote: [...] >> If you are still keen to investigate more, then can try either of these: >> >> - add iommu.strict=0 to the cmdline >> >> - use perf record+annotate to find the hotspot >> - For this you need to enable psuedo-NMI with 2x steps: >> CONFIG_ARM64_PSEUDO_NMI=y in defconfig >> Add irqchip.gicv3_pseudo_nmi=1 >> >> See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/Kconfig#n1745 >> Your kernel log should show: >> [ 0.000000] GICv3: Pseudo-NMIs enabled using forced ICC_PMR_EL1 >> synchronisation > > OK, will try the above tomorrow. Thanks, I was also going to suggest the latter, since it's what arm_smmu_cmdq_issue_cmdlist() does with IRQs masked that should be most indicative of where the slowness most likely stems from. FWIW I would expect iommu.strict=0 to give a proportional reduction in SMMU overhead for both cases since it should effectively mean only 1/256 as many invalidations are issued. Could you also check whether the SMMU platform devices have "numa_node" properties exposed in sysfs (and if so whether the values look right), and share all the SMMU output from the boot log? I still suspect that the most significant bottleneck is likely to be MMIO access across chips, incurring the CML/CCIX latency twice for every single read, but it's also possible that the performance of the SMMU itself could be reduced if its NUMA affinity is not described and we end up allocating stuff like pagetables on the wrong node as well. >> But my impression is that this may be a HW implementation issue, considering >> we don't see such a huge drop off on our HW. > > Except for mpere-mtjade, we saw bad nvme performance on ThunderX2® CN99XX too, > but I don't get one CN99XX system to check if the issue is same with > this one. I know Cavium's SMMU implementation didn't support MSIs, so that case would quite possibly lean towards the MMIO polling angle as well (albeit with a very different interconnect). Robin.