Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp424514imm; Thu, 6 Sep 2018 04:51:51 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb/rI7jIrtUCVxwmKYS1hwObkQ578SktEk7gVifQe624OW88Cac1CGtb5TvGBGuMHz8W1dr X-Received: by 2002:a63:5204:: with SMTP id g4-v6mr2279367pgb.274.1536234711203; Thu, 06 Sep 2018 04:51:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536234711; cv=none; d=google.com; s=arc-20160816; b=JALi6BEh0gF6lfPrIJVABfKoK5K/sx6DDlPImNGAgor8W5hHm/4sKn5PyALhUYnaW0 UsjnAQKBNq0ZNgPkJRuerB8YAAlW1GL1pyRZ0cHOZRxdRGtWlp93bYCVeZY25ZnInXFP cP+vIL6/IzmRe+Nqc39tY6JwG6t9gGdu9bkeE5COFpvnWYWW5VjrcIjqY9I9ymQfEKjV LMcKZjqU9f2o7eTOFYh4tReLbohp4QOd9nHfr9iUaJHHpiEobvIeWP5oKFZb6e49mQHe 7QqnJ6801uUFm7T1lfNp8+ucyhZs1X6t4e8k8GyrcN4IXKHearZmoFzx8VFEuKMTTi0G IFfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=En1GycakYv4vDaw/lfeqcnyCC3vz+gm1HFgZCp1ZL7Y=; b=kwjuFjtmPVe+SzqZ0tA+tuDjTjHh2OMchp6zMw20RM5sSHk2TpFrTrIFQBpl+Kaxm9 aR8frPQNEwq6MKpz9who96k5CzljYB27o5Yb9H9rUf/I1TGtSiwwMbrey7Yz/L+0+VFK VYHqtliG+64D0g7hQ81pmWMAcTJm/stAIT67SdSQ+h5XXy6vYNGhNZcU+BWtRgFYo5Kn dIKokDRhGCwbSGyvX86pG+pL7vomRDCWY+reOypFlgl64iZjuYiifuxSP9GDIhq4zrbC 1mZ9ze4kk992ZNdpPYQEGZqQgc2T+YSXLBU6XMBD6UP8N9wvaSiCt0nlIAIIhPXr/EuM oBNw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6-v6si4772016pgi.506.2018.09.06.04.51.35; Thu, 06 Sep 2018 04:51:51 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727640AbeIFQWG (ORCPT + 99 others); Thu, 6 Sep 2018 12:22:06 -0400 Received: from mga06.intel.com ([134.134.136.31]:27971 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725929AbeIFQWG (ORCPT ); Thu, 6 Sep 2018 12:22:06 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2018 04:47:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,338,1531810800"; d="scan'208";a="72078596" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.157]) by orsmga006.jf.intel.com with SMTP; 06 Sep 2018 04:46:53 -0700 Received: by lahna (sSMTP sendmail emulation); Thu, 06 Sep 2018 14:46:52 +0300 Date: Thu, 6 Sep 2018 14:46:52 +0300 From: Mika Westerberg To: Lukas Wunner 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: <20180906114652.GK2283@lahna.fi.intel.com> 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> <20180906112101.qmhkcqx73zmmko3q@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180906112101.qmhkcqx73zmmko3q@wunner.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) 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 01:21:01PM +0200, Lukas Wunner wrote: > 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. It is good enough for our case. > > > > > 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. Like I said, I think it is too complex. If we ever need to change the initcall level third time (which I doubt) we can start thinking about more complex solutions.