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

Configure Feed

Select the types of activity you want to include in your feed.

Revert "crypto: tcrypt - Restore multibuffer ahash tests"

This reverts commit c664f034172705a75f3f8a0c409b9bf95b633093.

Remove the multibuffer ahash speed tests again.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

-231
-231
crypto/tcrypt.c
··· 716 716 return crypto_wait_req(ret, wait); 717 717 } 718 718 719 - struct test_mb_ahash_data { 720 - struct scatterlist sg[XBUFSIZE]; 721 - char result[64]; 722 - struct ahash_request *req; 723 - struct crypto_wait wait; 724 - char *xbuf[XBUFSIZE]; 725 - }; 726 - 727 - static inline int do_mult_ahash_op(struct test_mb_ahash_data *data, u32 num_mb, 728 - int *rc) 729 - { 730 - int i, err; 731 - 732 - /* Fire up a bunch of concurrent requests */ 733 - err = crypto_ahash_digest(data[0].req); 734 - 735 - /* Wait for all requests to finish */ 736 - err = crypto_wait_req(err, &data[0].wait); 737 - if (num_mb < 2) 738 - return err; 739 - 740 - for (i = 0; i < num_mb; i++) { 741 - rc[i] = ahash_request_err(data[i].req); 742 - if (rc[i]) { 743 - pr_info("concurrent request %d error %d\n", i, rc[i]); 744 - err = rc[i]; 745 - } 746 - } 747 - 748 - return err; 749 - } 750 - 751 - static int test_mb_ahash_jiffies(struct test_mb_ahash_data *data, int blen, 752 - int secs, u32 num_mb) 753 - { 754 - unsigned long start, end; 755 - int bcount; 756 - int ret = 0; 757 - int *rc; 758 - 759 - rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL); 760 - if (!rc) 761 - return -ENOMEM; 762 - 763 - for (start = jiffies, end = start + secs * HZ, bcount = 0; 764 - time_before(jiffies, end); bcount++) { 765 - ret = do_mult_ahash_op(data, num_mb, rc); 766 - if (ret) 767 - goto out; 768 - } 769 - 770 - pr_cont("%d operations in %d seconds (%llu bytes)\n", 771 - bcount * num_mb, secs, (u64)bcount * blen * num_mb); 772 - 773 - out: 774 - kfree(rc); 775 - return ret; 776 - } 777 - 778 - static int test_mb_ahash_cycles(struct test_mb_ahash_data *data, int blen, 779 - u32 num_mb) 780 - { 781 - unsigned long cycles = 0; 782 - int ret = 0; 783 - int i; 784 - int *rc; 785 - 786 - rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL); 787 - if (!rc) 788 - return -ENOMEM; 789 - 790 - /* Warm-up run. */ 791 - for (i = 0; i < 4; i++) { 792 - ret = do_mult_ahash_op(data, num_mb, rc); 793 - if (ret) 794 - goto out; 795 - } 796 - 797 - /* The real thing. */ 798 - for (i = 0; i < 8; i++) { 799 - cycles_t start, end; 800 - 801 - start = get_cycles(); 802 - ret = do_mult_ahash_op(data, num_mb, rc); 803 - end = get_cycles(); 804 - 805 - if (ret) 806 - goto out; 807 - 808 - cycles += end - start; 809 - } 810 - 811 - pr_cont("1 operation in %lu cycles (%d bytes)\n", 812 - (cycles + 4) / (8 * num_mb), blen); 813 - 814 - out: 815 - kfree(rc); 816 - return ret; 817 - } 818 - 819 - static void test_mb_ahash_speed(const char *algo, unsigned int secs, 820 - struct hash_speed *speed, u32 num_mb) 821 - { 822 - struct test_mb_ahash_data *data; 823 - struct crypto_ahash *tfm; 824 - unsigned int i, j, k; 825 - int ret; 826 - 827 - data = kcalloc(num_mb, sizeof(*data), GFP_KERNEL); 828 - if (!data) 829 - return; 830 - 831 - tfm = crypto_alloc_ahash(algo, 0, 0); 832 - if (IS_ERR(tfm)) { 833 - pr_err("failed to load transform for %s: %ld\n", 834 - algo, PTR_ERR(tfm)); 835 - goto free_data; 836 - } 837 - 838 - for (i = 0; i < num_mb; ++i) { 839 - if (testmgr_alloc_buf(data[i].xbuf)) 840 - goto out; 841 - 842 - crypto_init_wait(&data[i].wait); 843 - 844 - data[i].req = ahash_request_alloc(tfm, GFP_KERNEL); 845 - if (!data[i].req) { 846 - pr_err("alg: hash: Failed to allocate request for %s\n", 847 - algo); 848 - goto out; 849 - } 850 - 851 - 852 - if (i) { 853 - ahash_request_set_callback(data[i].req, 0, NULL, NULL); 854 - ahash_request_chain(data[i].req, data[0].req); 855 - } else 856 - ahash_request_set_callback(data[0].req, 0, 857 - crypto_req_done, 858 - &data[0].wait); 859 - 860 - sg_init_table(data[i].sg, XBUFSIZE); 861 - for (j = 0; j < XBUFSIZE; j++) { 862 - sg_set_buf(data[i].sg + j, data[i].xbuf[j], PAGE_SIZE); 863 - memset(data[i].xbuf[j], 0xff, PAGE_SIZE); 864 - } 865 - } 866 - 867 - pr_info("\ntesting speed of multibuffer %s (%s)\n", algo, 868 - get_driver_name(crypto_ahash, tfm)); 869 - 870 - for (i = 0; speed[i].blen != 0; i++) { 871 - /* For some reason this only tests digests. */ 872 - if (speed[i].blen != speed[i].plen) 873 - continue; 874 - 875 - if (speed[i].blen > XBUFSIZE * PAGE_SIZE) { 876 - pr_err("template (%u) too big for tvmem (%lu)\n", 877 - speed[i].blen, XBUFSIZE * PAGE_SIZE); 878 - goto out; 879 - } 880 - 881 - if (klen) 882 - crypto_ahash_setkey(tfm, tvmem[0], klen); 883 - 884 - for (k = 0; k < num_mb; k++) 885 - ahash_request_set_crypt(data[k].req, data[k].sg, 886 - data[k].result, speed[i].blen); 887 - 888 - pr_info("test%3u " 889 - "(%5u byte blocks,%5u bytes per update,%4u updates): ", 890 - i, speed[i].blen, speed[i].plen, 891 - speed[i].blen / speed[i].plen); 892 - 893 - if (secs) { 894 - ret = test_mb_ahash_jiffies(data, speed[i].blen, secs, 895 - num_mb); 896 - cond_resched(); 897 - } else { 898 - ret = test_mb_ahash_cycles(data, speed[i].blen, num_mb); 899 - } 900 - 901 - 902 - if (ret) { 903 - pr_err("At least one hashing failed ret=%d\n", ret); 904 - break; 905 - } 906 - } 907 - 908 - out: 909 - ahash_request_free(data[0].req); 910 - 911 - for (k = 0; k < num_mb; ++k) 912 - testmgr_free_buf(data[k].xbuf); 913 - 914 - crypto_free_ahash(tfm); 915 - 916 - free_data: 917 - kfree(data); 918 - } 919 - 920 719 static int test_ahash_jiffies_digest(struct ahash_request *req, int blen, 921 720 char *out, int secs) 922 721 { ··· 2381 2582 fallthrough; 2382 2583 case 422: 2383 2584 test_ahash_speed("sm3", sec, generic_hash_speed_template); 2384 - if (mode > 400 && mode < 500) break; 2385 - fallthrough; 2386 - case 450: 2387 - test_mb_ahash_speed("sha1", sec, generic_hash_speed_template, 2388 - num_mb); 2389 - if (mode > 400 && mode < 500) break; 2390 - fallthrough; 2391 - case 451: 2392 - test_mb_ahash_speed("sha256", sec, generic_hash_speed_template, 2393 - num_mb); 2394 - if (mode > 400 && mode < 500) break; 2395 - fallthrough; 2396 - case 452: 2397 - test_mb_ahash_speed("sha512", sec, generic_hash_speed_template, 2398 - num_mb); 2399 - if (mode > 400 && mode < 500) break; 2400 - fallthrough; 2401 - case 453: 2402 - test_mb_ahash_speed("sm3", sec, generic_hash_speed_template, 2403 - num_mb); 2404 - if (mode > 400 && mode < 500) break; 2405 - fallthrough; 2406 - case 454: 2407 - test_mb_ahash_speed("streebog256", sec, 2408 - generic_hash_speed_template, num_mb); 2409 - if (mode > 400 && mode < 500) break; 2410 - fallthrough; 2411 - case 455: 2412 - test_mb_ahash_speed("streebog512", sec, 2413 - generic_hash_speed_template, num_mb); 2414 2585 if (mode > 400 && mode < 500) break; 2415 2586 fallthrough; 2416 2587 case 499: