yandex / odyssey

Scalable PostgreSQL connection pooler
BSD 3-Clause "New" or "Revised" License
3.21k stars 164 forks source link

Support Arm? #301

Open peresun opened 3 years ago

peresun commented 3 years ago

Machinarium does not support arm, mostly because mm_context_swap is written using x86 assembly.

Is there a way to make Machinarium support arm?

Thanks.

x4m commented 3 years ago

Hi! Yeah, and also there's a pause code in sleeplock... We definitely need to support these things. I'm not realy an expert in ARM assembler, but I think we can come up with something. Anyway, PR would be welcome!

peresun commented 3 years ago

Thanks for your reply. Now I use ucontext to get rid of writing arm asm, acutally odyssey has used uncontext to implement coroutines in history. I changed the interface of mm_context_create, So mm_scheduler_new look like:

#if __i386__ || __x86_64__
mm_context_create(&coroutine->context, &coroutine->stack,mm_scheduler_main, coroutine);

#else
mm_context_create(&coroutine->context, &(scheduler->main.context), &coroutine->stack,mm_scheduler_main, coroutine);
#endif

Performance may not be the best, but it can work. Is there any potential problem?

JerrySievert commented 3 years ago

@peresun do you have the changes available somewhere?

ruimarinho commented 3 years ago

With M1 chips, this is getting even more relevant. Would be great to merge your changes @peresun.