linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] clk: renesas: r9a06g032: Drop __packed for portability
@ 2020-11-30  8:57 Geert Uytterhoeven
  2020-11-30 21:57 ` Stephen Rothwell
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2020-11-30  8:57 UTC (permalink / raw)
  To: Stephen Rothwell, Michael Turquette, Stephen Boyd,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
  Cc: Gareth Williams, linux-renesas-soc, linux-clk, linuxppc-dev,
	linux-kernel, Geert Uytterhoeven

The R9A06G032 clock driver uses an array of packed structures to reduce
kernel size.  However, this array contains pointers, which are no longer
aligned naturally, and cannot be relocated on PPC64.  Hence when
compile-testing this driver on PPC64 with CONFIG_RELOCATABLE=y (e.g.
PowerPC allyesconfig), the following warnings are produced:

    WARNING: 136 bad relocations
    c000000000616be3 R_PPC64_UADDR64   .rodata+0x00000000000cf338
    c000000000616bfe R_PPC64_UADDR64   .rodata+0x00000000000cf370
    ...

Fix this by dropping the __packed attribute from the r9a06g032_clkdesc
definition, trading a small size increase for portability.

This increases the 156-entry clock table by 1 byte per entry, but due to
the compiler generating more efficient code for unpacked accesses, the
net size increase is only 76 bytes (gcc 9.3.0 on arm32).

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: 4c3d88526eba2143 ("clk: renesas: Renesas R9A06G032 clock driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2:
  - Fix authorship.
---
 drivers/clk/renesas/r9a06g032-clocks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c
index d900f6bf53d0b944..892e91b92f2c80f5 100644
--- a/drivers/clk/renesas/r9a06g032-clocks.c
+++ b/drivers/clk/renesas/r9a06g032-clocks.c
@@ -55,7 +55,7 @@ struct r9a06g032_clkdesc {
 			u16 sel, g1, r1, g2, r2;
 		} dual;
 	};
-} __packed;
+};
 
 #define I_GATE(_clk, _rst, _rdy, _midle, _scon, _mirack, _mistat) \
 	{ .gate = _clk, .reset = _rst, \
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] clk: renesas: r9a06g032: Drop __packed for portability
  2020-11-30  8:57 [PATCH v2] clk: renesas: r9a06g032: Drop __packed for portability Geert Uytterhoeven
@ 2020-11-30 21:57 ` Stephen Rothwell
  2020-12-01 10:03 ` Stephen Rothwell
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2020-11-30 21:57 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Michael Turquette, Stephen Boyd, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, Gareth Williams,
	linux-renesas-soc, linux-clk, linuxppc-dev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1462 bytes --]

Hi Geert,

On Mon, 30 Nov 2020 09:57:43 +0100 Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>
> The R9A06G032 clock driver uses an array of packed structures to reduce
> kernel size.  However, this array contains pointers, which are no longer
> aligned naturally, and cannot be relocated on PPC64.  Hence when
> compile-testing this driver on PPC64 with CONFIG_RELOCATABLE=y (e.g.
> PowerPC allyesconfig), the following warnings are produced:
> 
>     WARNING: 136 bad relocations
>     c000000000616be3 R_PPC64_UADDR64   .rodata+0x00000000000cf338
>     c000000000616bfe R_PPC64_UADDR64   .rodata+0x00000000000cf370
>     ...
> 
> Fix this by dropping the __packed attribute from the r9a06g032_clkdesc
> definition, trading a small size increase for portability.
> 
> This increases the 156-entry clock table by 1 byte per entry, but due to
> the compiler generating more efficient code for unpacked accesses, the
> net size increase is only 76 bytes (gcc 9.3.0 on arm32).
> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Fixes: 4c3d88526eba2143 ("clk: renesas: Renesas R9A06G032 clock driver")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> v2:
>   - Fix authorship.
> ---
>  drivers/clk/renesas/r9a06g032-clocks.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks.

I have added that to my fixes tree until it gets picked up elsewhere.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] clk: renesas: r9a06g032: Drop __packed for portability
  2020-11-30  8:57 [PATCH v2] clk: renesas: r9a06g032: Drop __packed for portability Geert Uytterhoeven
  2020-11-30 21:57 ` Stephen Rothwell
