Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6489139imm; Wed, 27 Jun 2018 08:26:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeHtjCzwn5bduE8dtNxLCaMiwknKk+kaNajlEjPLCkV8nuH0zcr4UpxEZyBAjKOWPwmErPS X-Received: by 2002:a62:e401:: with SMTP id r1-v6mr6373060pfh.172.1530113206513; Wed, 27 Jun 2018 08:26:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530113206; cv=none; d=google.com; s=arc-20160816; b=VIf9NrsEzPG7d8a5DsfI/xZwSKhUdZH4esJ/vuyqo70BzAWv+SwEN0kgMueFvfFc5y InPcyM/NE5I4+jlGI7RqyZ8a96fL22asHJB4wwOSPHEx6CFUVA1GRtGQEoseYsOE/DgA XixnkuWWeTO9yXio/jeVDh7SB5OdIrNr0HnDq2lwTGFoD5s6h5z/XZVvyS57IhezQ1Mh oS4kWFxybDsqGGoveAwYltO1+60YaaQMJk48zqdrIiT4QUwJxYZLeH17nWJaFHDKZuOD 0jscRgJU05pKkc4I5uyKQDVF5eHtEAQsLWCxZoCq+iVOpixoBbj5NGmoV9a1wRh6VNlc juDg== 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:arc-authentication-results; bh=YTMtg/423444nISMST99HPTIB9Of/y1kncP2pjkSBvg=; b=MoCmlmEWt6frCF2zwbzje+pqPY4pdpRy4PYvd1AjnsNP2HAh4QZL/6CFck//Xg903Z C3XPQDccfclpw+teIKFrz7m1W7p3zuzgW5yxzwFE4id5Ij0RR395pR5ow663vbNXmLSh 2n7/xuFsDABMimKaZ2pEj9sS1ZswQNtYSUnrMcenROWFoKVqwqmUXMKYX3L6emXX2TeI WRt0WkZDJzbvqzfbTPYabvnR/buZIGpPQkWvodTyN75Yoy6ZZTwmVa6KmuQGXO5YMt1v qAJkGW6RzvqrlZ4hBUpLrNOLYWhWbT6wOp3J8B5dA+7JgflhuFbhi9latHscfMF9tT55 mewQ== 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 13-v6si4538484ple.274.2018.06.27.08.26.32; Wed, 27 Jun 2018 08:26:46 -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 S934391AbeF0PND (ORCPT + 99 others); Wed, 27 Jun 2018 11:13:03 -0400 Received: from foss.arm.com ([217.140.101.70]:33056 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933133AbeF0PNC (ORCPT ); Wed, 27 Jun 2018 11:13:02 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D33E418A; Wed, 27 Jun 2018 08:13:01 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A36503F266; Wed, 27 Jun 2018 08:13:01 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 88B351AE3692; Wed, 27 Jun 2018 16:13:39 +0100 (BST) Date: Wed, 27 Jun 2018 16:13:39 +0100 From: Will Deacon To: Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Kees Cook , Michael Ellerman , Thomas Garnier , Thomas Gleixner , "Serge E. Hallyn" , Bjorn Helgaas , Benjamin Herrenschmidt , Russell King , Paul Mackerras , Catalin Marinas , Petr Mladek , Ingo Molnar , James Morris , Andrew Morton , Nicolas Pitre , Josh Poimboeuf , Steven Rostedt , Sergey Senozhatsky , Linus Torvalds , Jessica Yu , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, Ingo Molnar Subject: Re: [PATCH v9 3/6] module: use relative references for __ksymtab entries Message-ID: <20180627151339.GD30631@arm.com> References: <20180626182802.19932-1-ard.biesheuvel@linaro.org> <20180626182802.19932-4-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180626182802.19932-4-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ard, On Tue, Jun 26, 2018 at 08:27:58PM +0200, Ard Biesheuvel wrote: > An ordinary arm64 defconfig build has ~64 KB worth of __ksymtab > entries, each consisting of two 64-bit fields containing absolute > references, to the symbol itself and to a char array containing > its name, respectively. [...] > diff --git a/include/linux/export.h b/include/linux/export.h > index ea7df303d68d..ae072bc5aacf 100644 > --- a/include/linux/export.h > +++ b/include/linux/export.h > @@ -18,12 +18,6 @@ > #define VMLINUX_SYMBOL_STR(x) __VMLINUX_SYMBOL_STR(x) > > #ifndef __ASSEMBLY__ > -struct kernel_symbol > -{ > - unsigned long value; > - const char *name; > -}; > - > #ifdef MODULE > extern struct module __this_module; > #define THIS_MODULE (&__this_module) > @@ -54,17 +48,47 @@ extern struct module __this_module; > #define __CRC_SYMBOL(sym, sec) > #endif > > +#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS > +#include > +/* > + * Emit the ksymtab entry as a pair of relative references: this reduces > + * the size by half on 64-bit architectures, and eliminates the need for > + * absolute relocations that require runtime processing on relocatable > + * kernels. > + */ > +#define __KSYMTAB_ENTRY(sym, sec) \ > + __ADDRESSABLE(sym) \ > + asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \ > + " .balign 8 \n" \ Can we use KSYM_ALIGN here instead of 8, or do we need the 8-byte alignment even on 32-bit architectures? Will