[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72nqFuJm5f69G-Pc_9QHz+anwaon-WfVsPrkZWah1OP7Fg@mail.gmail.com>
Date: Thu, 13 Dec 2018 22:59:10 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: liuxiaozhou@...edance.com, Greg KH <gregkh@...uxfoundation.org>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH v2] Compiler Attributes: don't pollute userspace with
macro definitions
Hi Xiaozhou,
Couple of comments.
On Sun, Dec 9, 2018 at 4:27 AM Xiaozhou Liu <liuxiaozhou@...edance.com> wrote:
>
> v2: update commit message.
This line should go below the "---", since it shouldn't be part of the
commit message.
> +#ifdef __KERNEL__
> +
> #ifdef CONFIG_ENABLE_MUST_CHECK
> #define __must_check __attribute__((__warn_unused_result__))
> #else
> @@ -215,4 +217,6 @@ struct ftrace_likely_data {
> */
> #define noinline_for_stack noinline
>
> +#endif /* __KERNEL */
I wonder if we can/should simply move them into the __KERNEL__ &&
!__ASSEMBLY__ block that is above, instead. It would be simpler to
read, and there aren't apparently dependencies to those outside it
that go after the block.
I took a look at where the macros were at each "step", and, on one
hand, compiler-gcc.h was (and is) included entirely inside it, which
is from where most of the macros come originally from. On the other
hand, not all do: __must_check (the generic version, not the one in
-gcc.h) and noinline_for_stack were defined in __KERNEL__ (only)
before commit 815f0ddb346c ("include/linux/compiler*.h: make
compiler-*.h mutually exclusive"). But anyway using those two in
assembly does not make sense, right?
What do you think?
Greg/Linus, are you going to pick this (or a v3) directly? If not, I
can pick it up in compiler-attributes tree linux-next.
PS: In addition (related to this but not for this patch), we should
review whether other macros that are currently outside should be there
or simply pushed back into __KERNEL__ (and possibly __ASSEMBLY__). For
instance, __latent_entropy (the generic one) is outside, but it is
only defined in compiler-gcc.h, so the generic one should be inside
the __KERNEL__ && !__ASSEMBLY__ block, no?
Cheers,
Miguel
Powered by blists - more mailing lists