Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2393590pxj; Mon, 17 May 2021 00:07:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiAlJe+2yBle9fqhcVfEKF7gqOTVue6llIy9azQk+mAgVFDa64uD9x69LbQCs5kOEs1rcK X-Received: by 2002:a02:83c2:: with SMTP id j2mr47248995jah.6.1621235258874; Mon, 17 May 2021 00:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621235258; cv=none; d=google.com; s=arc-20160816; b=YrNj9ZFD9yjQJGcAESaJ3NYJtnoX0/0xgqgfkfk00ndWH9tajgB2XELx1UiSJ85vU5 Gx+IWkRxrEpI9ZWQmkHKMYua/LX/BC+GGVVr26XlsyOAAI0V0fxewWkCFKniib6lhaz2 vBCYrprVax44/GvX0ZXdFJ6R6lrEewlclbHtnNMqyALfmjJt5R0YsUhBiTrXSWQxw3TM Zuv2YmD8UQcQt5Y9nJFYXSG54m3ejLhxMLnydGQQaW2dWRG4uKjlTW2K2DHDWtHEDIVW LHNcHGs8emH1pJs6sBuLE0e6wElyhrCq81t4JTvIUjYldYVKM81AZXugRiF70IPnh7qi wSzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=E9v2r2smNamVJ15baKu7RgU+3VTNcmRbHXtm3O7LDrQ=; b=lYkL6NOYHZ3i+2QEpJr5P6ylUONJW+IhRX0i68PyBLeK/xnMWhRLuc5b28CvNYDRQ7 PY+urbfmnbDRL/WHdL+qOn1sWsMDy1rgNe0ZrzYMcpNKr2BqcHkBbzMoX3bJtAt5oloT 8JFcx4xLPKleKUakllh4AJyPeOzOKs0PkDDul1Vajf6juqTKvcXwtVph5ofFVnou+4fY t/fMhed0oUI85ewcp5NJamTOTuvMd/u5qJn/74QAl5B2lE+OjWSFnBgYcjNs4LsiahW4 UseCq+i5hqp1jpQ+r3JWB5cBbxd1EV9fPR7//KkffI0pNTCTI+c/iQp5sQrsvN8q7erj P75A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RlR7zpE2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p18si7783580jam.69.2021.05.17.00.07.26; Mon, 17 May 2021 00:07:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RlR7zpE2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234649AbhEQFsN (ORCPT + 99 others); Mon, 17 May 2021 01:48:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:54786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234465AbhEQFr6 (ORCPT ); Mon, 17 May 2021 01:47:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4CA1461206; Mon, 17 May 2021 05:46:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621230403; bh=JmwgZScpv1Y6+afuL5rc+s/6SWk09tL43qq7urCSkc8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RlR7zpE2Szs2oi7uznuAVwPN9RZj4qP1MdQDKHZaZsdhQ66MphvcDWJihoGKE/nib wg0YbhA+t0vrm7CkB25WX3vsGl1fIMbjmCZv1i9pTbMN8zKfWbkBk8gnnK5MRkx0ZG 1oxOZLY30gGbPWDXOpP6bZdkU+GToIs4nRGhrAnoyH5JkYmVsSeIJusks5SlyFlr9s YpkP8k3JQ5F+Ouv+T8W2O9C+XLyUlYl1XlEwtoZYIO2C9DyFf6Z1h7pRbFtTPwfcGK Z7SO5nH8hpKZg/smRhpSL9JtGZR50ZjrfjVGZgyd0chq2QpWFpd4R82kaH7AehH353 fS1S0RgK5+Usg== Date: Mon, 17 May 2021 14:46:37 +0900 From: Masami Hiramatsu To: Tiezhu Yang Cc: Jonathan Corbet , Marc Koderer , Mauro Carvalho Chehab , Christian Brauner , Jisheng Zhang , Mathieu Desnoyers , Ananth N Mavinakayanahalli , Andrew Morton , Randy Dunlap , Martin Schwidefsky , Johannes Thumshirn , Heiko Carstens , Joe Perches , linux-kernel@vger.kernel.org, Xuefeng Li Subject: Re: [PATCH v4 2/2] samples/kprobes: Fix typo in handler_post() Message-Id: <20210517144637.b781d07770621c3d81b2990e@kernel.org> In-Reply-To: <1621218083-23519-3-git-send-email-yangtiezhu@loongson.cn> References: <1621218083-23519-1-git-send-email-yangtiezhu@loongson.cn> <1621218083-23519-3-git-send-email-yangtiezhu@loongson.cn> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 17 May 2021 10:21:23 +0800 Tiezhu Yang wrote: > It should use post_handler instead of pre_handler in handler_post(). > > As Joe Perches suggested, it would be better to use pr_fmt and remove > all the embedded pre/post/fault strings. This would change the style of > the output through. > Looks good to me. Acked-by: Masami Hiramatsu Thank you! > Fixes: e16c5dd5157e ("samples/kprobes: Add s390 case in kprobe example module") > Acked-by: Marc Koderer > Acked-by: Masami Hiramatsu > Suggested-by: Joe Perches > Signed-off-by: Tiezhu Yang > --- > samples/kprobes/kprobe_example.c | 33 +++++++++++++++++---------------- > 1 file changed, 17 insertions(+), 16 deletions(-) > > diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c > index d77a546..5f1eb8b 100644 > --- a/samples/kprobes/kprobe_example.c > +++ b/samples/kprobes/kprobe_example.c > @@ -10,6 +10,8 @@ > * whenever kernel_clone() is invoked to create a new process. > */ > > +#define pr_fmt(fmt) "%s: " fmt, __func__ > + > #include > #include > #include > @@ -27,32 +29,31 @@ static struct kprobe kp = { > static int __kprobes handler_pre(struct kprobe *p, struct pt_regs *regs) > { > #ifdef CONFIG_X86 > - pr_info("<%s> pre_handler: p->addr = 0x%p, ip = %lx, flags = 0x%lx\n", > + pr_info("<%s> p->addr = 0x%p, ip = %lx, flags = 0x%lx\n", > p->symbol_name, p->addr, regs->ip, regs->flags); > #endif > #ifdef CONFIG_PPC > - pr_info("<%s> pre_handler: p->addr = 0x%p, nip = 0x%lx, msr = 0x%lx\n", > + pr_info("<%s> p->addr = 0x%p, nip = 0x%lx, msr = 0x%lx\n", > p->symbol_name, p->addr, regs->nip, regs->msr); > #endif > #ifdef CONFIG_MIPS > - pr_info("<%s> pre_handler: p->addr = 0x%p, epc = 0x%lx, status = 0x%lx\n", > + pr_info("<%s> p->addr = 0x%p, epc = 0x%lx, status = 0x%lx\n", > p->symbol_name, p->addr, regs->cp0_epc, regs->cp0_status); > #endif > #ifdef CONFIG_ARM64 > - pr_info("<%s> pre_handler: p->addr = 0x%p, pc = 0x%lx," > - " pstate = 0x%lx\n", > + pr_info("<%s> p->addr = 0x%p, pc = 0x%lx, pstate = 0x%lx\n", > p->symbol_name, p->addr, (long)regs->pc, (long)regs->pstate); > #endif > #ifdef CONFIG_ARM > - pr_info("<%s> pre_handler: p->addr = 0x%p, pc = 0x%lx, cpsr = 0x%lx\n", > + pr_info("<%s> p->addr = 0x%p, pc = 0x%lx, cpsr = 0x%lx\n", > p->symbol_name, p->addr, (long)regs->ARM_pc, (long)regs->ARM_cpsr); > #endif > #ifdef CONFIG_RISCV > - pr_info("<%s> pre_handler: p->addr = 0x%p, pc = 0x%lx, status = 0x%lx\n", > + pr_info("<%s> p->addr = 0x%p, pc = 0x%lx, status = 0x%lx\n", > p->symbol_name, p->addr, regs->epc, regs->status); > #endif > #ifdef CONFIG_S390 > - pr_info("<%s> pre_handler: p->addr, 0x%p, ip = 0x%lx, flags = 0x%lx\n", > + pr_info("<%s> p->addr, 0x%p, ip = 0x%lx, flags = 0x%lx\n", > p->symbol_name, p->addr, regs->psw.addr, regs->flags); > #endif > > @@ -65,31 +66,31 @@ static void __kprobes handler_post(struct kprobe *p, struct pt_regs *regs, > unsigned long flags) > { > #ifdef CONFIG_X86 > - pr_info("<%s> post_handler: p->addr = 0x%p, flags = 0x%lx\n", > + pr_info("<%s> p->addr = 0x%p, flags = 0x%lx\n", > p->symbol_name, p->addr, regs->flags); > #endif > #ifdef CONFIG_PPC > - pr_info("<%s> post_handler: p->addr = 0x%p, msr = 0x%lx\n", > + pr_info("<%s> p->addr = 0x%p, msr = 0x%lx\n", > p->symbol_name, p->addr, regs->msr); > #endif > #ifdef CONFIG_MIPS > - pr_info("<%s> post_handler: p->addr = 0x%p, status = 0x%lx\n", > + pr_info("<%s> p->addr = 0x%p, status = 0x%lx\n", > p->symbol_name, p->addr, regs->cp0_status); > #endif > #ifdef CONFIG_ARM64 > - pr_info("<%s> post_handler: p->addr = 0x%p, pstate = 0x%lx\n", > + pr_info("<%s> p->addr = 0x%p, pstate = 0x%lx\n", > p->symbol_name, p->addr, (long)regs->pstate); > #endif > #ifdef CONFIG_ARM > - pr_info("<%s> post_handler: p->addr = 0x%p, cpsr = 0x%lx\n", > + pr_info("<%s> p->addr = 0x%p, cpsr = 0x%lx\n", > p->symbol_name, p->addr, (long)regs->ARM_cpsr); > #endif > #ifdef CONFIG_RISCV > - pr_info("<%s> post_handler: p->addr = 0x%p, status = 0x%lx\n", > + pr_info("<%s> p->addr = 0x%p, status = 0x%lx\n", > p->symbol_name, p->addr, regs->status); > #endif > #ifdef CONFIG_S390 > - pr_info("<%s> pre_handler: p->addr, 0x%p, flags = 0x%lx\n", > + pr_info("<%s> p->addr, 0x%p, flags = 0x%lx\n", > p->symbol_name, p->addr, regs->flags); > #endif > } > @@ -101,7 +102,7 @@ static void __kprobes handler_post(struct kprobe *p, struct pt_regs *regs, > */ > static int handler_fault(struct kprobe *p, struct pt_regs *regs, int trapnr) > { > - pr_info("fault_handler: p->addr = 0x%p, trap #%d\n", p->addr, trapnr); > + pr_info("p->addr = 0x%p, trap #%d\n", p->addr, trapnr); > /* Return 0 because we don't handle the fault. */ > return 0; > } > -- > 2.1.0 > -- Masami Hiramatsu