• Ilya Leoshkevich's avatar
    s390/bpf: Align literal pool entries · e0491f64
    Ilya Leoshkevich authored
    When literal pool size exceeds 512k, it's no longer possible to
    reference all the entries in it using a single base register and long
    displacement. Therefore, PC-relative lgfrl and lgrl instructions need to
    be used.
    
    Unfortunately, they require their arguments to be aligned to 4- and
    8-byte boundaries respectively. This generates certain overhead due to
    necessary padding bytes. Grouping 4- and 8-byte entries together reduces
    the maximum overhead to 6 bytes (2 for aligning 4-byte entries and 4 for
    aligning 8-byte entries).
    
    While in theory it is possible to detect whether or not alignment is
    needed by comparing the literal pool size with 512k, in practice this
    leads to having two ways of emitting constants, making the code more
    complicated.
    
    Prefer code simplicity over trivial size saving, and always group and
    align literal pool entries.
    Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/bpf/20191118180340.68373-3-iii@linux.ibm.com
    e0491f64
bpf_jit_comp.c 42.4 KB