2018-02-27 19:49:48

by Matthew Wilcox

[permalink] [raw]
Subject: [PATCH] sparse doesn't support indirect_branch attribute


Don't use __attribute__((indirect_branch)) if we're compiling with
sparse.

Signed-off-by: Matthew Wilcox <[email protected]>

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index e2c7f4369eff..b6be4cc25e9d 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -93,7 +93,7 @@
#define __weak __attribute__((weak))
#define __alias(symbol) __attribute__((alias(#symbol)))

-#ifdef RETPOLINE
+#if defined(RETPOLINE) && !defined(__CHECKER__)
#define __noretpoline __attribute__((indirect_branch("keep")))
#endif



2018-02-27 20:19:28

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] sparse doesn't support indirect_branch attribute

On 02/27/2018 11:48 AM, Matthew Wilcox wrote:
>
> Don't use __attribute__((indirect_branch)) if we're compiling with
> sparse.
>
> Signed-off-by: Matthew Wilcox <[email protected]>
>
> diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> index e2c7f4369eff..b6be4cc25e9d 100644
> --- a/include/linux/compiler-gcc.h
> +++ b/include/linux/compiler-gcc.h
> @@ -93,7 +93,7 @@
> #define __weak __attribute__((weak))
> #define __alias(symbol) __attribute__((alias(#symbol)))
>
> -#ifdef RETPOLINE
> +#if defined(RETPOLINE) && !defined(__CHECKER__)
> #define __noretpoline __attribute__((indirect_branch("keep")))
> #endif
>
>

I don't mind the patch, but I did send a patch for this attribute on Feb. 13, 2018,
to the sparse mailing list.

--
~Randy

2018-02-27 22:13:43

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] sparse doesn't support indirect_branch attribute

On Tue, Feb 27, 2018 at 12:18 PM, Randy Dunlap <[email protected]> wrote:
>
> I don't mind the patch, but I did send a patch for this attribute on Feb. 13, 2018,
> to the sparse mailing list.

I think the sparse plan is to just stop warning about unknown
attributes, because it doesn't really help users (at most it's a note
to a sparse developer).

But sparse doesn't have the same regular releases the kernel has. Oh well.

Linus

2018-02-27 22:31:52

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] sparse doesn't support indirect_branch attribute

On 02/27/2018 02:12 PM, Linus Torvalds wrote:
> On Tue, Feb 27, 2018 at 12:18 PM, Randy Dunlap <[email protected]> wrote:
>>
>> I don't mind the patch, but I did send a patch for this attribute on Feb. 13, 2018,
>> to the sparse mailing list.
>
> I think the sparse plan is to just stop warning about unknown
> attributes, because it doesn't really help users (at most it's a note
> to a sparse developer).

Yes, there are sparse discussions about that.

There is also a kernel kbuild patch from Luc that Masahiro has also merged that
does -Wno-unknown-attributes (or however that is spelled).

> But sparse doesn't have the same regular releases the kernel has. Oh well.

Right.


--
~Randy

2018-02-27 22:34:10

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] sparse doesn't support indirect_branch attribute

On Tue, Feb 27, 2018 at 2:30 PM, Randy Dunlap <[email protected]> wrote:
>
> There is also a kernel kbuild patch from Luc that Masahiro has also merged that
> does -Wno-unknown-attributes (or however that is spelled).

That's probably a better interim workaround.

Linus

2018-02-27 22:37:17

by Luc Van Oostenryck

[permalink] [raw]
Subject: Re: [PATCH] sparse doesn't support indirect_branch attribute

On Tue, Feb 27, 2018 at 02:12:28PM -0800, Linus Torvalds wrote:
> On Tue, Feb 27, 2018 at 12:18 PM, Randy Dunlap <[email protected]> wrote:
> >
> > I don't mind the patch, but I did send a patch for this attribute on Feb. 13, 2018,
> > to the sparse mailing list.
>
> I think the sparse plan is to just stop warning about unknown
> attributes, because it doesn't really help users (at most it's a note
> to a sparse developer).
>
> But sparse doesn't have the same regular releases the kernel has. Oh well.

To compensate this, I sent a patch to use '-Wno-unknown-attribute' for kernel
builds. Masahiro Yamada has already taken it to the linux-kbuild tree.
I'm not sure if it's planned for the next -rc or for 4.17, though.

-- Luc Van Oostenryck

2018-02-28 01:41:20

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] sparse doesn't support indirect_branch attribute

2018-02-28 7:36 GMT+09:00 Luc Van Oostenryck <[email protected]>:
> On Tue, Feb 27, 2018 at 02:12:28PM -0800, Linus Torvalds wrote:
>> On Tue, Feb 27, 2018 at 12:18 PM, Randy Dunlap <[email protected]> wrote:
>> >
>> > I don't mind the patch, but I did send a patch for this attribute on Feb. 13, 2018,
>> > to the sparse mailing list.
>>
>> I think the sparse plan is to just stop warning about unknown
>> attributes, because it doesn't really help users (at most it's a note
>> to a sparse developer).
>>
>> But sparse doesn't have the same regular releases the kernel has. Oh well.
>
> To compensate this, I sent a patch to use '-Wno-unknown-attribute' for kernel
> builds. Masahiro Yamada has already taken it to the linux-kbuild tree.
> I'm not sure if it's planned for the next -rc or for 4.17, though.
>
> -- Luc Van Oostenryck


I am planning to send it in the next MW (i.e. v4.17-rc1)


If you want me to send this earlier as fixes PR,
please let me know.



--
Best Regards
Masahiro Yamada

2018-03-01 10:10:04

by Luc Van Oostenryck

[permalink] [raw]
Subject: Re: [PATCH] sparse doesn't support indirect_branch attribute

On Wed, Feb 28, 2018 at 10:30:58AM +0900, Masahiro Yamada wrote:
> 2018-02-28 7:36 GMT+09:00 Luc Van Oostenryck <[email protected]>:
> >
> > To compensate this, I sent a patch to use '-Wno-unknown-attribute' for kernel
> > builds. Masahiro Yamada has already taken it to the linux-kbuild tree.
> > I'm not sure if it's planned for the next -rc or for 4.17, though.
>
> I am planning to send it in the next MW (i.e. v4.17-rc1)
>
> If you want me to send this earlier as fixes PR,
> please let me know.
>

Hi,

Thanks for having taken this patch promptly.
Given that the warnings is issued more than 148000 and thus tend
to drown the other, more useful, warnings in the noise, I think
it would be a good thing to have this patch already in 4.16.
I should have put this clearly in the patch description.

Best regards,
-- Luc Van Oostenryck

2018-03-01 10:25:37

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] sparse doesn't support indirect_branch attribute

2018-03-01 19:06 GMT+09:00 Luc Van Oostenryck <[email protected]>:
> On Wed, Feb 28, 2018 at 10:30:58AM +0900, Masahiro Yamada wrote:
>> 2018-02-28 7:36 GMT+09:00 Luc Van Oostenryck <[email protected]>:
>> >
>> > To compensate this, I sent a patch to use '-Wno-unknown-attribute' for kernel
>> > builds. Masahiro Yamada has already taken it to the linux-kbuild tree.
>> > I'm not sure if it's planned for the next -rc or for 4.17, though.
>>
>> I am planning to send it in the next MW (i.e. v4.17-rc1)
>>
>> If you want me to send this earlier as fixes PR,
>> please let me know.
>>
>
> Hi,
>
> Thanks for having taken this patch promptly.
> Given that the warnings is issued more than 148000 and thus tend
> to drown the other, more useful, warnings in the noise, I think
> it would be a good thing to have this patch already in 4.16.
> I should have put this clearly in the patch description.
>
> Best regards,
> -- Luc Van Oostenryck


OK. I will send a PR for v4.16-rc4 this weekend.





--
Best Regards
Masahiro Yamada