Opened 15 years ago

Last modified 8 years 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:

Description

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 by Martin Decky, 15 years ago

Milestone: 0.5.0

comment:2 by Jakub Jermář, 14 years ago

Component: kernel/generic

comment:3 by Jiri Svoboda, 14 years ago

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

I think you mean IPC_M_DATA_WRITE.

comment:4 by Jakub Jermář, 13 years ago

Milestone: 0.5.00.5.1

comment:5 by Jakub Jermář, 12 years ago

Milestone: 0.5.00.5.1

comment:6 by Man OS, 11 years ago

Owner: set to Man OS
Status: newassigned

comment:7 by Jakub Jermář, 11 years ago

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 by Man OS, 11 years ago

Owner: Man OS removed
Status: assignednew

comment:9 by Jakub Jermář, 10 years ago

Milestone: 0.5.10.5.2

comment:10 by Jakub Jermář, 8 years ago

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