Commit 73f23a29 authored by Tom Zanussi's avatar Tom Zanussi Committed by Xiaochen Shen
Browse files

crypto: iaa - Remove comp/decomp delay statistics

mainline inclusion
from mainline-v6.10-rc1
commit 956cb8a37039306379a1a926ccb1b55e08ffae80
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I9TA1S
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=956cb8a37039306379a1a926ccb1b55e08ffae80



--------------------------------

As part of the simplification/cleanup of the iaa statistics, remove
the comp/decomp delay statistics.

They're actually not really useful and can be/are being more flexibly
generated using standard kernel tracing infrastructure.

Intel-SIG: commit 956cb8a37039 crypto: iaa - Remove comp/decomp delay statistics.
Backporting patches for Intel IAA crypto driver on Intel Xeon platform.

Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarXiaochen Shen <xiaochen.shen@intel.com>
parent 4af3fbbe
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -1498,7 +1498,6 @@ static int iaa_comp_acompress(struct acomp_req *req)
	u32 compression_crc;
	struct idxd_wq *wq;
	struct device *dev;
	u64 start_time_ns;
	int order = -1;

	compression_ctx = crypto_tfm_ctx(tfm);
@@ -1572,10 +1571,8 @@ static int iaa_comp_acompress(struct acomp_req *req)
		" req->dlen %d, sg_dma_len(sg) %d\n", dst_addr, nr_sgs,
		req->dst, req->dlen, sg_dma_len(req->dst));

	start_time_ns = iaa_get_ts();
	ret = iaa_compress(tfm, req, wq, src_addr, req->slen, dst_addr,
			   &req->dlen, &compression_crc, disable_async);
	update_max_comp_delay_ns(start_time_ns);
	if (ret == -EINPROGRESS)
		return ret;

@@ -1622,7 +1619,6 @@ static int iaa_comp_adecompress_alloc_dest(struct acomp_req *req)
	struct iaa_wq *iaa_wq;
	struct device *dev;
	struct idxd_wq *wq;
	u64 start_time_ns;
	int order = -1;

	cpu = get_cpu();
@@ -1679,10 +1675,8 @@ static int iaa_comp_adecompress_alloc_dest(struct acomp_req *req)
	dev_dbg(dev, "dma_map_sg, dst_addr %llx, nr_sgs %d, req->dst %p,"
		" req->dlen %d, sg_dma_len(sg) %d\n", dst_addr, nr_sgs,
		req->dst, req->dlen, sg_dma_len(req->dst));
	start_time_ns = iaa_get_ts();
	ret = iaa_decompress(tfm, req, wq, src_addr, req->slen,
			     dst_addr, &req->dlen, true);
	update_max_decomp_delay_ns(start_time_ns);
	if (ret == -EOVERFLOW) {
		dma_unmap_sg(dev, req->dst, sg_nents(req->dst), DMA_FROM_DEVICE);
		req->dlen *= 2;
@@ -1713,7 +1707,6 @@ static int iaa_comp_adecompress(struct acomp_req *req)
	int nr_sgs, cpu, ret = 0;
	struct iaa_wq *iaa_wq;
	struct device *dev;
	u64 start_time_ns;
	struct idxd_wq *wq;

	if (!iaa_crypto_enabled) {
@@ -1773,10 +1766,8 @@ static int iaa_comp_adecompress(struct acomp_req *req)
		" req->dlen %d, sg_dma_len(sg) %d\n", dst_addr, nr_sgs,
		req->dst, req->dlen, sg_dma_len(req->dst));

	start_time_ns = iaa_get_ts();
	ret = iaa_decompress(tfm, req, wq, src_addr, req->slen,
			     dst_addr, &req->dlen, false);
	update_max_decomp_delay_ns(start_time_ns);
	if (ret == -EINPROGRESS)
		return ret;

+0 −28
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@
static u64 total_comp_calls;
static u64 total_decomp_calls;
static u64 total_sw_decomp_calls;
static u64 max_comp_delay_ns;
static u64 max_decomp_delay_ns;
static u64 total_comp_bytes_out;
static u64 total_decomp_bytes_in;
static u64 total_completion_einval_errors;
@@ -70,26 +68,6 @@ void update_completion_comp_buf_overflow_errs(void)
	total_completion_comp_buf_overflow_errors++;
}

