Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2724539ybi; Mon, 17 Jun 2019 09:33:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqymJAAprt6/XExtLmpiCDoQqtN7TBxPT4/6v27fPvMQNWKpQnZiMggIyM/HZ/3RnPxFpdNn X-Received: by 2002:aa7:82d7:: with SMTP id f23mr112674827pfn.138.1560789235241; Mon, 17 Jun 2019 09:33:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560789235; cv=none; d=google.com; s=arc-20160816; b=c229bvff+jdtMyOEGtII1jXlDvXKTs66+CNB+T1IO7XNJvARCDvsgA+SJjyx7V7tEt UC6N2YKvffiayIO94cFz4gXa5vyDUqyl8flKfEXXK2RpUN39ESLcw5pV/5Z8RF687l4H RoDVo2n0oMmxcngACmyPmAo5mLH+/ZgYH4ERzWY9pyfifuaeNulWVqVNVy8vy2+Dlbz7 zMdjXxL5IbNDg1SLL3k2d/CbMee1jxhuH3ZMR9xpLWPqQgleCyIlL+RwJgI5LIA/U19X NtXowLSlGjL8G/b9xoqTkcHJ2hJcviztDqFdZgx9K8YtvKIvGfC5aV/wPQdon5Qn+GA2 pb0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=XyvlBZ9D/Zjk2MW/3VQHdWy6VMYt1yotnl1P/NZQLYw=; b=dVLZt/qDDO7rJ3d+Ej9P7/ZtqB6ecWPAFBK8R4Rgm1K29fFty036XdS9mtMGgQtEHF fyn0/OZ+aZP9twHY7qXgklpjDrsNt/O9lqRxIfIxU3LVoXc7X9+h+3v67BmaHQTi+0dV s2qKRf/VaHA+aaCPSBpMegSzFXb3oLFlg8DJ2J1TLRqn34JgqZUiD7wh3fSb63qAZkGi KWdbaS8L5Y93jbqHNo6TcmXIRT94VBPHW/gMBQp0aHkIx9cLbGf7XPjBgATfHmvuOFq2 dqb1KsEBIpFSpEZOLerp8phhub4rdaf4Jm4usqOU0ITcccE8ebNQYuoaB9GjA9oM/d4A ug7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EJ/Cp9sF"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j124si10838749pfb.151.2019.06.17.09.33.39; Mon, 17 Jun 2019 09:33:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EJ/Cp9sF"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727778AbfFQQc3 (ORCPT + 99 others); Mon, 17 Jun 2019 12:32:29 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:46303 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726238AbfFQQc3 (ORCPT ); Mon, 17 Jun 2019 12:32:29 -0400 Received: by mail-io1-f68.google.com with SMTP id i10so22455592iol.13 for ; Mon, 17 Jun 2019 09:32:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XyvlBZ9D/Zjk2MW/3VQHdWy6VMYt1yotnl1P/NZQLYw=; b=EJ/Cp9sFXyoWPLdx4T75q2KAVuLe6xIazZp50xTNkSvbp8Lz55BFAWfHHcfdafuJLs rlzMdiwYuGiot4wub+V48pZl2j6EaWZEUAPGnv1eowEzTFIfxowKcHGD2WhSXEPd3aJX k+rOD1WfnXUFECEDLjKKiLM/n6SgQ8XemLXAdZF7CeRJvGVkxwuaytocJcGMKDqTZjvu Rp10jnCmEfwE65wcMd3FVaQXFBQarjFZFkqWhKUbFJuDR4QXJbCetOuFahb5+xVGEJI5 c3H+CYuwx5kdUNS04YSIWIKRkcCrolC/vwbXKKuzWcgbrPcC+cjdcYDeYQdPNqfcL9RQ VxWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XyvlBZ9D/Zjk2MW/3VQHdWy6VMYt1yotnl1P/NZQLYw=; b=ozTiiKJnKVuyDvnccrzZ5WdpPbMIO/sexi3XwCj3xoU6Spwr9z87rXmjEkOqBjYRpB 1lQrDQAETSSAAteWaWK71Py6U6vWCv4hloy65FW41zvTv3qfiyo0ZBUrdDo1NWfReSNI BgwpUW1RmdixVcoLjS3z3/o5MjAhEbPGIJTUrFLdk5v/YEMHQGvf728ty5rrCqQoNknX J5KGz9bN3Aoc87Plp3TwIV0qzsjhjfphGIjpILwXzAvC6ArL4+MIT6WHgWuwwGBO6lNu kkqUDbpbvU++s13dX054uPy1n6NqKFm2yZxs/S9HobsMsAm31lQqxWAL384oQ7Vq06t7 bmrw== X-Gm-Message-State: APjAAAULZMbDX5t6tFOsYAUCbbrPcJg8bfDhgUr7qlF/XHhszObzF087 lKeqLBd1adf1gWnQO1lcB4NjtG/G2Zwcnze2eDUTF512 X-Received: by 2002:a05:6602:98:: with SMTP id h24mr11263939iob.49.1560789148415; Mon, 17 Jun 2019 09:32:28 -0700 (PDT) MIME-Version: 1.0 References: <20190617104237.2082388-1-arnd@arndb.de> <20190617112652.GB30800@fuggles.cambridge.arm.com> <20190617161330.GD30800@fuggles.cambridge.arm.com> In-Reply-To: <20190617161330.GD30800@fuggles.cambridge.arm.com> From: Ard Biesheuvel Date: Mon, 17 Jun 2019 18:32:16 +0200 Message-ID: Subject: Re: [PATCH] arm64/sve: fix genksyms generation To: Will Deacon Cc: Arnd Bergmann , Catalin Marinas , Dave Martin , =?UTF-8?B?QWxleCBCZW5uw6ll?= , Peter Maydell , Alan Hayward , Julien Grall , Marc Zyngier , Mark Rutland , Andrew Murray , Linux ARM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 17 Jun 2019 at 18:13, Will Deacon wrote: > > On Mon, Jun 17, 2019 at 02:21:46PM +0200, Arnd Bergmann wrote: > > On Mon, Jun 17, 2019 at 1:26 PM Will Deacon 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 > > > > --- > > > > 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? > The problem is not about the types we're *exporting*. Genksyms just gives up halfway through the file, as soon as it encounters something it doesn't like, and any symbol that hasn't been encountered yet at that point will not have a crc generated for it.