Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp941140rdh; Thu, 26 Oct 2023 23:09:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2UFqDRtwLabcDYkykNW0x1+2yeeFM83gxgk4BpY+hQrMFIV0vVaiLr0i3576MfUg0zsEy X-Received: by 2002:a05:6102:475c:b0:45a:d57c:36f9 with SMTP id ej28-20020a056102475c00b0045ad57c36f9mr1534677vsb.22.1698386968975; Thu, 26 Oct 2023 23:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698386968; cv=none; d=google.com; s=arc-20160816; b=0BzNvhgmp9xrdwru8BACmnQVj9XyIwdiwhJ8/KE8EL9cRRbJtPWYDM0VyLDS56FCg0 xEeWjJ/NgSO3hhYCIEHFe1SS1VXG5nSun5+HG6fAkKTUesbDLuWAYGye1XkNt9USrEMr YDeBQQyFUs5Z6S6DnpfyE9P7eHtJ/ShglYkq5tgAlRCT0/mg3tuwqjXPpoZ5g7+MbcxL Xr3oZX/izh/F59NcmJ2pcbIjLrR4hHfRk5gFqgcKUAFd6pdfS9SftQi1mLJl9bJaEHSM Fnja5/qi9dAjhlB58JBmAK6Rh7qTHbv5705wgAsbou+NqXgsSXkHANrEWvrlDAu5tUe7 9pKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=+DrVyO/lmmzNiD355grMg157EiJ4H0MKLPJHIYM0VSM=; fh=Wm7QmOI3/k/r46K+2wbTdfyBco6/90pWIwp7YFfvaWs=; b=eTklFhmCCijbHvDEX6gcQTP7l7V5qHm+XQ5a9TpWnqG2j7kBjhfn8I8jjlbqVZ7tY3 2+Va2SRiRq46fwDJ+asxoGcusixqgwJiII1bNK2I5U40ur/CL/62CFGmP0J+8g3BPMIG GcQjpuz5zli7Ydw8cAGCkxLC/yzmhKgPppiYl4MD7+itxCz/CCtdTqSTB2y2O0dykFLV YssXS0AI29ZgNjqE2yR3MNjBSjkQ65uk9h6TJfePQjaxxSI42BpyMyRrUbxim6NHNO3X 2KQj/cyaw2wFV1fT9kbEuyofXahWg0u4m8Ipbb33lwUB+je5nrrPi9hpDOi7lG6PUTCy DXSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Hekwgo6j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id g135-20020a25db8d000000b00d9ae190aff1si1809115ybf.451.2023.10.26.23.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 23:09:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Hekwgo6j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CB81A82CFA40; Thu, 26 Oct 2023 23:09:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345144AbjJ0GJR (ORCPT + 99 others); Fri, 27 Oct 2023 02:09:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbjJ0GJQ (ORCPT ); Fri, 27 Oct 2023 02:09:16 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1EB41B2; Thu, 26 Oct 2023 23:09:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698386954; x=1729922954; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=+DrVyO/lmmzNiD355grMg157EiJ4H0MKLPJHIYM0VSM=; b=Hekwgo6jRGDrzcq2saqRM+zqvUIqGMPoYzpyIbMmqbpVLIgLeWr1H5nr pneDqZWAWgR/r6D5BxyPFCRNB0tlu+CDx+k/0mvOBusG46FR7rX9IQelS FS3D1zLWTuVU9wJ55oDA62BLVaDJeaZXbYAfC7XmoCQtcX4nV50xljYLV yhs0aDd961PgIKs4vrp8iV6XkI0+yIGrm/wS5aDe+Lta26qzT0jD1wv5Q CxWEWNOkZjFV/+tWedHMKCY4Pl8PRCaeruxzQPEMR2ITfgS7Nwd65TzBr YgBsctdovK7a2+zU7M0goKeJUtRUugRR5SN6K4NI6A0NYve70ytf1Xxme w==; X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="418823669" X-IronPort-AV: E=Sophos;i="6.03,255,1694761200"; d="scan'208";a="418823669" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 23:09:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,255,1694761200"; d="scan'208";a="708126" Received: from jiaqingh-mobl.ccr.corp.intel.com (HELO [10.93.11.63]) ([10.93.11.63]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 23:08:35 -0700 Message-ID: Date: Fri, 27 Oct 2023 14:09:11 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] iommu: Introduce a rb_tree for looking up device Content-Language: en-US To: Baolu Lu , joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, dwmw2@infradead.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev Cc: jacob.jun.pan@linux.intel.com, kevin.tian@intel.com, yi.y.sun@intel.com, kvm@vger.kernel.org References: <20231024084124.11155-1-jiaqing.huang@intel.com> <5a4c169d-8e42-4609-87db-8b68f04bb0fe@linux.intel.com> From: "Huang, Jiaqing" In-Reply-To: <5a4c169d-8e42-4609-87db-8b68f04bb0fe@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 26 Oct 2023 23:09:26 -0700 (PDT) On 10/24/2023 7:58 PM, Baolu Lu wrote: > On 2023/10/24 16:41, Huang Jiaqing wrote: >> The existing IO page fault handler locates the PCI device by calling >> pci_get_domain_bus_and_slot(), which searches the list of all PCI >> devices until the desired PCI device is found. This is inefficient >> because the algorithm efficiency of searching a list is O(n). In the >> critical path of handling an IO page fault, this is not performance >> friendly given that I/O page fault handling patch is performance >> critical, and parallel heavy dsa_test may cause cpu stuck due to >> the low efficiency and lock competition in current path. >> >> To improve the performance of the IO page fault handler, replace >> pci_get_domain_bus_and_slot() with a local red-black tree. A red-black >> tree is a self-balancing binary search tree, which means that the >> average time complexity of searching a red-black tree is O(log(n)). This >> is significantly faster than O(n), so it can significantly improve the >> performance of the IO page fault handler. >> >> In addition, we can only insert the affected devices (those that have IO >> page fault enabled) into the red-black tree. This can further improve >> the performance of the IO page fault handler. >> >> This series depends on "deliver page faults to user space" patch-set: >> https://lore.kernel.org/linux-iommu/20230928042734.16134-1-baolu.lu@linux.intel.com/ >> > > The note above is not part of the commit message, and should be placed > below the tear line or in the cover letter, if there is one. Will fix, thanks for catching! BRs, Jiaqing