Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1501477 > unrolled thread

[PATCH 11/12] jump_label: declare jump table as external array

Started byVegard Nossum <vegard.nossum@oracle.com>
First post2016-10-16 17:20 +0200
Last post2016-10-17 23:40 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 11/12] jump_label: declare jump table as external array Vegard Nossum <vegard.nossum@oracle.com> - 2016-10-16 17:20 +0200
    Re: [PATCH 11/12] jump_label: declare jump table as external array Peter Zijlstra <peterz@infradead.org> - 2016-10-16 18:30 +0200
      Re: [PATCH 11/12] jump_label: declare jump table as external array Vegard Nossum <vegard.nossum@oracle.com> - 2016-10-16 19:00 +0200
        Re: [PATCH 11/12] jump_label: declare jump table as external array Peter Zijlstra <peterz@infradead.org> - 2016-10-16 19:50 +0200
        Re: [PATCH 11/12] jump_label: declare jump table as external array Steven Rostedt <rostedt@goodmis.org> - 2016-10-17 23:40 +0200

#1501477 — [PATCH 11/12] jump_label: declare jump table as external array

FromVegard Nossum <vegard.nossum@oracle.com>
Date2016-10-16 17:20 +0200
Subject[PATCH 11/12] jump_label: declare jump table as external array
Message-ID<ssVod-7uv-19@gated-at.bofh.it>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 include/linux/jump_label.h |  4 ++--
 kernel/jump_label.c        | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index a0547c5..7ba9918 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -76,6 +76,7 @@
 
 #ifndef __ASSEMBLY__
 
+#include <linux/extarray.h>
 #include <linux/types.h>
 #include <linux/compiler.h>
 
@@ -132,8 +133,7 @@ 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[];
+DECLARE_EXTARRAY(struct jump_entry, __jump_table);
 
 extern void jump_label_init(void);
 extern void jump_label_lock(void);
diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index 93ad6c1..bf14906 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -274,8 +274,8 @@ static void __jump_label_update(struct static_key *key,
 
 void __init jump_label_init(void)
 {
-	struct jump_entry *iter_start = __start___jump_table;
-	struct jump_entry *iter_stop = __stop___jump_table;
+	struct jump_entry *iter_start = ext_start(__jump_table);
+	struct jump_entry *iter_stop = ext_end(__jump_table);
 	struct static_key *key = NULL;
 	struct jump_entry *iter;
 
@@ -539,8 +539,8 @@ early_initcall(jump_label_init_module);
  */
 int jump_label_text_reserved(void *start, void *end)
 {
-	int ret = __jump_label_text_reserved(__start___jump_table,
-			__stop___jump_table, start, end);
+	int ret = __jump_label_text_reserved(ext_start(__jump_table),
+			ext_end(__jump_table), start, end);
 
 	if (ret)
 		return ret;
@@ -553,7 +553,7 @@ int jump_label_text_reserved(void *start, void *end)
 
 static void jump_label_update(struct static_key *key)
 {
-	struct jump_entry *stop = __stop___jump_table;
+	struct jump_entry *stop = ext_end(__jump_table);
 	struct jump_entry *entry = static_key_entries(key);
 #ifdef CONFIG_MODULES
 	struct module *mod;
-- 
2.10.0.479.g221bd91

[toc] | [next] | [standalone]


#1501518

FromPeter Zijlstra <peterz@infradead.org>
Date2016-10-16 18:30 +0200
Message-ID<ssWtY-8bF-11@gated-at.bofh.it>
In reply to#1501477
On Sun, Oct 16, 2016 at 05:16:15PM +0200, Vegard Nossum wrote:
> Cc: Jason Baron <jbaron@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>

NAK, -ENOCHANGELOG.

[toc] | [prev] | [next] | [standalone]


#1501529

FromVegard Nossum <vegard.nossum@oracle.com>
Date2016-10-16 19:00 +0200
Message-ID<ssWX1-8mi-69@gated-at.bofh.it>
In reply to#1501518
On 10/16/2016 06:25 PM, Peter Zijlstra wrote:
> On Sun, Oct 16, 2016 at 05:16:15PM +0200, Vegard Nossum wrote:
>> Cc: Jason Baron <jbaron@redhat.com>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: Steven Rostedt <rostedt@goodmis.org>
>> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
>
> NAK, -ENOCHANGELOG.
>

Hi Peter,

It's true I didn't put an RFC tag on this (mostly because git-send-email
doesn't seem to have an option for it?), but the whole point of doing
these other patches (03-12) was to demonstrate what the patches would
look like for some other kernel code and ask for feedback on the overall
interface/approach. I don't know if you read the introduction and first
patch in the series, but I'd expect that to be more than enough to
understand the problem.

If we really have to repeat the rationale for every patch, can we reuse
this?

"Comparisons between pointers to different arrays is technically
undefined behaviour and recent GCCs may incorrectly optimise away loop
termination conditions. Use the external array accessor macros to
prevent this from happening."


Vegard

[toc] | [prev] | [next] | [standalone]


#1501543

FromPeter Zijlstra <peterz@infradead.org>
Date2016-10-16 19:50 +0200
Message-ID<ssXJn-r1-13@gated-at.bofh.it>
In reply to#1501529
On Sun, Oct 16, 2016 at 06:50:55PM +0200, Vegard Nossum wrote:
> On 10/16/2016 06:25 PM, Peter Zijlstra wrote:
> >On Sun, Oct 16, 2016 at 05:16:15PM +0200, Vegard Nossum wrote:
> >>Cc: Jason Baron <jbaron@redhat.com>
> >>Cc: Peter Zijlstra <peterz@infradead.org>
> >>Cc: Steven Rostedt <rostedt@goodmis.org>
> >>Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
> >
> >NAK, -ENOCHANGELOG.
> >
> 
> Hi Peter,
> 
> It's true I didn't put an RFC tag on this (mostly because git-send-email
> doesn't seem to have an option for it?), but the whole point of doing
> these other patches (03-12) was to demonstrate what the patches would
> look like for some other kernel code and ask for feedback on the overall
> interface/approach. I don't know if you read the introduction and first
> patch in the series, but I'd expect that to be more than enough to
> understand the problem.

Well, seeing how I was not Cc'ed on any of the other patches, including
the first patch, I really couldn't say.

[toc] | [prev] | [next] | [standalone]


#1502490

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-10-17 23:40 +0200
Message-ID<stnNv-Pb-11@gated-at.bofh.it>
In reply to#1501529
On Sun, 16 Oct 2016 18:50:55 +0200
Vegard Nossum <vegard.nossum@oracle.com> wrote:
> >
> > NAK, -ENOCHANGELOG.

Agreed.

> >  
> 
> Hi Peter,
> 
> It's true I didn't put an RFC tag on this (mostly because git-send-email
> doesn't seem to have an option for it?), but the whole point of doing

I would think it does, although I never use it (I always use quilt
mail).


> these other patches (03-12) was to demonstrate what the patches would
> look like for some other kernel code and ask for feedback on the overall
> interface/approach. I don't know if you read the introduction and first
> patch in the series, but I'd expect that to be more than enough to
> understand the problem.

But we were not Cc'd on those. If we are not on the Cc to the
introduction nor the other patches, we will most likely not be reading
them.

> 
> If we really have to repeat the rationale for every patch, can we reuse
> this?
> 
> "Comparisons between pointers to different arrays is technically
> undefined behaviour and recent GCCs may incorrectly optimise away loop
> termination conditions. Use the external array accessor macros to
> prevent this from happening."
> 

So basically gcc will break on these array address calculations? Which
version of gcc started this, and has this actually been an issue?


-- Steve

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web