From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Yury Norov <yury.norov@gmail.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: 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: Mon, 11 Sep 2023 16:42:48 +0200 [thread overview]
Message-ID: <75000ef9-4ab6-9777-8497-8f786c30a2fe@intel.com> (raw)
In-Reply-To: <ZP3NlPOGtbT7CGQ1@yury-ThinkPad>
From: Yury Norov <yury.norov@gmail.com>
Date: Sun, 10 Sep 2023 07:07:16 -0700
> On Wed, Sep 06, 2023 at 05:54:26PM +0300, Andy Shevchenko wrote:
>> On Wed, Sep 06, 2023 at 04:40:39PM +0200, Alexander Lobakin wrote:
>>> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>>> Date: Thu, 31 Aug 2023 16:21:30 +0300
>>>> On Fri, Aug 25, 2023 at 04:49:07PM +0200, Alexander Lobakin wrote:
>>>>> 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?
>>>>
>>>> Hmm... Why can't you simply upstream your version? It seems better than mine.
>>>
>>> It was a part of the Netlink bigint API which is a bit on hold for now
>>> (I needed this macro available treewide).
>>> But I can send it as standalone if you're fine with that.
>>
>> I'm fine. Yury?
>
> Do we have opencoded BYTES_TO_BITS() somewhere else? If so, it should be
> fixed in the same series.
Treewide -- a ton.
We could add it so that devs could start using it and stop open-coding :D
>
> Regarding implementation, the current:
>
> #define BYTES_TO_BITS(nb) ((BITS_PER_LONG * (nb)) / sizeof(long))
>
> looks weird. Maybe there are some special considerations in a tracing
> subsystem to make it like this, but as per Masami's email - there's
> not.
>
> For a general purpose I'd suggest a simpler:
> #define BYTES_TO_BITS(nb) ((nb) * BITS_PER_BYTE)
I also didn't notice anything that would require using logic more
complex than this one. It would probably make more sense to define
it that way when moving.
>
> Thanks,
> Yury
Thanks,
Olek
prev parent reply other threads:[~2023-09-11 21:58 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
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 [this message]
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=75000ef9-4ab6-9777-8497-8f786c30a2fe@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®