2018-03-25 19:26:21

by Davidlohr Bueso

[permalink] [raw]
Subject: [PATCH -next 0/3] update some static key users to modern api

Hi,

I noticed a few users in the kernel calling stale static key api. Patches
are straightforward; note that the irqchip was also changed to not use
refcounting functions as it only 'disables' the feature.

Thanks!

Davidlohr Bueso (3):
i2c: update i2c_trace_msg static key to modern api
drivers/irqchip: update supports_deactivate static key to modern api
sched/core: update preempt_notifier_key to modern api

drivers/i2c/i2c-core-base.c | 12 ++++++------
drivers/irqchip/irq-gic-v3.c | 20 ++++++++++----------
drivers/irqchip/irq-gic.c | 22 +++++++++++-----------
kernel/sched/core.c | 12 ++++++------
4 files changed, 33 insertions(+), 33 deletions(-)

--
2.13.6



2018-03-25 19:24:55

by Davidlohr Bueso

[permalink] [raw]
Subject: [PATCH 2/3] drivers/irqchip: update supports_deactivate static key to modern api

Minor changes in semantics -- key init is true; replace

static_key_slow_dec with static_branch_disable
static_key_true with static_branch_likely

The first is because we never actually do any couterpart incs,
thus there is really no reference counting semantics going on.
Use the more proper static_branch_disable() construct.

Also added a '_key' suffix to supports_deactivate, for better
self documentation.

Cc: Thomas Gleixner <[email protected]>
Cc: Jason Cooper <[email protected]>
Cc: Marc Zyngier <[email protected]>
Signed-off-by: Davidlohr Bueso <[email protected]>
---
drivers/irqchip/irq-gic-v3.c | 20 ++++++++++----------
drivers/irqchip/irq-gic.c | 22 +++++++++++-----------
2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 56c8de84a72b..f32b1814278b 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -61,7 +61,7 @@ struct gic_chip_data {
};

static struct gic_chip_data gic_data __read_mostly;
-static struct static_key supports_deactivate = STATIC_KEY_INIT_TRUE;
+DEFINE_STATIC_KEY_TRUE(supports_deactivate_key);

