Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: iaa - Add global_stats file and remove individual stat files

Currently, the wq_stats output also includes the global stats, while
the individual global stats are also available as separate debugfs
files. Since these are all read-only, there's really no reason to
have them as separate files, especially since we already display them
as global stats in the wq_stats. It makes more sense to just add a
separate global_stats file to display those, and remove them from the
wq_stats, as well as removing the individual stats files.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Tom Zanussi and committed by
Herbert Xu
c21fb22d 956cb8a3

+60 -44
+43 -31
Documentation/driver-api/crypto/iaa/iaa-crypto.rst
··· 321 321 322 322 # ls -al /sys/kernel/debug/iaa-crypto/ 323 323 total 0 324 - drwxr-xr-x 2 root root 0 Mar 3 09:35 . 325 - drwx------ 47 root root 0 Mar 3 09:35 .. 326 - -rw-r--r-- 1 root root 0 Mar 3 09:35 max_acomp_delay_ns 327 - -rw-r--r-- 1 root root 0 Mar 3 09:35 max_adecomp_delay_ns 328 - -rw-r--r-- 1 root root 0 Mar 3 09:35 max_comp_delay_ns 329 - -rw-r--r-- 1 root root 0 Mar 3 09:35 max_decomp_delay_ns 330 - -rw-r--r-- 1 root root 0 Mar 3 09:35 stats_reset 331 - -rw-r--r-- 1 root root 0 Mar 3 09:35 total_comp_bytes_out 332 - -rw-r--r-- 1 root root 0 Mar 3 09:35 total_comp_calls 333 - -rw-r--r-- 1 root root 0 Mar 3 09:35 total_decomp_bytes_in 334 - -rw-r--r-- 1 root root 0 Mar 3 09:35 total_decomp_calls 335 - -rw-r--r-- 1 root root 0 Mar 3 09:35 wq_stats 324 + drwxr-xr-x 2 root root 0 Mar 3 07:55 . 325 + drwx------ 53 root root 0 Mar 3 07:55 .. 326 + -rw-r--r-- 1 root root 0 Mar 3 07:55 global_stats 327 + -rw-r--r-- 1 root root 0 Mar 3 07:55 stats_reset 328 + -rw-r--r-- 1 root root 0 Mar 3 07:55 wq_stats 336 329 337 - Most of the above statisticss are self-explanatory. The wq_stats file 338 - shows per-wq stats, a set for each iaa device and wq in addition to 339 - some global stats:: 330 + The global_stats file shows a set of global statistics collected since 331 + the driver has been loaded or reset:: 340 332 341 - # cat wq_stats 333 + # cat global_stats 342 334 global stats: 343 - total_comp_calls: 100 344 - total_decomp_calls: 100 345 - total_comp_bytes_out: 22800 346 - total_decomp_bytes_in: 22800 335 + total_comp_calls: 4300 336 + total_decomp_calls: 4164 337 + total_sw_decomp_calls: 0 338 + total_comp_bytes_out: 5993989 339 + total_decomp_bytes_in: 5993989 347 340 total_completion_einval_errors: 0 348 341 total_completion_timeout_errors: 0 349 - total_completion_comp_buf_overflow_errors: 0 342 + total_completion_comp_buf_overflow_errors: 136 350 343 344 + The wq_stats file shows per-wq stats, a set for each iaa device and wq 345 + in addition to some global stats:: 346 + 347 + # cat wq_stats 351 348 iaa device: 352 349 id: 1 353 350 n_wqs: 1 ··· 376 379 iaa device: 377 380 id: 5 378 381 n_wqs: 1 379 - comp_calls: 100 380 - comp_bytes: 22800 381 - decomp_calls: 100 382 - decomp_bytes: 22800 382 + comp_calls: 1360 383 + comp_bytes: 1999776 384 + decomp_calls: 0 385 + decomp_bytes: 0 383 386 wqs: 384 387 name: iaa_crypto 385 - comp_calls: 100 386 - comp_bytes: 22800 387 - decomp_calls: 100 388 - decomp_bytes: 22800 388 + comp_calls: 1360 389 + comp_bytes: 1999776 390 + decomp_calls: 0 391 + decomp_bytes: 0 389 392 390 - Writing 0 to 'stats_reset' resets all the stats, including the 393 + iaa device: 394 + id: 7 395 + n_wqs: 1 396 + comp_calls: 2940 397 + comp_bytes: 3994213 398 + decomp_calls: 4164 399 + decomp_bytes: 5993989 400 + wqs: 401 + name: iaa_crypto 402 + comp_calls: 2940 403 + comp_bytes: 3994213 404 + decomp_calls: 4164 405 + decomp_bytes: 5993989 406 + ... 407 + 408 + Writing to 'stats_reset' resets all the stats, including the 391 409 per-device and per-wq stats:: 392 410 393 - # echo 0 > stats_reset 411 + # echo 1 > stats_reset 394 412 # cat wq_stats 395 413 global stats: 396 414 total_comp_calls: 0
+17 -13
drivers/crypto/intel/iaa/iaa_crypto_stats.c
··· 159 159 wq_show(m, iaa_wq); 160 160 } 161 161 162 - static void global_stats_show(struct seq_file *m) 162 + static int global_stats_show(struct seq_file *m, void *v) 163 163 { 164 164 seq_puts(m, "global stats:\n"); 165 165 seq_printf(m, " total_comp_calls: %llu\n", total_comp_calls); ··· 173 173 total_completion_timeout_errors); 174 174 seq_printf(m, " total_completion_comp_buf_overflow_errors: %llu\n\n", 175 175 total_completion_comp_buf_overflow_errors); 176 + 177 + return 0; 176 178 } 177 179 178 180 static int wq_stats_show(struct seq_file *m, void *v) ··· 182 180 struct iaa_device *iaa_device; 183 181 184 182 mutex_lock(&iaa_devices_lock); 185 - 186 - global_stats_show(m); 187 183 188 184 list_for_each_entry(iaa_device, &iaa_devices, list) 189 185 device_stats_show(m, iaa_device); ··· 219 219 .release = single_release, 220 220 }; 221 221 222 + static int global_stats_open(struct inode *inode, struct file *file) 223 + { 224 + return single_open(file, global_stats_show, file); 225 + } 226 + 227 + static const struct file_operations global_stats_fops = { 228 + .open = global_stats_open, 229 + .read = seq_read, 230 + .llseek = seq_lseek, 231 + .release = single_release, 232 + }; 233 + 222 234 DEFINE_DEBUGFS_ATTRIBUTE(wq_stats_reset_fops, NULL, iaa_crypto_stats_reset, "%llu\n"); 223 235 224 236 int __init iaa_crypto_debugfs_init(void) ··· 240 228 241 229 iaa_crypto_debugfs_root = debugfs_create_dir("iaa_crypto", NULL); 242 230 243 - debugfs_create_u64("total_comp_calls", 0644, 244 - iaa_crypto_debugfs_root, &total_comp_calls); 245 - debugfs_create_u64("total_decomp_calls", 0644, 246 - iaa_crypto_debugfs_root, &total_decomp_calls); 247 - debugfs_create_u64("total_sw_decomp_calls", 0644, 248 - iaa_crypto_debugfs_root, &total_sw_decomp_calls); 249 - debugfs_create_u64("total_comp_bytes_out", 0644, 250 - iaa_crypto_debugfs_root, &total_comp_bytes_out); 251 - debugfs_create_u64("total_decomp_bytes_in", 0644, 252 - iaa_crypto_debugfs_root, &total_decomp_bytes_in); 231 + debugfs_create_file("global_stats", 0644, iaa_crypto_debugfs_root, NULL, 232 + &global_stats_fops); 253 233 debugfs_create_file("wq_stats", 0644, iaa_crypto_debugfs_root, NULL, 254 234 &wq_stats_fops); 255 235 debugfs_create_file("stats_reset", 0644, iaa_crypto_debugfs_root, NULL,