void update_max_comp_delay_ns(u64 start_time_ns)
{
	u64 time_diff;

	time_diff = ktime_get_ns() - start_time_ns;

	if (time_diff > max_comp_delay_ns)
		max_comp_delay_ns = time_diff;
}

void update_max_decomp_delay_ns(u64 start_time_ns)
{
	u64 time_diff;

	time_diff = ktime_get_ns() - start_time_ns;

	if (time_diff > max_decomp_delay_ns)
		max_decomp_delay_ns = time_diff;
}

void update_wq_comp_calls(struct idxd_wq *idxd_wq)
{
	struct iaa_wq *wq = idxd_wq_get_private(idxd_wq);
@@ -127,8 +105,6 @@ static void reset_iaa_crypto_stats(void)
	total_comp_calls = 0;
	total_decomp_calls = 0;
	total_sw_decomp_calls = 0;
	max_comp_delay_ns = 0;
	max_decomp_delay_ns = 0;
	total_comp_bytes_out = 0;
	total_decomp_bytes_in = 0;
	total_completion_einval_errors = 0;
@@ -252,10 +228,6 @@ int __init iaa_crypto_debugfs_init(void)

	iaa_crypto_debugfs_root = debugfs_create_dir("iaa_crypto", NULL);

	debugfs_create_u64("max_comp_delay_ns", 0644,
			   iaa_crypto_debugfs_root, &max_comp_delay_ns);
	debugfs_create_u64("max_decomp_delay_ns", 0644,
			   iaa_crypto_debugfs_root, &max_decomp_delay_ns);
	debugfs_create_u64("total_comp_calls", 0644,
			   iaa_crypto_debugfs_root, &total_comp_calls);
	debugfs_create_u64("total_decomp_calls", 0644,
+0 −8
Original line number Diff line number Diff line
@@ -13,8 +13,6 @@ void update_total_comp_bytes_out(int n);
void	update_total_decomp_calls(void);
void	update_total_sw_decomp_calls(void);
void	update_total_decomp_bytes_in(int n);
void	update_max_comp_delay_ns(u64 start_time_ns);
void	update_max_decomp_delay_ns(u64 start_time_ns);
void	update_completion_einval_errs(void);
void	update_completion_timeout_errs(void);
void	update_completion_comp_buf_overflow_errs(void);
@@ -24,8 +22,6 @@ void update_wq_comp_bytes(struct idxd_wq *idxd_wq, int n);
void	update_wq_decomp_calls(struct idxd_wq *idxd_wq);
void	update_wq_decomp_bytes(struct idxd_wq *idxd_wq, int n);

static inline u64	iaa_get_ts(void) { return ktime_get_ns(); }

#else
static inline int	iaa_crypto_debugfs_init(void) { return 0; }
static inline void	iaa_crypto_debugfs_cleanup(void) {}
@@ -35,8 +31,6 @@ static inline void update_total_comp_bytes_out(int n) {}
static inline void	update_total_decomp_calls(void) {}
static inline void	update_total_sw_decomp_calls(void) {}
static inline void	update_total_decomp_bytes_in(int n) {}
static inline void	update_max_comp_delay_ns(u64 start_time_ns) {}
static inline void	update_max_decomp_delay_ns(u64 start_time_ns) {}
static inline void	update_completion_einval_errs(void) {}
static inline void	update_completion_timeout_errs(void) {}
static inline void	update_completion_comp_buf_overflow_errs(void) {}
@@ -46,8 +40,6 @@ static inline void update_wq_comp_bytes(struct idxd_wq *idxd_wq, int n) {}
static inline void	update_wq_decomp_calls(struct idxd_wq *idxd_wq) {}
static inline void	update_wq_decomp_bytes(struct idxd_wq *idxd_wq, int n) {}

static inline u64	iaa_get_ts(void) { return 0; }

#endif // CONFIG_CRYPTO_DEV_IAA_CRYPTO_STATS

#endif