lkml.org 
[lkml]   [2020]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v3 bpf-next 5/8] printk: initialize vmlinux BTF outside of printk in late_initcall()
    Date
    vmlinux BTF initialization can take time so it's best to do that
    outside of printk context; otherwise the first printk() using %pT
    will trigger BTF initialization.

    Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
    ---
    lib/vsprintf.c | 12 ++++++++++++
    1 file changed, 12 insertions(+)

    diff --git a/lib/vsprintf.c b/lib/vsprintf.c
    index c0d209d..8ac136a 100644
    --- a/lib/vsprintf.c
    +++ b/lib/vsprintf.c
    @@ -3628,3 +3628,15 @@ int sscanf(const char *buf, const char *fmt, ...)
    return i;
    }
    EXPORT_SYMBOL(sscanf);
    +
    +/*
    + * Initialize vmlinux BTF as it may be used by printk()s and it's better
    + * to incur the cost of initialization outside of printk context.
    + */
    +static int __init init_btf_vmlinux(void)
    +{
    + (void) bpf_get_btf_vmlinux();
    +
    + return 0;
    +}
    +late_initcall(init_btf_vmlinux);
    --
    1.8.3.1
    \
     
     \ /
      Last update: 2020-06-23 14:11    [W:7.092 / U:0.840 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site