• Daniel Borkmann's avatar
    bpf: test ref bit from data path and add new tests for syscall path · d2baab62
    Daniel Borkmann authored
    The test_lru_map is relying on marking the LRU map entry via regular
    BPF map lookup from system call side. This is basically for simplicity
    reasons. Given we fixed marking entries in that case, the test needs
    to be fixed as well. Here we add a small drop-in replacement to retain
    existing behavior for the tests by marking out of the BPF program and
    transferring the retrieved value out via temporary map. This also adds
    new test cases to track the new behavior where two elements are marked,
    one via system call side and one via program side, where the next update
    then evicts the key looked up only from system call side.
    
      # ./test_lru_map
      nr_cpus:8
    
      test_lru_sanity0 (map_type:9 map_flags:0x0): Pass
      test_lru_sanity1 (map_type:9 map_flags:0x0): Pass
      test_lru_sanity2 (map_type:9 map_flags:0x0): Pass
      test_lru_sanity3 (map_type:9 map_flags:0x0): Pass
      test_lru_sanity4 (map_type:9 map_flags:0x0): Pass
      test_lru_sanity5 (map_type:9 map_flags:0x0): Pass
      test_lru_sanity7 (map_type:9 map_flags:0x0): Pass
      test_lru_sanity8 (map_type:9 map_flags:0x0): Pass
    
      test_lru_sanity0 (map_type:10 map_flags:0x0): Pass
      test_lru_sanity1 (map_type:10 map_flags:0x0): Pass
      test_lru_sanity2 (map_type:10 map_flags:0x0): Pass
      test_lru_sanity3 (map_type:10 map_flags:0x0): Pass
      test_lru_sanity4 (map_type:10 map_flags:0x0): Pass
      test_lru_sanity5 (map_type:10 map_flags:0x0): Pass
      test_lru_sanity7 (map_type:10 map_flags:0x0): Pass
      test_lru_sanity8 (map_type:10 map_flags:0x0): Pass
    
      test_lru_sanity0 (map_type:9 map_flags:0x2): Pass
      test_lru_sanity4 (map_type:9 map_flags:0x2): Pass
      test_lru_sanity6 (map_type:9 map_flags:0x2): Pass
      test_lru_sanity7 (map_type:9 map_flags:0x2): Pass
      test_lru_sanity8 (map_type:9 map_flags:0x2): Pass
    
      test_lru_sanity0 (map_type:10 map_flags:0x2): Pass
      test_lru_sanity4 (map_type:10 map_flags:0x2): Pass
      test_lru_sanity6 (map_type:10 map_flags:0x2): Pass
      test_lru_sanity7 (map_type:10 map_flags:0x2): Pass
      test_lru_sanity8 (map_type:10 map_flags:0x2): Pass
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    d2baab62
test_lru_map.c 23.5 KB