Follow us on Google+ Follow us on Facebook Follow us on Twitter

Opened 8 years ago

Last modified 16 months ago

#12 new enhancement

Eliminate one of two copies during IPC_M_DATA_WRITE

Reported by: Martin Decky Owned by:
Priority: minor Milestone:
Component: helenos/kernel/generic Version: mainline
Keywords: Cc:
Blocker for: Depends on:
See also:


With the addition of the IPC_M_DATA_SEND call method, a new space for kernel improvements opened. In particular, the change of the current behaviour, in which a pair of copy_to_uspace() and copy_from_uspace() is required, is desirable so that the data is transfered only once (the current implementation copies the data twice).

In more detail, the processing of the IPC_M_DATA_SEND call method is as follows. The sender makes the IPC_M_DATA_SEND call via an IPC syscall. The kernel allocates a buffer and copies the data from userspace into the buffer using copy_from_uspace(). The call is delivered to the destination task. The recipient evaluates the parameters such as the suggested destination address and size, and
eventually answers. If the answer is positive, the kernel then copies the data from the buffer into the destination task's address space using copy_to_usapce(). This solution is portable and generic, but as has been already stated above, there are two data transfers instead of one.

Here are some ideas I have about how to improve the situation.

(1) After the recipient agrees to receive the data, the data will be copied directly from one address space to the other via each task's userspace virtual addresses. There are instructions for this on sparc64, other architectures may or may not provide such hardware support; however, there are some obstacles and necessary improvements that would have to be dealt with and that would have to
be implemented (e.g. handling of page faults for other than the active address space).

(2) emulation of (1) for architectures that have no hardware support for (1). The data will be copied from one physical location (frame) into another using kernel virtual addresses. The kernel will need to make sure that both the source and destination physical frame, respectively, is mapped in both the source and
destination address space, respectively. Should the mapping for that frame be non-existent in one of the address spaces, the kernel will need to create the mapping for the task by simulating page faults (prefaulting). Currently, the mapping is created on-demand during a page fault. Support for prefaulting will need to be implemented.

Previously, I had some worries about the source address space disappearing (i.e. dying or exiting) before the answer arrives. Nevertheless, this issue is not specific to these improvements and needs to be solved even now. As I can tell, there is a protection in that the source task cannot exit if it has any unanswered calls.

Change History (10)

comment:1 Changed 8 years ago by Martin Decky

Milestone: 0.5.0

comment:2 Changed 8 years ago by Jakub Jermář

Component: kernel/generic

comment:3 Changed 8 years ago by Jiri Svoboda

Summary: More generic page faultsEliminate one of two copies during IPC_M_DATA_WRITE

I think you mean IPC_M_DATA_WRITE.

comment:4 Changed 7 years ago by Jakub Jermář


comment:5 Changed 5 years ago by Jakub Jermář


comment:6 Changed 5 years ago by Manish Sharma

Owner: set to Manish Sharma
Status: newassigned

comment:7 Changed 5 years ago by Jakub Jermář

Note that this ticket requires understanding of and fiddling with HelenOS memory management internals, I do not expect it to be any trivial.

comment:8 Changed 5 years ago by Manish Sharma

Owner: Manish Sharma deleted
Status: assignednew

comment:9 Changed 3 years ago by Jakub Jermář


comment:10 Changed 16 months ago by Jakub Jermář

Milestone: 0.6.1
Note: See TracTickets for help on using tickets.