Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1210465 > unrolled thread
| Started by | Kevin Hao <haokexin@gmail.com> |
|---|---|
| First post | 2015-08-20 14:20 +0200 |
| Last post | 2015-08-21 08:50 +0200 |
| Articles | 10 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH 0/8] powerpc: use jump label for {cpu,mmu}_has_feature() Kevin Hao <haokexin@gmail.com> - 2015-08-20 14:20 +0200
[PATCH 8/8] powerpc: use jump label for mmu_has_feature Kevin Hao <haokexin@gmail.com> - 2015-08-20 14:20 +0200
[PATCH 7/8] powerpc: use the jump label for cpu_has_feature Kevin Hao <haokexin@gmail.com> - 2015-08-20 14:20 +0200
[PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros Kevin Hao <haokexin@gmail.com> - 2015-08-20 14:20 +0200
Re: [PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros Peter Zijlstra <peterz@infradead.org> - 2015-08-20 20:40 +0200
Re: [PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros Kevin Hao <haokexin@gmail.com> - 2015-08-21 05:30 +0200
Re: [PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros Ingo Molnar <mingo@kernel.org> - 2015-08-21 08:30 +0200
Re: [PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros Kevin Hao <haokexin@gmail.com> - 2015-08-21 08:40 +0200
Re: [PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros Kevin Hao <haokexin@gmail.com> - 2015-08-21 08:50 +0200
Re: [PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros Ingo Molnar <mingo@kernel.org> - 2015-08-21 08:50 +0200
| From | Kevin Hao <haokexin@gmail.com> |
|---|---|
| Date | 2015-08-20 14:20 +0200 |
| Subject | [PATCH 0/8] powerpc: use jump label for {cpu,mmu}_has_feature() |
| Message-ID | <pZwZ4-4Ab-17@gated-at.bofh.it> |
Hi,
I have tried to change the {cpu,mmu}_has_feature() to use jump label two yeas
ago [1]. But that codes seem a bit ugly. This is a reimplementation by moving the
jump_label_init() much earlier so the jump label can be used in a very earlier
stage. Boot test on p4080ds, t2080rdb and powermac (qemu). This patch series
is against linux-next.
[1] https://lists.ozlabs.org/pipermail/linuxppc-dev/2013-September/111026.html
Kevin Hao (8):
jump_label: no need to acquire the jump_label_mutex in
jump_lable_init()
jump_label: make it possible for the archs to invoke jump_label_init()
much earlier
jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros
powerpc: invoke jump_label_init() in a much earlier stage
powerpc: kill mfvtb()
powerpc: move the cpu_has_feature to a separate file
powerpc: use the jump label for cpu_has_feature
powerpc: use jump label for mmu_has_feature
arch/powerpc/include/asm/cacheflush.h | 1 +
arch/powerpc/include/asm/cpufeatures.h | 34 +++++++++++++++++++++++++++++++++
arch/powerpc/include/asm/cputable.h | 16 ++++++++--------
arch/powerpc/include/asm/cputime.h | 1 +
arch/powerpc/include/asm/dbell.h | 1 +
arch/powerpc/include/asm/dcr-native.h | 1 +
arch/powerpc/include/asm/mman.h | 1 +
arch/powerpc/include/asm/mmu.h | 29 ++++++++++++++++++++++++++++
arch/powerpc/include/asm/reg.h | 9 ---------
arch/powerpc/include/asm/time.h | 3 ++-
arch/powerpc/include/asm/xor.h | 1 +
arch/powerpc/kernel/align.c | 1 +
arch/powerpc/kernel/cputable.c | 33 ++++++++++++++++++++++++++++++++
arch/powerpc/kernel/irq.c | 1 +
arch/powerpc/kernel/process.c | 1 +
arch/powerpc/kernel/setup-common.c | 1 +
arch/powerpc/kernel/setup_32.c | 5 +++++
arch/powerpc/kernel/setup_64.c | 4 ++++
arch/powerpc/kernel/smp.c | 1 +
arch/powerpc/platforms/cell/pervasive.c | 1 +
arch/powerpc/xmon/ppc-dis.c | 1 +
include/linux/jump_label.h | 6 ++++++
kernel/jump_label.c | 5 +++--
23 files changed, 137 insertions(+), 20 deletions(-)
create mode 100644 arch/powerpc/include/asm/cpufeatures.h
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Kevin Hao <haokexin@gmail.com> |
|---|---|
| Date | 2015-08-20 14:20 +0200 |
| Subject | [PATCH 8/8] powerpc: use jump label for mmu_has_feature |
| Message-ID | <pZwZ5-4Ab-45@gated-at.bofh.it> |
| In reply to | #1210465 |
The mmu features are fixed once the probe of mmu features are done.
And the function mmu_has_feature() does be used in some hot path.
The checking of the mmu features for each time of invoking of
mmu_has_feature() seems suboptimal. This tries to reduce this
overhead of this check by using jump label.
The generated assemble code of the following c program:
if (mmu_has_feature(MMU_FTR_XXX))
xxx()
Before:
lis r9,-16230
lwz r9,12324(r9)
lwz r9,24(r9)
andi. r10,r9,16
beqlr+
After:
nop if MMU_FTR_XXX is enabled
b xxx if MMU_FTR_XXX is not enabled
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
arch/powerpc/include/asm/mmu.h | 29 +++++++++++++++++++++++++++++
arch/powerpc/kernel/cputable.c | 15 +++++++++++++++
arch/powerpc/kernel/setup_32.c | 1 +
arch/powerpc/kernel/setup_64.c | 1 +
4 files changed, 46 insertions(+)
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index 3d5abfe6ba67..e091de352a75 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -109,6 +109,34 @@
DECLARE_PER_CPU(int, next_tlbcam_idx);
#endif
+#ifdef CONFIG_JUMP_LABEL
+#include <linux/jump_label.h>
+
+#define MAX_MMU_FEATURES (8 * sizeof(((struct cpu_spec *)0)->mmu_features))
+
+extern struct static_key_true mmu_feat_keys[MAX_MMU_FEATURES];
+
+extern void mmu_feat_keys_init(void);
+
+static inline int mmu_has_feature(unsigned long feature)
+{
+ int i;
+
+ i = __builtin_ctzl(feature);
+ return static_branch_likely(&mmu_feat_keys[i]);
+}
+
+static inline void mmu_clear_feature(unsigned long feature)
+{
+ int i;
+
+ i = __builtin_ctzl(feature);
+ cur_cpu_spec->mmu_features &= ~feature;
+ static_branch_disable(&mmu_feat_keys[i]);
+}
+#else
+static inline void mmu_feat_keys_init(void) { }
+
static inline int mmu_has_feature(unsigned long feature)
{
return (cur_cpu_spec->mmu_features & feature);
@@ -118,6 +146,7 @@ static inline void mmu_clear_feature(unsigned long feature)
{
cur_cpu_spec->mmu_features &= ~feature;
}
+#endif
extern unsigned int __start___mmu_ftr_fixup, __stop___mmu_ftr_fixup;
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 7d4fe69a61ed..18a843f139c3 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2212,4 +2212,19 @@ void __init cpu_feat_keys_init(void)
static_branch_disable(&cpu_feat_keys[i]);
}
}
+
+DEFINE_STATIC_KEY_TRUE_ARRAY(mmu_feat_keys, MAX_MMU_FEATURES);
+EXPORT_SYMBOL_GPL(mmu_feat_keys);
+
+void __init mmu_feat_keys_init(void)
+{
+ int i;
+
+ for (i = 0; i < MAX_MMU_FEATURES; i++) {
+ unsigned long f = 1ul << i;
+
+ if (!(cur_cpu_spec->mmu_features & f))
+ static_branch_disable(&mmu_feat_keys[i]);
+ }
+}
#endif
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 93756175a13c..8acff5a4bc3e 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -116,6 +116,7 @@ notrace void __init machine_init(u64 dt_ptr)
jump_label_init();
cpu_feat_keys_init();
+ mmu_feat_keys_init();
/* Enable early debugging if any specified (see udbg.h) */
udbg_early_init();
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 4cf3894d91fa..df6f98f1c46c 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -252,6 +252,7 @@ void __init early_setup(unsigned long dt_ptr)
jump_label_init();
cpu_feat_keys_init();
+ mmu_feat_keys_init();
/* -------- printk is now safe to use ------- */
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Kevin Hao <haokexin@gmail.com> |
|---|---|
| Date | 2015-08-20 14:20 +0200 |
| Subject | [PATCH 7/8] powerpc: use the jump label for cpu_has_feature |
| Message-ID | <pZwZ5-4Ab-47@gated-at.bofh.it> |
| In reply to | #1210465 |
The cpu features are fixed once the probe of cpu features are done.
And the function cpu_has_feature() does be used in some hot path.
The checking of the cpu features for each time of invoking of
cpu_has_feature() seems suboptimal. This tries to reduce this
overhead of this check by using jump label.
The generated assemble code of the following c program:
if (cpu_has_feature(CPU_FTR_XXX))
xxx()
Before:
lis r9,-16230
lwz r9,12324(r9)
lwz r9,12(r9)
andi. r10,r9,512
beqlr-
After:
nop if CPU_FTR_XXX is enabled
b xxx if CPU_FTR_XXX is not enabled
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
arch/powerpc/include/asm/cpufeatures.h | 20 ++++++++++++++++++++
arch/powerpc/include/asm/cputable.h | 8 ++++++++
arch/powerpc/kernel/cputable.c | 18 ++++++++++++++++++
arch/powerpc/kernel/setup_32.c | 1 +
arch/powerpc/kernel/setup_64.c | 1 +
5 files changed, 48 insertions(+)
diff --git a/arch/powerpc/include/asm/cpufeatures.h b/arch/powerpc/include/asm/cpufeatures.h
index 37650db5044f..405a97fe6ef9 100644
--- a/arch/powerpc/include/asm/cpufeatures.h
+++ b/arch/powerpc/include/asm/cpufeatures.h
@@ -3,6 +3,25 @@
#include <asm/cputable.h>
+#ifdef CONFIG_JUMP_LABEL
+#include <linux/jump_label.h>
+
+extern struct static_key_true cpu_feat_keys[MAX_CPU_FEATURES];
+
+static inline int cpu_has_feature(unsigned long feature)
+{
+ int i;
+
+ if (CPU_FTRS_ALWAYS & feature)
+ return 1;
+
+ if (!(CPU_FTRS_POSSIBLE & feature))
+ return 0;
+
+ i = __builtin_ctzl(feature);
+ return static_branch_likely(&cpu_feat_keys[i]);
+}
+#else
static inline int cpu_has_feature(unsigned long feature)
{
return (CPU_FTRS_ALWAYS & feature) ||
@@ -10,5 +29,6 @@ static inline int cpu_has_feature(unsigned long feature)
& cur_cpu_spec->cpu_features
& feature);
}
+#endif
#endif /* __ASM_POWERPC_CPUFEATURE_H */
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index ae4b6ef341cd..2ebee2894102 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -114,6 +114,12 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
extern const char *powerpc_base_platform;
+#ifdef CONFIG_JUMP_LABEL
+extern void cpu_feat_keys_init(void);
+#else
+static inline void cpu_feat_keys_init(void) { }
+#endif
+
/* TLB flush actions. Used as argument to cpu_spec.flush_tlb() hook */
enum {
TLB_INVAL_SCOPE_GLOBAL = 0, /* invalidate all TLBs */
@@ -124,6 +130,8 @@ enum {
/* CPU kernel features */
+#define MAX_CPU_FEATURES (8 * sizeof(((struct cpu_spec *)0)->cpu_features))
+
/* Retain the 32b definitions all use bottom half of word */
#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x00000001)
#define CPU_FTR_L2CR ASM_CONST(0x00000002)
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 7d80bfdfb15e..7d4fe69a61ed 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -15,6 +15,7 @@
#include <linux/threads.h>
#include <linux/init.h>
#include <linux/export.h>
+#include <linux/jump_label.h>
#include <asm/oprofile_impl.h>
#include <asm/cputable.h>
@@ -2195,3 +2196,20 @@ struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
return NULL;
}
+
+#ifdef CONFIG_JUMP_LABEL
+DEFINE_STATIC_KEY_TRUE_ARRAY(cpu_feat_keys, MAX_CPU_FEATURES);
+EXPORT_SYMBOL_GPL(cpu_feat_keys);
+
+void __init cpu_feat_keys_init(void)
+{
+ int i;
+
+ for (i = 0; i < MAX_CPU_FEATURES; i++) {
+ unsigned long f = 1ul << i;
+
+ if (!(cur_cpu_spec->cpu_features & f))
+ static_branch_disable(&cpu_feat_keys[i]);
+ }
+}
+#endif
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index f0868f510b3b..93756175a13c 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -115,6 +115,7 @@ notrace void __init machine_init(u64 dt_ptr)
lockdep_init();
jump_label_init();
+ cpu_feat_keys_init();
/* Enable early debugging if any specified (see udbg.h) */
udbg_early_init();
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index f0802a0b4a20..4cf3894d91fa 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -251,6 +251,7 @@ void __init early_setup(unsigned long dt_ptr)
lockdep_init();
jump_label_init();
+ cpu_feat_keys_init();
/* -------- printk is now safe to use ------- */
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Kevin Hao <haokexin@gmail.com> |
|---|---|
| Date | 2015-08-20 14:20 +0200 |
| Subject | [PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros |
| Message-ID | <pZwZ6-4Ab-53@gated-at.bofh.it> |
| In reply to | #1210465 |
These are used to define a static_key_{true,false} array.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
include/linux/jump_label.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 7f653e8f6690..5c1d6a49dd6b 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -267,6 +267,12 @@ struct static_key_false {
#define DEFINE_STATIC_KEY_FALSE(name) \
struct static_key_false name = STATIC_KEY_FALSE_INIT
+#define DEFINE_STATIC_KEY_TRUE_ARRAY(name, n) \
+ struct static_key_true name[n] = { [0 ... n - 1] = STATIC_KEY_TRUE_INIT }
+
+#define DEFINE_STATIC_KEY_FALSE_ARRAY(name, n) \
+ struct static_key_false name[n] = { [0 ... n - 1] = STATIC_KEY_FALSE_INIT }
+
#ifdef HAVE_JUMP_LABEL
/*
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-08-20 20:40 +0200 |
| Subject | Re: [PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros |
| Message-ID | <pZCUN-4Dv-15@gated-at.bofh.it> |
| In reply to | #1210469 |
On Thu, Aug 20, 2015 at 08:14:31PM +0800, Kevin Hao wrote:
> These are used to define a static_key_{true,false} array.
Yes but why...
there might have been some clue in the patches you didn't send me, but
since you didn't send them, I'm left wondering.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Kevin Hao <haokexin@gmail.com> |
|---|---|
| Date | 2015-08-21 05:30 +0200 |
| Subject | Re: [PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros |
| Message-ID | <pZLbI-8j2-1@gated-at.bofh.it> |
| In reply to | #1210674 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, Aug 20, 2015 at 08:31:58PM +0200, Peter Zijlstra wrote:
> On Thu, Aug 20, 2015 at 08:14:31PM +0800, Kevin Hao wrote:
> > These are used to define a static_key_{true,false} array.
>
> Yes but why...
>
> there might have been some clue in the patches you didn't send me, but
> since you didn't send them, I'm left wondering.
Sorry for the confusion. In order to use jump label for the
{cpu,mmu}_has_feature() functions on powerpc, we need to declare an array of
32 or 64 static_key_true (one static_key_true for each cpu or mmu feature).
The following are the two patches which depends on this patch.
https://lkml.org/lkml/2015/8/20/355
https://lkml.org/lkml/2015/8/20/356
So far only DEFINE_STATIC_KEY_TRUE_ARRAY macro is used, but I think it may seem
canonical to define the macros for both true or false keys at the same time.
Thanks,
Kevin
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-08-21 08:30 +0200 |
| Subject | Re: [PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros |
| Message-ID | <pZNZX-3SZ-87@gated-at.bofh.it> |
| In reply to | #1210469 |
* Kevin Hao <haokexin@gmail.com> wrote:
> These are used to define a static_key_{true,false} array.
>
> Signed-off-by: Kevin Hao <haokexin@gmail.com>
> ---
> include/linux/jump_label.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
> index 7f653e8f6690..5c1d6a49dd6b 100644
> --- a/include/linux/jump_label.h
> +++ b/include/linux/jump_label.h
> @@ -267,6 +267,12 @@ struct static_key_false {
> #define DEFINE_STATIC_KEY_FALSE(name) \
> struct static_key_false name = STATIC_KEY_FALSE_INIT
>
> +#define DEFINE_STATIC_KEY_TRUE_ARRAY(name, n) \
> + struct static_key_true name[n] = { [0 ... n - 1] = STATIC_KEY_TRUE_INIT }
> +
> +#define DEFINE_STATIC_KEY_FALSE_ARRAY(name, n) \
> + struct static_key_false name[n] = { [0 ... n - 1] = STATIC_KEY_FALSE_INIT }
I think the define makes the code more obfuscated and less clear, the open-coded
initialization is pretty dense and easy to read to begin with.
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Kevin Hao <haokexin@gmail.com> |
|---|---|
| Date | 2015-08-21 08:40 +0200 |
| Subject | Re: [PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros |
| Message-ID | <pZO9z-44i-1@gated-at.bofh.it> |
| In reply to | #1210917 |
[Multipart message — attachments visible in raw view] — view raw
On Fri, Aug 21, 2015 at 08:28:26AM +0200, Ingo Molnar wrote:
>
> * Kevin Hao <haokexin@gmail.com> wrote:
>
> > These are used to define a static_key_{true,false} array.
> >
> > Signed-off-by: Kevin Hao <haokexin@gmail.com>
> > ---
> > include/linux/jump_label.h | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
> > index 7f653e8f6690..5c1d6a49dd6b 100644
> > --- a/include/linux/jump_label.h
> > +++ b/include/linux/jump_label.h
> > @@ -267,6 +267,12 @@ struct static_key_false {
> > #define DEFINE_STATIC_KEY_FALSE(name) \
> > struct static_key_false name = STATIC_KEY_FALSE_INIT
> >
> > +#define DEFINE_STATIC_KEY_TRUE_ARRAY(name, n) \
> > + struct static_key_true name[n] = { [0 ... n - 1] = STATIC_KEY_TRUE_INIT }
> > +
> > +#define DEFINE_STATIC_KEY_FALSE_ARRAY(name, n) \
> > + struct static_key_false name[n] = { [0 ... n - 1] = STATIC_KEY_FALSE_INIT }
>
> I think the define makes the code more obfuscated and less clear, the open-coded
> initialization is pretty dense and easy to read to begin with.
OK, I will drop this patch and move the initialization of the array to the
corresponding patch.
Thanks,
Kevin
[toc] | [prev] | [next] | [standalone]
| From | Kevin Hao <haokexin@gmail.com> |
|---|---|
| Date | 2015-08-21 08:50 +0200 |
| Subject | Re: [PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros |
| Message-ID | <pZOjf-4fE-13@gated-at.bofh.it> |
| In reply to | #1210921 |
[Multipart message — attachments visible in raw view] — view raw
On Fri, Aug 21, 2015 at 08:40:59AM +0200, Ingo Molnar wrote: > Please also Cc: peterz and me to the next submission of the series - static key > (and jump label) changes go through the locking tree normally, and there's a > number of changes pending already for v4.3: Sure. Thanks, Kevin
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-08-21 08:50 +0200 |
| Subject | Re: [PATCH 3/8] jump_label: introduce DEFINE_STATIC_KEY_{TRUE,FALSE}_ARRAY macros |
| Message-ID | <pZOjf-4fE-7@gated-at.bofh.it> |
| In reply to | #1210921 |
* Kevin Hao <haokexin@gmail.com> wrote:
> On Fri, Aug 21, 2015 at 08:28:26AM +0200, Ingo Molnar wrote:
> >
> > * Kevin Hao <haokexin@gmail.com> wrote:
> >
> > > These are used to define a static_key_{true,false} array.
> > >
> > > Signed-off-by: Kevin Hao <haokexin@gmail.com>
> > > ---
> > > include/linux/jump_label.h | 6 ++++++
> > > 1 file changed, 6 insertions(+)
> > >
> > > diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
> > > index 7f653e8f6690..5c1d6a49dd6b 100644
> > > --- a/include/linux/jump_label.h
> > > +++ b/include/linux/jump_label.h
> > > @@ -267,6 +267,12 @@ struct static_key_false {
> > > #define DEFINE_STATIC_KEY_FALSE(name) \
> > > struct static_key_false name = STATIC_KEY_FALSE_INIT
> > >
> > > +#define DEFINE_STATIC_KEY_TRUE_ARRAY(name, n) \
> > > + struct static_key_true name[n] = { [0 ... n - 1] = STATIC_KEY_TRUE_INIT }
> > > +
> > > +#define DEFINE_STATIC_KEY_FALSE_ARRAY(name, n) \
> > > + struct static_key_false name[n] = { [0 ... n - 1] = STATIC_KEY_FALSE_INIT }
> >
> > I think the define makes the code more obfuscated and less clear, the open-coded
> > initialization is pretty dense and easy to read to begin with.
>
> OK, I will drop this patch and move the initialization of the array to the
> corresponding patch.
Please also Cc: peterz and me to the next submission of the series - static key
(and jump label) changes go through the locking tree normally, and there's a
number of changes pending already for v4.3:
20f9ed1568c0 locking/static_keys: Make verify_keys() static
412758cb2670 jump label, locking/static_keys: Update docs
2bf9e0ab08c6 locking/static_keys: Provide a selftest
ed79e946732e s390/uaccess, locking/static_keys: employ static_branch_likely()
3bbfafb77a06 x86, tsc, locking/static_keys: Employ static_branch_likely()
1987c947d905 locking/static_keys: Add selftest
11276d5306b8 locking/static_keys: Add a new static_key interface
706249c222f6 locking/static_keys: Rework update logic
e33886b38cc8 locking/static_keys: Add static_key_{en,dis}able() helpers
7dcfd915bae5 jump_label: Add jump_entry_key() helper
a1efb01feca5 jump_label, locking/static_keys: Rename JUMP_LABEL_TYPE_* and related helpers to the static_key* pattern
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web