• J
    nfp: bpf: detect load/store sequences lowered from memory copy · 6bc7103c
    Jiong Wang 提交于
    This patch add the optimization frontend, but adding a new eBPF IR scan
    pass "nfp_bpf_opt_ldst_gather".
    
    The pass will traverse the IR to recognize the load/store pairs sequences
    that come from lowering of memory copy builtins.
    
    The gathered memory copy information will be kept in the meta info
    structure of the first load instruction in the sequence and will be
    consumed by the optimization backend added in the previous patches.
    
    NOTE: a sequence with cross memory access doesn't qualify this
    optimization, i.e. if one load in the sequence will load from place that
    has been written by previous store. This is because when we turn the
    sequence into single CPP operation, we are reading all contents at once
    into NFP transfer registers, then write them out as a whole. This is not
    identical with what the original load/store sequence is doing.
    
    Detecting cross memory access for two random pointers will be difficult,
    fortunately under XDP/eBPF's restrictied runtime environment, the copy
    normally happen among map, packet data and stack, they do not overlap with
    each other.
    
    And for cases supported by NFP, cross memory access will only happen on
    PTR_TO_PACKET. Fortunately for this, there is ID information that we could
    do accurate memory alias check.
    Signed-off-by: NJiong Wang <jiong.wang@netronome.com>
    Reviewed-by: NJakub Kicinski <jakub.kicinski@netronome.com>
    Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
    6bc7103c
jit.c 69.8 KB