Message ID | d253b71638e2af1cac9eb804c935810d0e021841.1521639065.git.christophe.leroy@c-s.fr (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/2] powerpc/time: inline arch_vtime_task_switch() | expand |
Hi Christophe, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on v4.16-rc6 next-20180322] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Christophe-Leroy/powerpc-time-inline-arch_vtime_task_switch/20180323-115145 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-defconfig (attached as .config) compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=powerpc All errors (new ones prefixed by >>): arch/powerpc/xmon/xmon.c: In function 'dump_one_paca': >> arch/powerpc/xmon/xmon.c:2426:20: error: 'struct cpu_accounting_data' has no member named 'utime_scaled' DUMP(p, accounting.utime_scaled, "llx"); ^ arch/powerpc/xmon/xmon.c:2349:65: note: in definition of macro 'DUMP' printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \ ^~~~ In file included from include/linux/compiler_types.h:58:0, from include/linux/kconfig.h:74, from <command-line>:0: include/linux/compiler-gcc.h:170:2: error: 'struct cpu_accounting_data' has no member named 'utime_scaled' __builtin_offsetof(a, b) ^ include/linux/stddef.h:17:32: note: in expansion of macro '__compiler_offsetof' #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER) ^~~~~~~~~~~~~~~~~~~ arch/powerpc/xmon/xmon.c:2350:3: note: in expansion of macro 'offsetof' offsetof(struct paca_struct, name)); ^~~~~~~~ arch/powerpc/xmon/xmon.c:2426:2: note: in expansion of macro 'DUMP' DUMP(p, accounting.utime_scaled, "llx"); ^~~~ >> arch/powerpc/xmon/xmon.c:2429:21: error: 'struct cpu_accounting_data' has no member named 'startspurr'; did you mean 'starttime'? DUMP(p, accounting.startspurr, "llx"); ^ arch/powerpc/xmon/xmon.c:2349:65: note: in definition of macro 'DUMP' printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \ ^~~~ In file included from include/linux/compiler_types.h:58:0, from include/linux/kconfig.h:74, from <command-line>:0: >> arch/powerpc/xmon/xmon.c:2429:21: error: 'struct cpu_accounting_data' has no member named 'startspurr'; did you mean 'starttime'? DUMP(p, accounting.startspurr, "llx"); ^ include/linux/compiler-gcc.h:170:24: note: in definition of macro '__compiler_offsetof' __builtin_offsetof(a, b) ^ arch/powerpc/xmon/xmon.c:2350:3: note: in expansion of macro 'offsetof' offsetof(struct paca_struct, name)); ^~~~~~~~ arch/powerpc/xmon/xmon.c:2429:2: note: in expansion of macro 'DUMP' DUMP(p, accounting.startspurr, "llx"); ^~~~ >> arch/powerpc/xmon/xmon.c:2430:20: error: 'struct cpu_accounting_data' has no member named 'utime_sspurr' DUMP(p, accounting.utime_sspurr, "llx"); ^ arch/powerpc/xmon/xmon.c:2349:65: note: in definition of macro 'DUMP' printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \ ^~~~ In file included from include/linux/compiler_types.h:58:0, from include/linux/kconfig.h:74, from <command-line>:0: include/linux/compiler-gcc.h:170:2: error: 'struct cpu_accounting_data' has no member named 'utime_sspurr' __builtin_offsetof(a, b) ^ include/linux/stddef.h:17:32: note: in expansion of macro '__compiler_offsetof' #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER) ^~~~~~~~~~~~~~~~~~~ arch/powerpc/xmon/xmon.c:2350:3: note: in expansion of macro 'offsetof' offsetof(struct paca_struct, name)); ^~~~~~~~ arch/powerpc/xmon/xmon.c:2430:2: note: in expansion of macro 'DUMP' DUMP(p, accounting.utime_sspurr, "llx"); ^~~~ vim +2426 arch/powerpc/xmon/xmon.c ddadb6b8e Michael Ellerman 2012-09-13 2331 ddadb6b8e Michael Ellerman 2012-09-13 2332 if (setjmp(bus_error_jmp) != 0) { ddadb6b8e Michael Ellerman 2012-09-13 2333 printf("*** Error dumping paca for cpu 0x%x!\n", cpu); ddadb6b8e Michael Ellerman 2012-09-13 2334 return; ddadb6b8e Michael Ellerman 2012-09-13 2335 } ddadb6b8e Michael Ellerman 2012-09-13 2336 ddadb6b8e Michael Ellerman 2012-09-13 2337 catch_memory_errors = 1; ddadb6b8e Michael Ellerman 2012-09-13 2338 sync(); ddadb6b8e Michael Ellerman 2012-09-13 2339 ddadb6b8e Michael Ellerman 2012-09-13 2340 p = &paca[cpu]; ddadb6b8e Michael Ellerman 2012-09-13 2341 d81041820 Michael Ellerman 2017-12-06 2342 printf("paca for cpu 0x%x @ %px:\n", cpu, p); ddadb6b8e Michael Ellerman 2012-09-13 2343 ad987fc8e Michael Ellerman 2015-10-14 2344 printf(" %-*s = %s\n", 20, "possible", cpu_possible(cpu) ? "yes" : "no"); ad987fc8e Michael Ellerman 2015-10-14 2345 printf(" %-*s = %s\n", 20, "present", cpu_present(cpu) ? "yes" : "no"); ad987fc8e Michael Ellerman 2015-10-14 2346 printf(" %-*s = %s\n", 20, "online", cpu_online(cpu) ? "yes" : "no"); ddadb6b8e Michael Ellerman 2012-09-13 2347 ddadb6b8e Michael Ellerman 2012-09-13 2348 #define DUMP(paca, name, format) \ ad987fc8e Michael Ellerman 2015-10-14 2349 printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \ ddadb6b8e Michael Ellerman 2012-09-13 @2350 offsetof(struct paca_struct, name)); ddadb6b8e Michael Ellerman 2012-09-13 2351 ddadb6b8e Michael Ellerman 2012-09-13 2352 DUMP(p, lock_token, "x"); ddadb6b8e Michael Ellerman 2012-09-13 2353 DUMP(p, paca_index, "x"); ddadb6b8e Michael Ellerman 2012-09-13 2354 DUMP(p, kernel_toc, "lx"); ddadb6b8e Michael Ellerman 2012-09-13 2355 DUMP(p, kernelbase, "lx"); ddadb6b8e Michael Ellerman 2012-09-13 2356 DUMP(p, kernel_msr, "lx"); 2248fade9 Michael Ellerman 2018-01-11 2357 DUMP(p, emergency_sp, "px"); 729b0f715 Mahesh Salgaonkar 2013-10-30 2358 #ifdef CONFIG_PPC_BOOK3S_64 2248fade9 Michael Ellerman 2018-01-11 2359 DUMP(p, nmi_emergency_sp, "px"); 2248fade9 Michael Ellerman 2018-01-11 2360 DUMP(p, mc_emergency_sp, "px"); c4f3b52ce Nicholas Piggin 2016-12-20 2361 DUMP(p, in_nmi, "x"); 729b0f715 Mahesh Salgaonkar 2013-10-30 2362 DUMP(p, in_mce, "x"); ad987fc8e Michael Ellerman 2015-10-14 2363 DUMP(p, hmi_event_available, "x"); 729b0f715 Mahesh Salgaonkar 2013-10-30 2364 #endif ddadb6b8e Michael Ellerman 2012-09-13 2365 DUMP(p, data_offset, "lx"); ddadb6b8e Michael Ellerman 2012-09-13 2366 DUMP(p, hw_cpu_id, "x"); ddadb6b8e Michael Ellerman 2012-09-13 2367 DUMP(p, cpu_start, "x"); ddadb6b8e Michael Ellerman 2012-09-13 2368 DUMP(p, kexec_state, "x"); 4e0037470 Michael Ellerman 2017-10-19 2369 #ifdef CONFIG_PPC_BOOK3S_64 ad987fc8e Michael Ellerman 2015-10-14 2370 for (i = 0; i < SLB_NUM_BOLTED; i++) { ad987fc8e Michael Ellerman 2015-10-14 2371 u64 esid, vsid; ad987fc8e Michael Ellerman 2015-10-14 2372 ad987fc8e Michael Ellerman 2015-10-14 2373 if (!p->slb_shadow_ptr) ad987fc8e Michael Ellerman 2015-10-14 2374 continue; ad987fc8e Michael Ellerman 2015-10-14 2375 ad987fc8e Michael Ellerman 2015-10-14 2376 esid = be64_to_cpu(p->slb_shadow_ptr->save_area[i].esid); ad987fc8e Michael Ellerman 2015-10-14 2377 vsid = be64_to_cpu(p->slb_shadow_ptr->save_area[i].vsid); ad987fc8e Michael Ellerman 2015-10-14 2378 ad987fc8e Michael Ellerman 2015-10-14 2379 if (esid || vsid) { ad987fc8e Michael Ellerman 2015-10-14 2380 printf(" slb_shadow[%d]: = 0x%016lx 0x%016lx\n", ad987fc8e Michael Ellerman 2015-10-14 2381 i, esid, vsid); ad987fc8e Michael Ellerman 2015-10-14 2382 } ad987fc8e Michael Ellerman 2015-10-14 2383 } ad987fc8e Michael Ellerman 2015-10-14 2384 DUMP(p, vmalloc_sllp, "x"); ad987fc8e Michael Ellerman 2015-10-14 2385 DUMP(p, slb_cache_ptr, "x"); ad987fc8e Michael Ellerman 2015-10-14 2386 for (i = 0; i < SLB_CACHE_ENTRIES; i++) ad987fc8e Michael Ellerman 2015-10-14 2387 printf(" slb_cache[%d]: = 0x%016lx\n", i, p->slb_cache[i]); 274920a3e Michael Ellerman 2018-01-10 2388 274920a3e Michael Ellerman 2018-01-10 2389 DUMP(p, rfi_flush_fallback_area, "px"); ad987fc8e Michael Ellerman 2015-10-14 2390 #endif ad987fc8e Michael Ellerman 2015-10-14 2391 DUMP(p, dscr_default, "llx"); ad987fc8e Michael Ellerman 2015-10-14 2392 #ifdef CONFIG_PPC_BOOK3E 2248fade9 Michael Ellerman 2018-01-11 2393 DUMP(p, pgd, "px"); 2248fade9 Michael Ellerman 2018-01-11 2394 DUMP(p, kernel_pgd, "px"); 2248fade9 Michael Ellerman 2018-01-11 2395 DUMP(p, tcd_ptr, "px"); 2248fade9 Michael Ellerman 2018-01-11 2396 DUMP(p, mc_kstack, "px"); 2248fade9 Michael Ellerman 2018-01-11 2397 DUMP(p, crit_kstack, "px"); 2248fade9 Michael Ellerman 2018-01-11 2398 DUMP(p, dbg_kstack, "px"); ad987fc8e Michael Ellerman 2015-10-14 2399 #endif 2248fade9 Michael Ellerman 2018-01-11 2400 DUMP(p, __current, "px"); ddadb6b8e Michael Ellerman 2012-09-13 2401 DUMP(p, kstack, "lx"); 90d647374 Michael Ellerman 2017-10-09 2402 printf(" kstack_base = 0x%016lx\n", p->kstack & ~(THREAD_SIZE - 1)); ddadb6b8e Michael Ellerman 2012-09-13 2403 DUMP(p, stab_rr, "lx"); ddadb6b8e Michael Ellerman 2012-09-13 2404 DUMP(p, saved_r1, "lx"); ddadb6b8e Michael Ellerman 2012-09-13 2405 DUMP(p, trap_save, "x"); 4e26bc4a4 Madhavan Srinivasan 2017-12-20 2406 DUMP(p, irq_soft_mask, "x"); ddadb6b8e Michael Ellerman 2012-09-13 2407 DUMP(p, irq_happened, "x"); ddadb6b8e Michael Ellerman 2012-09-13 2408 DUMP(p, io_sync, "x"); ddadb6b8e Michael Ellerman 2012-09-13 2409 DUMP(p, irq_work_pending, "x"); ddadb6b8e Michael Ellerman 2012-09-13 2410 DUMP(p, nap_state_lost, "x"); ad987fc8e Michael Ellerman 2015-10-14 2411 DUMP(p, sprg_vdso, "llx"); ad987fc8e Michael Ellerman 2015-10-14 2412 ad987fc8e Michael Ellerman 2015-10-14 2413 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM ad987fc8e Michael Ellerman 2015-10-14 2414 DUMP(p, tm_scratch, "llx"); ad987fc8e Michael Ellerman 2015-10-14 2415 #endif ad987fc8e Michael Ellerman 2015-10-14 2416 ad987fc8e Michael Ellerman 2015-10-14 2417 #ifdef CONFIG_PPC_POWERNV 2248fade9 Michael Ellerman 2018-01-11 2418 DUMP(p, core_idle_state_ptr, "px"); ad987fc8e Michael Ellerman 2015-10-14 2419 DUMP(p, thread_idle_state, "x"); ad987fc8e Michael Ellerman 2015-10-14 2420 DUMP(p, thread_mask, "x"); ad987fc8e Michael Ellerman 2015-10-14 2421 DUMP(p, subcore_sibling_mask, "x"); ad987fc8e Michael Ellerman 2015-10-14 2422 #endif ddadb6b8e Michael Ellerman 2012-09-13 2423 8c8b73c48 Frederic Weisbecker 2017-01-05 2424 DUMP(p, accounting.utime, "llx"); 8c8b73c48 Frederic Weisbecker 2017-01-05 2425 DUMP(p, accounting.stime, "llx"); 8c8b73c48 Frederic Weisbecker 2017-01-05 @2426 DUMP(p, accounting.utime_scaled, "llx"); c223c9038 Christophe Leroy 2016-05-17 2427 DUMP(p, accounting.starttime, "llx"); c223c9038 Christophe Leroy 2016-05-17 2428 DUMP(p, accounting.starttime_user, "llx"); c223c9038 Christophe Leroy 2016-05-17 @2429 DUMP(p, accounting.startspurr, "llx"); c223c9038 Christophe Leroy 2016-05-17 @2430 DUMP(p, accounting.utime_sspurr, "llx"); f828c3d0a Frederic Weisbecker 2017-01-05 2431 DUMP(p, accounting.steal_time, "llx"); ddadb6b8e Michael Ellerman 2012-09-13 2432 #undef DUMP ddadb6b8e Michael Ellerman 2012-09-13 2433 ddadb6b8e Michael Ellerman 2012-09-13 2434 catch_memory_errors = 0; ddadb6b8e Michael Ellerman 2012-09-13 2435 sync(); ddadb6b8e Michael Ellerman 2012-09-13 2436 } ddadb6b8e Michael Ellerman 2012-09-13 2437 :::::: The code at line 2426 was first introduced by commit :::::: 8c8b73c4811f2b5e458a7418dca07d2ef85c7db1 sched/cputime, powerpc: Prepare accounting structure for cputime flush on tick :::::: TO: Frederic Weisbecker <fweisbec@gmail.com> :::::: CC: Ingo Molnar <mingo@kernel.org> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 0c76d93d5da5..8c9f54779ff1 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -142,7 +142,7 @@ config PPC select ARCH_HAS_PHYS_TO_DMA select ARCH_HAS_PMEM_API if PPC64 select ARCH_HAS_MEMBARRIER_CALLBACKS - select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE + select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE && PPC64 select ARCH_HAS_SG_CHAIN select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !RELOCATABLE && !HIBERNATION) select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST diff --git a/arch/powerpc/include/asm/accounting.h b/arch/powerpc/include/asm/accounting.h index 3abcf98ed2e0..f1096d4cc658 100644 --- a/arch/powerpc/include/asm/accounting.h +++ b/arch/powerpc/include/asm/accounting.h @@ -15,8 +15,10 @@ struct cpu_accounting_data { /* Accumulated cputime values to flush on ticks*/ unsigned long utime; unsigned long stime; +#ifdef ARCH_HAS_SCALED_CPUTIME unsigned long utime_scaled; unsigned long stime_scaled; +#endif unsigned long gtime; unsigned long hardirq_time; unsigned long softirq_time; @@ -25,8 +27,10 @@ struct cpu_accounting_data { /* Internal counters */ unsigned long starttime; /* TB value snapshot */ unsigned long starttime_user; /* TB value on exit to usermode */ +#ifdef ARCH_HAS_SCALED_CPUTIME unsigned long startspurr; /* SPURR value snapshot */ unsigned long utime_sspurr; /* ->user_time when ->startspurr set */ +#endif }; #endif diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h index 36345341dd70..c11d4fd27028 100644 --- a/arch/powerpc/include/asm/cputime.h +++ b/arch/powerpc/include/asm/cputime.h @@ -61,7 +61,9 @@ static inline void arch_vtime_task_switch(struct task_struct *prev) struct cpu_accounting_data *acct = get_accounting(current); acct->starttime = get_accounting(prev)->starttime; +#ifdef ARCH_HAS_SCALED_CPUTIME acct->startspurr = get_accounting(prev)->startspurr; +#endif } #endif diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index aa6aa5d4a60c..09e5eb9f0e81 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -175,6 +175,7 @@ static void calc_cputime_factors(void) * Read the SPURR on systems that have it, otherwise the PURR, * or if that doesn't exist return the timebase value passed in. */ +#ifdef ARCH_HAS_SCALED_CPUTIME static unsigned long read_spurr(unsigned long tb) { if (cpu_has_feature(CPU_FTR_SPURR)) @@ -183,6 +184,7 @@ static unsigned long read_spurr(unsigned long tb) return mfspr(SPRN_PURR); return tb; } +#endif #ifdef CONFIG_PPC_SPLPAR @@ -282,22 +284,28 @@ static unsigned long vtime_delta(struct task_struct *tsk, unsigned long *stime_scaled, unsigned long *steal_time) { - unsigned long now, nowscaled, deltascaled; + unsigned long now; unsigned long stime; +#ifdef ARCH_HAS_SCALED_CPUTIME + unsigned long nowscaled, deltascaled; unsigned long utime, utime_scaled; +#endif struct cpu_accounting_data *acct = get_accounting(tsk); WARN_ON_ONCE(!irqs_disabled()); now = mftb(); +#ifdef ARCH_HAS_SCALED_CPUTIME nowscaled = read_spurr(now); +#endif stime = now - acct->starttime; acct->starttime = now; - deltascaled = nowscaled - acct->startspurr; - acct->startspurr = nowscaled; *steal_time = calculate_stolen_time(now); +#ifdef ARCH_HAS_SCALED_CPUTIME + deltascaled = nowscaled - acct->startspurr; + acct->startspurr = nowscaled; utime = acct->utime - acct->utime_sspurr; acct->utime_sspurr = acct->utime; @@ -322,6 +330,7 @@ static unsigned long vtime_delta(struct task_struct *tsk, } } acct->utime_scaled += utime_scaled; +#endif return stime; } @@ -338,7 +347,9 @@ void vtime_account_system(struct task_struct *tsk) if ((tsk->flags & PF_VCPU) && !irq_count()) { acct->gtime += stime; +#ifdef ARCH_HAS_SCALED_CPUTIME acct->utime_scaled += stime_scaled; +#endif } else { if (hardirq_count()) acct->hardirq_time += stime; @@ -347,7 +358,9 @@ void vtime_account_system(struct task_struct *tsk) else acct->stime += stime; +#ifdef ARCH_HAS_SCALED_CPUTIME acct->stime_scaled += stime_scaled; +#endif } } EXPORT_SYMBOL_GPL(vtime_account_system); @@ -375,8 +388,12 @@ void vtime_flush(struct task_struct *tsk) if (acct->utime) account_user_time(tsk, cputime_to_nsecs(acct->utime)); +#ifdef ARCH_HAS_SCALED_CPUTIME if (acct->utime_scaled) tsk->utimescaled += cputime_to_nsecs(acct->utime_scaled); + if (acct->stime_scaled) + tsk->stimescaled += cputime_to_nsecs(acct->stime_scaled); +#endif if (acct->gtime) account_guest_time(tsk, cputime_to_nsecs(acct->gtime)); @@ -390,8 +407,6 @@ void vtime_flush(struct task_struct *tsk) if (acct->stime) account_system_index_time(tsk, cputime_to_nsecs(acct->stime), CPUTIME_SYSTEM); - if (acct->stime_scaled) - tsk->stimescaled += cputime_to_nsecs(acct->stime_scaled); if (acct->hardirq_time) account_system_index_time(tsk, cputime_to_nsecs(acct->hardirq_time), @@ -401,13 +416,15 @@ void vtime_flush(struct task_struct *tsk) CPUTIME_SOFTIRQ); acct->utime = 0; +#ifdef ARCH_HAS_SCALED_CPUTIME acct->utime_scaled = 0; acct->utime_sspurr = 0; + acct->stime_scaled = 0; +#endif acct->gtime = 0; acct->steal_time = 0; acct->idle_time = 0; acct->stime = 0; - acct->stime_scaled = 0; acct->hardirq_time = 0; acct->softirq_time = 0; }
scaled cputime is only meaningfull when the processor has SPURR and/or PURR, which means only on PPC64. Removing it on PPC32 significantly reduces the size of vtime_account_system() and vtime_account_idle() on an 8xx: Before: 00000114 l F .text 000000a8 vtime_delta 000004c0 g F .text 00000100 vtime_account_system 000005c0 g F .text 00000048 vtime_account_idle After: (vtime_delta gets inlined in the two functions) 00000418 g F .text 000000a0 vtime_account_system 000004b8 g F .text 00000054 vtime_account_idle Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> --- arch/powerpc/Kconfig | 2 +- arch/powerpc/include/asm/accounting.h | 4 ++++ arch/powerpc/include/asm/cputime.h | 2 ++ arch/powerpc/kernel/time.c | 29 +++++++++++++++++++++++------ 4 files changed, 30 insertions(+), 7 deletions(-)