Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1741321ybt; Thu, 18 Jun 2020 16:22:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxb9HaFd1+pEDWqtJLhr6JuyjgwZRQuvvjBukhnK1ivT1nUCjKIZueHTuadXkgJl9jKLw+k X-Received: by 2002:a17:906:1ed2:: with SMTP id m18mr705718ejj.529.1592522565789; Thu, 18 Jun 2020 16:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592522565; cv=none; d=google.com; s=arc-20160816; b=q/qJz2V0Lc7CSDlaySVpuEW8KPjGfv858siTTPrSI0eDO8UjTJ8xZ6VMVtGOCH3zLK Uw+CXeXhm8SkVj3a4Lpk043apYL+TqH8RffaVdWfG770zUH3nri5csqQI1cquE1efZ+k 7poqr8fIQBnep9CBwvp/TuTKlafOjiZ2BPBq9G9lvnJh/qdRp2xIB3fa59wlg+EE8XB6 gjTSDWxNC7Cx8FbEI3LI1pL3sWWH70PmNILit7ubzMeVIm6YNCqwgNKFjsSEZzc9yb17 ZgSYMWOtQUlHcBIsraYrf6q9DI1ST4+ek0SxSJwrHJ6Tj88uMgV9SA0bz6TRwgINb+qr EMzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=qWRu5ynq63s6rvxwcBKG7uOd/H0E0TsjTr5wvg/oOPE=; b=S6QFmycKEZr+yTSbq3UKCYc/1eRL+vuTOvQZn/sSFeluBlcL2nQSX7CW5ECBxPdGfM zOlM+thMCC6qNwjzpefEBEH5aKjxpVYOyU+yXrH1mW0LmYHu0DncxNuLt11nHcY7IPIJ 4nn2JUD9f8UCPEVdUNolkIRiZz+ILOVtt5675uXXEZKQ2z1l7XbQ2EGwUZCbLqMfdHM9 md7qP4ZWHwx6DNuA0U0NbQQiGYKlh0boVu6rCPWjooReWSBT7ikb0V/0hChvszPlpTJA 1AJBBhqFVyBpRxQpsWCzcsKAU2ZcpUlJ6XRuFDL1FnpfTvAGp9xUa8X8kMe237zdVEgd X9Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QZsK6YRi; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si2753893edm.379.2020.06.18.16.22.23; Thu, 18 Jun 2020 16:22:45 -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=@redhat.com header.s=mimecast20190719 header.b=QZsK6YRi; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728242AbgFRXTY (ORCPT + 99 others); Thu, 18 Jun 2020 19:19:24 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:58796 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726835AbgFRXTW (ORCPT ); Thu, 18 Jun 2020 19:19:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592522361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qWRu5ynq63s6rvxwcBKG7uOd/H0E0TsjTr5wvg/oOPE=; b=QZsK6YRihKX9lDYJ9YuxAAT3dbG/I9EdwuszP5k8L1t2HcnYBzl450SXYlSiAWsxOoCxUt dytzzKYYBQ/ag/dURTe80+NV8xk5nxhNBj8GKvIiSLh6NyBbRcsyuppzNMRl5ViyIbBveT Ek0IWssPTsbybgr7fcZ8O3AggUsrfeI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460--WN60a8zPlubEq7twmzMJg-1; Thu, 18 Jun 2020 19:19:17 -0400 X-MC-Unique: -WN60a8zPlubEq7twmzMJg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C2641108BD15; Thu, 18 Jun 2020 23:19:15 +0000 (UTC) Received: from T590 (ovpn-12-44.pek2.redhat.com [10.72.12.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 697C389283; Thu, 18 Jun 2020 23:19:05 +0000 (UTC) Date: Fri, 19 Jun 2020 07:19:01 +0800 From: Ming Lei To: Masami Hiramatsu Cc: Ming Lei , "Naveen N. Rao" , Anil S Keshavamurthy , Linux Kernel Mailing List , "David S. Miller" , Steven Rostedt , linux-block Subject: Re: kprobe: __blkdev_put probe is missed Message-ID: <20200618231901.GA196099@T590> References: <20200618125438.GA191266@T590> <20200618225602.3f2cca3f0ed48427fc0a483b@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200618225602.3f2cca3f0ed48427fc0a483b@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 18, 2020 at 10:56:02PM +0900, Masami Hiramatsu wrote: > Hi Ming, > > On Thu, 18 Jun 2020 20:54:38 +0800 > Ming Lei wrote: > > > On Wed, Jun 17, 2020 at 06:30:39PM +0800, Ming Lei wrote: > > > Hello Guys, > > > > > > I found probe on __blkdev_put is missed, which can be observed > > > via bcc/perf reliably: > > > > > > 1) start trace > > > - perf probe __blkdev_put > > > - perf trace -a -e probe:__blkdev_put > > Could you dump the kprobe_event as below? > > # cat /sys/kernel/tracing/kprobe_events > > > > > > > > or > > > > > > /usr/share/bcc/tools/stackcount __blkdev_put > > > > > > 2) run the following command: > > > blockdev --getbsz /dev/sda1 > > And dump the kprobe profile? > > # cat /sys/kernel/tracing/kprobe_profile > > > > > > > 3) 'perf trace' or stackcount just dumps one trace event, and it > > > should have been two > > > __blkdev_put() traces, since one __blkdev_put() is called for > > > partition(/dev/sda1), > > > and another is for disk(/dev/sda). If trace_printk() is added in __blkdev_put(), > > > two events will be captured from ftrace. > > > > > > > The issue can be shown by loading a kprobe module which registers on > > __blkdev_put(), just by replacing _do_fork with __blkdev_put on > > samples/kprobes/kprobe_example.c. > > Could you tell me what kernel are you using? > > I'm using 5.4 on ubuntu and can not reproduce it with kprobe_event. > > root@devnote2:/sys/kernel/tracing# uname -a > Linux devnote2 5.4.0-37-generic #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux > root@devnote2:/sys/kernel/tracing# echo p __blkdev_put > kprobe_events > root@devnote2:/sys/kernel/tracing# echo 1 > events/kprobes/p___blkdev_put_0/enable > root@devnote2:/sys/kernel/tracing# cat trace > # tracer: nop > # > # entries-in-buffer/entries-written: 0/0 #P:8 > # > # _-----=> irqs-off > # / _----=> need-resched > # | / _---=> hardirq/softirq > # || / _--=> preempt-depth > # ||| / delay > # TASK-PID CPU# |||| TIMESTAMP FUNCTION > # | | | |||| | | > root@devnote2:/sys/kernel/tracing# blockdev --getbsz /dev/nvme0n1 > 4096 > root@devnote2:/sys/kernel/tracing# cat trace > # tracer: nop > # > # entries-in-buffer/entries-written: 1/1 #P:8 > # > # _-----=> irqs-off > # / _----=> need-resched > # | / _---=> hardirq/softirq > # || / _--=> preempt-depth > # ||| / delay > # TASK-PID CPU# |||| TIMESTAMP FUNCTION > # | | | |||| | | > <...>-111740 [002] .... 301734.476991: p___blkdev_put_0: (__blkdev_put+0x0/0x1e0) > > Hmm, maybe some issue in the latest kernel...? Hello Masami, I am testing the latest upstream kernel, your trace actually reproduces this issue. After 'blockdev --getbsz /dev/nvme0n1' returns, __blkdev_put() should have been called two times(one for partition, and the other for disk), however kprobe trace just shows one time of calling this function. If trace_printk() is added at the entry of __blkdev_put() manually, you will see that __blkdev_put() is called two times in 'blockdev --getbsz /dev/nvme0n1'. Thanks, Ming