Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1999610ybl; Tue, 3 Dec 2019 16:29:46 -0800 (PST) X-Google-Smtp-Source: APXvYqy97XA2gpl/7ayKWnjMdfBh9IRKmngRXi9Dhk6KZf4inDWHKdaxWxjKSyXIbc0AnUNJ+Bw3 X-Received: by 2002:aca:d6d2:: with SMTP id n201mr408672oig.112.1575419386210; Tue, 03 Dec 2019 16:29:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575419386; cv=none; d=google.com; s=arc-20160816; b=u/5hK0uRkJGpog5wkkVs9CF3O7tKSojgNZ1UOPKKVeRRJ7fl08Us2Hq3gLHUjfaNkO kY4JsW5HyFIw6RkI+8Y3uTBcUti8gtD54OKN5plq6vTeX9VC8o08JHMOupkbC4swlcjh 4yCBMyKM+2rTxr4YZIuWuioQ4FbU/mWxMimwIN5jLjc+agLI1By83Zhn23wsoL8fyl1/ fff6XVAm+oSwQ+8Ag9JhqIzhxPkfzvYZaRN2f5+9rQoD+BL3vieGyNYfspgm3BzVuCHh k2sR1yrta5D/2FWq3tNsYpgrs9fQ/IHInwgE76FWdKK1SuMr1jPs5S08khYjOEeJiUrx I50A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:cc; bh=yK9Tt6tulttI7A+V14b4pBZyPisz/w4G5N21Df7kHg0=; b=C8MtSyVx985u8YPje13cbcCNgjBmdtF/OsgMYpy7DdSDjC1UUqD0fTEqZJHeTyAkS5 tB4MXATCQ2yV4pTFsy0xk6NYIrVJSovvySztPqXjnaNoF3RokVCFwZkvI1d+80Tp8ERN oo4NUZTJZLtZjaGO0L0NGJEIzhNUPbxyorjhs09YYpjOEcR8awFatfLqv06b01AKT1xy xoSIvB2m9o7/z+fOd4AYE2IeoGDWoxP8V7H1FfEa9RWd1cq3FZJdp3AQ1Pw9ByZYaABY DiVeJrhoB5rtcEe7LBOp03DSkDH6quIlSMn3V3kmGpLvza7b0cYCKWhD7yv7uSr0gwCH JRLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i205si2309312oih.277.2019.12.03.16.29.18; Tue, 03 Dec 2019 16:29:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726131AbfLDA1t (ORCPT + 99 others); Tue, 3 Dec 2019 19:27:49 -0500 Received: from mga07.intel.com ([134.134.136.100]:21712 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726024AbfLDA1t (ORCPT ); Tue, 3 Dec 2019 19:27:49 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2019 16:27:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,275,1571727600"; d="scan'208";a="223028262" Received: from allen-box.sh.intel.com (HELO [10.239.159.136]) ([10.239.159.136]) by orsmga002.jf.intel.com with ESMTP; 03 Dec 2019 16:27:46 -0800 Cc: baolu.lu@linux.intel.com, ashok.raj@intel.com, jacob.jun.pan@linux.intel.com, kevin.tian@intel.com, Eric Auger , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/5] iommu/vt-d: Consolidate various cache flush ops To: David Woodhouse , Joerg Roedel References: <20191122030449.28892-1-baolu.lu@linux.intel.com> <22759c43f440eecee60b2d318b6f8e8fe2587bcb.camel@infradead.org> From: Lu Baolu Message-ID: <4100ad7a-0818-7fc1-aaf5-bf0ef44f3f54@linux.intel.com> Date: Wed, 4 Dec 2019 08:27:10 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: <22759c43f440eecee60b2d318b6f8e8fe2587bcb.camel@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi David, On 12/3/19 4:49 PM, David Woodhouse wrote: > On Fri, 2019-11-22 at 11:04 +0800, Lu Baolu wrote: >> Intel VT-d 3.0 introduces more caches and interfaces for software to >> flush when it runs in the scalable mode. Currently various cache flush >> helpers are scattered around. This consolidates them by putting them in >> the existing iommu_flush structure. >> >> /* struct iommu_flush - Intel IOMMU cache invalidation ops >> * >> * @cc_inv: invalidate context cache >> * @iotlb_inv: Invalidate IOTLB and paging structure caches when software >> * has changed second-level tables. >> * @p_iotlb_inv: Invalidate IOTLB and paging structure caches when software >> * has changed first-level tables. >> * @pc_inv: invalidate pasid cache >> * @dev_tlb_inv: invalidate cached mappings used by requests-without-PASID >> * from the Device-TLB on a endpoint device. >> * @p_dev_tlb_inv: invalidate cached mappings used by requests-with-PASID >> * from the Device-TLB on an endpoint device >> */ >> struct iommu_flush { >> void (*cc_inv)(struct intel_iommu *iommu, u16 did, >> u16 sid, u8 fm, u64 type); >> void (*iotlb_inv)(struct intel_iommu *iommu, u16 did, u64 addr, >> unsigned int size_order, u64 type); >> void (*p_iotlb_inv)(struct intel_iommu *iommu, u16 did, u32 pasid, >> u64 addr, unsigned long npages, bool ih); >> void (*pc_inv)(struct intel_iommu *iommu, u16 did, u32 pasid, >> u64 granu); >> void (*dev_tlb_inv)(struct intel_iommu *iommu, u16 sid, u16 pfsid, >> u16 qdep, u64 addr, unsigned int mask); >> void (*p_dev_tlb_inv)(struct intel_iommu *iommu, u16 sid, u16 pfsid, >> u32 pasid, u16 qdep, u64 addr, >> unsigned long npages); >> }; >> >> The name of each cache flush ops is defined according to the spec section 6.5 >> so that people are easy to look up them in the spec. > > Hm, indirect function calls are quite expensive these days. Good consideration. Thanks! > > I would have preferred to go in the opposite direction, since surely > aren't going to have *many* of these implementations. Currently there's > only one for register-based and one for queued invalidation, right? > Even if VT-d 3.0 throws an extra version in, I think I'd prefer to take > out the indirection completely and have an if/then helper. > > Would love to see a microbenchmark of unmap operations before and after > this patch series with retpoline enabled, to see the effect. Yes. Need some micro-bench tests to address the concern. Best regards, baolu