Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1317456lqp; Mon, 15 Apr 2024 02:43:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV7uRuWx2hoTAIZDKcHCx9bby44L5RARWwoIpwYxXQFVCJ8Iee8zUUjYXdNq8UYDEIrhsLXrrLqe6aZuH9ldpy3NZcFy2TfWwGwLNGw9g== X-Google-Smtp-Source: AGHT+IFtT0+WVvMFGKN+p8yBqW+hl2GROkpSKfWPvHyXSVf+inne29uGM5HqpIFtVTmougAVaI8a X-Received: by 2002:a05:6e02:20e5:b0:36a:203e:6433 with SMTP id q5-20020a056e0220e500b0036a203e6433mr11200766ilv.9.1713174192032; Mon, 15 Apr 2024 02:43:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713174192; cv=pass; d=google.com; s=arc-20160816; b=N/U7sfpq+zzp+TahXR4PRs5d3gvZHqakCC6tERDksLDatCkOCsZaZxNcYwOt8GiI6n 9MVukPVSjNj7Q/Rw2KwLldD2FJJADMApVsKrm+lJ8fhIsXnKOvSyX3O4sscngbwXu+xL +C5JDBNw1hMSgoB5LUZBwTLkBR1NkcI0cR1/Je2V87jtUBBxuY81VxIiUlYCVweSUQtJ vN9ojVaeXzrob8pG5sSKXfX5S15mNnVZONH9BbvOGqfl1eeScvd2NrH0Ehem7vg6MLfw lQTEnY+i69oGc7Ua5T40WQGTD76IPnaNPssrYINLfWFDJypDQACnQRJ7YRQja9kAbeFD ZDSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:cc:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=4CxacAa/1JE3uVPlazNgPCag9G8ov79JLi0kRliGK2M=; fh=cy41LzDBXpcixtrFKP6SXhbINKUAbxTyiTF+lBqbnIg=; b=0kgGT7OhueXuF3fmhSHWNxnmXeUoHsyLSdbH4MDgpR30GktV5GqrTiZu8dHFqPL/xf XBuNpGMwgVrHV9Atfo5RkQk7hzjDmNirgpFUjj8t3+lBUdxDfuRmOXN6lxcaqaSNHGLN LRoc864ZFT0Us0Zc+5OIMimcxkScXVxXyAlOh8yiJXjvrQl7KcBOIr9yCJIDj8RytNSI uwHPWZifQmPH9po1qVQ8mcSfhEiNUGZsM70Oe5mw6geXWpwHopsErA2bgEqFM72MrZXs tKVPUWpUWRLD2P+/8SlTy2Uc1yAxv+JXYXBKg4EzPgyfmDsA2830RJn6lz5Enu565ZIq He/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hkX+Afsp; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-144530-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144530-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id k5-20020a634b45000000b005dc8b2148ccsi7474875pgl.836.2024.04.15.02.43.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 02:43:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144530-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hkX+Afsp; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-144530-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144530-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B4557B21899 for ; Mon, 15 Apr 2024 05:01:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F25DA4A23; Mon, 15 Apr 2024 05:01:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hkX+Afsp" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 7EF2D1367 for ; Mon, 15 Apr 2024 05:01:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713157298; cv=none; b=FFRMh4xc9JPzNWUkoPPq4/LVY3T+2gtTGR8O1YhNiIFFhfkozV8gU1ay64dc6CI6HTJwDiX6o9/UpZbYy737XkJ40gVQaHvOLixANVfj2chM9wdxI1oj83qV41yGhILXKTSU307bM2HjYVEqF3NIFPeQHxohEw24+vyuAkfXDEo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713157298; c=relaxed/simple; bh=Foesuml+1ORyJSj3WNO/ccAGGj85+yXj4BEzJbW4VAQ=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=hy/L99zdYD7MLWEOPTesQ/5ekoL/AXEVPWozUJrEd7N44IPwGQ3HEv+19npPB4m0Q6oO1g13SX17py9up9shpMiXVk0KQ712hGr3wIL7ojAajbzCMim0qYmu0O+rnKjIqyV8zbxVXLZcWLcdLq08sF6wDorhHYpRKeXf9xU7Kl8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hkX+Afsp; arc=none smtp.client-ip=198.175.65.14 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=1713157295; x=1744693295; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=Foesuml+1ORyJSj3WNO/ccAGGj85+yXj4BEzJbW4VAQ=; b=hkX+Afsp69eEFGrGps+QnXiYAMecMF/LRW9cuU6UpfMBX7xm/u3ASuUg BIQf/Y/mK/iaJjnGsfCpMvKviWd3AHt+ee6K3yJC6A2R6mS2DzQlo1tFH alrR6JSNvbbKfJ3UHCfrtS36vdFnJQpxZIHS+Er0iSboiS0be8hv5t7kZ 2ABcZbmgviB3AHUQd91PFV7UGrlqNrC+rQuVM4Y35dv889udyvzq1Usgv EQ2wMNelfNQAMCCCHh9YBS4XoMXn4TgknErYn7MEdFGuWrEV1hm6X4+kI 3xhMT6e50OlJJbeLBS39gzsHfsaZdlcgTegq+Zawl2z5jcyoENN8nk/tj g==; X-CSE-ConnectionGUID: aPAqZYDfRIOG20SIkwy6xg== X-CSE-MsgGUID: EVF/8WGXTN6w6DMZP9qcdw== X-IronPort-AV: E=McAfee;i="6600,9927,11044"; a="12374935" X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="12374935" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2024 22:01:34 -0700 X-CSE-ConnectionGUID: 0Nug+8IlRxO0D/tSm3I2pA== X-CSE-MsgGUID: RVUMpqqXTu2Ljw0X/qGvlg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="21783503" Received: from unknown (HELO [10.239.159.127]) ([10.239.159.127]) by fmviesa010.fm.intel.com with ESMTP; 14 Apr 2024 22:01:33 -0700 Message-ID: Date: Mon, 15 Apr 2024 13:00:20 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: baolu.lu@linux.intel.com, "Tian, Kevin" , Jacob Pan , Joerg Roedel , Will Deacon , Robin Murphy , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 1/1] iommu/vt-d: Remove caching mode check before device TLB flush To: Yi Liu , "Zhang, Tina" , "iommu@lists.linux.dev" References: <20240415013835.9527-1-baolu.lu@linux.intel.com> Content-Language: en-US From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/15/24 10:43 AM, Yi Liu wrote: > On 2024/4/15 10:22, Zhang, Tina wrote: >> >> >>> -----Original Message----- >>> From: Lu Baolu >>> Sent: Monday, April 15, 2024 9:39 AM >>> To: iommu@lists.linux.dev >>> Cc: Tian, Kevin ; Liu, Yi L >>> ; Jacob >>> Pan ; Joerg Roedel ; >>> Will >>> Deacon ; Robin Murphy ; linux- >>> kernel@vger.kernel.org; Lu Baolu >>> Subject: [PATCH v3 1/1] iommu/vt-d: Remove caching mode check before >>> device TLB flush >>> >>> The Caching Mode (CM) of the Intel IOMMU indicates if the hardware >>> implementation caches not-present or erroneous translation-structure >>> entries >>> except for the first-stage translation. The caching mode is >>> irrelevant to the >>> device TLB, therefore there is no need to check it before a device TLB >>> invalidation operation. >>> >>> Remove two caching mode checks before device TLB invalidation in the >>> driver. >>> The removal of these checks doesn't change the driver's behavior in >>> critical >>> map/unmap paths. Hence, there is no functionality or performance impact, >>> especially since commit <29b32839725f> ("iommu/vt-d: >>> Do not use flush-queue when caching-mode is on") has already disabled >>> flush-queue for caching mode. Therefore, caching mode will never call >>> intel_flush_iotlb_all(). >> The current logic is if the caching mode is being used and a domain >> isn't using first level I/O page table, then flush-queue won't be >> used. Otherwise, the flush-queue can be enabled. >> See https://github.com/torvalds/linux/commit/257ec29074 >> >> In other words, if the caching mode is being used and a domain is >> using first level I/O page table, the flush-queue can be used for this >> domain to flush iotlb. Could the code change in this patch bring any >> performance impact to this case? > > This seems to have performance deduction in the nested translation case. > The iommufd nested support bas been merged in 6.8, while the Qemu side > is wip. So this performance deduction does not happen until Qemu is > done. Should this also be considered as a performance regression? TBH. Caching mode is irrelevant to first-stage and nesting translations. If the QEMU implementation still relies on caching mode for nesting support, it's already broken. Best regards, baolu