Commit d7afcd1
committed
add arm64 support for clock frequency helpers
On arm64, `cpu_khz` and `tsc_khz` do not exist -- they are x86-only
globals tied to the TSC. Replace them with arch-appropriate alternatives:
- homa_clock_khz(): use `arch_timer_get_cntfrq() / 1000` on arm64,
which returns the ARM generic timer frequency matching get_cycles().
- timetrace.c: replace tsc_khz with homa_clock_khz() in the three
places that print "cpu_khz:" for trace output.
- homa_metrics.c: guard the tsc_khz-based cycle conversion with
CONFIG_X86; on arm64 both homa_clock() and Linux timekeeping use
the same arch timer so no conversion is needed.
Without this patch, building HomaModule on arm64 fails with:
error: 'cpu_khz' undeclared (first use in this function)
Signed-off-by: Serapheim Dimitropoulos <sdimitropoulos@coreweave.com>1 parent 8f941bf commit d7afcd1
3 files changed
Lines changed: 25 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
| |||
842 | 845 | | |
843 | 846 | | |
844 | 847 | | |
| 848 | + | |
845 | 849 | | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
846 | 855 | | |
847 | 856 | | |
848 | 857 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
245 | 250 | | |
246 | 251 | | |
247 | 252 | | |
248 | 253 | | |
249 | 254 | | |
250 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
251 | 262 | | |
252 | 263 | | |
253 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
393 | | - | |
| 393 | + | |
| 394 | + | |
394 | 395 | | |
395 | 396 | | |
396 | 397 | | |
| |||
631 | 632 | | |
632 | 633 | | |
633 | 634 | | |
634 | | - | |
| 635 | + | |
635 | 636 | | |
636 | 637 | | |
637 | 638 | | |
| |||
758 | 759 | | |
759 | 760 | | |
760 | 761 | | |
761 | | - | |
| 762 | + | |
762 | 763 | | |
763 | 764 | | |
764 | 765 | | |
| |||
0 commit comments