From patchwork Tue Dec 2 10:16:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 5419101 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DB4409F1C5 for ; Tue, 2 Dec 2014 10:24:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6613A2028D for ; Tue, 2 Dec 2014 10:24:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 056C22027D for ; Tue, 2 Dec 2014 10:24:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xvka2-00066O-6f; Tue, 02 Dec 2014 10:21:14 +0000 Received: from szxga03-in.huawei.com ([119.145.14.66]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XvkZw-0004aB-Pt for linux-arm-kernel@lists.infradead.org; Tue, 02 Dec 2014 10:21:11 +0000 Received: from 172.24.2.119 (EHLO lggeml422-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AYB14155; Tue, 02 Dec 2014 18:19:53 +0800 (CST) Received: from kernel-host.huawei (10.107.197.247) by lggeml422-hub.china.huawei.com (10.72.61.32) with Microsoft SMTP Server id 14.3.158.1; Tue, 2 Dec 2014 18:19:46 +0800 From: Wang Nan To: Subject: [PATCH] ARM: probes: move all probe code to dedicate directory Date: Tue, 2 Dec 2014 18:16:23 +0800 Message-ID: <1417515383-79890-1-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <547D471B.2070908@hitachi.com> References: <547D471B.2070908@hitachi.com> MIME-Version: 1.0 X-Originating-IP: [10.107.197.247] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.547D924A.0077, ss=1, re=0.001, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: ffc95889af32d5cb488ac6c26cc00934 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141202_022109_619202_025C70F5 X-CRM114-Status: GOOD ( 11.05 ) X-Spam-Score: -0.7 (/) Cc: tixy@linaro.org, lizefan@huawei.com, linux@arm.linux.org.uk, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In discussion on LKML (https://lkml.org/lkml/2014/11/28/158), Russell King suggests to move all probe related code to arch/arm/probes. This patch does the work. Due to dependency on 'arch/arm/kernel/patch.h', this patch also moves patch.h to 'arch/arm/include/asm/patch.h', and related '#include' directives are also midified to '#include '. Signed-off-by: Wang Nan --- v1 -> v2: - Names of files are also changes to express their function. --- arch/arm/Makefile | 1 + arch/arm/{kernel => include/asm}/patch.h | 0 arch/arm/kernel/Makefile | 16 ++-------------- arch/arm/kernel/jump_label.c | 2 +- arch/arm/kernel/patch.c | 3 +-- arch/arm/probes/Makefile | 15 +++++++++++++++ arch/arm/{kernel/probes-arm.c => probes/decode-arm.c} | 4 ++-- arch/arm/{kernel/probes-arm.h => probes/decode-arm.h} | 0 .../arm/{kernel/probes-thumb.c => probes/decode-thumb.c} | 4 ++-- .../arm/{kernel/probes-thumb.h => probes/decode-thumb.h} | 0 arch/arm/{kernel/probes.c => probes/decode.c} | 2 +- arch/arm/{kernel/probes.h => probes/decode.h} | 0 .../kprobes-arm.c => probes/kprobes/actions-arm.c} | 2 +- .../kprobes-common.c => probes/kprobes/actions-common.c} | 0 .../kprobes-thumb.c => probes/kprobes/actions-thumb.c} | 2 +- arch/arm/{kernel => probes/kprobes}/kprobes.c | 6 +++--- arch/arm/{kernel => probes/kprobes}/kprobes.h | 2 +- .../kprobes-test-arm.c => probes/kprobes/test-arm.c} | 2 +- .../kprobes-test.c => probes/kprobes/test-core.c} | 6 +++--- .../kprobes-test.h => probes/kprobes/test-core.h} | 0 .../kprobes-test-thumb.c => probes/kprobes/test-thumb.c} | 2 +- .../uprobes-arm.c => probes/uprobes/actions-arm.c} | 4 ++-- arch/arm/{kernel => probes/uprobes}/uprobes.c | 4 ++-- arch/arm/{kernel => probes/uprobes}/uprobes.h | 0 24 files changed, 40 insertions(+), 37 deletions(-) rename arch/arm/{kernel => include/asm}/patch.h (100%) create mode 100644 arch/arm/probes/Makefile rename arch/arm/{kernel/probes-arm.c => probes/decode-arm.c} (99%) rename arch/arm/{kernel/probes-arm.h => probes/decode-arm.h} (100%) rename arch/arm/{kernel/probes-thumb.c => probes/decode-thumb.c} (99%) rename arch/arm/{kernel/probes-thumb.h => probes/decode-thumb.h} (100%) rename arch/arm/{kernel/probes.c => probes/decode.c} (99%) rename arch/arm/{kernel/probes.h => probes/decode.h} (100%) rename arch/arm/{kernel/kprobes-arm.c => probes/kprobes/actions-arm.c} (99%) rename arch/arm/{kernel/kprobes-common.c => probes/kprobes/actions-common.c} (100%) rename arch/arm/{kernel/kprobes-thumb.c => probes/kprobes/actions-thumb.c} (99%) rename arch/arm/{kernel => probes/kprobes}/kprobes.c (99%) rename arch/arm/{kernel => probes/kprobes}/kprobes.h (98%) rename arch/arm/{kernel/kprobes-test-arm.c => probes/kprobes/test-arm.c} (99%) rename arch/arm/{kernel/kprobes-test.c => probes/kprobes/test-core.c} (99%) rename arch/arm/{kernel/kprobes-test.h => probes/kprobes/test-core.h} (100%) rename arch/arm/{kernel/kprobes-test-thumb.c => probes/kprobes/test-thumb.c} (99%) rename arch/arm/{kernel/uprobes-arm.c => probes/uprobes/actions-arm.c} (99%) rename arch/arm/{kernel => probes/uprobes}/uprobes.c (99%) rename arch/arm/{kernel => probes/uprobes}/uprobes.h (100%) diff --git a/arch/arm/kernel/uprobes.h b/arch/arm/probes/uprobes/uprobes.h similarity index 100% rename from arch/arm/kernel/uprobes.h rename to arch/arm/probes/uprobes/uprobes.h diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 034a949..a57d9bb 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -266,6 +266,7 @@ core-$(CONFIG_KVM_ARM_HOST) += arch/arm/kvm/ # If we have a machine-specific directory, then include it in the build. core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ +core-y += arch/arm/probes/ core-y += arch/arm/net/ core-y += arch/arm/crypto/ core-y += arch/arm/firmware/ diff --git a/arch/arm/kernel/patch.h b/arch/arm/include/asm/patch.h similarity index 100% rename from arch/arm/kernel/patch.h rename to arch/arm/include/asm/patch.h diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 38ddd9f..40d3e00 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile @@ -51,20 +51,8 @@ obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o insn.o obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o insn.o obj-$(CONFIG_JUMP_LABEL) += jump_label.o insn.o patch.o obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o -obj-$(CONFIG_UPROBES) += probes.o probes-arm.o uprobes.o uprobes-arm.o -obj-$(CONFIG_KPROBES) += probes.o kprobes.o kprobes-common.o patch.o -ifdef CONFIG_THUMB2_KERNEL -obj-$(CONFIG_KPROBES) += kprobes-thumb.o probes-thumb.o -else -obj-$(CONFIG_KPROBES) += kprobes-arm.o probes-arm.o -endif -obj-$(CONFIG_ARM_KPROBES_TEST) += test-kprobes.o -test-kprobes-objs := kprobes-test.o -ifdef CONFIG_THUMB2_KERNEL -test-kprobes-objs += kprobes-test-thumb.o -else -test-kprobes-objs += kprobes-test-arm.o -endif +# Main staffs in KPROBES are in arch/arm/probes/ . +obj-$(CONFIG_KPROBES) += patch.o obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o obj-$(CONFIG_ARM_THUMBEE) += thumbee.o obj-$(CONFIG_KGDB) += kgdb.o diff --git a/arch/arm/kernel/jump_label.c b/arch/arm/kernel/jump_label.c index 4ce4f78..c6c73ed 100644 --- a/arch/arm/kernel/jump_label.c +++ b/arch/arm/kernel/jump_label.c @@ -1,8 +1,8 @@ #include #include +#include #include "insn.h" -#include "patch.h" #ifdef HAVE_JUMP_LABEL diff --git a/arch/arm/kernel/patch.c b/arch/arm/kernel/patch.c index 07314af..08bcfa1 100644 --- a/arch/arm/kernel/patch.c +++ b/arch/arm/kernel/patch.c @@ -5,8 +5,7 @@ #include #include #include - -#include "patch.h" +#include struct patch { void *addr; diff --git a/arch/arm/probes/Makefile b/arch/arm/probes/Makefile new file mode 100644 index 0000000..0b9bd28 --- /dev/null +++ b/arch/arm/probes/Makefile @@ -0,0 +1,15 @@ +obj-$(CONFIG_UPROBES) += decode.o decode-arm.o uprobes/uprobes.o uprobes/actions-arm.o +obj-$(CONFIG_KPROBES) += decode.o kprobes/kprobes.o kprobes/actions-common.o +ifdef CONFIG_THUMB2_KERNEL +obj-$(CONFIG_KPROBES) += decode-thumb.o kprobes/actions-thumb.o +else +obj-$(CONFIG_KPROBES) += decode-arm.o kprobes/actions-arm.o +endif +obj-$(CONFIG_ARM_KPROBES_TEST) += test-kprobes.o +test-kprobes-objs := kprobes/test-core.o +ifdef CONFIG_THUMB2_KERNEL +test-kprobes-objs += kprobes/test-thumb.o +else +test-kprobes-objs += kprobes/test-arm.o +endif + diff --git a/arch/arm/kernel/probes-arm.c b/arch/arm/probes/decode-arm.c similarity index 99% rename from arch/arm/kernel/probes-arm.c rename to arch/arm/probes/decode-arm.c index 8eaef81..1fb81e7 100644 --- a/arch/arm/kernel/probes-arm.c +++ b/arch/arm/probes/decode-arm.c @@ -20,8 +20,8 @@ #include #include -#include "probes.h" -#include "probes-arm.h" +#include "decode.h" +#include "decode-arm.h" #define sign_extend(x, signbit) ((x) | (0 - ((x) & (1 << (signbit))))) diff --git a/arch/arm/kernel/probes-arm.h b/arch/arm/probes/decode-arm.h similarity index 100% rename from arch/arm/kernel/probes-arm.h rename to arch/arm/probes/decode-arm.h diff --git a/arch/arm/kernel/probes-thumb.c b/arch/arm/probes/decode-thumb.c similarity index 99% rename from arch/arm/kernel/probes-thumb.c rename to arch/arm/probes/decode-thumb.c index 4131351..2cddd18 100644 --- a/arch/arm/kernel/probes-thumb.c +++ b/arch/arm/probes/decode-thumb.c @@ -12,8 +12,8 @@ #include #include -#include "probes.h" -#include "probes-thumb.h" +#include "decode.h" +#include "decode-thumb.h" static const union decode_item t32_table_1110_100x_x0xx[] = { diff --git a/arch/arm/kernel/probes-thumb.h b/arch/arm/probes/decode-thumb.h similarity index 100% rename from arch/arm/kernel/probes-thumb.h rename to arch/arm/probes/decode-thumb.h diff --git a/arch/arm/kernel/probes.c b/arch/arm/probes/decode.c similarity index 99% rename from arch/arm/kernel/probes.c rename to arch/arm/probes/decode.c index a8ab540..0141d70 100644 --- a/arch/arm/kernel/probes.c +++ b/arch/arm/probes/decode.c @@ -17,7 +17,7 @@ #include #include -#include "probes.h" +#include "decode.h" #ifndef find_str_pc_offset diff --git a/arch/arm/kernel/probes.h b/arch/arm/probes/decode.h similarity index 100% rename from arch/arm/kernel/probes.h rename to arch/arm/probes/decode.h diff --git a/arch/arm/kernel/kprobes-arm.c b/arch/arm/probes/kprobes/actions-arm.c similarity index 99% rename from arch/arm/kernel/kprobes-arm.c rename to arch/arm/probes/kprobes/actions-arm.c index ac300c6..864feac 100644 --- a/arch/arm/kernel/kprobes-arm.c +++ b/arch/arm/probes/kprobes/actions-arm.c @@ -63,7 +63,7 @@ #include #include "kprobes.h" -#include "probes-arm.h" +#include "../decode-arm.h" #if __LINUX_ARM_ARCH__ >= 6 #define BLX(reg) "blx "reg" \n\t" diff --git a/arch/arm/kernel/kprobes-common.c b/arch/arm/probes/kprobes/actions-common.c similarity index 100% rename from arch/arm/kernel/kprobes-common.c rename to arch/arm/probes/kprobes/actions-common.c diff --git a/arch/arm/kernel/kprobes-thumb.c b/arch/arm/probes/kprobes/actions-thumb.c similarity index 99% rename from arch/arm/kernel/kprobes-thumb.c rename to arch/arm/probes/kprobes/actions-thumb.c index 9495d7f..35d6054 100644 --- a/arch/arm/kernel/kprobes-thumb.c +++ b/arch/arm/probes/kprobes/actions-thumb.c @@ -14,7 +14,7 @@ #include #include "kprobes.h" -#include "probes-thumb.h" +#include "decode-thumb.h" /* These emulation encodings are functionally equivalent... */ #define t32_emulate_rd8rn16rm0ra12_noflags \ diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/probes/kprobes/kprobes.c similarity index 99% rename from arch/arm/kernel/kprobes.c rename to arch/arm/probes/kprobes/kprobes.c index 6d64420..ea77d39 100644 --- a/arch/arm/kernel/kprobes.c +++ b/arch/arm/probes/kprobes/kprobes.c @@ -30,11 +30,11 @@ #include #include #include +#include #include "kprobes.h" -#include "probes-arm.h" -#include "probes-thumb.h" -#include "patch.h" +#include "decode-arm.h" +#include "decode-thumb.h" #define MIN_STACK_SIZE(addr) \ min((unsigned long)MAX_STACK_SIZE, \ diff --git a/arch/arm/kernel/kprobes.h b/arch/arm/probes/kprobes/kprobes.h similarity index 98% rename from arch/arm/kernel/kprobes.h rename to arch/arm/probes/kprobes/kprobes.h index 9a2712e..7b58ecf 100644 --- a/arch/arm/kernel/kprobes.h +++ b/arch/arm/probes/kprobes/kprobes.h @@ -19,7 +19,7 @@ #ifndef _ARM_KERNEL_KPROBES_H #define _ARM_KERNEL_KPROBES_H -#include "probes.h" +#include "../decode.h" /* * These undefined instructions must be unique and diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/probes/kprobes/test-arm.c similarity index 99% rename from arch/arm/kernel/kprobes-test-arm.c rename to arch/arm/probes/kprobes/test-arm.c index cb14242..d9a1255 100644 --- a/arch/arm/kernel/kprobes-test-arm.c +++ b/arch/arm/probes/kprobes/test-arm.c @@ -13,7 +13,7 @@ #include #include -#include "kprobes-test.h" +#include "test-core.h" #define TEST_ISA "32" diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/probes/kprobes/test-core.c similarity index 99% rename from arch/arm/kernel/kprobes-test.c rename to arch/arm/probes/kprobes/test-core.c index b206d77..3dcfc58 100644 --- a/arch/arm/kernel/kprobes-test.c +++ b/arch/arm/probes/kprobes/test-core.c @@ -210,9 +210,9 @@ #include #include "kprobes.h" -#include "probes-arm.h" -#include "probes-thumb.h" -#include "kprobes-test.h" +#include "decode-arm.h" +#include "decode-thumb.h" +#include "test-core.h" #define BENCHMARKING 1 diff --git a/arch/arm/kernel/kprobes-test.h b/arch/arm/probes/kprobes/test-core.h similarity index 100% rename from arch/arm/kernel/kprobes-test.h rename to arch/arm/probes/kprobes/test-core.h diff --git a/arch/arm/kernel/kprobes-test-thumb.c b/arch/arm/probes/kprobes/test-thumb.c similarity index 99% rename from arch/arm/kernel/kprobes-test-thumb.c rename to arch/arm/probes/kprobes/test-thumb.c index 844dd10..d58fa10 100644 --- a/arch/arm/kernel/kprobes-test-thumb.c +++ b/arch/arm/probes/kprobes/test-thumb.c @@ -12,7 +12,7 @@ #include #include -#include "kprobes-test.h" +#include "test-core.h" #define TEST_ISA "16" diff --git a/arch/arm/kernel/uprobes-arm.c b/arch/arm/probes/uprobes/actions-arm.c similarity index 99% rename from arch/arm/kernel/uprobes-arm.c rename to arch/arm/probes/uprobes/actions-arm.c index d3b655f..b98a0a8 100644 --- a/arch/arm/kernel/uprobes-arm.c +++ b/arch/arm/probes/uprobes/actions-arm.c @@ -13,8 +13,8 @@ #include #include -#include "probes.h" -#include "probes-arm.h" +#include "../decode.h" +#include "../decode-arm.h" #include "uprobes.h" static int uprobes_substitute_pc(unsigned long *pinsn, u32 oregs) diff --git a/arch/arm/kernel/uprobes.c b/arch/arm/probes/uprobes/uprobes.c similarity index 99% rename from arch/arm/kernel/uprobes.c rename to arch/arm/probes/uprobes/uprobes.c index 56adf9c..f611989 100644 --- a/arch/arm/kernel/uprobes.c +++ b/arch/arm/probes/uprobes/uprobes.c @@ -17,8 +17,8 @@ #include #include -#include "probes.h" -#include "probes-arm.h" +#include "../decode.h" +#include "../decode-arm.h" #include "uprobes.h" #define UPROBE_TRAP_NR UINT_MAX