Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp62364lqj; Thu, 11 Apr 2024 09:51:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWjTl1us5ii04GM9KnMINeZpLCAcuXupZ8R3GcMacFEn9U3rpOjXYEqYlM1Q5QBnH6ZkWsdeDKB5wltJYUYV4r8TFIo+V7cYAuiswJLoA== X-Google-Smtp-Source: AGHT+IHNKI27tJptMIH2H669ADPSjoDPLPkm4owq02MkaWIK4hBZkOPnW7nS7MAgqpInWtluDzMB X-Received: by 2002:a05:6a20:1054:b0:1a9:5a2a:7e4e with SMTP id gt20-20020a056a20105400b001a95a2a7e4emr346693pzc.21.1712854315918; Thu, 11 Apr 2024 09:51:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712854315; cv=pass; d=google.com; s=arc-20160816; b=iI6KHhei2CHk9tr1hGJLF+CyQ+t8eCOffaoTJUWFWUHsi82OTAe8Edhumiw5pmKuG/ spvbvnho1KEnJdOpXx1itENoPs4WfHsznmUKavmyEIbzq4OT3tNC640EQMCnIzdLIRP8 gRUWixIGBwpD8xh7BQ4VmevqmfIiJmKV3Qe+0m0JPdHp+MgsfYgHjrMrh3ntEubWNpie UI7dbp2HHreerOKtuef7ghr856jKLb86cwr77Jtx5Uur2D0F7ym/tNklHopUiEvweDc/ 4BQY9VybLOo2ndYGzgOey+Lz5eTvwfx4SBFTiSJjgwTHD8D90QXQNuh5IAUEX314VWYa hGsg== 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=BFwghchx/gHbbJD5vVe2EVSVLBUiJpXNDLGaHwi17xs=; fh=1sXk3Fm8BZWqgnJROOg45OmJm9n2zXA1LqCGHeJqJFU=; b=NZ8JlnXYFRS/Q7JqaPlsXvsa5iXoD/4SJB2qXRU4PGUmDyFLbk3Fk4TVmVeReQdene uMhZAqp2FMOcLsF7L/hni7x+72hfRc6oA9bYv8epXQx807X6tE1/5nq//ZTrGxvU9VW7 Khr8fs4e5rAuCbWRX4kjF+igEy0KyMGswKtXkKwo4wTF9xNlFnF0bFHkOHVvU2Somr2G lKLGfxv2Z0O+YcLOQ6TVLWKw8eAp1hH7XKrNoDIVJeD0sfeUB82Z/nvaJhZOs7qpRQ7K m3p/NKAZaRE5cxDv5jUyusVTjZls/avS66o/5YHCh/BV9iTreMflk5FshxfxcvqLc0P5 2uRg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lAIkcmdA; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-140564-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140564-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bz11-20020a056a02060b00b005f3a866f4f7si1701557pgb.815.2024.04.11.09.51.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 09:51:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140564-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lAIkcmdA; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-140564-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140564-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id BEA0E2854EE for ; Thu, 11 Apr 2024 13:49:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6DA614D703; Thu, 11 Apr 2024 13:48:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lAIkcmdA" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 78E0B14BF8D for ; Thu, 11 Apr 2024 13:48:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712843328; cv=none; b=SioNEkvsoadt4iVCFDHaZMHJkf9ZTr2LH+kkYTYBtAVBSCi3J5BAnx5sfX53rjAMETrNkzZ+1O6hrMmkrLLdcNlMlFeH7li9x27ARvPKawiRD4gaKoXolDYPUpEoRUfC3OYpnDuzo/N2vX5h1D46WwXTNiRw4ycfrqSMb4sXwn4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712843328; c=relaxed/simple; bh=xGNplq0dGEVxNyyn6OExBbLtHPrjPVL/jcM69HeNAH0=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=hckoWSOB+SUmQkJqFAzm9nlZVENEpUuk6XaHu27mGF3wYPAyzldehH8iaYF1wKSQrF9WJxHCL58Uwadi9QF9tdQthtltRJ4vyOTLNKlOvBMx7/s5cqrTuweyaGxs2anX4rLWS92QhgREREUdtVAELQkUXMFcYFgX/iB2TKV7RhM= 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=lAIkcmdA; arc=none smtp.client-ip=198.175.65.19 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=1712843327; x=1744379327; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=xGNplq0dGEVxNyyn6OExBbLtHPrjPVL/jcM69HeNAH0=; b=lAIkcmdA0ZKPczc9O2BZ0Nefd0Om1moAwX0ZTyD0ImWlLqaBpTawj5xO 38nhKNyQ8uFxHCKmWpoXt+3cmhmFtYWq2aQr+D4d6wc4CYN+CNZL+zjyu pbhinKSM6GO58MAlbEvfAuM8ME3TKEeWfqJLOCI+ze0iMrb/XbkZ0timI aQwBBwZMrz6xIHhdRd+U3VeJb7H9Q8QkbWg31APSeB4rFxiJGuGdpCLJu al/z9cyURNE19SqH56C9xKXvu72A+UeRuQkabUeQ2rSoKELsPVjUtOKus plq+1aWqXRXOYBgmIkZaY1mSt0P3/l47+a2M2V2yzV/pjxDLy2p3js5qn g==; X-CSE-ConnectionGUID: pgF9KKSASrq2Fq7BdMvfsA== X-CSE-MsgGUID: zDkFV8/kRieWr+fiaXeC9A== X-IronPort-AV: E=McAfee;i="6600,9927,11041"; a="8127512" X-IronPort-AV: E=Sophos;i="6.07,193,1708416000"; d="scan'208";a="8127512" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2024 06:48:46 -0700 X-CSE-ConnectionGUID: 45GIl950TEyf3UET/I8gYQ== X-CSE-MsgGUID: xZddPnEiSU2/81SAj/BNMQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,193,1708416000"; d="scan'208";a="25373830" Received: from blu2-mobl.ccr.corp.intel.com (HELO [10.124.237.86]) ([10.124.237.86]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2024 06:48:43 -0700 Message-ID: <57d2fe8c-b438-42ae-a1ff-0ba0ee226c37@linux.intel.com> Date: Thu, 11 Apr 2024 21:48:41 +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, Kevin Tian , Yi Liu , Jacob Pan , Joerg Roedel , Will Deacon , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/1] iommu/vt-d: Remove caching mode check before device TLB flush To: Robin Murphy , iommu@lists.linux.dev References: <20240410055823.264501-1-baolu.lu@linux.intel.com> <51055d13-4a72-4000-9a22-b403d8c5b2ff@arm.com> Content-Language: en-US From: Baolu Lu In-Reply-To: <51055d13-4a72-4000-9a22-b403d8c5b2ff@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024/4/11 21:13, Robin Murphy wrote: > On 10/04/2024 6:58 am, Lu Baolu wrote: >> The Caching Mode (CM) of the Intel IOMMU indicates if the hardware >> implementation caches not-present or erroneous translation-structure >> entries except 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. >> >> iommu_flush_iotlb_psi() is called in map and unmap paths. The caching >> mode check before device TLB invalidation will cause device TLB >> invalidation always issued if IOMMU is not running in caching mode. >> This is wrong and causes unnecessary performance overhead. >> >> The removal of caching mode check in intel_flush_iotlb_all() doesn't >> impact anything no matter the IOMMU is working in caching mode or not. >> Commit <29b32839725f> ("iommu/vt-d: Do not use flush-queue when >> caching-mode is on") has already disabled flush-queue for caching mode, >> hence caching mode will never call intel_flush_iotlb_all(). > > Well, technically it might still, at domain creation via > iommu_create_device_direct_mappings(), but domain->has_iotlb_device > should definitely be false at that point ???? Oh! I overlooked that path. :-) Yes. iommu_create_device_direct_mappings() is called before setting the domain to device for intel iommu driver, hence in practice the domain->has_iotlb_device is always false. Best regards, baolu