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

parisc: unify CCIO_COLLECT_STATS implementation

Make it behave in the same manner as SBA_COLLECT_STATS, further
clean ups pending.

authored by

Kyle McMartin and committed by
Kyle McMartin
1e22166c dae2cdf3

+17 -26
+17 -26
drivers/parisc/ccio-dma.c
··· 66 66 #undef DEBUG_CCIO_RUN_SG 67 67 68 68 #ifdef CONFIG_PROC_FS 69 - /* 70 - * CCIO_SEARCH_TIME can help measure how fast the bitmap search is. 71 - * impacts performance though - ditch it if you don't use it. 72 - */ 73 - #define CCIO_SEARCH_TIME 74 - #undef CCIO_MAP_STATS 75 - #else 76 - #undef CCIO_SEARCH_TIME 77 - #undef CCIO_MAP_STATS 69 + /* depends on proc fs support. But costs CPU performance. */ 70 + #undef CCIO_COLLECT_STATS 78 71 #endif 79 72 80 73 #include <linux/proc_fs.h> ··· 232 239 u32 res_size; /* size of resource map in bytes */ 233 240 spinlock_t res_lock; 234 241 235 - #ifdef CCIO_SEARCH_TIME 242 + #ifdef CCIO_COLLECT_STATS 236 243 #define CCIO_SEARCH_SAMPLE 0x100 237 244 unsigned long avg_search[CCIO_SEARCH_SAMPLE]; 238 245 unsigned long avg_idx; /* current index into avg_search */ 239 - #endif 240 - #ifdef CCIO_MAP_STATS 241 246 unsigned long used_pages; 242 247 unsigned long msingle_calls; 243 248 unsigned long msingle_pages; ··· 342 351 unsigned int pages_needed = size >> IOVP_SHIFT; 343 352 unsigned int res_idx; 344 353 unsigned long boundary_size; 345 - #ifdef CCIO_SEARCH_TIME 354 + #ifdef CCIO_COLLECT_STATS 346 355 unsigned long cr_start = mfctl(16); 347 356 #endif 348 357 ··· 397 406 DBG_RES("%s() res_idx %d res_hint: %d\n", 398 407 __func__, res_idx, ioc->res_hint); 399 408 400 - #ifdef CCIO_SEARCH_TIME 409 + #ifdef CCIO_COLLECT_STATS 401 410 { 402 411 unsigned long cr_end = mfctl(16); 403 412 unsigned long tmp = cr_end - cr_start; ··· 407 416 ioc->avg_search[ioc->avg_idx++] = cr_start; 408 417 ioc->avg_idx &= CCIO_SEARCH_SAMPLE - 1; 409 418 #endif 410 - #ifdef CCIO_MAP_STATS 419 + #ifdef CCIO_COLLECT_STATS 411 420 ioc->used_pages += pages_needed; 412 421 #endif 413 422 /* ··· 443 452 DBG_RES("%s(): res_idx: %d pages_mapped %d\n", 444 453 __func__, res_idx, pages_mapped); 445 454 446 - #ifdef CCIO_MAP_STATS 455 + #ifdef CCIO_COLLECT_STATS 447 456 ioc->used_pages -= pages_mapped; 448 457 #endif 449 458 ··· 755 764 size = ALIGN(size + offset, IOVP_SIZE); 756 765 spin_lock_irqsave(&ioc->res_lock, flags); 757 766 758 - #ifdef CCIO_MAP_STATS 767 + #ifdef CCIO_COLLECT_STATS 759 768 ioc->msingle_calls++; 760 769 ioc->msingle_pages += size >> IOVP_SHIFT; 761 770 #endif ··· 819 828 820 829 spin_lock_irqsave(&ioc->res_lock, flags); 821 830 822 - #ifdef CCIO_MAP_STATS 831 + #ifdef CCIO_COLLECT_STATS 823 832 ioc->usingle_calls++; 824 833 ioc->usingle_pages += size >> IOVP_SHIFT; 825 834 #endif ··· 885 894 */ 886 895 #define PIDE_FLAG 0x80000000UL 887 896 888 - #ifdef CCIO_MAP_STATS 897 + #ifdef CCIO_COLLECT_STATS 889 898 #define IOMMU_MAP_STATS 890 899 #endif 891 900 #include "iommu-helpers.h" ··· 929 938 930 939 spin_lock_irqsave(&ioc->res_lock, flags); 931 940 932 - #ifdef CCIO_MAP_STATS 941 + #ifdef CCIO_COLLECT_STATS 933 942 ioc->msg_calls++; 934 943 #endif 935 944 ··· 988 997 DBG_RUN_SG("%s() START %d entries, %08lx,%x\n", 989 998 __func__, nents, sg_virt_addr(sglist), sglist->length); 990 999 991 - #ifdef CCIO_MAP_STATS 1000 + #ifdef CCIO_COLLECT_STATS 992 1001 ioc->usg_calls++; 993 1002 #endif 994 1003 995 1004 while(sg_dma_len(sglist) && nents--) { 996 1005 997 - #ifdef CCIO_MAP_STATS 1006 + #ifdef CCIO_COLLECT_STATS 998 1007 ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT; 999 1008 #endif 1000 1009 ccio_unmap_single(dev, sg_dma_address(sglist), ··· 1039 1048 len += seq_printf(m, "IO PDIR size : %d bytes (%d entries)\n", 1040 1049 total_pages * 8, total_pages); 1041 1050 1042 - #ifdef CCIO_MAP_STATS 1051 + #ifdef CCIO_COLLECT_STATS 1043 1052 len += seq_printf(m, "IO PDIR entries : %ld free %ld used (%d%%)\n", 1044 1053 total_pages - ioc->used_pages, ioc->used_pages, 1045 1054 (int)(ioc->used_pages * 100 / total_pages)); ··· 1048 1057 len += seq_printf(m, "Resource bitmap : %d bytes (%d pages)\n", 1049 1058 ioc->res_size, total_pages); 1050 1059 1051 - #ifdef CCIO_SEARCH_TIME 1060 + #ifdef CCIO_COLLECT_STATS 1052 1061 min = max = ioc->avg_search[0]; 1053 1062 for(j = 0; j < CCIO_SEARCH_SAMPLE; ++j) { 1054 1063 avg += ioc->avg_search[j]; ··· 1061 1070 len += seq_printf(m, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n", 1062 1071 min, avg, max); 1063 1072 #endif 1064 - #ifdef CCIO_MAP_STATS 1073 + #ifdef CCIO_COLLECT_STATS 1065 1074 len += seq_printf(m, "pci_map_single(): %8ld calls %8ld pages (avg %d/1000)\n", 1066 1075 ioc->msingle_calls, ioc->msingle_pages, 1067 1076 (int)((ioc->msingle_pages * 1000)/ioc->msingle_calls)); ··· 1079 1088 len += seq_printf(m, "pci_unmap_sg() : %8ld calls %8ld pages (avg %d/1000)\n\n\n", 1080 1089 ioc->usg_calls, ioc->usg_pages, 1081 1090 (int)((ioc->usg_pages * 1000)/ioc->usg_calls)); 1082 - #endif /* CCIO_MAP_STATS */ 1091 + #endif /* CCIO_COLLECT_STATS */ 1083 1092 1084 1093 ioc = ioc->next; 1085 1094 }