From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=3.0 tests=BAYES_00,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5444BC4361B for ; Sun, 6 Dec 2020 14:12:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2234C2312F for ; Sun, 6 Dec 2020 14:12:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728377AbgLFOMO (ORCPT ); Sun, 6 Dec 2020 09:12:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:38022 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728273AbgLFOMN (ORCPT ); Sun, 6 Dec 2020 09:12:13 -0500 From: Masami Hiramatsu Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: Ingo Molnar , Steven Rostedt Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org, "Naveen N . Rao" , Anil S Keshavamurthy , David Miller , Borislav Petkov , x86@kernel.org Subject: [PATCH 0/1] x86/kprobes: Classify opcode while preparing kprobe Date: Sun, 6 Dec 2020 23:11:28 +0900 Message-Id: <160726388853.3413805.4854581312983421622.stgit@devnote2> X-Mailer: git-send-email 2.25.1 User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I noticed that the kprobe x86 still has an inefficient code. Currently kprobes x86 decodes opcode right after single stepping in resume_execution(), which is kprobe's hot path. But it already decoded the opcode while preparing arch_specific_insn in arch_copy_kprobe(), so this is inefficient. So decode the opcode while preparing kprobes (arch_copy_kprobe()) instead of resume_execution() and set some flags for resuming from single stepping. This also removes the custom instruction prefix decoding, which should be done in x86 instruction decoder. Thank you, --- Masami Hiramatsu (1): x86/kprobes: Do not decode opcode in resume_execution() arch/x86/include/asm/kprobes.h | 11 ++- arch/x86/kernel/kprobes/core.c | 166 ++++++++++++++++++---------------------- 2 files changed, 80 insertions(+), 97 deletions(-) -- Masami Hiramatsu (Linaro)