erpc-io / eRPC

Efficient RPCs for datacenter networks
https://erpc.io/
Other
835 stars 137 forks source link

Is aarch64 supported? #111

Open Eren121 opened 2 months ago

Eren121 commented 2 months ago

I achieved to make it compile on this architecture with minor changes in src/util/timer.h:

static inline size_t rdtsc() {
  uint64_t tsc;
  asm volatile("mrs %0, cntvct_el0" : "=r"(tsc));
  return tsc;
}

static double measure_rdtsc_freq() {
    uint32_t freq_hz;
    asm volatile ("mrs %0, cntfrq_el0; isb; " : "=r"(freq_hz) :: "memory");
    return static_cast<double(freq_hz);
}

But I don't know if there can be others compatibility problems at runtime?

anujkaliaiitd commented 2 months ago

Interesting, good to know that the code compiles with minor changes. It'll be great if you could submit a PR for this, ifdef-ed by the architecture.

I haven't tried eRPC on an ARM server, but I can't think of any issues that'll prevent it from working. I'm curious to learn if it ends up working for you.

Eren121 commented 1 month ago

This works, but there is one assertion that fails:

rt_assert(freq_ghz >= 0.5 && freq_ghz <= 5.0, "Invalid RDTSC frequency");

Because on Arm, the frequency is not tied to the CPU frequency and is much lower (0.2 Ghz on my machine). It also does not scale with CPU frequency scaling (independant timer).

Why is this assertion there? Can it affect wrongly eRPC if we remove it?