Difference between revisions of "BPF Maps"

From CRIU
Jump to navigation Jump to search
m
m (formatting)
 
Line 1: Line 1:
 
BPF maps are kernel objects which store data (used by BPF programs) in the form of key-value pairs. Applications access BPF maps using file descriptors. C/R of BPF maps involves serializing their ''meta-data'' and ''data'':
 
BPF maps are kernel objects which store data (used by BPF programs) in the form of key-value pairs. Applications access BPF maps using file descriptors. C/R of BPF maps involves serializing their ''meta-data'' and ''data'':
  
: '''Meta-data''' - This includes information such as map type, key size, value size, etc. CRIU obtains this information from the proc filesystem and using the <code>bpf</code> system call with argument <code>BPF_OBJ_GET_INFO_BY_FD</code>
+
: '''Meta-data''' - This includes information such as map type, key size, value size, etc. CRIU obtains this information from the proc filesystem and using the <code>bpf</code> system call with argument <code>BPF_OBJ_GET_INFO_BY_FD</code>.
  
: '''Data''' - This is the map's contents i.e. the actual key-value pairs. CRIU relies on batch operations to read <code>(BPF_MAP_LOOKUP_BATCH)</code> key-value pairs from maps during the checkpoint stage and to write <code>(BPF_MAP_UPDATE_BATCH)</code> them during the restore phase.
+
: '''Data''' - This is the map's contents, i.e. the actual key-value pairs. CRIU relies on batch operations to read (<code>BPF_MAP_LOOKUP_BATCH</code>) key-value pairs from maps during the checkpoint stage and to write (<code>BPF_MAP_UPDATE_BATCH</code>) them during the restore phase.
  
 
== Support for BPF Maps ==
 
== Support for BPF Maps ==

Latest revision as of 03:37, 14 November 2020

BPF maps are kernel objects which store data (used by BPF programs) in the form of key-value pairs. Applications access BPF maps using file descriptors. C/R of BPF maps involves serializing their meta-data and data:

Meta-data - This includes information such as map type, key size, value size, etc. CRIU obtains this information from the proc filesystem and using the bpf system call with argument BPF_OBJ_GET_INFO_BY_FD.
Data - This is the map's contents, i.e. the actual key-value pairs. CRIU relies on batch operations to read (BPF_MAP_LOOKUP_BATCH) key-value pairs from maps during the checkpoint stage and to write (BPF_MAP_UPDATE_BATCH) them during the restore phase.

Support for BPF Maps[edit]

CRIU currently supports C/R of the following BPF map types:

  • BPF_MAP_TYPE_HASH
  • BPF_MAP_TYPE_ARRAY

To-Do[edit]

  • C/R of BTF (BPF Type Format) information
  • C/R of other kinds of BPF maps

External Links[edit]