diff options
author | Tejun Heo <tj@kernel.org> | 2015-02-13 17:37:09 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-14 00:21:37 -0500 |
commit | 839b268033c5d1316b2f8cf49184984e6f335fee (patch) | |
tree | d8b42b5dbfdab5922c422207a2eaad757ac4b6b1 /arch | |
parent | 0c118b7bd09a1d11731ba80421a34ea1105c5b21 (diff) |
tile: use %*pb[l] to print bitmaps including cpumasks and nodemasks
printk and friends can now format bitmaps using '%*pb[l]'. cpumask
and nodemask also provide cpumask_pr_args() and nodemask_pr_args()
respectively which can be used to generate the two printf arguments
necessary to format the specified cpu/nodemask.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/tile/kernel/hardwall.c | 5 | ||||
-rw-r--r-- | arch/tile/kernel/proc.c | 5 | ||||
-rw-r--r-- | arch/tile/kernel/setup.c | 13 | ||||
-rw-r--r-- | arch/tile/mm/homecache.c | 12 | ||||
-rw-r--r-- | arch/tile/mm/init.c | 18 |
5 files changed, 20 insertions, 33 deletions
diff --git a/arch/tile/kernel/hardwall.c b/arch/tile/kernel/hardwall.c index c4646bb99342..2fd1694ac1d0 100644 --- a/arch/tile/kernel/hardwall.c +++ b/arch/tile/kernel/hardwall.c | |||
@@ -909,11 +909,8 @@ static void hardwall_destroy(struct hardwall_info *info) | |||
909 | static int hardwall_proc_show(struct seq_file *sf, void *v) | 909 | static int hardwall_proc_show(struct seq_file *sf, void *v) |
910 | { | 910 | { |
911 | struct hardwall_info *info = sf->private; | 911 | struct hardwall_info *info = sf->private; |
912 | char buf[256]; | ||
913 | 912 | ||
914 | int rc = cpulist_scnprintf(buf, sizeof(buf), &info->cpumask); | 913 | seq_printf(sf, "%*pbl\n", cpumask_pr_args(&info->cpumask)); |
915 | buf[rc++] = '\n'; | ||
916 | seq_write(sf, buf, rc); | ||
917 | return 0; | 914 | return 0; |
918 | } | 915 | } |
919 | 916 | ||
diff --git a/arch/tile/kernel/proc.c b/arch/tile/kernel/proc.c index 6829a9508649..7983e9868df6 100644 --- a/arch/tile/kernel/proc.c +++ b/arch/tile/kernel/proc.c | |||
@@ -45,10 +45,9 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
45 | int n = ptr_to_cpu(v); | 45 | int n = ptr_to_cpu(v); |
46 | 46 | ||
47 | if (n == 0) { | 47 | if (n == 0) { |
48 | char buf[NR_CPUS*5]; | ||
49 | cpulist_scnprintf(buf, sizeof(buf), cpu_online_mask); | ||
50 | seq_printf(m, "cpu count\t: %d\n", num_online_cpus()); | 48 | seq_printf(m, "cpu count\t: %d\n", num_online_cpus()); |
51 | seq_printf(m, "cpu list\t: %s\n", buf); | 49 | seq_printf(m, "cpu list\t: %*pbl\n", |
50 | cpumask_pr_args(cpu_online_mask)); | ||
52 | seq_printf(m, "model name\t: %s\n", chip_model); | 51 | seq_printf(m, "model name\t: %s\n", chip_model); |
53 | seq_printf(m, "flags\t\t:\n"); /* nothing for now */ | 52 | seq_printf(m, "flags\t\t:\n"); /* nothing for now */ |
54 | seq_printf(m, "cpu MHz\t\t: %llu.%06llu\n", | 53 | seq_printf(m, "cpu MHz\t\t: %llu.%06llu\n", |
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c index 864eea69556d..f1f579914952 100644 --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c | |||
@@ -215,12 +215,11 @@ early_param("mem", setup_mem); /* compatibility with x86 */ | |||
215 | 215 | ||
216 | static int __init setup_isolnodes(char *str) | 216 | static int __init setup_isolnodes(char *str) |
217 | { | 217 | { |
218 | char buf[MAX_NUMNODES * 5]; | ||
219 | if (str == NULL || nodelist_parse(str, isolnodes) != 0) | 218 | if (str == NULL || nodelist_parse(str, isolnodes) != 0) |
220 | return -EINVAL; | 219 | return -EINVAL; |
221 | 220 | ||
222 | nodelist_scnprintf(buf, sizeof(buf), isolnodes); | 221 | pr_info("Set isolnodes value to '%*pbl'\n", |
223 | pr_info("Set isolnodes value to '%s'\n", buf); | 222 | nodemask_pr_args(&isolnodes)); |
224 | return 0; | 223 | return 0; |
225 | } | 224 | } |
226 | early_param("isolnodes", setup_isolnodes); | 225 | early_param("isolnodes", setup_isolnodes); |
@@ -1315,11 +1314,9 @@ early_param("disabled_cpus", disabled_cpus); | |||
1315 | 1314 | ||
1316 | void __init print_disabled_cpus(void) | 1315 | void __init print_disabled_cpus(void) |
1317 | { | 1316 | { |
1318 | if (!cpumask_empty(&disabled_map)) { | 1317 | if (!cpumask_empty(&disabled_map)) |
1319 | char buf[100]; | 1318 | pr_info("CPUs not available for Linux: %*pbl\n", |
1320 | cpulist_scnprintf(buf, sizeof(buf), &disabled_map); | 1319 | cpumask_pr_args(&disabled_map)); |
1321 | pr_info("CPUs not available for Linux: %s\n", buf); | ||
1322 | } | ||
1323 | } | 1320 | } |
1324 | 1321 | ||
1325 | static void __init setup_cpu_maps(void) | 1322 | static void __init setup_cpu_maps(void) |
diff --git a/arch/tile/mm/homecache.c b/arch/tile/mm/homecache.c index 0029b3fb651b..40ca30a9fee3 100644 --- a/arch/tile/mm/homecache.c +++ b/arch/tile/mm/homecache.c | |||
@@ -115,7 +115,6 @@ void flush_remote(unsigned long cache_pfn, unsigned long cache_control, | |||
115 | struct cpumask cache_cpumask_copy, tlb_cpumask_copy; | 115 | struct cpumask cache_cpumask_copy, tlb_cpumask_copy; |
116 | struct cpumask *cache_cpumask, *tlb_cpumask; | 116 | struct cpumask *cache_cpumask, *tlb_cpumask; |
117 | HV_PhysAddr cache_pa; | 117 | HV_PhysAddr cache_pa; |
118 | char cache_buf[NR_CPUS*5], tlb_buf[NR_CPUS*5]; | ||
119 | 118 | ||
120 | mb(); /* provided just to simplify "magic hypervisor" mode */ | 119 | mb(); /* provided just to simplify "magic hypervisor" mode */ |
121 | 120 | ||
@@ -149,13 +148,12 @@ void flush_remote(unsigned long cache_pfn, unsigned long cache_control, | |||
149 | asids, asidcount); | 148 | asids, asidcount); |
150 | if (rc == 0) | 149 | if (rc == 0) |
151 | return; | 150 | return; |
152 | cpumask_scnprintf(cache_buf, sizeof(cache_buf), &cache_cpumask_copy); | ||
153 | cpumask_scnprintf(tlb_buf, sizeof(tlb_buf), &tlb_cpumask_copy); | ||
154 | 151 | ||
155 | pr_err("hv_flush_remote(%#llx, %#lx, %p [%s], %#lx, %#lx, %#lx, %p [%s], %p, %d) = %d\n", | 152 | pr_err("hv_flush_remote(%#llx, %#lx, %p [%*pb], %#lx, %#lx, %#lx, %p [%*pb], %p, %d) = %d\n", |
156 | cache_pa, cache_control, cache_cpumask, cache_buf, | 153 | cache_pa, cache_control, cache_cpumask, |
157 | (unsigned long)tlb_va, tlb_length, tlb_pgsize, | 154 | cpumask_pr_args(&cache_cpumask_copy), |
158 | tlb_cpumask, tlb_buf, asids, asidcount, rc); | 155 | (unsigned long)tlb_va, tlb_length, tlb_pgsize, tlb_cpumask, |
156 | cpumask_pr_args(&tlb_cpumask_copy), asids, asidcount, rc); | ||
159 | panic("Unsafe to continue."); | 157 | panic("Unsafe to continue."); |
160 | } | 158 | } |
161 | 159 | ||
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c index be240cc4978d..ace32d7d3864 100644 --- a/arch/tile/mm/init.c +++ b/arch/tile/mm/init.c | |||
@@ -353,15 +353,13 @@ static int __init setup_ktext(char *str) | |||
353 | 353 | ||
354 | /* Neighborhood ktext pages on specified mask */ | 354 | /* Neighborhood ktext pages on specified mask */ |
355 | else if (cpulist_parse(str, &ktext_mask) == 0) { | 355 | else if (cpulist_parse(str, &ktext_mask) == 0) { |
356 | char buf[NR_CPUS * 5]; | ||
357 | cpulist_scnprintf(buf, sizeof(buf), &ktext_mask); | ||
358 | if (cpumask_weight(&ktext_mask) > 1) { | 356 | if (cpumask_weight(&ktext_mask) > 1) { |
359 | ktext_small = 1; | 357 | ktext_small = 1; |
360 | pr_info("ktext: using caching neighborhood %s with small pages\n", | 358 | pr_info("ktext: using caching neighborhood %*pbl with small pages\n", |
361 | buf); | 359 | cpumask_pr_args(&ktext_mask)); |
362 | } else { | 360 | } else { |
363 | pr_info("ktext: caching on cpu %s with one huge page\n", | 361 | pr_info("ktext: caching on cpu %*pbl with one huge page\n", |
364 | buf); | 362 | cpumask_pr_args(&ktext_mask)); |
365 | } | 363 | } |
366 | } | 364 | } |
367 | 365 | ||
@@ -492,11 +490,9 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base) | |||
492 | struct cpumask bad; | 490 | struct cpumask bad; |
493 | cpumask_andnot(&bad, &ktext_mask, cpu_possible_mask); | 491 | cpumask_andnot(&bad, &ktext_mask, cpu_possible_mask); |
494 | cpumask_and(&ktext_mask, &ktext_mask, cpu_possible_mask); | 492 | cpumask_and(&ktext_mask, &ktext_mask, cpu_possible_mask); |
495 | if (!cpumask_empty(&bad)) { | 493 | if (!cpumask_empty(&bad)) |
496 | char buf[NR_CPUS * 5]; | 494 | pr_info("ktext: not using unavailable cpus %*pbl\n", |
497 | cpulist_scnprintf(buf, sizeof(buf), &bad); | 495 | cpumask_pr_args(&bad)); |
498 | pr_info("ktext: not using unavailable cpus %s\n", buf); | ||
499 | } | ||
500 | if (cpumask_empty(&ktext_mask)) { | 496 | if (cpumask_empty(&ktext_mask)) { |
501 | pr_warn("ktext: no valid cpus; caching on %d\n", | 497 | pr_warn("ktext: no valid cpus; caching on %d\n", |
502 | smp_processor_id()); | 498 | smp_processor_id()); |