Received: by 10.192.165.148 with SMTP id m20csp31024imm; Thu, 19 Apr 2018 12:26:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+vkgzNQ59tfkoJ0Qed2epAC6pNheyNhSU/R1IVPYYRWcLU6CY7jbrkXnjyIZXFZUdNbyJT X-Received: by 10.101.72.140 with SMTP id n12mr6171159pgs.155.1524165974061; Thu, 19 Apr 2018 12:26:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524165974; cv=none; d=google.com; s=arc-20160816; b=LU9nkwfuAmVas8hN6t0SHOSOs4blcmKVzYRRUcWba9u4+avRl2ligA/u26IV5z7anp HOcEVmptrmhSMHRsEXXjXrenEW9/fGh9iuKg3x4ZOz2xDBKGDBMODvyLFhLOIj/tDXbt sFRFKawKUG0kUU/9B6l2S3vV/8dNCW8scE5PnV+RPoPs4z89azajEHBHYGAF3KQYaVUp mdDS4yAUVsRhJfrgLge+BusFGoX1caWNTVQxpBKYv2AMNLzWFifeQ4oqrGluV7ZE2kUL ITd5AWjOI3Er4dWcEtCzDgNBMCxa5OzKK4e3/fLIfbyQKVO4Cq6L25DdiFEOHIci5uK0 iQ6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=AHT9+BOtOaDjHMqKQqMuUurkCknO4ceZiw6pZQtoRM4=; b=vmDBxjVEq3GtAQGhNRkqa8QKFfRrD5OsnVvQM+RWp4Jy7lg6m539Z7Gq/Ois9oyOKM ou1LE7ECGuTArjc9Svds5XYeuOXznP9+RFr2p8Bc+a7qJStvBBQS2TD+a25dOXTX6wDW FN8qlbtWyRr42Y2MSbdskbGJ7kmaZs+OmYjCP3Gng5vXuv5durJwdcJDB6OU3h4C5Eid AYBhC4lLB4TRC/zGxVrIKgIqHj97jEEfsFWvII6b+RljHpbNG4GW/lP5wJBw0lv6WuWo K+7W7UEbreHASphDO6VBMi4ofFspYRvbee5NnZlDC0mTk2pfy4AYzZS9XSR90vYmU+P0 1U2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=JTlqxFGU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c76si3579327pga.156.2018.04.19.12.25.59; Thu, 19 Apr 2018 12:26:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=JTlqxFGU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752804AbeDSTYo (ORCPT + 99 others); Thu, 19 Apr 2018 15:24:44 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:37228 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752086AbeDSTYm (ORCPT ); Thu, 19 Apr 2018 15:24:42 -0400 Received: by mail-pl0-f67.google.com with SMTP id f7-v6so3823992plr.4 for ; Thu, 19 Apr 2018 12:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=AHT9+BOtOaDjHMqKQqMuUurkCknO4ceZiw6pZQtoRM4=; b=JTlqxFGUa0pFNYCOY8JNB/2bWXcZdtgH3hm9QC3J51zkXQMnJPPD+QR452XLlE6eSg 48IPYtclg2b0kQONAgoi/JID1h8p4DjdtSWjhL9+iaj/UocVHjbs3+JnxoUhKSfo19/n QplZIvqKj+E9TeA8C89BqD0vhN9tn+x6hQn5p9dm160WBer9aBYuQopV32Bg1P5xdg2K aXOlFeVXCfexfEqhQnEFeVgbX6PCRMX4MFQX246Qc9KfvbP0/Fbn77q2TvfMQkWlxtvB yif1cS7uZrS7C13GHm5w373Rpw6Zo7YNDXfyJbj1qH4Ilclw51TW9fn/AlmVOm2X6OBj ftdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=AHT9+BOtOaDjHMqKQqMuUurkCknO4ceZiw6pZQtoRM4=; b=G2RJ/4YOk00wQCacWtbzPmQ5TixNBgzrukfKdVyKgosO+8WiqvfLSaBLaVVeqNbqsp 1kWhewc+/tR4m+qmWmmH98YgFdd8kE4/kL4YfJjZdGmpT7z1g1T+3uaEMXQsdqi2ytcy D4j00l4anWntm9wLVB64FsyzUT+JV266ExTxCbExeS260sBcMuHTraU5EnWgUJEgD5zR l0XhFNZ79gUm283MaXQFMRuytkdzxRo3TmiF2qY8gq4vLBZ2jPouynGOinSKy6dyZZkW kWJkJqmGdDqkM9wM0Ot2lgigTqbwfhowy++Jh/84sQd3AjG9nxw6iUGqNh2MbDCbOKXq DxRA== X-Gm-Message-State: ALQs6tBHl38eJN86hdGAfBM6O5eDJxvDT9XXcadtpulToCQWV+ZFLgro Ar2D4Dj+Fwswn5LYmg9PWFBHlw== X-Received: by 2002:a17:902:7e4a:: with SMTP id a10-v6mr3095072pln.276.1524165880976; Thu, 19 Apr 2018 12:24:40 -0700 (PDT) Received: from vader ([2620:10d:c090:200::5:65ed]) by smtp.gmail.com with ESMTPSA id f22sm9640376pff.146.2018.04.19.12.24.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Apr 2018 12:24:40 -0700 (PDT) Date: Thu, 19 Apr 2018 12:24:39 -0700 From: Omar Sandoval To: Steffen Maier Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Steven Rostedt , Ingo Molnar , Jens Axboe , Li Zefan , Li Zefan , Bart Van Assche Subject: Re: [PATCH 2/2] tracing/events: block: dev_t via driver core for plug and unplug events Message-ID: <20180419192341.GC20941@vader> References: <20180413130719.22921-1-maier@linux.ibm.com> <20180413130719.22921-3-maier@linux.ibm.com> <20180415083154.GA12254@kroah.com> <59186bf6-abf1-87b0-914d-eed1b40ef4a8@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <59186bf6-abf1-87b0-914d-eed1b40ef4a8@linux.ibm.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 16, 2018 at 06:33:27PM +0200, Steffen Maier wrote: > Hi Greg, > > On 04/15/2018 10:31 AM, Greg Kroah-Hartman wrote: > > On Fri, Apr 13, 2018 at 03:07:18PM +0200, Steffen Maier wrote: > > > diff --git a/include/trace/events/block.h b/include/trace/events/block.h > > > index a13613d27cee..cffedc26e8a3 100644 > > > --- a/include/trace/events/block.h > > > +++ b/include/trace/events/block.h > > > @@ -460,14 +460,18 @@ TRACE_EVENT(block_plug, > > > TP_ARGS(q), > > > TP_STRUCT__entry( > > > + __field( dev_t, dev ) > > > __array( char, comm, TASK_COMM_LEN ) > > > ), > > > TP_fast_assign( > > > + __entry->dev = q->kobj.parent ? > > > + container_of(q->kobj.parent, struct device, kobj)->devt : 0; > > > > That really really really scares me. It feels very fragile and messing > > with parent pointers is ripe for things breaking in the future in odd > > and unexplainable ways. > > > > And how can the parent be NULL? > > I'm hoping for help by block layer experts. > > I suppose block device unplug/removal could be a case. But I don't know the > details how this works and if object release is protected while I/O is > pending and new I/O is rejected beforehand. That might make my approach safe > as it would not call the trace functions while the parent pointer changes. We quiesce and freeze the queue before tearing it down, so it won't be NULL while we're still doing I/O. Cc'ing Bart in case I'm lying to you, though ;) > > I don't know the block layer but this feels very wrong to me. Are you > > sure there isn't some other way to get this info? > > No, I'm not sure at all. But I'm no block layer expert either. This is just > an idea I had which did work for my cases and I'm looking for confirmation > or denial by the experts. So if it's not safe from a block layer point of > view either, then I have to ditch it. There's not a pretty way to do this, but using the proper helpers would be preferred: disk_devt(dev_to_disk(kobj_to_dev(q->kobj.parent))) The parent of a request_queue is always a gendisk, so this should always work. > -- > Mit freundlichen Gr??en / Kind regards > Steffen Maier > > Linux on z Systems Development > > IBM Deutschland Research & Development GmbH > Vorsitzende des Aufsichtsrats: Martina Koederitz > Geschaeftsfuehrung: Dirk Wittkopp > Sitz der Gesellschaft: Boeblingen > Registergericht: Amtsgericht Stuttgart, HRB 243294 >