From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Yury Norov <yury.norov@gmail.com>,
Uros Bizjak <ubizjak@gmail.com>,
"Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-trace-kernel@vger.kernel.org>,
"Steven Rostedt" <rostedt@goodmis.org>
Subject: Re: [PATCH v1 1/1] bitops: Share BYTES_TO_BITS() for everyone
Date: Fri, 25 Aug 2023 16:49:07 +0200 [thread overview]
Message-ID: <a5574786-0a49-454d-67e3-571983e6a6e8@intel.com> (raw)
In-Reply-To: <20230824123728.2761663-1-andriy.shevchenko@linux.intel.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Thu, 24 Aug 2023 15:37:28 +0300
> It may be new callers for the same macro, share it.
>
> Note, it's unknown why it's represented in the current form instead of
> simple multiplication and commit 1ff511e35ed8 ("tracing/kprobes: Add
> bitfield type") doesn't explain that neither. Let leave it as is and
> we may improve it in the future.
Maybe symmetrical change in tools/ like I did[0] an aeon ago?
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> include/linux/bitops.h | 2 ++
> kernel/trace/trace_probe.c | 3 +--
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/bitops.h b/include/linux/bitops.h
> index 2ba557e067fe..66dc091e0c28 100644
> --- a/include/linux/bitops.h
> +++ b/include/linux/bitops.h
> @@ -21,6 +21,8 @@
> #define BITS_TO_U32(nr) __KERNEL_DIV_ROUND_UP(nr, BITS_PER_TYPE(u32))
> #define BITS_TO_BYTES(nr) __KERNEL_DIV_ROUND_UP(nr, BITS_PER_TYPE(char))
>
> +#define BYTES_TO_BITS(nb) ((BITS_PER_LONG * (nb)) / sizeof(long))
> +
> extern unsigned int __sw_hweight8(unsigned int w);
> extern unsigned int __sw_hweight16(unsigned int w);
> extern unsigned int __sw_hweight32(unsigned int w);
> diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> index c68a72707852..da6297d24d61 100644
> --- a/kernel/trace/trace_probe.c
> +++ b/kernel/trace/trace_probe.c
> @@ -11,6 +11,7 @@
> */
> #define pr_fmt(fmt) "trace_probe: " fmt
>
> +#include <linux/bitops.h>
> #include <linux/bpf.h>
>
> #include "trace_probe.h"
> @@ -830,8 +831,6 @@ parse_probe_arg(char *arg, const struct fetch_type *type,
> return ret;
> }
>
> -#define BYTES_TO_BITS(nb) ((BITS_PER_LONG * (nb)) / sizeof(long))
> -
> /* Bitfield type needs to be parsed into a fetch function */
> static int __parse_bitfield_probe_arg(const char *bf,
> const struct fetch_type *t,
[0]
https://github.com/alobakin/linux/commit/fd308001fe6d38837fe820427209a6a99e4850a8
Thanks,
Olek
next prev parent reply other threads:[~2023-08-25 14:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 12:37 Andy Shevchenko
2023-08-25 14:49 ` Alexander Lobakin [this message]
2023-08-30 7:16 ` Masami Hiramatsu
2023-08-31 13:21 ` Andy Shevchenko
2023-09-06 14:40 ` Alexander Lobakin
2023-09-06 14:54 ` Andy Shevchenko
2023-09-10 14:07 ` Yury Norov
2023-09-11 14:42 ` Alexander Lobakin
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=a5574786-0a49-454d-67e3-571983e6a6e8@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=ubizjak@gmail.com \
--cc=yury.norov@gmail.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
all inboxes | Powered by JetHome®