Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2628574ybi; Mon, 17 Jun 2019 08:00:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgCysBwLl3phcOrXfEm0O2+hGfx5g3R15fARX/JErXnZtvMWCoNonoyeHvZ3PILbLLM0xa X-Received: by 2002:a65:5302:: with SMTP id m2mr49121205pgq.369.1560783623818; Mon, 17 Jun 2019 08:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560783623; cv=none; d=google.com; s=arc-20160816; b=wZ7rvUMQ7qaYe7nNcGNXIB9SiOrsWdusnq9/cW79ZcfVk7ag39OS6dO/Qd6hsFDofS WvK1xASxsYVxZyJfylmAdfzMC10bGYX6mBLyvpYxyGKUeOQBfoe1OOPtovQH2ViaUThX GPAx8JIVUqwwzGSIAkb/lmKqJcPWEqPbUHLhWOOpYMv3kdlWEQn52sIrzammz9P07U9L zwFgsPxbVj4btu0XsDQF+buEl5RHlGo07fK/YLuclhA29I1HnNWEz76442/Snz9rWcKb kk5MjK1795wXZ9rYA0b/aIsJRv2TEKCpRFikdhPHc3zSdUThk0V8VUEeB0Z6PHg8oWUs 8VQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:in-reply-to:subject:cc:to:from:user-agent :references:dkim-signature; bh=ghbiEfQ6eCAvNR3r+RTqQOdACpqT5ffcn6cO7EYSCQI=; b=SnKKEJaHlR5vWm6iWYqo8RfrGXDjWesMm+7svJj6E6xdnM+cXZikDMsjARKNRtZozA QOgzLZxJYDeu6O8IDieMBfUUysx7P4S6RxyCLHimliS0kpTA057KgYg+0+85BvDBco8W b2T8FAvN8/JYHNQuYoalcIYauxixd97oWA0wXwFZaZV2rZ7E0658v3f0T14gy5zYkmvy mIWzm83V41QHf356nWKCop5cGEamQi+u3gyJnNf9Z8xx/9p1IidK90QoTNpXVBTKrTDr c/KB+2Axuuq8GUc5hqm5mGdqoRGe4hHxV8ArBLokCrWmvOwg4W0lrFltSijUgTogLbXF nDKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ingREZ1H; 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 j11si4782081pfi.279.2019.06.17.08.00.07; Mon, 17 Jun 2019 08:00:23 -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=ingREZ1H; 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 S1728170AbfFQO74 (ORCPT + 99 others); Mon, 17 Jun 2019 10:59:56 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38074 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726215AbfFQO7z (ORCPT ); Mon, 17 Jun 2019 10:59:55 -0400 Received: by mail-wm1-f66.google.com with SMTP id s15so9476985wmj.3 for ; Mon, 17 Jun 2019 07:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version:content-transfer-encoding; bh=ghbiEfQ6eCAvNR3r+RTqQOdACpqT5ffcn6cO7EYSCQI=; b=ingREZ1HqUKGlmG/guNYSpiJDuTNDsJ0go8J5yZCMurHP+Uu7wXwE1G75cLSbhlL3v qLsZT+UPiey6CH1QT59tUW9FgGrUOe0UToIOB9AnuRaqf/W+WIKzVgmH/FkL7ZdB1AAe c44+xWbOLjf2mCDY2E1y7GRWm4xvzmsDS1U7bROepRkLzIzbhaV09+ylFsWix8vF6Te3 pgopenGGUoCzG9iMGp3U3HZLVESHEdn3nZtBbKOCAWf60sP6cmtDtsvf6bmezTktY4/8 yZSfXxvOaE7uX9/+5O3mUiOz/ExnSgNpxTlwWz2JXVRiBgvq4Wch/RUA3yO7VaG3PELG Bk5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version:content-transfer-encoding; bh=ghbiEfQ6eCAvNR3r+RTqQOdACpqT5ffcn6cO7EYSCQI=; b=gV210R/VdfdhajOIomrC0/i8YEKRk3KVnGaH47Bbz0mBP+HsbrdFdDT6f9EAgMu3Pc wLc8/vR1agGGSP0NukXWwWdYSv7TEn8Ddnl4lMrwzpI1IDZ6Py+iFU3vTdPsgl7dp22q 175UGpdSkbJjnxGA/CXFFxKFNNZ8bdJTEkXdgfoPG+QCrjoIna+44+OnXVAm1lSuODNw sXaUYCRF3rlZnfB37cHHvjnxdPNwiykNXO8TrKixq0PHu7xr6nCZGzRFA/AN4UZyyKnX ZlvmL3BA0MAjLx04Bf4c0im+0esTgDI/NKXSsCFFBuI1NRgWrp8CPX3X51Z3DNJZiQB5 fKuA== X-Gm-Message-State: APjAAAUbn61zjVxJmCni7+UjAsfvuZ4HP5J9fJq0f5JZ3YAvV7Zc/LYp C3m9Bog0okR/ABCohryIZBIE6Q== X-Received: by 2002:a1c:f918:: with SMTP id x24mr12940842wmh.132.1560783592558; Mon, 17 Jun 2019 07:59:52 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id r2sm16240349wma.26.2019.06.17.07.59.51 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 07:59:51 -0700 (PDT) Received: from zen (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 993AE1FF87; Mon, 17 Jun 2019 15:59:51 +0100 (BST) References: <20190617104237.2082388-1-arnd@arndb.de> <20190617112652.GB30800@fuggles.cambridge.arm.com> User-agent: mu4e 1.3.2; emacs 26.1 From: Alex =?utf-8?Q?Benn=C3=A9e?= To: Arnd Bergmann Cc: Will Deacon , Catalin Marinas , Dave Martin , Ard Biesheuvel , Peter Maydell , Alan Hayward , Julien Grall , Marc Zyngier , Mark Rutland , Andrew Murray , Linux ARM , Linux Kernel Mailing List Subject: Re: [PATCH] arm64/sve: fix genksyms generation In-reply-to: Date: Mon, 17 Jun 2019 15:59:51 +0100 Message-ID: <87a7eg9s0o.fsf@zen.linaroharston> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd Bergmann writes: > On Mon, Jun 17, 2019 at 1:26 PM Will Deacon wrote: >> >> Hi Arnd, >> >> 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 configurat= ion > at https://pastebin.com/cU8iQ4ta now. I was building this with clang > rather than gcc, which may affect the issue, but I assumed not. > >> > WARNING: EXPORT symbol "kernel_neon_begin" [vmlinux] version generatio= n failed, symbol will not be versioned. >> > /home/arnd/cross/x86_64/gcc-8.1.0-nolibc/aarch64-linux/bin/aarch64-lin= ux-ld: arch/arm64/kernel/fpsimd.o: relocation R_AARCH64_ABS32 against `__cr= c_kernel_neon_begin' can not be used when making a shared object >> > arch/arm64/kernel/fpsimd.o:(.data+0x0): dangerous relocation: unsuppor= ted relocation >> > arch/arm64/kernel/fpsimd.o:(".discard.addressable"+0x0): dangerous rel= ocation: unsupported relocation >> > arch/arm64/kernel/fpsimd.o:(".discard.addressable"+0x8): dangerous rel= ocation: 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 con= versions") >> >> I can't see which part of that patch causes the problem, so I'm a bit wa= ry >> of the fix. We've been using __uint128_t for a while now, and I see ther= e'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. Shouldn't the solution for this be to fix genksyms to be less fragile and more understanding? The code base doesn't seem to be full of these sorts of ifdef workarounds. > > Arnd -- Alex Benn=C3=A9e