static struct gic_kvm_info gic_v3_kvm_info;
static DEFINE_PER_CPU(bool, has_rss);
@@ -354,7 +354,7 @@ static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs
if (likely(irqnr > 15 && irqnr < 1020) || irqnr >= 8192) {
int err;

- if (static_key_true(&supports_deactivate))
+ if (static_branch_likely(&supports_deactivate_key))
gic_write_eoir(irqnr);
else
isb();
@@ -362,7 +362,7 @@ static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs
err = handle_domain_irq(gic_data.domain, irqnr, regs);
if (err) {
WARN_ONCE(true, "Unexpected interrupt received!\n");
- if (static_key_true(&supports_deactivate)) {
+ if (static_branch_likely(&supports_deactivate_key)) {
if (irqnr < 8192)
gic_write_dir(irqnr);
} else {
@@ -373,7 +373,7 @@ static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs
}
if (irqnr < 16) {
gic_write_eoir(irqnr);
- if (static_key_true(&supports_deactivate))
+ if (static_branch_likely(&supports_deactivate_key))
gic_write_dir(irqnr);
#ifdef CONFIG_SMP
/*
@@ -576,7 +576,7 @@ static void gic_cpu_sys_reg_init(void)
*/
gic_write_bpr1(0);

- if (static_key_true(&supports_deactivate)) {
+ if (static_branch_likely(&supports_deactivate_key)) {
/* EOI drops priority only (mode 1) */
gic_write_ctlr(ICC_CTLR_EL1_EOImode_drop);
} else {
@@ -884,7 +884,7 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
{
struct irq_chip *chip = &gic_chip;

- if (static_key_true(&supports_deactivate))
+ if (static_branch_likely(&supports_deactivate_key))
chip = &gic_eoimode1_chip;

/* SGIs are private to the core kernel */
@@ -1075,9 +1075,9 @@ static int __init gic_init_bases(void __iomem *dist_base,
int err;

if (!is_hyp_mode_available())
- static_key_slow_dec(&supports_deactivate);
+ static_branch_disable(&supports_deactivate_key);

- if (static_key_true(&supports_deactivate))
+ if (static_branch_likely(&supports_deactivate_key))
pr_info("GIC: Using split EOI/Deactivate mode\n");

gic_data.fwnode = handle;
@@ -1312,7 +1312,7 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare

gic_populate_ppi_partitions(node);

- if (static_key_true(&supports_deactivate))
+ if (static_branch_likely(&supports_deactivate_key))
gic_of_setup_kvm_info(node);
return 0;

@@ -1614,7 +1614,7 @@ gic_acpi_init(struct acpi_subtable_header *header, const unsigned long end)

acpi_set_irq_model(ACPI_IRQ_MODEL_GIC, domain_handle);

- if (static_key_true(&supports_deactivate))
+ if (static_branch_likely(&supports_deactivate_key))
gic_acpi_setup_kvm_info();

return 0;
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index ac2e62d613d1..9b7630cee56c 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -121,7 +121,7 @@ static DEFINE_RAW_SPINLOCK(cpu_map_lock);
#define NR_GIC_CPU_IF 8
static u8 gic_cpu_map[NR_GIC_CPU_IF] __read_mostly;

-static struct static_key supports_deactivate = STATIC_KEY_INIT_TRUE;
+DEFINE_STATIC_KEY_TRUE(supports_deactivate_key);

static struct gic_chip_data gic_data[CONFIG_ARM_GIC_MAX_NR] __read_mostly;

@@ -361,7 +361,7 @@ static void __exception_irq_entry gic_handle_irq(struct pt_regs *regs)
irqnr = irqstat & GICC_IAR_INT_ID_MASK;

if (likely(irqnr > 15 && irqnr < 1020)) {
- if (static_key_true(&supports_deactivate))
+ if (static_branch_likely(&supports_deactivate_key))
writel_relaxed(irqstat, cpu_base + GIC_CPU_EOI);
isb();
handle_domain_irq(gic->domain, irqnr, regs);
@@ -369,7 +369,7 @@ static void __exception_irq_entry gic_handle_irq(struct pt_regs *regs)
}
if (irqnr < 16) {
writel_relaxed(irqstat, cpu_base + GIC_CPU_EOI);
- if (static_key_true(&supports_deactivate))
+ if (static_branch_likely(&supports_deactivate_key))
writel_relaxed(irqstat, cpu_base + GIC_CPU_DEACTIVATE);
#ifdef CONFIG_SMP
/*
@@ -466,7 +466,7 @@ static void gic_cpu_if_up(struct gic_chip_data *gic)
u32 mode = 0;
int i;

- if (gic == &gic_data[0] && static_key_true(&supports_deactivate))
+ if (gic == &gic_data[0] && static_branch_likely(&supports_deactivate_key))
mode = GIC_CPU_CTRL_EOImodeNS;

if (gic_check_gicv2(cpu_base))
@@ -1219,11 +1219,11 @@ static int __init __gic_init_bases(struct gic_chip_data *gic,
"irqchip/arm/gic:starting",
gic_starting_cpu, NULL);
set_handle_irq(gic_handle_irq);
- if (static_key_true(&supports_deactivate))
+ if (static_branch_likely(&supports_deactivate_key))
pr_info("GIC: Using split EOI/Deactivate mode\n");
}

- if (static_key_true(&supports_deactivate) && gic == &gic_data[0]) {
+ if (static_branch_likely(&supports_deactivate_key) && gic == &gic_data[0]) {
name = kasprintf(GFP_KERNEL, "GICv2");
gic_init_chip(gic, NULL, name, true);
} else {
@@ -1250,7 +1250,7 @@ void __init gic_init(unsigned int gic_nr, int irq_start,
* Non-DT/ACPI systems won't run a hypervisor, so let's not
* bother with these...
*/
- static_key_slow_dec(&supports_deactivate);
+ static_branch_disable(&supports_deactivate_key);

gic = &gic_data[gic_nr];
gic->raw_dist_base = dist_base;
@@ -1430,7 +1430,7 @@ static void __init gic_of_setup_kvm_info(struct device_node *node)
if (ret)
return;

- if (static_key_true(&supports_deactivate))
+ if (static_branch_likely(&supports_deactivate_key))
gic_set_kvm_info(&gic_v2_kvm_info);
}

@@ -1457,7 +1457,7 @@ gic_of_init(struct device_node *node, struct device_node *parent)
* or the CPU interface is too small.
*/
if (gic_cnt == 0 && !gic_check_eoimode(node, &gic->raw_cpu_base))
- static_key_slow_dec(&supports_deactivate);
+ static_branch_disable(&supports_deactivate_key);

ret = __gic_init_bases(gic, -1, &node->fwnode);
if (ret) {
@@ -1638,7 +1638,7 @@ static int __init gic_v2_acpi_init(struct acpi_subtable_header *header,
* interface will always be the right size.
*/
if (!is_hyp_mode_available())
- static_key_slow_dec(&supports_deactivate);
+ static_branch_disable(&supports_deactivate_key);

/*
* Initialize GIC instance zero (no multi-GIC support).
@@ -1663,7 +1663,7 @@ static int __init gic_v2_acpi_init(struct acpi_subtable_header *header,
if (IS_ENABLED(CONFIG_ARM_GIC_V2M))
gicv2m_init(NULL, gic_data[0].domain);

- if (static_key_true(&supports_deactivate))
+ if (static_branch_likely(&supports_deactivate_key))
gic_acpi_setup_kvm_info();

return 0;
--
2.13.6


2018-03-25 19:25:07

by Davidlohr Bueso

[permalink] [raw]
Subject: [PATCH 3/3] sched/core: update preempt_notifier_key to modern api

No changes in refcount semantics -- key init is false; replace

static_key_slow_inc|dec with static_branch_inc|dec
static_key_false with static_branch_unlikely

Signed-off-by: Davidlohr Bueso <[email protected]>
---
kernel/sched/core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 757d5a251ca4..311451e58c3c 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2462,17 +2462,17 @@ void wake_up_new_task(struct task_struct *p)

#ifdef CONFIG_PREEMPT_NOTIFIERS

-static struct static_key preempt_notifier_key = STATIC_KEY_INIT_FALSE;
+DEFINE_STATIC_KEY_FALSE(preempt_notifier_key);

void preempt_notifier_inc(void)
{
- static_key_slow_inc(&preempt_notifier_key);
+ static_branch_inc(&preempt_notifier_key);
}
EXPORT_SYMBOL_GPL(preempt_notifier_inc);

void preempt_notifier_dec(void)
{
- static_key_slow_dec(&preempt_notifier_key);
+ static_branch_dec(&preempt_notifier_key);
}
EXPORT_SYMBOL_GPL(preempt_notifier_dec);

@@ -2482,7 +2482,7 @@ EXPORT_SYMBOL_GPL(preempt_notifier_dec);
*/
void preempt_notifier_register(struct preempt_notifier *notifier)
{
- if (!static_key_false(&preempt_notifier_key))
+ if (!static_branch_unlikely(&preempt_notifier_key))
WARN(1, "registering preempt_notifier while notifiers disabled\n");

hlist_add_head(&notifier->link, &current->preempt_notifiers);
@@ -2511,7 +2511,7 @@ static void __fire_sched_in_preempt_notifiers(struct task_struct *curr)

static __always_inline void fire_sched_in_preempt_notifiers(struct task_struct *curr)
{
- if (static_key_false(&preempt_notifier_key))
+ if (static_branch_unlikely(&preempt_notifier_key))
__fire_sched_in_preempt_notifiers(curr);
}

@@ -2529,7 +2529,7 @@ static __always_inline void
fire_sched_out_preempt_notifiers(struct task_struct *curr,
struct task_struct *next)
{
- if (static_key_false(&preempt_notifier_key))
+ if (static_branch_unlikely(&preempt_notifier_key))
__fire_sched_out_preempt_notifiers(curr, next);
}

--
2.13.6


2018-03-25 19:26:46

by Davidlohr Bueso

[permalink] [raw]
Subject: [PATCH 1/3] i2c: update i2c_trace_msg static key to modern api

No changes in refcount semantics -- key init is false; replace

static_key_slow_inc|dec with static_branch_inc|dec
static_key_false with static_branch_unlikely

Added a '_key' suffix to i2c_trace_msg, for better self
documentation.

Cc: Wolfram Sang <[email protected]>
Cc: [email protected]
Signed-off-by: Davidlohr Bueso <[email protected]>
---
drivers/i2c/i2c-core-base.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 16a3b73375a6..c8461fb26c0d 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -69,18 +69,18 @@ static DEFINE_IDR(i2c_adapter_idr);

static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver);

-static struct static_key i2c_trace_msg = STATIC_KEY_INIT_FALSE;
+DEFINE_STATIC_KEY_FALSE(i2c_trace_msg_key);
static bool is_registered;

int i2c_transfer_trace_reg(void)
{
- static_key_slow_inc(&i2c_trace_msg);
+ static_branch_inc(&i2c_trace_msg_key);
return 0;
}

void i2c_transfer_trace_unreg(void)
{
- static_key_slow_dec(&i2c_trace_msg);
+ static_branch_dec(&i2c_trace_msg_key);
}

const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id,
@@ -1848,11 +1848,11 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
if (adap->quirks && i2c_check_for_quirks(adap, msgs, num))
return -EOPNOTSUPP;

- /* i2c_trace_msg gets enabled when tracepoint i2c_transfer gets
+ /* i2c_trace_msg_key gets enabled when tracepoint i2c_transfer gets
* enabled. This is an efficient way of keeping the for-loop from
* being executed when not needed.
*/
- if (static_key_false(&i2c_trace_msg)) {
+ if (static_branch_unlikely(&i2c_trace_msg_key)) {
int i;
for (i = 0; i < num; i++)
if (msgs[i].flags & I2C_M_RD)
@@ -1871,7 +1871,7 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
break;
}

- if (static_key_false(&i2c_trace_msg)) {
+ if (static_branch_unlikely(&i2c_trace_msg_key)) {
int i;
for (i = 0; i < ret; i++)
if (msgs[i].flags & I2C_M_RD)
--
2.13.6


2018-03-26 08:20:04

by Marc Zyngier

[permalink] [raw]
Subject: Re: [PATCH 2/3] drivers/irqchip: update supports_deactivate static key to modern api

Hi Davidlohr,

On 25/03/18 20:10, Davidlohr Bueso wrote:
> Minor changes in semantics -- key init is true; replace
>
> static_key_slow_dec with static_branch_disable
> static_key_true with static_branch_likely
>
> The first is because we never actually do any couterpart incs,
> thus there is really no reference counting semantics going on.
> Use the more proper static_branch_disable() construct.
>
> Also added a '_key' suffix to supports_deactivate, for better
> self documentation.
>
> Cc: Thomas Gleixner <[email protected]>
> Cc: Jason Cooper <[email protected]>
> Cc: Marc Zyngier <[email protected]>
> Signed-off-by: Davidlohr Bueso <[email protected]>
> ---
> drivers/irqchip/irq-gic-v3.c | 20 ++++++++++----------
> drivers/irqchip/irq-gic.c | 22 +++++++++++-----------
> 2 files changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> index 56c8de84a72b..f32b1814278b 100644
> --- a/drivers/irqchip/irq-gic-v3.c
> +++ b/drivers/irqchip/irq-gic-v3.c
> @@ -61,7 +61,7 @@ struct gic_chip_data {
> };
>
> static struct gic_chip_data gic_data __read_mostly;
> -static struct static_key supports_deactivate = STATIC_KEY_INIT_TRUE;
> +DEFINE_STATIC_KEY_TRUE(supports_deactivate_key);

When you combine this...

[...]

> diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> index ac2e62d613d1..9b7630cee56c 100644
> --- a/drivers/irqchip/irq-gic.c
> +++ b/drivers/irqchip/irq-gic.c
> @@ -121,7 +121,7 @@ static DEFINE_RAW_SPINLOCK(cpu_map_lock);
> #define NR_GIC_CPU_IF 8
> static u8 gic_cpu_map[NR_GIC_CPU_IF] __read_mostly;
>
> -static struct static_key supports_deactivate = STATIC_KEY_INIT_TRUE;
> +DEFINE_STATIC_KEY_TRUE(supports_deactivate_key);

...with that, bad things happen:

drivers/irqchip/irq-gic-v3.o:(.data+0x278): multiple definition of `supports_deactivate_key'
drivers/irqchip/irq-gic.o:(.data+0x18): first defined here
Makefile:1032: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

Thanks,

M.
--
Jazz is not dead. It just smells funny...

2018-03-26 08:35:35

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 1/3] i2c: update i2c_trace_msg static key to modern api

On Sun, Mar 25, 2018 at 12:10:54PM -0700, Davidlohr Bueso wrote:
> -static struct static_key i2c_trace_msg = STATIC_KEY_INIT_FALSE;
> +DEFINE_STATIC_KEY_FALSE(i2c_trace_msg_key);

static DEFINE_STATIC_KEY_FALSE()..

2018-03-26 08:36:03

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 1/3] i2c: update i2c_trace_msg static key to modern api

On Sun, Mar 25, 2018 at 12:10:54PM -0700, Davidlohr Bueso wrote:
> @@ -1848,11 +1848,11 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
> if (adap->quirks && i2c_check_for_quirks(adap, msgs, num))
> return -EOPNOTSUPP;
>
> - /* i2c_trace_msg gets enabled when tracepoint i2c_transfer gets
> + /* i2c_trace_msg_key gets enabled when tracepoint i2c_transfer gets
> * enabled. This is an efficient way of keeping the for-loop from
> * being executed when not needed.
> */
> - if (static_key_false(&i2c_trace_msg)) {
> + if (static_branch_unlikely(&i2c_trace_msg_key)) {

broken comment style.

2018-03-26 08:36:41

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 2/3] drivers/irqchip: update supports_deactivate static key to modern api

On Sun, Mar 25, 2018 at 12:10:55PM -0700, Davidlohr Bueso wrote:
> @@ -61,7 +61,7 @@ struct gic_chip_data {
> };
>
> static struct gic_chip_data gic_data __read_mostly;
> -static struct static_key supports_deactivate = STATIC_KEY_INIT_TRUE;
> +DEFINE_STATIC_KEY_TRUE(supports_deactivate_key);

static DEFINE_STATIC_KEY_TRUE();

2018-03-26 08:36:50

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 2/3] drivers/irqchip: update supports_deactivate static key to modern api

On Sun, Mar 25, 2018 at 12:10:55PM -0700, Davidlohr Bueso wrote:
> -static struct static_key supports_deactivate = STATIC_KEY_INIT_TRUE;
> +DEFINE_STATIC_KEY_TRUE(supports_deactivate_key);

again...

2018-03-26 08:37:05

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 3/3] sched/core: update preempt_notifier_key to modern api

On Sun, Mar 25, 2018 at 12:10:56PM -0700, Davidlohr Bueso wrote:
> No changes in refcount semantics -- key init is false; replace
>
> static_key_slow_inc|dec with static_branch_inc|dec
> static_key_false with static_branch_unlikely
>
> Signed-off-by: Davidlohr Bueso <[email protected]>
> ---
> kernel/sched/core.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 757d5a251ca4..311451e58c3c 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -2462,17 +2462,17 @@ void wake_up_new_task(struct task_struct *p)
>
> #ifdef CONFIG_PREEMPT_NOTIFIERS
>
> -static struct static_key preempt_notifier_key = STATIC_KEY_INIT_FALSE;
> +DEFINE_STATIC_KEY_FALSE(preempt_notifier_key);

and again..

2018-03-26 14:09:20

by Davidlohr Bueso

[permalink] [raw]
Subject: Re: [PATCH 2/3] drivers/irqchip: update supports_deactivate static key to modern api

On Mon, 26 Mar 2018, Marc Zyngier wrote:

>> static struct gic_chip_data gic_data __read_mostly;
>> -static struct static_key supports_deactivate = STATIC_KEY_INIT_TRUE;
>> +DEFINE_STATIC_KEY_TRUE(supports_deactivate_key);
>
>When you combine this...
>
>[...]
>
>> diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
>> index ac2e62d613d1..9b7630cee56c 100644
>> --- a/drivers/irqchip/irq-gic.c
>> +++ b/drivers/irqchip/irq-gic.c
>> @@ -121,7 +121,7 @@ static DEFINE_RAW_SPINLOCK(cpu_map_lock);
>> #define NR_GIC_CPU_IF 8
>> static u8 gic_cpu_map[NR_GIC_CPU_IF] __read_mostly;
>>
>> -static struct static_key supports_deactivate = STATIC_KEY_INIT_TRUE;
>> +DEFINE_STATIC_KEY_TRUE(supports_deactivate_key);
>
>...with that, bad things happen:
>
>drivers/irqchip/irq-gic-v3.o:(.data+0x278): multiple definition of `supports_deactivate_key'
>drivers/irqchip/irq-gic.o:(.data+0x18): first defined here
>Makefile:1032: recipe for target 'vmlinux' failed
>make: *** [vmlinux] Error 1

Hmm both were (cross) compile tested, I'll have a look.

Thanks,
Davidlohr

2018-03-26 14:25:32

by Marc Zyngier

[permalink] [raw]
Subject: Re: [PATCH 2/3] drivers/irqchip: update supports_deactivate static key to modern api

On 26/03/18 14:54, Davidlohr Bueso wrote:
> On Mon, 26 Mar 2018, Marc Zyngier wrote:
>
>>> static struct gic_chip_data gic_data __read_mostly;
>>> -static struct static_key supports_deactivate = STATIC_KEY_INIT_TRUE;
>>> +DEFINE_STATIC_KEY_TRUE(supports_deactivate_key);
>>
>> When you combine this...
>>
>> [...]
>>
>>> diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
>>> index ac2e62d613d1..9b7630cee56c 100644
>>> --- a/drivers/irqchip/irq-gic.c
>>> +++ b/drivers/irqchip/irq-gic.c
>>> @@ -121,7 +121,7 @@ static DEFINE_RAW_SPINLOCK(cpu_map_lock);
>>> #define NR_GIC_CPU_IF 8
>>> static u8 gic_cpu_map[NR_GIC_CPU_IF] __read_mostly;
>>>
>>> -static struct static_key supports_deactivate = STATIC_KEY_INIT_TRUE;
>>> +DEFINE_STATIC_KEY_TRUE(supports_deactivate_key);
>>
>> ...with that, bad things happen:
>>
>> drivers/irqchip/irq-gic-v3.o:(.data+0x278): multiple definition of `supports_deactivate_key'
>> drivers/irqchip/irq-gic.o:(.data+0x18): first defined here
>> Makefile:1032: recipe for target 'vmlinux' failed
>> make: *** [vmlinux] Error 1
>
> Hmm both were (cross) compile tested, I'll have a look.

Odd. I don't see how you can avoid this failure at link time...

M.
--
Jazz is not dead. It just smells funny...

2018-03-26 20:12:47

by Davidlohr Bueso

[permalink] [raw]
Subject: Re: [PATCH 2/3] drivers/irqchip: update supports_deactivate static key to modern api

On Mon, 26 Mar 2018, Marc Zyngier wrote:
>Odd. I don't see how you can avoid this failure at link time...

yeah, I must have only compiled drivers/ or drivers/irqchip/.
Had I done a full build, I would have realized that I left out
all the static definitions Peter pointed out. Sending a v2.

Thanks,
Davidlohr