From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: vegard.nossum@oracle.com, penberg@kernel.org,
jamie.iles@oracle.com, hpa@zytor.com, mingo@redhat.com,
tglx@linutronix.de, x86@kernel.org, linux-kernel@vger.kernel.org,
linux-mm@vger.kernel.org
Subject: Re: [PATCH 2/4] x86: Move instruction decoder data into header
Date: Tue, 15 Apr 2014 10:41:01 +0900 [thread overview]
Message-ID: <534C8E2D.9020506@hitachi.com> (raw)
In-Reply-To: <1397497450-6440-2-git-send-email-sasha.levin@oracle.com>
(2014/04/15 2:44), Sasha Levin wrote:
> Right now we generate data for the instruction decoder and place it
> as a code file which gets #included directly (yuck).
>
> Instead, make it a header which will also be usable by other code
> that wants to use the data in there.
Hmm, making the generated data into a header file may clone
the data table instances for each object file. Since the inat
table is not so small, I think we'd better just export the tables.
Thank you,
>
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
> arch/x86/Makefile | 6 ++++++
> arch/x86/lib/Makefile | 8 +++++---
> arch/x86/lib/inat.c | 2 +-
> arch/x86/tools/Makefile | 8 ++++----
> 4 files changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index 602f57e..26eee4e 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -178,6 +178,12 @@ archscripts: scripts_basic
> $(Q)$(MAKE) $(build)=arch/x86/tools relocs
>
> ###
> +# inat instruction table generation
> +
> +archprepare:
> + $(Q)$(MAKE) $(build)=arch/x86/lib inat_tables
> +
> +###
> # Syscall table generation
>
> archheaders:
> diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
> index eabcb6e..3014da8 100644
> --- a/arch/x86/lib/Makefile
> +++ b/arch/x86/lib/Makefile
> @@ -7,12 +7,12 @@ inat_tables_maps = $(srctree)/arch/x86/lib/x86-opcode-map.txt
> quiet_cmd_inat_tables = GEN $@
> cmd_inat_tables = $(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@
>
> -$(obj)/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
> +$(obj)/../include/generated/asm/inat-tables.h: $(inat_tables_script) $(inat_tables_maps)
> $(call cmd,inat_tables)
>
> -$(obj)/inat.o: $(obj)/inat-tables.c
> +$(obj)/inat.o: $(obj)/../include/generated/asm/inat-tables.h
>
> -clean-files := inat-tables.c
> +clean-files := ../include/asm/inat-tables.h
>
> obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o
>
> @@ -44,3 +44,5 @@ else
> lib-y += copy_user_64.o copy_user_nocache_64.o
> lib-y += cmpxchg16b_emu.o
> endif
> +
> +inat_tables: $(obj)/../include/generated/asm/inat-tables.h
> diff --git a/arch/x86/lib/inat.c b/arch/x86/lib/inat.c
> index c1f01a8..641a996 100644
> --- a/arch/x86/lib/inat.c
> +++ b/arch/x86/lib/inat.c
> @@ -21,7 +21,7 @@
> #include <asm/insn.h>
>
> /* Attribute tables are generated from opcode map */
> -#include "inat-tables.c"
> +#include <asm/inat-tables.h>
>
> /* Attribute search APIs */
> insn_attr_t inat_get_opcode_attribute(insn_byte_t opcode)
> diff --git a/arch/x86/tools/Makefile b/arch/x86/tools/Makefile
> index e812034..e34e7e3 100644
> --- a/arch/x86/tools/Makefile
> +++ b/arch/x86/tools/Makefile
> @@ -28,14 +28,14 @@ posttest: $(obj)/test_get_len vmlinux $(obj)/insn_sanity
> hostprogs-y += test_get_len insn_sanity
>
> # -I needed for generated C source and C source which in the kernel tree.
> -HOSTCFLAGS_test_get_len.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/uapi/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/uapi/
> +HOSTCFLAGS_test_get_len.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/uapi/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/uapi/ -I$(srctree)/arch/x86/include/generated/
>
> -HOSTCFLAGS_insn_sanity.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/
> +HOSTCFLAGS_insn_sanity.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/ -I$(srctree)/arch/x86/include/generated/
>
> # Dependencies are also needed.
> -$(obj)/test_get_len.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
> +$(obj)/test_get_len.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/include/generated/asm/inat-tables.h
>
> -$(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
> +$(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/include/generated/asm/inat-tables.h
>
> HOST_EXTRACFLAGS += -I$(srctree)/tools/include
> hostprogs-y += relocs
>
--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
next prev parent reply other threads:[~2014-04-15 1:41 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-14 17:44 [PATCH 1/4] kmemcheck: add additional selfchecks Sasha Levin
2014-04-14 17:44 ` [PATCH 2/4] x86: Move instruction decoder data into header Sasha Levin
2014-04-15 1:41 ` Masami Hiramatsu [this message]
2014-04-15 2:28 ` Sasha Levin
2014-04-15 3:10 ` Masami Hiramatsu
2014-04-15 14:24 ` Sasha Levin
2014-04-16 3:06 ` Masami Hiramatsu
2014-04-14 17:44 ` [PATCH 3/4] x86/insn: Extract more information about instructions Sasha Levin
2014-04-15 3:12 ` Masami Hiramatsu
2014-04-15 4:36 ` Masami Hiramatsu
2014-04-15 15:10 ` Sasha Levin
2014-04-16 3:26 ` H. Peter Anvin
2014-04-16 3:47 ` Sasha Levin
2014-04-16 3:54 ` H. Peter Anvin
2014-04-16 4:03 ` Sasha Levin
2014-04-16 4:31 ` H. Peter Anvin
2014-04-16 5:30 ` Masami Hiramatsu
2014-04-17 15:20 ` Sasha Levin
2014-04-17 15:28 ` H. Peter Anvin
2014-04-17 17:31 ` Sasha Levin
2014-04-18 3:40 ` Masami Hiramatsu
2014-04-18 3:45 ` H. Peter Anvin
2014-04-18 15:47 ` Sasha Levin
2014-04-18 16:48 ` H. Peter Anvin
2014-04-16 5:44 ` Masami Hiramatsu
2014-04-17 15:33 ` Sasha Levin
2014-04-18 3:25 ` Masami Hiramatsu
2014-04-14 17:44 ` [PATCH 4/4] kmemcheck: Switch to using kernel disassembler Sasha Levin
2014-04-15 8:17 ` Pekka Enberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=534C8E2D.9020506@hitachi.com \
--to=masami.hiramatsu.pt@hitachi.com \
--cc=hpa@zytor.com \
--cc=jamie.iles@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=penberg@kernel.org \
--cc=sasha.levin@oracle.com \
--cc=tglx@linutronix.de \
--cc=vegard.nossum@oracle.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.