From patchwork Sun Aug 19 02:56:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 1343321 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 3F3C3DF25A for ; Sun, 19 Aug 2012 03:12:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753278Ab2HSC7r (ORCPT ); Sat, 18 Aug 2012 22:59:47 -0400 Received: from mga11.intel.com ([192.55.52.93]:1635 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753949Ab2HSC5p (ORCPT ); Sat, 18 Aug 2012 22:57:45 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 18 Aug 2012 19:57:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.77,792,1336374000"; d="scan'208";a="204911357" Received: from tassilo.jf.intel.com ([10.7.201.151]) by fmsmga001.fm.intel.com with ESMTP; 18 Aug 2012 19:57:25 -0700 Received: by tassilo.jf.intel.com (Postfix, from userid 501) id ECD94241947; Sat, 18 Aug 2012 19:57:25 -0700 (PDT) From: Andi Kleen To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, mmarek@suse.cz, linux-kbuild@vger.kernel.org, JBeulich@suse.com, akpm@linux-foundation.org, Andi Kleen , Andy Lutomirski Subject: [PATCH 54/74] x86, lto, vdso: Don't duplicate vvar address variables Date: Sat, 18 Aug 2012 19:56:50 -0700 Message-Id: <1345345030-22211-55-git-send-email-andi@firstfloor.org> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1345345030-22211-1-git-send-email-andi@firstfloor.org> References: <1345345030-22211-1-git-send-email-andi@firstfloor.org> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org From: Andi Kleen Every includer of vvar.h currently gets own static variables for all the vvar addresses. Generate just one set each for the main kernel and for the vdso. This saves some data space. Cc: Andy Lutomirski Signed-off-by: Andi Kleen --- arch/x86/include/asm/vvar.h | 27 +++++++++++++++++---------- arch/x86/vdso/vclock_gettime.c | 1 + arch/x86/vdso/vma.c | 1 + 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/asm/vvar.h b/arch/x86/include/asm/vvar.h index d76ac40..1fd06a8 100644 --- a/arch/x86/include/asm/vvar.h +++ b/arch/x86/include/asm/vvar.h @@ -24,27 +24,34 @@ /* The kernel linker script defines its own magic to put vvars in the * right place. */ -#define DECLARE_VVAR(offset, type, name) \ - EMIT_VVAR(name, offset) +#define DECLARE_VVAR(type, name) \ + EMIT_VVAR(name, VVAR_OFFSET_ ## name) + +#elif defined(__VVAR_ADDR) + +#define DECLARE_VVAR(type, name) \ + type const * const vvaraddr_ ## name = \ + (void *)(VVAR_ADDRESS + (VVAR_OFFSET_ ## name)); #else -#define DECLARE_VVAR(offset, type, name) \ - static type const * const vvaraddr_ ## name = \ - (void *)(VVAR_ADDRESS + (offset)); +#define DECLARE_VVAR(type, name) \ + extern type const * const vvaraddr_ ## name; #define DEFINE_VVAR(type, name) \ type name \ __attribute__((section(".vvar_" #name), aligned(16))) __visible +#endif #define VVAR(name) (*vvaraddr_ ## name) -#endif - /* DECLARE_VVAR(offset, type, name) */ -DECLARE_VVAR(0, volatile unsigned long, jiffies) -DECLARE_VVAR(16, int, vgetcpu_mode) -DECLARE_VVAR(128, struct vsyscall_gtod_data, vsyscall_gtod_data) +#define VVAR_OFFSET_jiffies 0 +DECLARE_VVAR(volatile unsigned long, jiffies) +#define VVAR_OFFSET_vgetcpu_mode 16 +DECLARE_VVAR(int, vgetcpu_mode) +#define VVAR_OFFSET_vsyscall_gtod_data 128 +DECLARE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) #undef DECLARE_VVAR diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c index 885eff4..007eac4 100644 --- a/arch/x86/vdso/vclock_gettime.c +++ b/arch/x86/vdso/vclock_gettime.c @@ -10,6 +10,7 @@ /* Disable profiling for userspace code: */ #define DISABLE_BRANCH_PROFILING +#define __VVAR_ADDR 1 #include #include diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c index fe08e2b..4432cfc 100644 --- a/arch/x86/vdso/vma.c +++ b/arch/x86/vdso/vma.c @@ -3,6 +3,7 @@ * Copyright 2007 Andi Kleen, SUSE Labs. * Subject to the GPL, v.2 */ +#define __VVAR_ADDR 1 #include #include #include