Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make parasite code support glibc? #2393

Open
sirius0118 opened this issue Apr 18, 2024 · 5 comments
Open

How to make parasite code support glibc? #2393

sirius0118 opened this issue Apr 18, 2024 · 5 comments

Comments

@sirius0118
Copy link

sirius0118 commented Apr 18, 2024

I want to add some new functions in the parasite code, which need to call the function of glibc.

I noticed that there is a macro definition -DCR_NOGLIBC in the Makefile(criu/Makefile), so can we also use glibc without defining this macro?

If we use the implementation of the std_printf function in compel (implemented step by step by manually wrapping the system call), it will be very complicated to implement this function step by step through the system call.
I tried to add a printf("hello world\n"); code to the dump_page function of criu/criu/pie/parasite.c(or others position in the parasite code). When the printf is executed, the segment error is triggered. How can I fix this?

Handle-elf-host.c can generate relocation rules, but when I add printf, there is another relocation type(R_x86_64_GOTTPOFF), which has no corresponding handling in handle-elf-host.c, so I simply skip it and don't handle this relocation.

@sirius0118 sirius0118 changed the title How to make Parsite code support glibc? How to make parasite code support glibc? Apr 18, 2024
@avagin
Copy link
Member

avagin commented Apr 18, 2024

I want to add some new functions in the parasite code, which need to call the function of glibc.

What function is it?

I noticed that there is a macro definition -DCR_NOGLIBC in the Makefile(criu/Makefile), so can we also use glibc without defining this macro?

We probably can do that, but first we need to understand why we need it.

@sirius0118
Copy link
Author

sirius0118 commented Apr 19, 2024

Thanks for your reply @avagin.

I want to add some new functions in the parasite code, which need to call the function of glibc.

What function is it?

I want to add the RDMA function to the parasite code. In lazy-page mode the parasite code can create connection with page-client, so the parasite code can serve the page fault request directly(maybe 5us). If we put the RDMA function in page-server, we need add once extra page copy time(maybe 2us), because RDMA transmission pages need to memory registion first, which can only regist the memory in the process' virtual memory address space.

So agfter add this function in CRIU, we can reduce the page fault serving time in lazy-page mode.

I noticed that there is a macro definition -DCR_NOGLIBC in the Makefile(criu/Makefile), so can we also use glibc without defining this macro?

We probably can do that, but first we need to understand why we need it.

If I can run glibc helper function in parasite code, I think I can relize the ibverbs function work in parasite code. And I will contribute the code to the community.
Can you tell me how to modify the CRIU? It is very important for me. Thank you very much.

@rst0git
Copy link
Member

rst0git commented Apr 19, 2024

I want to add the RDMA function to the parasite code.
Can you tell me how to modify the CRIU?

If I recall correctly, Mike Rapoport (@rppt) had a proof-of-concept for this functionality 12 and might be able to provide some advice on how it can be implemented.

Footnotes

  1. https://lpc.events/event/2/contributions/135/

  2. https://lpc.events/event/2/contributions/205/

@sirius0118
Copy link
Author

I want to add the RDMA function to the parasite code.
Can you tell me how to modify the CRIU?

If I recall correctly, Mike Rapoport (@rppt) had a proof-of-concept for this functionality 12 and might be able to provide some advice on how it can be implemented.

Footnotes

  1. https://lpc.events/event/2/contributions/135/
  2. https://lpc.events/event/2/contributions/205/

Thank you very much @rst0git , your information was very effective. I had readed the slide and watched the video. But I can not seem to find an open source demo. @rppt

Copy link

A friendly reminder that this issue had no activity for 30 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants