From: Jiri Olsa <olsajiri@gmail.com>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: acme@kernel.org, ast@kernel.org, andrii@kernel.org,
daniel@iogearbox.net, eddyz87@gmail.com, haoluo@google.com,
john.fastabend@gmail.com, kpsingh@chromium.org,
sinquersw@gmail.com, martin.lau@kernel.org,
songliubraving@fb.com, sdf@google.com, timo@incline.eu,
yhs@fb.com, bpf@vger.kernel.org
Subject: Re: [PATCH dwarves 0/3] dwarves: improve BTF encoder comparison method
Date: Mon, 13 Mar 2023 10:40:53 +0100 [thread overview]
Message-ID: <ZA7vpa3A0IDUUL7W@krava> (raw)
In-Reply-To: <1678459850-16140-1-git-send-email-alan.maguire@oracle.com>
On Fri, Mar 10, 2023 at 02:50:47PM +0000, Alan Maguire wrote:
> Currently when looking for function prototype mismatches with a view
> to excluding inconsistent functions, we fall back to a comparison
> between parameter names when the name and number of parameters match.
> This is brittle, as it is sometimes the case that a function has
> multiple type-identical definitions which use different parameters.
>
> Here the existing dwarves_fprintf functionality is re-used to instead
> create a string representation of the function prototype - minus the
> parameter names - to support a less brittle comparison method.
>
> To support this, patch 1 generalizes function prototype print to
> take a conf_fprintf parameter; this allows us to customize the
> parameters we use in prototype string generation.
>
> Patch 2 supports generating prototypes without modifiers such
> as const as they can lead to false positive prototype mismatches;
> see the patch for details.
>
> Finally patch 3 replaces the logic used to compare parameter
> names with the prototype string comparison instead.
>
> Using verbose pahole output we can see some of the rejected
> comparisons. 73 comparisons are rejected via prototype
> comparison, 63 of which are non "."-suffixed functions. For
> example:
>
> function mismatch for 'name_show'('name_show'): 'ssize_t ()(struct kobject *, struct kobj_attribute *, char *)' != 'ssize_t ()(struct device *, struct device_attribute *, char *)'
>
> With these changes, the syscalls defined in sys_ni.c
> that Jiri mentioned were missing [1] are present in BTF:
>
> [43071] FUNC '__ia32_compat_sys_io_setup' type_id=42335 linkage=static
> [43295] FUNC '__ia32_sys_io_setup' type_id=42335 linkage=static
> [47536] FUNC '__x64_sys_io_setup' type_id=42335 linkage=static
>
> [43290] FUNC '__ia32_sys_io_destroy' type_id=42335 linkage=static
> [47531] FUNC '__x64_sys_io_destroy' type_id=42335 linkage=static
>
> [43072] FUNC '__ia32_compat_sys_io_submit' type_id=42335 linkage=static
> [43296] FUNC '__ia32_sys_io_submit' type_id=42335 linkage=static
> [47537] FUNC '__x64_sys_io_submit' type_id=42335 linkage=static
>
> [1] https://lore.kernel.org/bpf/ZAsBYpsBV0wvkhh0@krava/
>
> Alan Maguire (3):
> dwarves_fprintf: generalize function prototype print to support
> passing conf
> dwarves_fprintf: support skipping modifier
> btf_encoder: compare functions via prototypes not parameter names
lgtm, the syscalls from sys_ni.c are there
for me the total number of syscalls increased from 249 to 432, great ;-)
Acked/Tested-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
>
> btf_encoder.c | 67 +++++++++++++++++++++++++------------------------------
> dwarves.h | 6 +++++
> dwarves_fprintf.c | 48 ++++++++++++++++++++++++++-------------
> 3 files changed, 70 insertions(+), 51 deletions(-)
>
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2023-03-13 9:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 14:50 [PATCH dwarves 0/3] dwarves: improve BTF encoder comparison method Alan Maguire
2023-03-10 14:50 ` [PATCH dwarves 1/3] dwarves_fprintf: generalize function prototype print to support passing conf Alan Maguire
2023-03-10 14:50 ` [PATCH dwarves 2/3] dwarves_fprintf: support skipping modifier Alan Maguire
2023-03-13 12:20 ` Arnaldo Carvalho de Melo
2023-03-13 12:29 ` Arnaldo Carvalho de Melo
2023-03-13 13:16 ` Alan Maguire
2023-03-13 13:50 ` Eduard Zingerman
2023-03-13 16:37 ` Alan Maguire
2023-03-13 17:12 ` Eduard Zingerman
2023-03-13 18:28 ` Arnaldo Carvalho de Melo
2023-03-13 14:45 ` Eduard Zingerman
2023-03-13 17:18 ` Alan Maguire
2023-03-13 18:26 ` Arnaldo Carvalho de Melo
2023-03-10 14:50 ` [PATCH dwarves 3/3] btf_encoder: compare functions via prototypes not parameter names Alan Maguire
2023-03-10 15:18 ` [PATCH dwarves 0/3] dwarves: improve BTF encoder comparison method Arnaldo Carvalho de Melo
2023-03-13 9:40 ` Jiri Olsa [this message]
2023-03-13 12:33 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZA7vpa3A0IDUUL7W@krava \
--to=olsajiri@gmail.com \
--cc=acme@kernel.org \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@chromium.org \
--cc=martin.lau@kernel.org \
--cc=sdf@google.com \
--cc=sinquersw@gmail.com \
--cc=songliubraving@fb.com \
--cc=timo@incline.eu \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox