# Linux Kernel Module Cheat

###### 24.21.1.1.1. gem5 functional requests

As seen at gem5 functional vs atomic vs timing memory requests, functional requests are not used in common simulation, since the core must always go through caches.

Functional access are therefore only used for more magic simulation functionalities.

One such functionality, is the gem5 syscall emulation mode implementation of the futex system call which is done at `futexFunc` in `src/sim/sycall_emul.hh`.

As seen from `man futex`, the Linux kernel reads the value from an address that is given as the first argument of the call.

Therefore, here it makes sense for gem5 syscall implementation, which does not actually have a real kernel running, to just make a functional request and be done with it, since the impact of cache changes done by this read would be insignificant to the cost of an actual full context switch that would happen on a real syscall.

It is generally hard to implement functional requests for Ruby runs, because packets are flying through the memory system in a transient state, and there is no simple way of finding exactly which ones might have the latest version of the memory. See for example:

- https://gem5.atlassian.net/browse/GEM5-496

- https://gem5.atlassian.net/browse/GEM5-604

- https://gem5.atlassian.net/browse/GEM5-675

- https://gem5.atlassian.net/browse/GEM5-676

The typical error message in that case is:

    fatal: Ruby functional read failed for address