diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2015-04-10 08:33:08 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2015-04-15 06:23:52 -0400 |
commit | 6001018ae8c659e624351d2e73b1272bacd68d6a (patch) | |
tree | 5a489e3a6a65ca05d1b15a27c4f425f8181ca807 /arch/s390 | |
parent | df3044f1ef002c2269b11cb76a1b2bec629732b4 (diff) |
s390/pci: extract software counters from fmb
The software counters are not a part of the function measurement
block. Also we do not check for zdev->fmb != NULL when using these
counters (function measurement can be toggled at runtime). Just move
the software counters to struct zpci_dev.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/include/asm/pci.h | 8 | ||||
-rw-r--r-- | arch/s390/pci/pci.c | 5 | ||||
-rw-r--r-- | arch/s390/pci/pci_debug.c | 21 | ||||
-rw-r--r-- | arch/s390/pci/pci_dma.c | 8 |
4 files changed, 28 insertions, 14 deletions
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h index ef803c202d42..d318e38dcb83 100644 --- a/arch/s390/include/asm/pci.h +++ b/arch/s390/include/asm/pci.h | |||
@@ -44,10 +44,6 @@ struct zpci_fmb { | |||
44 | u64 rpcit_ops; | 44 | u64 rpcit_ops; |
45 | u64 dma_rbytes; | 45 | u64 dma_rbytes; |
46 | u64 dma_wbytes; | 46 | u64 dma_wbytes; |
47 | /* software counters */ | ||
48 | atomic64_t allocated_pages; | ||
49 | atomic64_t mapped_pages; | ||
50 | atomic64_t unmapped_pages; | ||
51 | } __packed __aligned(16); | 47 | } __packed __aligned(16); |
52 | 48 | ||
53 | enum zpci_state { | 49 | enum zpci_state { |
@@ -111,6 +107,10 @@ struct zpci_dev { | |||
111 | /* Function measurement block */ | 107 | /* Function measurement block */ |
112 | struct zpci_fmb *fmb; | 108 | struct zpci_fmb *fmb; |
113 | u16 fmb_update; /* update interval */ | 109 | u16 fmb_update; /* update interval */ |
110 | /* software counters */ | ||
111 | atomic64_t allocated_pages; | ||
112 | atomic64_t mapped_pages; | ||
113 | atomic64_t unmapped_pages; | ||
114 | 114 | ||
115 | enum pci_bus_speed max_bus_speed; | 115 | enum pci_bus_speed max_bus_speed; |
116 | 116 | ||
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 98336200c7b2..281893864e1b 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c | |||
@@ -190,6 +190,11 @@ int zpci_fmb_enable_device(struct zpci_dev *zdev) | |||
190 | return -ENOMEM; | 190 | return -ENOMEM; |
191 | WARN_ON((u64) zdev->fmb & 0xf); | 191 | WARN_ON((u64) zdev->fmb & 0xf); |
192 | 192 | ||
193 | /* reset software counters */ | ||
194 | atomic64_set(&zdev->allocated_pages, 0); | ||
195 | atomic64_set(&zdev->mapped_pages, 0); | ||
196 | atomic64_set(&zdev->unmapped_pages, 0); | ||
197 | |||
193 | args.fmb_addr = virt_to_phys(zdev->fmb); | 198 | args.fmb_addr = virt_to_phys(zdev->fmb); |
194 | return mod_pci(zdev, ZPCI_MOD_FC_SET_MEASURE, 0, &args); | 199 | return mod_pci(zdev, ZPCI_MOD_FC_SET_MEASURE, 0, &args); |
195 | } | 200 | } |
diff --git a/arch/s390/pci/pci_debug.c b/arch/s390/pci/pci_debug.c index 3229a2e570df..97db1a411d54 100644 --- a/arch/s390/pci/pci_debug.c +++ b/arch/s390/pci/pci_debug.c | |||
@@ -31,12 +31,25 @@ static char *pci_perf_names[] = { | |||
31 | "Refresh operations", | 31 | "Refresh operations", |
32 | "DMA read bytes", | 32 | "DMA read bytes", |
33 | "DMA write bytes", | 33 | "DMA write bytes", |
34 | /* software counters */ | 34 | }; |
35 | |||
36 | static char *pci_sw_names[] = { | ||
35 | "Allocated pages", | 37 | "Allocated pages", |
36 | "Mapped pages", | 38 | "Mapped pages", |
37 | "Unmapped pages", | 39 | "Unmapped pages", |
38 | }; | 40 | }; |
39 | 41 | ||
42 | static void pci_sw_counter_show(struct seq_file *m) | ||
43 | { | ||
44 | struct zpci_dev *zdev = m->private; | ||
45 | atomic64_t *counter = &zdev->allocated_pages; | ||
46 | int i; | ||
47 | |||
48 | for (i = 0; i < ARRAY_SIZE(pci_sw_names); i++, counter++) | ||
49 | seq_printf(m, "%26s:\t%llu\n", pci_sw_names[i], | ||
50 | atomic64_read(counter)); | ||
51 | } | ||
52 | |||
40 | static int pci_perf_show(struct seq_file *m, void *v) | 53 | static int pci_perf_show(struct seq_file *m, void *v) |
41 | { | 54 | { |
42 | struct zpci_dev *zdev = m->private; | 55 | struct zpci_dev *zdev = m->private; |
@@ -63,12 +76,8 @@ static int pci_perf_show(struct seq_file *m, void *v) | |||
63 | for (i = 4; i < 6; i++) | 76 | for (i = 4; i < 6; i++) |
64 | seq_printf(m, "%26s:\t%llu\n", | 77 | seq_printf(m, "%26s:\t%llu\n", |
65 | pci_perf_names[i], *(stat + i)); | 78 | pci_perf_names[i], *(stat + i)); |
66 | /* software counters */ | ||
67 | for (i = 6; i < ARRAY_SIZE(pci_perf_names); i++) | ||
68 | seq_printf(m, "%26s:\t%llu\n", | ||
69 | pci_perf_names[i], | ||
70 | atomic64_read((atomic64_t *) (stat + i))); | ||
71 | 79 | ||
80 | pci_sw_counter_show(m); | ||
72 | return 0; | 81 | return 0; |
73 | } | 82 | } |
74 | 83 | ||
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c index 4cbb29a4d615..6fd8d5836138 100644 --- a/arch/s390/pci/pci_dma.c +++ b/arch/s390/pci/pci_dma.c | |||
@@ -300,7 +300,7 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page, | |||
300 | flags |= ZPCI_TABLE_PROTECTED; | 300 | flags |= ZPCI_TABLE_PROTECTED; |
301 | 301 | ||
302 | if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) { | 302 | if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) { |
303 | atomic64_add(nr_pages, &zdev->fmb->mapped_pages); | 303 | atomic64_add(nr_pages, &zdev->mapped_pages); |
304 | return dma_addr + (offset & ~PAGE_MASK); | 304 | return dma_addr + (offset & ~PAGE_MASK); |
305 | } | 305 | } |
306 | 306 | ||
@@ -328,7 +328,7 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr, | |||
328 | zpci_err_hex(&dma_addr, sizeof(dma_addr)); | 328 | zpci_err_hex(&dma_addr, sizeof(dma_addr)); |
329 | } | 329 | } |
330 | 330 | ||
331 | atomic64_add(npages, &zdev->fmb->unmapped_pages); | 331 | atomic64_add(npages, &zdev->unmapped_pages); |
332 | iommu_page_index = (dma_addr - zdev->start_dma) >> PAGE_SHIFT; | 332 | iommu_page_index = (dma_addr - zdev->start_dma) >> PAGE_SHIFT; |
333 | dma_free_iommu(zdev, iommu_page_index, npages); | 333 | dma_free_iommu(zdev, iommu_page_index, npages); |
334 | } | 334 | } |
@@ -357,7 +357,7 @@ static void *s390_dma_alloc(struct device *dev, size_t size, | |||
357 | return NULL; | 357 | return NULL; |
358 | } | 358 | } |
359 | 359 | ||
360 | atomic64_add(size / PAGE_SIZE, &zdev->fmb->allocated_pages); | 360 | atomic64_add(size / PAGE_SIZE, &zdev->allocated_pages); |
361 | if (dma_handle) | 361 | if (dma_handle) |
362 | *dma_handle = map; | 362 | *dma_handle = map; |
363 | return (void *) pa; | 363 | return (void *) pa; |
@@ -370,7 +370,7 @@ static void s390_dma_free(struct device *dev, size_t size, | |||
370 | struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); | 370 | struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); |
371 | 371 | ||
372 | size = PAGE_ALIGN(size); | 372 | size = PAGE_ALIGN(size); |
373 | atomic64_sub(size / PAGE_SIZE, &zdev->fmb->allocated_pages); | 373 | atomic64_sub(size / PAGE_SIZE, &zdev->allocated_pages); |
374 | s390_dma_unmap_pages(dev, dma_handle, size, DMA_BIDIRECTIONAL, NULL); | 374 | s390_dma_unmap_pages(dev, dma_handle, size, DMA_BIDIRECTIONAL, NULL); |
375 | free_pages((unsigned long) pa, get_order(size)); | 375 | free_pages((unsigned long) pa, get_order(size)); |
376 | } | 376 | } |