linux_dsm_epyc7002/arch/tile/kernel
Chris Metcalf e658a6f14d tile: avoid using clocksource_cyc2ns with absolute cycle count
For large values of "mult" and long uptimes, the intermediate
result of "cycles * mult" can overflow 64 bits.  For example,
the tile platform calls clocksource_cyc2ns with a 1.2 GHz clock;
we have mult = 853, and after 208.5 days, we overflow 64 bits.

Since clocksource_cyc2ns() is intended to be used for relative
cycle counts, not absolute cycle counts, performance is more
importance than accepting a wider range of cycle values.  So,
just use mult_frac() directly in tile's sched_clock().

Commit 4cecf6d401 ("sched, x86: Avoid unnecessary overflow
in sched_clock") by Salman Qazi results in essentially the same
generated code for x86 as this change does for tile.  In fact,
a follow-on change by Salman introduced mult_frac() and switched
to using it, so the C code was largely identical at that point too.

Peter Zijlstra then added mul_u64_u32_shr() and switched x86
to use it.  This is, in principle, better; by optimizing the
64x64->64 multiplies to be 32x32->64 multiplies we can potentially
save some time.  However, the compiler piplines the 64x64->64
multiplies pretty well, and the conditional branch in the generic
mul_u64_u32_shr() causes some bubbles in execution, with the
result that it's pretty much a wash.  If tilegx provided its own
implementation of mul_u64_u32_shr() without the conditional branch,
we could potentially save 3 cycles, but that seems like small gain
for a fair amount of additional build scaffolding; no other platform
currently provides a mul_u64_u32_shr() override, and tile doesn't
currently have an <asm/div64.h> header to put the override in.

Additionally, gcc currently has an optimization bug that prevents
it from recognizing the opportunity to use a 32x32->64 multiply,
and so the result would be no better than the existing mult_frac()
until such time as the compiler is fixed.

For now, just using mult_frac() seems like the right answer.

Cc: stable@kernel.org [v3.4+]
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
2016-11-23 15:28:54 -05:00
..
vdso tile/vdso: emit a GNU hash as well 2015-08-06 20:22:40 -04:00
asm-offsets.c tile: check for correct compiler earlier in asm-offsets.c 2013-09-03 14:53:09 -04:00
backtrace.c arch/tile: big-endian: properly bswap instruction bundles when backtracing 2012-06-18 13:11:21 -04:00
compat_signal.c signal: fix information leak in copy_siginfo_from_user32 2015-08-07 04:39:40 +03:00
compat.c tile 32-bit big-endian: fix bugs in syscall argument order 2016-06-15 15:31:01 -04:00
early_printk.c printk: remove used-once early_vprintk 2014-12-10 17:41:10 -08:00
entry.S nmi_backtrace: generate one-line reports for idle cpus 2016-10-07 18:46:30 -07:00
ftrace.c ftrace: Add return address pointer to ftrace_ret_stack 2016-08-24 12:15:14 +02:00
hardwall.c tile: use %*pb[l] to print bitmaps including cpumasks and nodemasks 2015-02-13 21:21:37 -08:00
head_32.S tile: parameterize VA and PA space more cleanly 2013-09-03 14:47:34 -04:00
head_64.S tile: parameterize VA and PA space more cleanly 2013-09-03 14:47:34 -04:00
hvglue_trace.c tile: support delivering NMIs for multicore backtrace 2015-05-11 11:22:31 -04:00
hvglue.S tile: support delivering NMIs for multicore backtrace 2015-05-11 11:22:31 -04:00
intvec_32.S arch/tile: move user_exit() to early kernel entry sequence 2016-01-18 14:49:30 -05:00
intvec_64.S arch/tile: move user_exit() to early kernel entry sequence 2016-01-18 14:49:30 -05:00
irq.c tile: Use the more common pr_warn instead of pr_warning 2014-11-11 15:51:42 -05:00
jump_label.c tile/jump_label: add jump label support for TILE-Gx 2016-01-04 15:09:31 -05:00
kgdb.c tile: Fix misspellings in comments. 2016-03-04 14:44:57 -05:00
kprobes.c tile: define a macro ktext_writable_addr to get writable kernel text address 2016-01-04 15:09:31 -05:00
machine_kexec.c tile: Use the more common pr_warn instead of pr_warning 2014-11-11 15:51:42 -05:00
Makefile tile/jump_label: add jump label support for TILE-Gx 2016-01-04 15:09:31 -05:00
mcount_64.S tile: ftrace: fix function_graph tracer issues 2015-04-17 14:01:38 -04:00
messaging.c tile: Use the more common pr_warn instead of pr_warning 2014-11-11 15:51:42 -05:00
module.c module: remove mod arg from module_free, rename module_memfree(). 2015-01-20 11:38:33 +10:30
pci_gx.c Fix typo 2016-05-23 12:17:22 -04:00
pci-dma.c dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
pci.c PCI: Assign resources before drivers claim devices (pci_scan_root_bus()) 2015-03-19 10:17:13 -05:00
perf_event.c perf core: Pass max stack as a perf_callchain_entry context 2016-05-16 23:11:50 -03:00
pmc.c arch/tile: adopt the new nmi_backtrace framework 2016-10-07 18:46:30 -07:00
proc.c tile: use %*pb[l] to print bitmaps including cpumasks and nodemasks 2015-02-13 21:21:37 -08:00
process.c arch/tile: adopt the new nmi_backtrace framework 2016-10-07 18:46:30 -07:00
ptrace.c tile/ptrace: run seccomp after ptrace 2016-06-14 10:54:46 -07:00
reboot.c tile: various console improvements 2013-08-12 14:46:18 -04:00
regs_32.S tile: change <asm/system.h> to <asm/switch_to.h> in comments 2013-09-03 14:53:17 -04:00
regs_64.S tile: change <asm/system.h> to <asm/switch_to.h> in comments 2013-09-03 14:53:17 -04:00
relocate_kernel_32.S tile: remove support for TILE64 2013-09-03 14:53:29 -04:00
relocate_kernel_64.S tile: remove support for TILE64 2013-09-03 14:53:29 -04:00
setup.c include/linux/nodemask.h: create next_node_in() helper 2016-05-19 19:12:14 -07:00
signal.c tile: Remove signal translation and exec_domain 2015-04-12 21:03:27 +02:00
single_step.c arch/tile: move user_exit() to early kernel entry sequence 2016-01-18 14:49:30 -05:00
smp.c tile: support arch_irq_work_raise 2015-04-17 12:58:44 -04:00
smpboot.c arch/hotplug: Call into idle with a proper state 2016-03-01 20:36:57 +01:00
stack.c tile: include the syscall number in the backtrace 2016-01-18 14:49:16 -05:00
sys.c tile 32-bit big-endian: fix bugs in syscall argument order 2016-06-15 15:31:01 -04:00
sysfs.c bus: subsys: update return type of ->remove_dev() to void 2015-08-05 17:08:14 -07:00
tile-desc_32.c arch/tile: factor out <arch/opcode.h> header 2011-11-03 16:58:54 -04:00
tile-desc_64.c arch/tile: factor out <arch/opcode.h> header 2011-11-03 16:58:54 -04:00
time.c tile: avoid using clocksource_cyc2ns with absolute cycle count 2016-11-23 15:28:54 -05:00
tlb.c tile: do less L1 I-cache eviction 2013-08-30 11:56:34 -04:00
traps.c arch/tile: adopt the new nmi_backtrace framework 2016-10-07 18:46:30 -07:00
unaligned.c Fix typo 2016-05-23 12:17:22 -04:00
usb.c tile: fix build failure 2015-09-28 11:23:39 -04:00
vdso.c arm64,ia64,ppc,s390,sh,tile,um,x86,mm: remove default gate area 2014-08-08 15:57:27 -07:00
vmlinux.lds.S nmi_backtrace: generate one-line reports for idle cpus 2016-10-07 18:46:30 -07:00