Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3685276ybi; Tue, 18 Jun 2019 05:03:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9rvaA/Xc8ixpUBbaDuHQUGaPrFbh5+oQn8UusjuV5unkCYaVeT3gqz56Ydvft7D92b646 X-Received: by 2002:a63:3148:: with SMTP id x69mr2335918pgx.226.1560859416930; Tue, 18 Jun 2019 05:03:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560859416; cv=none; d=google.com; s=arc-20160816; b=evx4BUoWI5HH4HV8PCKapGTKbvPLhvuIT7VkrcAMNPdjtlmVqWvTZnwSIjPbtf560D dYU2ZIRCTtFk/OJzk7KbpYCeiq1lgmrfLhcr3WaoSxetClcTlckymSKFDc9c0bmRzMLn c2qzT5l2OTHhTPzx4LQHaXRstAJ+9+U+69FKJXhlqfELQLP8p9/xW1hmrW41tapGCGVx GsRvvtEuKfUs5aP8B/lBvl+2C7X6Yitx3KhUYW1MejoIsmyxr1+ODt2xaGL2ddU0es3u WcBESkD4jyC9HIZcY0NZMo0ZELcP1Yb7veafBppkireVkNGLWmbyDH5JrqJzhDL1EpYu s8Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=YACznW/38JQmasCHNx9pYbbUJKPo/i3WWVbTFWf+2Xc=; b=d/DhA+y8Tdl5llvZJozSIYQQSbMSHPdmBPsO8Hf7qyU0zGFo5/1UfFkgq4C2M5uCAi YARcdirbxYD1BOmoapSj87FUDfqUQ2ERKDUkla9c8jitpuZKkgHOvz2mkt5PC9EFoaPd rcBVT+EF9Jv6e6Af9IhHW7p7igZTvI4LWhRH1MGS9V651xqrj6HZlwRI9MNj9CGAvU3i Gi7W+5T6r4uTUnlGtyfATsZnTSwlGJbTIve4qrBpvlI2w3c9d6cJxEbSxUFkuGtkJfzz r/HnpPdQreHG6Cgjt7XFJO8eakVIUnfyG8SDfxvsPpZ5nAeJw01f/48fDuQU33HFEiAP bolg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si13054009pfr.52.2019.06.18.05.03.18; Tue, 18 Jun 2019 05:03:36 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbfFRMDH (ORCPT + 99 others); Tue, 18 Jun 2019 08:03:07 -0400 Received: from foss.arm.com ([217.140.110.172]:37354 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725913AbfFRMDH (ORCPT ); Tue, 18 Jun 2019 08:03:07 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 96F1A2B; Tue, 18 Jun 2019 05:03:06 -0700 (PDT) Received: from fuggles.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D9E003F246; Tue, 18 Jun 2019 05:03:04 -0700 (PDT) Date: Tue, 18 Jun 2019 13:02:59 +0100 From: Will Deacon To: Ard Biesheuvel Cc: Arnd Bergmann , Catalin Marinas , Dave Martin , Alex =?iso-8859-1?Q?Benn=E9e?= , 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 Message-ID: <20190618120259.GA31041@fuggles.cambridge.arm.com> References: <20190617104237.2082388-1-arnd@arndb.de> <20190617112652.GB30800@fuggles.cambridge.arm.com> <20190617161330.GD30800@fuggles.cambridge.arm.com> <20190617164553.GI30800@fuggles.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190617164553.GI30800@fuggles.cambridge.arm.com> User-Agent: Mutt/1.11.1+86 (6f28e57d73f2) () Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, Ard, On Mon, Jun 17, 2019 at 05:45:56PM +0100, Will Deacon wrote: > On Mon, Jun 17, 2019 at 06:32:16PM +0200, Ard Biesheuvel wrote: > > 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. > > Hmm, but it appears to be either working or failing silently for me, which > doesn't match what Arnd is seeing. I'd prefer to fix genksyms but I'm not > happy touching it if I can't show it's broken to begin with. If I pass '-w' > I see it barfing on all sorts of random stuff, for example the static_assert > in include/linux/fs.h: > > static_assert(offsetof(struct filename, iname) % sizeof(long) == 0); Ok, I had some more fun with this today. First of all, we needed a new .config, but also, the issue only appears with linux-next. With that configuration, I can hit the issue. What seems to occur is that when parsing: static __uint128_t arm64_cpu_to_le128(__uint128_t x) { u64 a = swab64(x); u64 b = swab64(x >> 64); return ((__uint128_t)a << 64) | b; } in fpsimd.c, then genksyms doesn't treate __uint128_t as a type and therefore fails to figure out that this is a function. Consequently, it keeps trying (and failing) to parse until it sees the end of the current expression. This happens when it hits: EXPORT_SYMBOL(kernel_neon_begin); thanks to the semi-colon. So one nasty bodge to fix this is: diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index bb42cd04baec..693a978f41f9 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -368,6 +368,8 @@ static __uint128_t arm64_cpu_to_le128(__uint128_t x) } #endif +short of_fixing_genksyms_we_must_use_this_hack; + #define arm64_le128_to_cpu(x) arm64_cpu_to_le128(x) /* but actually, I think I've managed to hack genksyms itself. Patch below. Will --->8 From 6e004b8824d4eb6a4e61cd794fbc3a761b50135b Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Tue, 18 Jun 2019 12:56:49 +0100 Subject: [PATCH] genksyms: Teach parse about __uint128_t built-in type __uint128_t crops up in a few files that export symbols to modules, so teach genksyms about it so that we don't end up skipping the CRC generation for some symbols due to the parser failing to spot them: | WARNING: EXPORT symbol "kernel_neon_begin" [vmlinux] version | generation failed, symbol will not be versioned. | ld: arch/arm64/kernel/fpsimd.o: relocation R_AARCH64_ABS32 against | `__crc_kernel_neon_begin' can not be used when making a shared | object | ld: arch/arm64/kernel/fpsimd.o:(.data+0x0): dangerous relocation: | unsupported relocation Cc: Ard Biesheuvel Reported-by: Arnd Bergmann Signed-off-by: Will Deacon --- scripts/genksyms/keywords.c | 1 + scripts/genksyms/parse.y | 2 ++ 2 files changed, 3 insertions(+) diff --git a/scripts/genksyms/keywords.c b/scripts/genksyms/keywords.c index 9f40bcd17d07..6ec585febfa4 100644 --- a/scripts/genksyms/keywords.c +++ b/scripts/genksyms/keywords.c @@ -53,6 +53,7 @@ static struct resword { { "struct", STRUCT_KEYW }, { "typedef", TYPEDEF_KEYW }, { "typeof", TYPEOF_KEYW }, + { "__uint128_t", BUILTIN_INT_KEYW }, { "union", UNION_KEYW }, { "unsigned", UNSIGNED_KEYW }, { "void", VOID_KEYW }, diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y index 00a6d7e54971..1ebcf52cd0f9 100644 --- a/scripts/genksyms/parse.y +++ b/scripts/genksyms/parse.y @@ -76,6 +76,7 @@ static void record_compound(struct string_list **keyw, %token ATTRIBUTE_KEYW %token AUTO_KEYW %token BOOL_KEYW +%token BUILTIN_INT_KEYW %token CHAR_KEYW %token CONST_KEYW %token DOUBLE_KEYW @@ -263,6 +264,7 @@ simple_type_specifier: | VOID_KEYW | BOOL_KEYW | VA_LIST_KEYW + | BUILTIN_INT_KEYW | TYPE { (*$1)->tag = SYM_TYPEDEF; $$ = $1; } ; -- 2.11.0