Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp406036imm; Thu, 6 Sep 2018 04:31:10 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYDbkvDrAz004SbNZvLuRbcSaPXogfJtt7fiy+t7GN0hZahPbnQNPmaDmPElPuCbtwJ418A X-Received: by 2002:a17:902:28c7:: with SMTP id f65-v6mr2166836plb.240.1536233470435; Thu, 06 Sep 2018 04:31:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536233470; cv=none; d=google.com; s=arc-20160816; b=wgVuYTguljb61xvewTB3z47V1FCXYAcaOf2ERyWSC9r932N3J5tUrH3v9MYAPv/Yky vHtXNoffV0yoUraIcoqxpIwBqDU7NjnqiHNss5iwPGQB29pRBLchf4WPbx9RJEvlgFL2 ZOkHjMOsR7gGyXPIhlKDH39AOyH1P+oPtvR5WwAHcTxnjHsqpX6Q2wgNol4ZcidqIiga 2gr855C4ZZ/No29iUDvpsXSJ7N7jhAs8dvaLkgDhWpV2HNPr58HojJObM972hBgy9cz3 +/7r9Ly26NQcx8lz5wB2GV67KPCbSDOLu6wgF+Pxg46pNXfoj1O2yUjW/OCsHah3RTTm geYg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=45B0O8itMQWfAXFVYbb3S2hgK0vGCJZDQzDGQB82Vwk=; b=OIs5I4IGxLGkQ941EU293ZSLwH/zrFKr3IXuaTaFSAePNx4neVOsPTARL6RFYX6TB1 LPQvhYwPBWg3SMv2loV24dR40Hk2ai3hpw+lJkTo/Q8FjV6R6DFC77PV+CN5qfodADMQ fwtvZVBfhI9bHGAsDcYZDMebyW5pjVeVKXpAJXx9/xbVcwLod0bx68cTkufkDFheCTLu 3Wy9DURSmYWCKv6Xz3MmYjF1L+aar8zA09C6Ckzq1jGxtVq9IBBuHCrTjUaoVllPHSq9 kl40VZuuc2oimpDkoifvY9itednP1ZcJuFmPIlS8BhvbIv4IJi78pu2cqW41oU+fGS0u ffGQ== ARC-Authentication-Results: i=1; mx.google.com; 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 35-v6si5005341pgz.453.2018.09.06.04.30.55; Thu, 06 Sep 2018 04:31:10 -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; 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 S1727579AbeIFP4D (ORCPT + 99 others); Thu, 6 Sep 2018 11:56:03 -0400 Received: from bmailout3.hostsharing.net ([176.9.242.62]:49861 "EHLO bmailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726349AbeIFP4C (ORCPT ); Thu, 6 Sep 2018 11:56:02 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id EC8B1100DEC8A; Thu, 6 Sep 2018 13:21:01 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 9DC3E44FAAB; Thu, 6 Sep 2018 13:21:01 +0200 (CEST) Date: Thu, 6 Sep 2018 13:21:01 +0200 From: Lukas Wunner To: Mika Westerberg Cc: linux-kernel@vger.kernel.org, Andreas Noever , Michael Jamet , Yehezkel Bernat , Lu Baolu Subject: Re: [PATCH 2/2] thunderbolt: Initialize after IOMMUs Message-ID: <20180906112101.qmhkcqx73zmmko3q@wunner.de> References: <20180903132012.23531-1-mika.westerberg@linux.intel.com> <20180903132012.23531-2-mika.westerberg@linux.intel.com> <20180905084746.xmckzskxzsdliz3e@wunner.de> <20180905094602.GH2283@lahna.fi.intel.com> <20180906081337.3mosfpfggfmoj633@wunner.de> <20180906103602.GV2283@lahna.fi.intel.com> <20180906110049.gfdhurvkvvdjw7zh@wunner.de> <20180906110756.GY2283@lahna.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180906110756.GY2283@lahna.fi.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 06, 2018 at 02:07:56PM +0300, Mika Westerberg wrote: > On Thu, Sep 06, 2018 at 01:00:49PM +0200, Lukas Wunner wrote: > > On Thu, Sep 06, 2018 at 01:36:02PM +0300, Mika Westerberg wrote: > > > On Thu, Sep 06, 2018 at 10:13:37AM +0200, Lukas Wunner wrote: > > > > So with this patch, you rely on the linker ordering nhi_init() after > > > > ir_dev_scope_init(), however to the best of my knowledge the link > > > > order is not guaranteed. > > > > > > What says that? > > > > Within the same initcall level, the ordering is determined by the Makefile > > AFAIK. Someone changes the Makefile, your dependency scheme falls apart. > > There are other drivers doing the same so they would fail as well. It is > common practice AFAIK. That doesn't make it a *good* practice. > > > > Looking at commit acb40d841257, which started this, I'm wondering > > > > why you did not simply export tbnet_init() and call it from the > > > > thunderbolt driver after the property stuff has been fully set up? > > > > After all, thunderbolt-net is useless without thunderbolt or am I > > > > missing something? Then you could revert back to module_init(). > > > > > > The same reason you don't call PCI driver functions from PCI core. It > > > makes absolutely zero sense. > > > > > > Thunderbolt is bus and provides driver API to drivers. We hopefully are > > > getting other service drivers (say SCSI over TBT) that are going to be > > > use the same interfaces. > > > > Then add a blocking notifier chain into which these service drivers can > > hook. Other buses have that as well. > > It is really too complex to add notifier just for that. This works fine > and is not against any kernel principles I am aware of. Well, there's a difference between "it works and gets the job done, let's move on" and "let's try to find a solution that fixes not just this use case but potentially benefits others as well". FWIW, what I had in mind is a blocking notifier chain that gets called when a bus registers or unregisters. TB service drivers would then check if it's tb_bus_type and start initialization. Thanks, Lukas