Skip to content

Commit cdb083e

Browse files
tzanussiherbertx
authored andcommitted
crypto: iaa - Fix comp/decomp delay statistics
The comp/decomp delay statistics currently have no callers; somehow they were dropped during refactoring. There originally were also two sets, one for the async algorithm, the other for the synchronous version. Because the synchronous algorithm was dropped, one set should be removed. To keep it consistent with the rest of the stats, and since there's no ambiguity, remove the acomp/adecomp versions. Also add back the callers. Reported-by: Rex Zhang <rex.zhang@intel.com> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 262534d commit cdb083e

File tree

3 files changed

+13
-32
lines changed

3 files changed

+13
-32
lines changed

drivers/crypto/intel/iaa/iaa_crypto_main.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,7 @@ static int iaa_comp_acompress(struct acomp_req *req)
14941494
u32 compression_crc;
14951495
struct idxd_wq *wq;
14961496
struct device *dev;
1497+
u64 start_time_ns;
14971498
int order = -1;
14981499

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

1571+
start_time_ns = iaa_get_ts();
15701572
ret = iaa_compress(tfm, req, wq, src_addr, req->slen, dst_addr,
15711573
&req->dlen, &compression_crc, disable_async);
1574+
update_max_comp_delay_ns(start_time_ns);
15721575
if (ret == -EINPROGRESS)
15731576
return ret;
15741577

@@ -1615,6 +1618,7 @@ static int iaa_comp_adecompress_alloc_dest(struct acomp_req *req)
16151618
struct iaa_wq *iaa_wq;
16161619
struct device *dev;
16171620
struct idxd_wq *wq;
1621+
u64 start_time_ns;
16181622
int order = -1;
16191623

16201624
cpu = get_cpu();
@@ -1671,8 +1675,10 @@ static int iaa_comp_adecompress_alloc_dest(struct acomp_req *req)
16711675
dev_dbg(dev, "dma_map_sg, dst_addr %llx, nr_sgs %d, req->dst %p,"
16721676
" req->dlen %d, sg_dma_len(sg) %d\n", dst_addr, nr_sgs,
16731677
req->dst, req->dlen, sg_dma_len(req->dst));
1678+
start_time_ns = iaa_get_ts();
16741679
ret = iaa_decompress(tfm, req, wq, src_addr, req->slen,
16751680
dst_addr, &req->dlen, true);
1681+
update_max_decomp_delay_ns(start_time_ns);
16761682
if (ret == -EOVERFLOW) {
16771683
dma_unmap_sg(dev, req->dst, sg_nents(req->dst), DMA_FROM_DEVICE);
16781684
req->dlen *= 2;
@@ -1703,6 +1709,7 @@ static int iaa_comp_adecompress(struct acomp_req *req)
17031709
int nr_sgs, cpu, ret = 0;
17041710
struct iaa_wq *iaa_wq;
17051711
struct device *dev;
1712+
u64 start_time_ns;
17061713
struct idxd_wq *wq;
17071714

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

1772+
start_time_ns = iaa_get_ts();
17651773
ret = iaa_decompress(tfm, req, wq, src_addr, req->slen,
17661774
dst_addr, &req->dlen, false);
1775+
update_max_decomp_delay_ns(start_time_ns);
17671776
if (ret == -EINPROGRESS)
17681777
return ret;
17691778

drivers/crypto/intel/iaa/iaa_crypto_stats.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ static u64 total_decomp_calls;
2222
static u64 total_sw_decomp_calls;
2323
static u64 max_comp_delay_ns;
2424
static u64 max_decomp_delay_ns;
25-
static u64 max_acomp_delay_ns;
26-
static u64 max_adecomp_delay_ns;
2725
static u64 total_comp_bytes_out;
2826
static u64 total_decomp_bytes_in;
2927
static u64 total_completion_einval_errors;
@@ -92,26 +90,6 @@ void update_max_decomp_delay_ns(u64 start_time_ns)
9290
max_decomp_delay_ns = time_diff;
9391
}
9492

