Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6931357rdb; Tue, 2 Jan 2024 20:55:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIzcZO3M1cmC+VFE4adTT70r1TlHKi3FYTdsITnSI3jodr+gLg+lkTP4XReVpD42T5d362 X-Received: by 2002:a05:622a:1787:b0:427:eb7d:46e3 with SMTP id s7-20020a05622a178700b00427eb7d46e3mr14528697qtk.75.1704257719543; Tue, 02 Jan 2024 20:55:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704257719; cv=none; d=google.com; s=arc-20160816; b=TkLQdSYKVhHtxd1daKLJqH3G4bRg69SbnGaGUriqIwGtkLa0g+MZlYlRAIQyQERqri R/0+2QCb7fDW40t5NClX3499ZWOwSpDw9R3HhJQNtQ0AbFgBEtXulwmc7RKmRDuZ0OMd 2WyxKEYzIj1JyW4TDMTpaRAH/gvV+6Hivsn/4bKUF/TsmntDlHtrbVqdksj7yEn8Kblg z8YZDoyW+hqHQe81HvDlGDQqrFS2g03VaTBgIOJr+BthpeSnqEnI8HePBJxoVHRreiAj 7asjR0Iz6URoYrefGtXjb4efLAfe+XPGkazebp2le+jp5VcDBedCSrqaxoONVgQoZw4g lu+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=pSA28r9+inW+Rb9VWft5oawNfyLf55tvqLK3YW5cAd8=; fh=eQ+qIczSSRvz7jVYFyfdSAdSJF6uapvWNDKrT1+uBFM=; b=qLaNaSWt37uZbjUJ1JGcojbyHutCXeR/e9CI3qdARUjH151kMpE7RoGolYLC8EfL5V muu7XVzjMjJK9xiKoIPbPKkGIMP49QDwjgb/SARsVI7TAfF0o7TGy6EdsJoXa2jhXUwl J/T8KNARFgyQhnIxFc9np8SWRL0bJyjvB/FZ4L34JwmrhPXcBLD1okaepbWW65vWpmT3 gLJvR+2NnvnWD9RTmICdi8HWMy/zR+iNAV/eUP7WEz9CvrHL+lVfXVyd8Qb/7Z0aaydA 8RxaywUkOSSr5hM6csYS92AuY02v8bB/eCbDhaiys73FtGCsktNSv+Nj/onfj0sF4ThQ aTZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FHU9OOXF; spf=pass (google.com: domain of linux-kernel+bounces-15156-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15156-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t22-20020a05622a149600b00428366614b1si920016qtx.224.2024.01.02.20.55.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 20:55:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15156-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FHU9OOXF; spf=pass (google.com: domain of linux-kernel+bounces-15156-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15156-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3B73A1C22E44 for ; Wed, 3 Jan 2024 04:55:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 076EE17721; Wed, 3 Jan 2024 04:55:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FHU9OOXF" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EB95171C4 for ; Wed, 3 Jan 2024 04:55:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704257711; x=1735793711; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=xwcgHyf2clMX/2mSlPKtbei8nLICIiRQRSs8SIsGMqc=; b=FHU9OOXFwrKHPkPhvUlnMb+peXqQqNrnrxFoAxBMl24ijCH1aFmWMVbU OKRDtZLM/G5EWLUwxkzUhVkkaIxcDj5t92iQbDDD7s0u+RlSJgzizXjV7 shMTTn26Gm9eIUpNHCe8vC+I2pdbmBLX0kcXVlPk4n4/lu6qlcmbz3ics YuZU1c9nn+tBUQzOcOtQSKH3o7qklyqFbiHVJO2E41EqmCk5CRTdN0+tM 0qJlujC8SISdF0h/QGRFOZ21gaoy/UPpLEQPEq/lAzGQBH7kb+S2/K9e6 Hb6iX3CmZGvavENF5LpAFXNDYtPhYHuU2g01PCFQ5JWXf3/LDXCXWhAwp g==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="3774252" X-IronPort-AV: E=Sophos;i="6.04,326,1695711600"; d="scan'208";a="3774252" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2024 20:55:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1111248794" X-IronPort-AV: E=Sophos;i="6.04,326,1695711600"; d="scan'208";a="1111248794" Received: from ply01-vm-store.bj.intel.com ([10.238.153.201]) by fmsmga005.fm.intel.com with ESMTP; 02 Jan 2024 20:55:08 -0800 From: Ethan Zhao To: robin.murphy@arm.com Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, regressions@lists.linux.dev Subject: [Regression] [iommu/iova] iova_rbtree_lock contended seriously causing performance bottleneck (bisect done; commit found) Date: Tue, 2 Jan 2024 23:55:06 -0500 Message-Id: <20240103045506.1077586-1-haifeng.zhao@linux.intel.com> X-Mailer: git-send-email 2.31.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit flame graph queued_spin_lock_slowpath-------------\ do_raw_spin_lock \ _raw_spin_lock_irqsave \ __alloc_and_insert_iova_range \ alloc_iova_fast \ iommu_dma_alloc_iova \ __iommu_dma_map \ iommu_dma_map_page \ ice_tx_map.isra.0 \ ice_xmit_frame_ring \ dev_hard_start_xmit \ sch_direct_xmit \ __dev_xmit_skb \ __dev_queue_xmit \ ip_finish_output2 \ __ip_queue_xmit \ __tcp_transmit_skb \ tcp_write_xmit \ __tcp_push_pending_frames \ tcp_sendmsg_locked \ tcp_sendmsg \ tcp_sendmsg \ sock_write_iter \ do_iter_readv_writev \ do_iter_write \ vfs_writev \ do_writev \ do_syscall_64 \ entry_SYSCALL_64_after_hwframe \ __GI___writev \ [nginx] \ ngx_linux_sendfile_chain \ ngx_http_write_filter \ ngx_output_chain \ ngx_http_send_response \ ngx_http_script_return_code \ [nginx] \ ngx_http_core_run_phases \ ngx_http_process_request \ Setup: 1. configure server nginx with following nginx.conf (appended to the tail) 2. request server with WRK ./wrk -t 64 -c 1024 -d 40 --latency http://$server_ip:10802/1KB.json Debugging summary: Bisect identified "commit 371d7955e310 iommu/iova: Improve restart logic" as cause. nginx.conf user nginx; worker_processes 16; error_log /var/log/nginx/error.log crit; pid /var/run/nginx.pid; events { worker_connections 4000; use epoll; multi_accept on; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log off; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; keepalive_requests 20480; gzip_min_length 10240; gzip_comp_level 1; gzip_vary on; gzip_disable msie6; gzip_proxied expired no-cache no-store private auth; gzip_types # text/html is always compressed by HttpGzipModule text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml application/atom+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml; reset_timedout_connection on; client_body_timeout 10; send_timeout 2; include /etc/nginx/conf.d/*.conf; server { listen 10802; server_name localhost; location / { root /usr/share/nginx/html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { #root /usr/share/nginx/html; root /ramdisk; } location /1KB.json { return 202 '{"status":"success","result":"\ Hello from NGINX, 2KB test\ Nanchang, which was the capital of Yuzhang Prefecture during the HanDynasty, \ now falls under the jurisdiction of Hongzhou. It straddles the borderof the \ influence of the Ye and Zhen constellations , and is adjacent to theHeng \ and the Lu mountains . The three rivers enfold it like the frontpart \ of a garment and the five lakes encircle it like a girdle. Itcontrols \ nature’s jewels. The radiance of its legendary sword shootsdirectly upward \ between the constellations Niu and Dou. Its talented peopleare outstanding,\ and the spirit of intelligence pervades the place. This wasthe place where Xu \ Ru spent the night on his visit to Chen Fan (10). The mightyHongzhou spreads \ meteors chasing one another.\ "}'; } } } -- 2.31.1