linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm: prevent inlining in arxescsi.c causing build failures
@ 2011-12-01  4:26 Paul Gortmaker
  2011-12-01  8:06 ` Uwe Kleine-König
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Gortmaker @ 2011-12-01  4:26 UTC (permalink / raw)
  To: linux-arm-kernel

The following failure is seen in routine coverage builds:

  CC [M]  drivers/scsi/arm/arxescsi.o
/tmp/cccEyiO7.s: Assembler messages:
/tmp/cccEyiO7.s:334: Error: symbol `.loop_1' is already defined
/tmp/cccEyiO7.s:337: Error: symbol `.loop_2' is already defined
/tmp/cccEyiO7.s:343: Error: symbol `.loop_3' is already defined
/tmp/cccEyiO7.s:365: Error: symbol `.loop_1' is already defined
/tmp/cccEyiO7.s:368: Error: symbol `.loop_2' is already defined
/tmp/cccEyiO7.s:374: Error: symbol `.loop_3' is already defined
make[4]: *** [drivers/scsi/arm/arxescsi.o] Error 1

It is caused by multiple inline of arxescsi_pseudo_dma_write()
which is responsible for the above labels.  Marking the fcn
as non-inline fixes the issue.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

diff --git a/drivers/scsi/arm/arxescsi.c b/drivers/scsi/arm/arxescsi.c
index a750aa7..2608a9e 100644
--- a/drivers/scsi/arm/arxescsi.c
+++ b/drivers/scsi/arm/arxescsi.c
@@ -72,7 +72,8 @@ arxescsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp,
 	return fasdma_pseudo;
 }
 
-static void arxescsi_pseudo_dma_write(unsigned char *addr, void __iomem *base)
+static noinline void
+arxescsi_pseudo_dma_write(unsigned char *addr, void __iomem *base)
 {
        __asm__ __volatile__(
        "               stmdb   sp!, {r0-r12}\n"
-- 
1.7.7.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] arm: prevent inlining in arxescsi.c causing build failures
@ 2012-01-22 19:16 Paul Gortmaker
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Gortmaker @ 2012-01-22 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

The following failure is seen in routine coverage builds:

  CC [M]  drivers/scsi/arm/arxescsi.o
/tmp/cccEyiO7.s: Assembler messages:
/tmp/cccEyiO7.s:334: Error: symbol `.loop_1' is already defined
/tmp/cccEyiO7.s:337: Error: symbol `.loop_2' is already defined
/tmp/cccEyiO7.s:343: Error: symbol `.loop_3' is already defined
/tmp/cccEyiO7.s:365: Error: symbol `.loop_1' is already defined
/tmp/cccEyiO7.s:368: Error: symbol `.loop_2' is already defined
/tmp/cccEyiO7.s:374: Error: symbol `.loop_3' is already defined
make[4]: *** [drivers/scsi/arm/arxescsi.o] Error 1

It is caused by multiple inline of arxescsi_pseudo_dma_write()
which is responsible for the above labels.  Marking the fcn
as non-inline fixes the issue.

Arnd Bergmann considered un-inlinling vs fixing the loop[1] to
use local labels and came to the following conclusion:

  The problem is mostly in the code: The symbols are defined in an
  inline assembly that is not meant to be instantiated multiple times.
  gcc may decide to unroll the loop in which this is done, which causes
  the error above. Unrolling the loop is a rather silly thing to do
  here, because the code is rather large and does not at all benefit
  from unrolling. You can use the patch below to fix the code to still
  work if the loop is unrolled, but I also think that marking the
  function as uninline is a good idea, in particular because I don't
  trust the old assembly to still do the right thing otherwise:
  It manually saves and restores the registers on the stack, where
  you nowadays would specify specific clobbers for the registers
  it uses, and let the compiler take care of it. It also doesn't
  contain a memory clobber for the buffer, so keeping the function
  out-of-line is probably the safe choice.

[1] https://lkml.org/lkml/2011/12/1/189

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
CC: Arnd Bergmann <arnd@arndb.de>
CC: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>

---
v2: add desc. from Arnd indicating why un-inlining is the best choice

diff --git a/drivers/scsi/arm/arxescsi.c b/drivers/scsi/arm/arxescsi.c
index a750aa7..2608a9e 100644
--- a/drivers/scsi/arm/arxescsi.c
+++ b/drivers/scsi/arm/arxescsi.c
@@ -72,7 +72,8 @@ arxescsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp,
 	return fasdma_pseudo;
 }
 
-static void arxescsi_pseudo_dma_write(unsigned char *addr, void __iomem *base)
+static noinline void
+arxescsi_pseudo_dma_write(unsigned char *addr, void __iomem *base)
 {
        __asm__ __volatile__(
        "               stmdb   sp!, {r0-r12}\n"
-- 
1.7.7.2

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

end of thread, other threads:[~2012-01-22 19:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-01  4:26 [PATCH] arm: prevent inlining in arxescsi.c causing build failures Paul Gortmaker
2011-12-01  8:06 ` Uwe Kleine-König
2011-12-01 10:46   ` Sergei Shtylyov
2011-12-01 14:06   ` Arnd Bergmann
  -- strict thread matches above, loose matches on Subject: below --
2012-01-22 19:16 Paul Gortmaker

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).