crypto: Intel Analytics Accelerator (IAA) bugfixes
Subsystems (3)
cover crypto: Intel Analytics Accelerator (IAA) bugfixes
Hi Herbert,
Here are a couple of bugfixes for some minor problems discovered while testing.
Thanks,
Tom
Tom Zanussi (2):
crypto: iaa - Fix async_disable descriptor leak
crypto: iaa - Fix comp/decomp delay statistics
drivers/crypto/intel/iaa/iaa_crypto_main.c | 13 ++++++++-- drivers/crypto/intel/iaa/iaa_crypto_stats.c | 28 --------------------- drivers/crypto/intel/iaa/iaa_crypto_stats.h | 8 +++--- 3 files changed, 15 insertions(+), 34 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/2 crypto: iaa - Fix async_disable descriptor leak
The disable_async paths of iaa_compress/decompress() don't free idxd descriptors in the async_disable case. Currently this only happens in the testcases where req->dst is set to null. Add a test to free them in those paths.
--- drivers/crypto/intel/iaa/iaa_crypto_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/intel/iaa/iaa_crypto_main.c +2 -2
@@ -1222,7 +1222,7 @@ static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req, *compression_crc = idxd_desc->iax_completion->crc; -if (!ctx->async_mode) +if (!ctx->async_mode || disable_async)idxd_free_desc (wq, idxd_desc); out:return ret;
@@ -1468,7 +1468,7 @@ static int iaa_decompress(struct crypto_tfm *tfm, struct acomp_req *req, *dlen = req->dlen; -if (!ctx->async_mode) +if (!ctx->async_mode || disable_async)idxd_free_desc (wq, idxd_desc);/* Update stats */
Signature · 1 line
2.34.1
PATCH 2/2 crypto: iaa - Fix comp/decomp delay statistics
In reply to Tom ZanussiThe 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.
--- drivers/crypto/intel/iaa/iaa_crypto_main.c | 9 +++++++ drivers/crypto/intel/iaa/iaa_crypto_stats.c | 28 --------------------- drivers/crypto/intel/iaa/iaa_crypto_stats.h | 8 +++--- 3 files changed, 13 insertions(+), 32 deletions(-)
drivers/crypto/intel/iaa/iaa_crypto_main.c +9 -0
@@ -1494,6 +1494,7 @@ 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);
@@ -1567,8 +1568,10 @@ 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;
@@ -1615,6 +1618,7 @@ 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 ();
@@ -1671,8 +1675,10 @@ 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 ;
@@ -1703,6 +1709,7 @@ 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) {
@@ -1762,8 +1769,10 @@ 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;
drivers/crypto/intel/iaa/iaa_crypto_stats.c +0 -28
@@ -22,8 +22,6 @@ 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 max_acomp_delay_ns; -static u64 max_adecomp_delay_ns;static u64 total_comp_bytes_out;static u64 total_decomp_bytes_in;static u64 total_completion_einval_errors;
@@ -92,26 +90,6 @@ void update_max_decomp_delay_ns(u64 start_time_ns) max_decomp_delay_ns = time_diff; } -void update_max_acomp_delay_ns (u64 start_time_ns) -{ -u64 time_diff; - - time_diff =ktime_get_ns () - start_time_ns; - -if (time_diff > max_acomp_delay_ns) - max_acomp_delay_ns = time_diff; -} - -void update_max_adecomp_delay_ns (u64 start_time_ns) -{ -u64 time_diff; - - time_diff =ktime_get_ns () - start_time_ns; - -if (time_diff > max_adecomp_delay_ns) - max_adecomp_delay_ns = time_diff; -} -void update_wq_comp_calls (struct idxd_wq *idxd_wq) {struct iaa_wq *wq =idxd_wq_get_private (idxd_wq);
@@ -151,8 +129,6 @@ static void reset_iaa_crypto_stats(void) total_sw_decomp_calls =0 ; max_comp_delay_ns =0 ; max_decomp_delay_ns =0 ; - max_acomp_delay_ns =0 ; - max_adecomp_delay_ns =0 ; total_comp_bytes_out =0 ; total_decomp_bytes_in =0 ; total_completion_einval_errors =0 ;
@@ -280,10 +256,6 @@ int __init iaa_crypto_debugfs_init(void) 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 ("max_acomp_delay_ns" ,0644 , - iaa_crypto_debugfs_root, &max_comp_delay_ns); -debugfs_create_u64 ("max_adecomp_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,
drivers/crypto/intel/iaa/iaa_crypto_stats.h +4 -4
@@ -15,8 +15,6 @@ 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_max_acomp_delay_ns (u64 start_time_ns); -void update_max_adecomp_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 );
@@ -26,6 +24,8 @@ 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 ) {}
@@ -37,8 +37,6 @@ 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_max_acomp_delay_ns (u64 start_time_ns) {} -static inline void update_max_adecomp_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 ) {}
@@ -48,6 +46,8 @@ 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
Signature · 1 line
2.34.1
Herbert Xu
maintainerQuoted 9 lines · Tom Zanussi
Hi Herbert,
Here are a couple of bugfixes for some minor problems discovered while testing.
Thanks,
Tom
Quoted 11 lines
Tom Zanussi (2):
crypto: iaa - Fixasync_disabledescriptor leak
crypto: iaa - Fix comp/decomp delay statisticsdrivers/crypto/intel/iaa/iaa_crypto_main.c | 13 ++++++++-- drivers/crypto/intel/iaa/iaa_crypto_stats.c | 28 --------------------- drivers/crypto/intel/iaa/iaa_crypto_stats.h | 8 +++--- 3 files changed, 15 insertions(+), 34 deletions(-)Signature · 1 line
2.34.1
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt