From patchwork Fri Apr 13 13:07:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffen Maier X-Patchwork-Id: 10340055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E746360153 for ; Fri, 13 Apr 2018 13:08:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E1172871F for ; Fri, 13 Apr 2018 13:08:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92B81287F3; Fri, 13 Apr 2018 13:08:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83A882871F for ; Fri, 13 Apr 2018 13:08:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754170AbeDMNI3 (ORCPT ); Fri, 13 Apr 2018 09:08:29 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52572 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753985AbeDMNI1 (ORCPT ); Fri, 13 Apr 2018 09:08:27 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3DD4Atn094936 for ; Fri, 13 Apr 2018 09:08:26 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hask41xg9-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Fri, 13 Apr 2018 09:08:26 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 13 Apr 2018 14:08:24 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 13 Apr 2018 14:08:20 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3DD8Kds8323472; Fri, 13 Apr 2018 13:08:20 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3E65F52043; Fri, 13 Apr 2018 12:59:15 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id F3E9D52041; Fri, 13 Apr 2018 12:59:14 +0100 (BST) From: Steffen Maier To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Cc: Steven Rostedt , Ingo Molnar , Jens Axboe , Li Zefan , Greg Kroah-Hartman , Steffen Maier Subject: [RFC] tracing/events: block: also try to get dev_t via driver core for some events Date: Fri, 13 Apr 2018 15:07:19 +0200 X-Mailer: git-send-email 2.13.5 In-Reply-To: <20180413130719.22921-1-maier@linux.ibm.com> References: <20180413130719.22921-1-maier@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041313-0044-0000-0000-00000546EEAA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041313-0045-0000-0000-000028872E79 Message-Id: <20180413130719.22921-4-maier@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-13_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804130122 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Complements v2.6.31 commit 55782138e47d ("tracing/events: convert block trace points to TRACE_EVENT()") for cases where rq->rq_disk == NULL: block_rq_requeue, block_rq_insert, block_rq_issue; and for cases where bio == NULL: block_getrq, block_sleeprq. NB: The NULL pointer check for q->kobj.parent is certainly racy and I don't have enough experience if it's good enough for a trace event. Since I don't know when above cases would occur, I'm not sure this is worth it. Signed-off-by: Steffen Maier --- include/trace/events/block.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/trace/events/block.h b/include/trace/events/block.h index cffedc26e8a3..c476b7af404b 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h @@ -86,7 +86,9 @@ TRACE_EVENT(block_rq_requeue, ), TP_fast_assign( - __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; + __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : + (q->kobj.parent ? + container_of(q->kobj.parent, struct device, kobj)->devt : 0); __entry->sector = blk_rq_trace_sector(rq); __entry->nr_sector = blk_rq_trace_nr_sectors(rq); @@ -162,7 +164,9 @@ DECLARE_EVENT_CLASS(block_rq, ), TP_fast_assign( - __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; + __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : + (q->kobj.parent ? + container_of(q->kobj.parent, struct device, kobj)->devt : 0); __entry->sector = blk_rq_trace_sector(rq); __entry->nr_sector = blk_rq_trace_nr_sectors(rq); __entry->bytes = blk_rq_bytes(rq); @@ -397,7 +401,9 @@ DECLARE_EVENT_CLASS(block_get_rq, ), TP_fast_assign( - __entry->dev = bio ? bio_dev(bio) : 0; + __entry->dev = bio ? bio_dev(bio) : + (q->kobj.parent ? + container_of(q->kobj.parent, struct device, kobj)->devt : 0); __entry->sector = bio ? bio->bi_iter.bi_sector : 0; __entry->nr_sector = bio ? bio_sectors(bio) : 0; blk_fill_rwbs(__entry->rwbs,