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


Groups > linux.kernel > #1734174 > unrolled thread

[PATCH] powerpc: make irq_chip const, __initdata and __initconst

Started byBhumika Goyal <bhumirks@gmail.com>
First post2017-09-18 16:20 +0200
Last post2017-09-20 13:20 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] powerpc: make irq_chip const, __initdata and __initconst Bhumika Goyal <bhumirks@gmail.com> - 2017-09-18 16:20 +0200
    Re: [PATCH] powerpc: make irq_chip const, __initdata and __initconst Michael Ellerman <mpe@ellerman.id.au> - 2017-09-20 08:30 +0200
      Re: [PATCH] powerpc: make irq_chip const, __initdata and  __initconst Julia Lawall <julia.lawall@lip6.fr> - 2017-09-20 08:40 +0200
        Re: [PATCH] powerpc: make irq_chip const, __initdata and __initconst Michael Ellerman <mpe@ellerman.id.au> - 2017-09-20 13:20 +0200

#1734174 — [PATCH] powerpc: make irq_chip const, __initdata and __initconst

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-09-18 16:20 +0200
Subject[PATCH] powerpc: make irq_chip const, __initdata and __initconst
Message-ID<ur53Z-7mI-17@gated-at.bofh.it>
Make ehv_pic_irq_chip, mpic_ipi_chip and mpic_tm_chip const as they are
used only as a copy operation. This usage is during init, so make them
__initconst too.
Make mpic_ipi_chip __initdata as it is only modified during the init
phase and there is no reference of it anywhere after init.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 arch/powerpc/sysdev/ehv_pic.c | 2 +-
 arch/powerpc/sysdev/mpic.c    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/sysdev/ehv_pic.c b/arch/powerpc/sysdev/ehv_pic.c
index 48866e6..12a54f3 100644
--- a/arch/powerpc/sysdev/ehv_pic.c
+++ b/arch/powerpc/sysdev/ehv_pic.c
@@ -141,7 +141,7 @@ int ehv_pic_set_irq_type(struct irq_data *d, unsigned int flow_type)
 	return IRQ_SET_MASK_OK_NOCOPY;
 }
 
-static struct irq_chip ehv_pic_irq_chip = {
+static const struct irq_chip ehv_pic_irq_chip __initconst = {
 	.irq_mask	= ehv_pic_mask_irq,
 	.irq_unmask	= ehv_pic_unmask_irq,
 	.irq_eoi	= ehv_pic_end_irq,
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index ead3e25..6a435c0 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -964,21 +964,21 @@ static void mpic_set_destination(unsigned int virq, unsigned int cpuid)
 };
 
 #ifdef CONFIG_SMP
-static struct irq_chip mpic_ipi_chip = {
+static const struct irq_chip mpic_ipi_chip __initconst = {
 	.irq_mask	= mpic_mask_ipi,
 	.irq_unmask	= mpic_unmask_ipi,
 	.irq_eoi	= mpic_end_ipi,
 };
 #endif /* CONFIG_SMP */
 
-static struct irq_chip mpic_tm_chip = {
+static struct irq_chip mpic_tm_chip __initdata = {
 	.irq_mask	= mpic_mask_tm,
 	.irq_unmask	= mpic_unmask_tm,
 	.irq_eoi	= mpic_end_irq,
 };
 
 #ifdef CONFIG_MPIC_U3_HT_IRQS
-static struct irq_chip mpic_irq_ht_chip = {
+static const struct irq_chip mpic_irq_ht_chip __initconst = {
 	.irq_startup	= mpic_startup_ht_irq,
 	.irq_shutdown	= mpic_shutdown_ht_irq,
 	.irq_mask	= mpic_mask_irq,
-- 
1.9.1

[toc] | [next] | [standalone]


#1735551

FromMichael Ellerman <mpe@ellerman.id.au>
Date2017-09-20 08:30 +0200
Message-ID<urGGd-7Hy-9@gated-at.bofh.it>
In reply to#1734174
Bhumika Goyal <bhumirks@gmail.com> writes:

> Make ehv_pic_irq_chip, mpic_ipi_chip and mpic_tm_chip const as they are
> used only as a copy operation. This usage is during init, so make them
> __initconst too.
> Make mpic_ipi_chip __initdata as it is only modified during the init
> phase and there is no reference of it anywhere after init.

The change log doesn't seem to match the code.

It's mpic_tm_chip which you marked __initdata, and that looks wrong, as
we keep a pointer to it here:

	mpic->hc_tm = mpic_tm_chip;

cheers

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


#1735554 — Re: [PATCH] powerpc: make irq_chip const, __initdata and __initconst

FromJulia Lawall <julia.lawall@lip6.fr>
Date2017-09-20 08:40 +0200
SubjectRe: [PATCH] powerpc: make irq_chip const, __initdata and __initconst
Message-ID<urGPU-7L3-9@gated-at.bofh.it>
In reply to#1735551

On Wed, 20 Sep 2017, Michael Ellerman wrote:

> Bhumika Goyal <bhumirks@gmail.com> writes:
>
> > Make ehv_pic_irq_chip, mpic_ipi_chip and mpic_tm_chip const as they are
> > used only as a copy operation. This usage is during init, so make them
> > __initconst too.
> > Make mpic_ipi_chip __initdata as it is only modified during the init
> > phase and there is no reference of it anywhere after init.
>
> The change log doesn't seem to match the code.
>
> It's mpic_tm_chip which you marked __initdata, and that looks wrong, as
> we keep a pointer to it here:
>
> 	mpic->hc_tm = mpic_tm_chip;

This looks like a memory copy.

julia

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


#1735722

FromMichael Ellerman <mpe@ellerman.id.au>
Date2017-09-20 13:20 +0200
Message-ID<urLcR-2iJ-11@gated-at.bofh.it>
In reply to#1735554
Julia Lawall <julia.lawall@lip6.fr> writes:

> On Wed, 20 Sep 2017, Michael Ellerman wrote:
>
>> Bhumika Goyal <bhumirks@gmail.com> writes:
>>
>> > Make ehv_pic_irq_chip, mpic_ipi_chip and mpic_tm_chip const as they are
>> > used only as a copy operation. This usage is during init, so make them
>> > __initconst too.
>> > Make mpic_ipi_chip __initdata as it is only modified during the init
>> > phase and there is no reference of it anywhere after init.
>>
>> The change log doesn't seem to match the code.
>>
>> It's mpic_tm_chip which you marked __initdata, and that looks wrong, as
>> we keep a pointer to it here:
>>
>> 	mpic->hc_tm = mpic_tm_chip;
>
> This looks like a memory copy.

Yes you're right.

That's pretty horrible given the size of struct irq_chip, but it's not a
bug in this patch.

There are 5 struct irq_chip's embedded in struct mpic, it must be
enormous!

cheers

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web