@ 2020-12-01 10:03 ` Stephen Rothwell
  2020-12-05  6:24 ` Stephen Boyd
  2020-12-07 21:58 ` Stephen Boyd
  3 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2020-12-01 10:03 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Michael Turquette, Stephen Boyd, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, Gareth Williams,
	linux-renesas-soc, linux-clk, linuxppc-dev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1969 bytes --]

Hi Geert,

On Mon, 30 Nov 2020 09:57:43 +0100 Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>
> The R9A06G032 clock driver uses an array of packed structures to reduce
> kernel size.  However, this array contains pointers, which are no longer
> aligned naturally, and cannot be relocated on PPC64.  Hence when
> compile-testing this driver on PPC64 with CONFIG_RELOCATABLE=y (e.g.
> PowerPC allyesconfig), the following warnings are produced:
> 
>     WARNING: 136 bad relocations
>     c000000000616be3 R_PPC64_UADDR64   .rodata+0x00000000000cf338
>     c000000000616bfe R_PPC64_UADDR64   .rodata+0x00000000000cf370
>     ...
> 
> Fix this by dropping the __packed attribute from the r9a06g032_clkdesc
> definition, trading a small size increase for portability.
> 
> This increases the 156-entry clock table by 1 byte per entry, but due to
> the compiler generating more efficient code for unpacked accesses, the
> net size increase is only 76 bytes (gcc 9.3.0 on arm32).
> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Fixes: 4c3d88526eba2143 ("clk: renesas: Renesas R9A06G032 clock driver")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> v2:
>   - Fix authorship.
> ---
>  drivers/clk/renesas/r9a06g032-clocks.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c
> index d900f6bf53d0b944..892e91b92f2c80f5 100644
> --- a/drivers/clk/renesas/r9a06g032-clocks.c
> +++ b/drivers/clk/renesas/r9a06g032-clocks.c
> @@ -55,7 +55,7 @@ struct r9a06g032_clkdesc {
>  			u16 sel, g1, r1, g2, r2;
>  		} dual;
>  	};
> -} __packed;
> +};
>  
>  #define I_GATE(_clk, _rst, _rdy, _midle, _scon, _mirack, _mistat) \
>  	{ .gate = _clk, .reset = _rst, \
> -- 
> 2.25.1
> 

Tested-by: Stephen Rothwell <sfr@canb.auug.org.au> # PowerPC allyesconfig build

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] clk: renesas: r9a06g032: Drop __packed for portability
  2020-11-30  8:57 [PATCH v2] clk: renesas: r9a06g032: Drop __packed for portability Geert Uytterhoeven
  2020-11-30 21:57 ` Stephen Rothwell
  2020-12-01 10:03 ` Stephen Rothwell
@ 2020-12-05  6:24 ` Stephen Boyd
  2020-12-05  9:05   ` Geert Uytterhoeven
  2020-12-07 21:58 ` Stephen Boyd
  3 siblings, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2020-12-05  6:24 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Geert Uytterhoeven, Michael Ellerman,
	Michael Turquette, Paul Mackerras, Stephen Rothwell
  Cc: Gareth Williams, linux-renesas-soc, linux-clk, linuxppc-dev,
	linux-kernel, Geert Uytterhoeven

Quoting Geert Uytterhoeven (2020-11-30 00:57:43)
> The R9A06G032 clock driver uses an array of packed structures to reduce
> kernel size.  However, this array contains pointers, which are no longer
> aligned naturally, and cannot be relocated on PPC64.  Hence when
> compile-testing this driver on PPC64 with CONFIG_RELOCATABLE=y (e.g.
> PowerPC allyesconfig), the following warnings are produced:
> 
>     WARNING: 136 bad relocations
>     c000000000616be3 R_PPC64_UADDR64   .rodata+0x00000000000cf338
>     c000000000616bfe R_PPC64_UADDR64   .rodata+0x00000000000cf370
>     ...
> 
> Fix this by dropping the __packed attribute from the r9a06g032_clkdesc
> definition, trading a small size increase for portability.
> 
> This increases the 156-entry clock table by 1 byte per entry, but due to
> the compiler generating more efficient code for unpacked accesses, the
> net size increase is only 76 bytes (gcc 9.3.0 on arm32).
> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Fixes: 4c3d88526eba2143 ("clk: renesas: Renesas R9A06G032 clock driver")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Acked-by: Stephen Boyd <sboyd@kernel.org>

Unless you want me to pick this up for clk-fixes?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] clk: renesas: r9a06g032: Drop __packed for portability
  2020-12-05  6:24 ` Stephen Boyd
@ 2020-12-05  9:05   ` Geert Uytterhoeven
  0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2020-12-05  9:05 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Benjamin Herrenschmidt, Geert Uytterhoeven, Michael Ellerman,
	Michael Turquette, Paul Mackerras, Stephen Rothwell,
	Gareth Williams, Linux-Renesas, linux-clk, linuxppc-dev,
	Linux Kernel Mailing List

Hi Stephen,

On Sat, Dec 5, 2020 at 7:24 AM Stephen Boyd <sboyd@kernel.org> wrote:
> Quoting Geert Uytterhoeven (2020-11-30 00:57:43)
> > The R9A06G032 clock driver uses an array of packed structures to reduce
> > kernel size.  However, this array contains pointers, which are no longer
> > aligned naturally, and cannot be relocated on PPC64.  Hence when
> > compile-testing this driver on PPC64 with CONFIG_RELOCATABLE=y (e.g.
> > PowerPC allyesconfig), the following warnings are produced:
> >
> >     WARNING: 136 bad relocations
> >     c000000000616be3 R_PPC64_UADDR64   .rodata+0x00000000000cf338
> >     c000000000616bfe R_PPC64_UADDR64   .rodata+0x00000000000cf370
> >     ...
> >
> > Fix this by dropping the __packed attribute from the r9a06g032_clkdesc
> > definition, trading a small size increase for portability.
> >
> > This increases the 156-entry clock table by 1 byte per entry, but due to
> > the compiler generating more efficient code for unpacked accesses, the
> > net size increase is only 76 bytes (gcc 9.3.0 on arm32).
> >
> > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > Fixes: 4c3d88526eba2143 ("clk: renesas: Renesas R9A06G032 clock driver")
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
>
> Acked-by: Stephen Boyd <sboyd@kernel.org>
>
> Unless you want me to pick this up for clk-fixes?

Yes please. Forgot to retain this comment for v2:

   "Please take directly (ppc or clk), as this is a build fix.
    https://lore.kernel.org/linux-clk/20201128122819.32187696@canb.auug.org.au/"

Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] clk: renesas: r9a06g032: Drop __packed for portability
  2020-11-30  8:57 [PATCH v2] clk: renesas: r9a06g032: Drop __packed for portability Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2020-12-05  6:24 ` Stephen Boyd
@ 2020-12-07 21:58 ` Stephen Boyd
  3 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2020-12-07 21:58 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Geert Uytterhoeven, Michael Ellerman,
	Michael Turquette, Paul Mackerras, Stephen Rothwell
  Cc: Gareth Williams, linux-renesas-soc, linux-clk, linuxppc-dev,
	linux-kernel, Geert Uytterhoeven

Quoting Geert Uytterhoeven (2020-11-30 00:57:43)
> The R9A06G032 clock driver uses an array of packed structures to reduce
> kernel size.  However, this array contains pointers, which are no longer
> aligned naturally, and cannot be relocated on PPC64.  Hence when
> compile-testing this driver on PPC64 with CONFIG_RELOCATABLE=y (e.g.
> PowerPC allyesconfig), the following warnings are produced:
> 
>     WARNING: 136 bad relocations
>     c000000000616be3 R_PPC64_UADDR64   .rodata+0x00000000000cf338
>     c000000000616bfe R_PPC64_UADDR64   .rodata+0x00000000000cf370
>     ...
> 
> Fix this by dropping the __packed attribute from the r9a06g032_clkdesc
> definition, trading a small size increase for portability.
> 
> This increases the 156-entry clock table by 1 byte per entry, but due to
> the compiler generating more efficient code for unpacked accesses, the
> net size increase is only 76 bytes (gcc 9.3.0 on arm32).
> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Fixes: 4c3d88526eba2143 ("clk: renesas: Renesas R9A06G032 clock driver")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Applied to clk-fixes

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-07 21:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30  8:57 [PATCH v2] clk: renesas: r9a06g032: Drop __packed for portability Geert Uytterhoeven
2020-11-30 21:57 ` Stephen Rothwell
2020-12-01 10:03 ` Stephen Rothwell
2020-12-05  6:24 ` Stephen Boyd
2020-12-05  9:05   ` Geert Uytterhoeven
2020-12-07 21:58 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).