linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Mark Rutland" <mark.rutland@arm.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Ard Biesheuvel" <ard.biesheuvel@linaro.org>,
	"Marc Zyngier" <marc.zyngier@arm.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Julien Grall" <julien.grall@arm.com>,
	"Alan Hayward" <alan.hayward@arm.com>,
	"Andrew Murray" <andrew.murray@arm.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Dave Martin" <Dave.Martin@arm.com>,
	"Linux ARM" <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] arm64/sve: fix genksyms generation
Date: Mon, 17 Jun 2019 17:13:30 +0100	[thread overview]
Message-ID: <20190617161330.GD30800@fuggles.cambridge.arm.com> (raw)
In-Reply-To: <CAK8P3a2aJNiLTyfRDqazJa2sAc-Jf-QShSZ7+4-whHSxKbLUVQ@mail.gmail.com>

On Mon, Jun 17, 2019 at 02:21:46PM +0200, Arnd Bergmann wrote:
> On Mon, Jun 17, 2019 at 1:26 PM Will Deacon <will.deacon@arm.com> wrote:
> > On Mon, Jun 17, 2019 at 12:42:11PM +0200, Arnd Bergmann wrote:
> > > genksyms does not understand __uint128_t, so we get a build failure
> > > in the fpsimd module when it cannot export a symbol right:
> >
> > The fpsimd code is builtin, so which module is actually failing? My
> > allmodconfig build succeeds, so I must be missing something.
> 
> It happened for me on randconfig builds, you can find one such configuration
> at https://pastebin.com/cU8iQ4ta now. I was building this with clang
> rather than gcc, which may affect the issue, but I assumed not.

Hmm, I've failed to reproduce the issue with that config and either GCC
(7.1.1 and 8.3.0) or Clang (a flavour of 9.0.0 from a few months ago).

> > > WARNING: EXPORT symbol "kernel_neon_begin" [vmlinux] version generation failed, symbol will not be versioned.
> > > /home/arnd/cross/x86_64/gcc-8.1.0-nolibc/aarch64-linux/bin/aarch64-linux-ld: arch/arm64/kernel/fpsimd.o: relocation R_AARCH64_ABS32 against `__crc_kernel_neon_begin' can not be used when making a shared object
> > > arch/arm64/kernel/fpsimd.o:(.data+0x0): dangerous relocation: unsupported relocation
> > > arch/arm64/kernel/fpsimd.o:(".discard.addressable"+0x0): dangerous relocation: unsupported relocation
> > > arch/arm64/kernel/fpsimd.o:(".discard.addressable"+0x8): dangerous relocation: unsupported relocation
> > >
> > > We could teach genksyms about the type, but it's easier to just
> > > work around it by defining that type locally in a way that genksyms
> > > understands.
> > >
> > > Fixes: 41040cf7c5f0 ("arm64/sve: Fix missing SVE/FPSIMD endianness conversions")
> >
> > I can't see which part of that patch causes the problem, so I'm a bit wary
> > of the fix. We've been using __uint128_t for a while now, and I see there's
> > one in the x86 kvm code as well, so it would be nice to understand what's
> > happening here so that we can avoid running into it in future as well.
> 
> The problem is only in files that export a symbol. This is also the
> case in arch/x86/kernel/kvm.c, but it may be lucky because the
> type only appears /after/ the last export in that file.
> 
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > > ---
> > >  arch/arm64/kernel/fpsimd.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
> > > index 07f238ef47ae..2aba07cccf50 100644
> > > --- a/arch/arm64/kernel/fpsimd.c
> > > +++ b/arch/arm64/kernel/fpsimd.c
> > > @@ -400,6 +400,9 @@ static int __init sve_sysctl_init(void) { return 0; }
> > >  #define ZREG(sve_state, vq, n) ((char *)(sve_state) +                \
> > >       (SVE_SIG_ZREG_OFFSET(vq, n) - SVE_SIG_REGS_OFFSET))
> > >
> > > +#ifdef __GENKSYMS__
> > > +typedef __u64 __uint128_t[2];
> > > +#endif
> >
> > I suspect I need to figure out what genksyms is doing, but I'm nervous
> > about exposing this as an array type without understanding whether or
> > not that has consequences for its operation.
> 
> The entire point is genksyms is to ensure that types of exported symbols
> are compatible. To do this, it has a limited parser for C source code that
> understands the basic types (char, int, long, _Bool, etc) and how to
> aggregate them into structs and function arguments. This process has
> always been fragile, and it clearly breaks when it fails to understand a
> particular type.

Ok, but the patch that appears to cause this problem doesn't change the
type of anything we're exporting. The symbol in your log is
"kernel_neon_begin" which is:

	void kernel_neon_begin(void);

so I'm still fairly confused about the problem. In fact, even if I create
a silly:

	void will_kernel_neon_begin(__uint128_t);

function, then somehow I see it being processed:

	__crc_will_kernel_neon_begin = 0x5401d250;

Is there some way that your passing '-w' to genksyms?

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-06-17 16:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 10:42 [PATCH] arm64/sve: fix genksyms generation Arnd Bergmann
2019-06-17 11:26 ` Will Deacon
2019-06-17 12:21   ` Arnd Bergmann
2019-06-17 14:59     ` Alex Bennée
2019-06-17 15:10       ` Arnd Bergmann
2019-06-17 16:13     ` Will Deacon [this message]
2019-06-17 16:32       ` Ard Biesheuvel
2019-06-17 16:45         ` Will Deacon
2019-06-18 12:02           ` Will Deacon
2019-06-18 14:15             ` Arnd Bergmann
2019-07-09 19:06               ` Laura Abbott
2019-07-10  8:15                 ` Will Deacon
2019-07-10  8:48                   ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190617161330.GD30800@fuggles.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=Dave.Martin@arm.com \
    --cc=alan.hayward@arm.com \
    --cc=alex.bennee@linaro.org \
    --cc=andrew.murray@arm.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=julien.grall@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=peter.maydell@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).