95-
void update_max_acomp_delay_ns(u64 start_time_ns)
96-
{
97-
u64 time_diff;
98-
99-
time_diff = ktime_get_ns() - start_time_ns;
100-
101-
if (time_diff > max_acomp_delay_ns)
102-
max_acomp_delay_ns = time_diff;
103-
}
104-
105-
void update_max_adecomp_delay_ns(u64 start_time_ns)
106-
{
107-
u64 time_diff;
108-
109-
time_diff = ktime_get_ns() - start_time_ns;
110-
111-
if (time_diff > max_adecomp_delay_ns)
112-
max_adecomp_delay_ns = time_diff;
113-
}
114-
11593
void update_wq_comp_calls(struct idxd_wq *idxd_wq)
11694
{
11795
struct iaa_wq *wq = idxd_wq_get_private(idxd_wq);
@@ -151,8 +129,6 @@ static void reset_iaa_crypto_stats(void)
151129
total_sw_decomp_calls = 0;
152130
max_comp_delay_ns = 0;
153131
max_decomp_delay_ns = 0;
154-
max_acomp_delay_ns = 0;
155-
max_adecomp_delay_ns = 0;
156132
total_comp_bytes_out = 0;
157133
total_decomp_bytes_in = 0;
158134
total_completion_einval_errors = 0;
@@ -280,10 +256,6 @@ int __init iaa_crypto_debugfs_init(void)
280256
iaa_crypto_debugfs_root, &max_comp_delay_ns);
281257
debugfs_create_u64("max_decomp_delay_ns", 0644,
282258
iaa_crypto_debugfs_root, &max_decomp_delay_ns);
283-
debugfs_create_u64("max_acomp_delay_ns", 0644,
284-
iaa_crypto_debugfs_root, &max_comp_delay_ns);
285-
debugfs_create_u64("max_adecomp_delay_ns", 0644,
286-
iaa_crypto_debugfs_root, &max_decomp_delay_ns);
287259
debugfs_create_u64("total_comp_calls", 0644,
288260
iaa_crypto_debugfs_root, &total_comp_calls);
289261
debugfs_create_u64("total_decomp_calls", 0644,

drivers/crypto/intel/iaa/iaa_crypto_stats.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ void update_total_sw_decomp_calls(void);
1515
void update_total_decomp_bytes_in(int n);
1616
void update_max_comp_delay_ns(u64 start_time_ns);
1717
void update_max_decomp_delay_ns(u64 start_time_ns);
18-
void update_max_acomp_delay_ns(u64 start_time_ns);
19-
void update_max_adecomp_delay_ns(u64 start_time_ns);
2018
void update_completion_einval_errs(void);
2119
void update_completion_timeout_errs(void);
2220
void update_completion_comp_buf_overflow_errs(void);
@@ -26,6 +24,8 @@ void update_wq_comp_bytes(struct idxd_wq *idxd_wq, int n);
2624
void update_wq_decomp_calls(struct idxd_wq *idxd_wq);
2725
void update_wq_decomp_bytes(struct idxd_wq *idxd_wq, int n);
2826

27+
static inline u64 iaa_get_ts(void) { return ktime_get_ns(); }
28+
2929
#else
3030
static inline int iaa_crypto_debugfs_init(void) { return 0; }
3131
static inline void iaa_crypto_debugfs_cleanup(void) {}
@@ -37,8 +37,6 @@ static inline void update_total_sw_decomp_calls(void) {}
3737
static inline void update_total_decomp_bytes_in(int n) {}
3838
static inline void update_max_comp_delay_ns(u64 start_time_ns) {}
3939
static inline void update_max_decomp_delay_ns(u64 start_time_ns) {}
40-
static inline void update_max_acomp_delay_ns(u64 start_time_ns) {}
41-
static inline void update_max_adecomp_delay_ns(u64 start_time_ns) {}
4240
static inline void update_completion_einval_errs(void) {}
4341
static inline void update_completion_timeout_errs(void) {}
4442
static inline void update_completion_comp_buf_overflow_errs(void) {}
@@ -48,6 +46,8 @@ static inline void update_wq_comp_bytes(struct idxd_wq *idxd_wq, int n) {}
4846
static inline void update_wq_decomp_calls(struct idxd_wq *idxd_wq) {}
4947
static inline void update_wq_decomp_bytes(struct idxd_wq *idxd_wq, int n) {}
5048

49+
static inline u64 iaa_get_ts(void) { return 0; }
50+
5151
#endif // CONFIG_CRYPTO_DEV_IAA_CRYPTO_STATS
5252

5353
#endif

0 commit comments

Comments
 (0)