iommu/vt-d: Add cache invalidation latency sampling
Queued invalidation execution time is performance critical and needs to be monitored. This adds code to sample the execution time of IOTLB/ devTLB/ICE cache invalidation. Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/20210520031531.712333-1-baolu.lu@linux.intel.com Link: https://lore.kernel.org/r/20210610020115.1637656-16-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
456bb0b97f
commit
74eb87a0f9
|
@ -34,6 +34,7 @@
|
|||
#include <trace/events/intel_iommu.h>
|
||||
|
||||
#include "../irq_remapping.h"
|
||||
#include "perf.h"
|
||||
|
||||
typedef int (*dmar_res_handler_t)(struct acpi_dmar_header *, void *);
|
||||
struct dmar_res_callback {
|
||||
|
@ -1342,15 +1343,33 @@ int qi_submit_sync(struct intel_iommu *iommu, struct qi_desc *desc,
|
|||
unsigned int count, unsigned long options)
|
||||
{
|
||||
struct q_inval *qi = iommu->qi;
|
||||
s64 devtlb_start_ktime = 0;
|
||||
s64 iotlb_start_ktime = 0;
|
||||
s64 iec_start_ktime = 0;
|
||||
struct qi_desc wait_desc;
|
||||
int wait_index, index;
|
||||
unsigned long flags;
|
||||
int offset, shift;
|
||||
int rc, i;
|
||||
u64 type;
|
||||
|
||||
if (!qi)
|
||||
return 0;
|
||||
|
||||
type = desc->qw0 & GENMASK_ULL(3, 0);
|
||||
|
||||
if ((type == QI_IOTLB_TYPE || type == QI_EIOTLB_TYPE) &&
|
||||
dmar_latency_enabled(iommu, DMAR_LATENCY_INV_IOTLB))
|
||||
iotlb_start_ktime = ktime_to_ns(ktime_get());
|
||||
|
||||
if ((type == QI_DIOTLB_TYPE || type == QI_DEIOTLB_TYPE) &&
|
||||
dmar_latency_enabled(iommu, DMAR_LATENCY_INV_DEVTLB))
|
||||
devtlb_start_ktime = ktime_to_ns(ktime_get());
|
||||
|
||||
if (type == QI_IEC_TYPE &&
|
||||
dmar_latency_enabled(iommu, DMAR_LATENCY_INV_IEC))
|
||||
iec_start_ktime = ktime_to_ns(ktime_get());
|
||||
|
||||
restart:
|
||||
rc = 0;
|
||||
|
||||
|
@ -1425,6 +1444,18 @@ restart:
|
|||
if (rc == -EAGAIN)
|
||||
goto restart;
|
||||
|
||||
if (iotlb_start_ktime)
|
||||
dmar_latency_update(iommu, DMAR_LATENCY_INV_IOTLB,
|
||||
ktime_to_ns(ktime_get()) - iotlb_start_ktime);
|
||||
|
||||
if (devtlb_start_ktime)
|
||||
dmar_latency_update(iommu, DMAR_LATENCY_INV_DEVTLB,
|
||||
ktime_to_ns(ktime_get()) - devtlb_start_ktime);
|
||||
|
||||
if (iec_start_ktime)
|
||||
dmar_latency_update(iommu, DMAR_LATENCY_INV_IEC,
|
||||
ktime_to_ns(ktime_get()) - iec_start_ktime);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue