* [PATCH] jump_label: mark __start/stop___jump_table const
@ 2017-02-09 21:11 Michael S. Tsirkin
2017-02-09 21:40 ` Michael S. Tsirkin
2017-02-10 5:01 ` kbuild test robot
0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2017-02-09 21:11 UTC (permalink / raw)
To: linux-kernel
Cc: Jason Baron, Peter Zijlstra, Steven Rostedt, Borislav Petkov,
Andrew Morton, Linus Torvalds, Thomas Gleixner, Mel Gorman,
Ingo Molnar
Attempts to assign values through these pointers would fail.
Mark them const to make sure the failure is compile time.
Cc: Jason Baron <jbaron@akamai.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/linux/jump_label.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index a0547c5..48ed83f 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -132,8 +132,8 @@ static __always_inline bool static_key_true(struct static_key *key)
return !arch_static_branch(key, true);
}
-extern struct jump_entry __start___jump_table[];
-extern struct jump_entry __stop___jump_table[];
+extern const struct jump_entry __start___jump_table[];
+extern const struct jump_entry __stop___jump_table[];
extern void jump_label_init(void);
extern void jump_label_lock(void);
--
MST
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] jump_label: mark __start/stop___jump_table const
2017-02-09 21:11 [PATCH] jump_label: mark __start/stop___jump_table const Michael S. Tsirkin
@ 2017-02-09 21:40 ` Michael S. Tsirkin
2017-02-10 5:01 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2017-02-09 21:40 UTC (permalink / raw)
To: linux-kernel
Cc: Jason Baron, Peter Zijlstra, Steven Rostedt, Borislav Petkov,
Andrew Morton, Linus Torvalds, Thomas Gleixner, Mel Gorman,
Ingo Molnar
On Thu, Feb 09, 2017 at 11:11:32PM +0200, Michael S. Tsirkin wrote:
> Attempts to assign values through these pointers would fail.
> Mark them const to make sure the failure is compile time.
>
> Cc: Jason Baron <jbaron@akamai.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Ingo Molnar <mingo@kernel.org>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Hmm this produces a bunch of warnings that I managed
to somehow miss. Self-Nack. Pls disregard.
> ---
> include/linux/jump_label.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
> index a0547c5..48ed83f 100644
> --- a/include/linux/jump_label.h
> +++ b/include/linux/jump_label.h
> @@ -132,8 +132,8 @@ static __always_inline bool static_key_true(struct static_key *key)
> return !arch_static_branch(key, true);
> }
>
> -extern struct jump_entry __start___jump_table[];
> -extern struct jump_entry __stop___jump_table[];
> +extern const struct jump_entry __start___jump_table[];
> +extern const struct jump_entry __stop___jump_table[];
>
> extern void jump_label_init(void);
> extern void jump_label_lock(void);
> --
> MST
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] jump_label: mark __start/stop___jump_table const
2017-02-09 21:11 [PATCH] jump_label: mark __start/stop___jump_table const Michael S. Tsirkin
2017-02-09 21:40 ` Michael S. Tsirkin
@ 2017-02-10 5:01 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2017-02-10 5:01 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: kbuild-all, linux-kernel, Jason Baron, Peter Zijlstra,
Steven Rostedt, Borislav Petkov, Andrew Morton, Linus Torvalds,
Thomas Gleixner, Mel Gorman, Ingo Molnar
[-- Attachment #1: Type: text/plain, Size: 4930 bytes --]
Hi Michael,
[auto build test WARNING on linus/master]
[also build test WARNING on v4.10-rc7 next-20170209]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Michael-S-Tsirkin/jump_label-mark-__start-stop___jump_table-const/20170210-104623
config: x86_64-rhel (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
kernel/jump_label.c: In function 'jump_label_init':
>> kernel/jump_label.c:284:34: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
struct jump_entry *iter_start = __start___jump_table;
^~~~~~~~~~~~~~~~~~~~
kernel/jump_label.c:285:33: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
struct jump_entry *iter_stop = __stop___jump_table;
^~~~~~~~~~~~~~~~~~~
kernel/jump_label.c: In function 'jump_label_text_reserved':
>> kernel/jump_label.c:549:39: warning: passing argument 1 of '__jump_label_text_reserved' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
int ret = __jump_label_text_reserved(__start___jump_table,
^~~~~~~~~~~~~~~~~~~~
kernel/jump_label.c:210:12: note: expected 'struct jump_entry *' but argument is of type 'const struct jump_entry *'
static int __jump_label_text_reserved(struct jump_entry *iter_start,
^~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/jump_label.c:550:4: warning: passing argument 2 of '__jump_label_text_reserved' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
__stop___jump_table, start, end);
^~~~~~~~~~~~~~~~~~~
kernel/jump_label.c:210:12: note: expected 'struct jump_entry *' but argument is of type 'const struct jump_entry *'
static int __jump_label_text_reserved(struct jump_entry *iter_start,
^~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/jump_label.c: In function 'jump_label_update':
kernel/jump_label.c:563:28: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
struct jump_entry *stop = __stop___jump_table;
^~~~~~~~~~~~~~~~~~~
vim +/const +284 kernel/jump_label.c
706249c22 Peter Zijlstra 2015-07-24 268 struct jump_entry *entry,
706249c22 Peter Zijlstra 2015-07-24 269 struct jump_entry *stop)
706249c22 Peter Zijlstra 2015-07-24 270 {
706249c22 Peter Zijlstra 2015-07-24 271 for (; (entry < stop) && (jump_entry_key(entry) == key); entry++) {
706249c22 Peter Zijlstra 2015-07-24 272 /*
706249c22 Peter Zijlstra 2015-07-24 273 * entry->code set to 0 invalidates module init text sections
706249c22 Peter Zijlstra 2015-07-24 274 * kernel_text_address() verifies we are not in core kernel
706249c22 Peter Zijlstra 2015-07-24 275 * init code, see jump_label_invalidate_module_init().
706249c22 Peter Zijlstra 2015-07-24 276 */
706249c22 Peter Zijlstra 2015-07-24 277 if (entry->code && kernel_text_address(entry->code))
706249c22 Peter Zijlstra 2015-07-24 278 arch_jump_label_transform(entry, jump_label_type(entry));
706249c22 Peter Zijlstra 2015-07-24 279 }
706249c22 Peter Zijlstra 2015-07-24 280 }
706249c22 Peter Zijlstra 2015-07-24 281
97ce2c88f Jeremy Fitzhardinge 2011-10-12 282 void __init jump_label_init(void)
bf5438fca Jason Baron 2010-09-17 283 {
bf5438fca Jason Baron 2010-09-17 @284 struct jump_entry *iter_start = __start___jump_table;
bf5438fca Jason Baron 2010-09-17 285 struct jump_entry *iter_stop = __stop___jump_table;
c5905afb0 Ingo Molnar 2012-02-24 286 struct static_key *key = NULL;
bf5438fca Jason Baron 2010-09-17 287 struct jump_entry *iter;
bf5438fca Jason Baron 2010-09-17 288
1f69bf9c6 Jason Baron 2016-08-03 289 /*
1f69bf9c6 Jason Baron 2016-08-03 290 * Since we are initializing the static_key.enabled field with
1f69bf9c6 Jason Baron 2016-08-03 291 * with the 'raw' int values (to avoid pulling in atomic.h) in
1f69bf9c6 Jason Baron 2016-08-03 292 * jump_label.h, let's make sure that is safe. There are only two
:::::: The code at line 284 was first introduced by commit
:::::: bf5438fca2950b03c21ad868090cc1a8fcd49536 jump label: Base patch for jump label
:::::: TO: Jason Baron <jbaron@redhat.com>
:::::: CC: Steven Rostedt <rostedt@goodmis.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38265 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-10 5:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-09 21:11 [PATCH] jump_label: mark __start/stop___jump_table const Michael S. Tsirkin
2017-02-09 21:40 ` Michael S. Tsirkin
2017-02-10 5:01 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox