Received: by 10.192.165.148 with SMTP id m20csp4008556imm; Tue, 8 May 2018 01:02:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrOcK/CpGMZyuChztwBYWUFD7VsLUsaeI8URsd4CaoGqQRXrcP1LfS2fnO4rIOtfTjODnoQ X-Received: by 10.98.102.221 with SMTP id s90mr38749811pfj.123.1525766561858; Tue, 08 May 2018 01:02:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525766561; cv=none; d=google.com; s=arc-20160816; b=pLE3LX1BlIsV/md2Qx3vXsulp6fBjJNPgcBe/SatBe++eOw5TZcv3KyaDuQyVbRrt2 3Rgq3B6rgYRyl9WnCrr8VxwKdowmN4a5jmA2d+6ALMKx1to8DGGzktFuTnoIQEAmJm8Y oV+4FgGn+OXymnxQ2agykkznZWpi6wEKaGIEfN8bef4zB2XQnAYwN3S3aoaHBtRAtTM+ HpflvuV9eMRAineA5nSs7QRxHJaBINCW6mFzJITIQQnxy9vihq5+m495edFzUNXsl5d0 JnpmvModTvRY5aG2xtpXmlrOBcv7BXS2SifCBgtMrtS1er4heRq0GPPV/rlL7pnq0UvH MAVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=rEf20kFy9YiD1ZevLdQELU8BulRLPEK95SfZZ7X+iIs=; b=dVvSXwXabTIwoY3qVFBtSuChCtIH8q6P7XYx34EIUEXs8apw//jyRKShttUaDPV7KP lF//ZUVUB/d0Ed3u0mVbJgkhrezcdCA65dRSTXpsT6bXdKe4rZy6V5Gg6hnwGdS8WeKB JAidhIOOSCD0g2iZV0+aDL+48vr5c5+fsZBMkovzsQYSjdOOernaicFx+O0j0XDA4ve3 RQGV+wXxREkZ8d0sQoDaEMyqBKy/I5CsNlFShJhwT3VxdM21Cz7GJ7ptcsA3iTQKu222 to7r/u0GS+TSeTdA9mIhbBFQxWg1ucXJYdlghKujALIJzyYq7x+S/r5aXFXL6dyHh+Dv Q44Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=a6CTTjAg; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w19-v6si23196962plp.538.2018.05.08.01.02.26; Tue, 08 May 2018 01:02:41 -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=@gmail.com header.s=20161025 header.b=a6CTTjAg; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754291AbeEHICG (ORCPT + 99 others); Tue, 8 May 2018 04:02:06 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:45907 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754189AbeEHICE (ORCPT ); Tue, 8 May 2018 04:02:04 -0400 Received: by mail-pf0-f194.google.com with SMTP id c10so23564310pfi.12 for ; Tue, 08 May 2018 01:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=rEf20kFy9YiD1ZevLdQELU8BulRLPEK95SfZZ7X+iIs=; b=a6CTTjAggRLoQg9/VHpaf6PC0uJWoJXZJta344uQG1jprz5x38lV5x/3PYslSIju2d 3YMpm2K/kArcFCkzIl+QBu9BP4+I9jXanrA+bAQAzKiwswasqdlTaYEBo8ZGNsaq3N2a 7IXY3UbamWr3sf2k6+gKnczU2b8sCKpVNWvjqSjHRRTKNppRJVzqoPDGFLMzG/0jr1Ub v+Tv7GCiIVrhh4A9H8l8Ri+nHkUs2ICal9FtG6miMpYer3afX3WlmEgK/1aHnacP9+uB KrQfvc1ixxphkcEGlldofMM8ijnqqq5dGw4hHwoB92J3ugmQ782Npko4/8wRGlTXR1RI bGPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=rEf20kFy9YiD1ZevLdQELU8BulRLPEK95SfZZ7X+iIs=; b=nr0cInR6gE0Gdb9GjOGe41BOUsvBwN3w7mrfrVYaSgiHv7rCWHaW1x6mNYOsFV7wFm O5Njadm4frRME6U7d1KhFJO+rxjVHR9rt21kVq0XLJFGSh8AVNJNK7GjWIskgEm2CJbm ivt2Y3CZdH71SUQcSXRYqmGfe2A1irfxsB7zZuW8cVNhiqi4IHvdhnOT3BB/r5SQve4x gSFPtnFEwyBQdukmvwJ33qMkbQcdC+0Std2U5mdJHECLi1a3Jl3Y1TB1qkTk1GlUpjPd nkETeMwCvdVP4ljS0z3lMJopUwldJDMfZcxBiNcGC3P+QzZdK13pFRRUha3cDFCOduKm bZPg== X-Gm-Message-State: ALKqPwdIW4hv+7tmi4OuaztIP3GkVo5RXbNf3gCCawCX+wo3fPIRQ7Fa MjUpcRCSTPQRfQJJSc0xYfMUVOP2 X-Received: by 2002:a63:6d8f:: with SMTP id i137-v6mr424321pgc.268.1525766523649; Tue, 08 May 2018 01:02:03 -0700 (PDT) Received: from [192.168.1.101] (222-154-41-72-adsl.bb.spark.co.nz. [222.154.41.72]) by smtp.gmail.com with ESMTPSA id p11-v6sm30589090pgn.18.2018.05.08.01.01.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 01:02:02 -0700 (PDT) Subject: Re: [PATCH] nubus: Unconditionally register bus type To: Greg Kroah-Hartman , Geert Uytterhoeven References: <5aee5ed3.1c69fb81.19d98.ef06SMTPIN_ADDED_MISSING@mx.google.com> <20180506045530.GA5328@kroah.com> <20180506202018.GC8924@kroah.com> <20180508070037.GA4792@kroah.com> <20180508072522.GA26568@kroah.com> Cc: Finn Thain , Linux/m68k , Linux Kernel Development From: Michael Schmitz X-Enigmail-Draft-Status: N1110 Message-ID: <53b0fe0b-70c5-a327-57b8-47c02331d2bd@gmail.com> Date: Tue, 8 May 2018 20:01:56 +1200 User-Agent: Mozilla/5.0 (X11; Linux ppc; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <20180508072522.GA26568@kroah.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, Am 08.05.2018 um 19:25 schrieb Greg Kroah-Hartman: > On Tue, May 08, 2018 at 09:07:27AM +0200, Geert Uytterhoeven wrote: >> Hi Greg, >> >> On Tue, May 8, 2018 at 9:00 AM, Greg Kroah-Hartman >> wrote: >>> On Mon, May 07, 2018 at 09:51:12AM +1200, Michael Schmitz wrote: >>>> the BUG() was triggered by loading a Mac Nubus network card module on >>>> a multiplatform kernel running on an Amiga machine. Up to Finn's Nubus >>>> core rewrite (this February), we've seen no errors. Since then, Nubus >>>> drivers fail to register because the Nubus bus is only registered on >>>> Macs. >>>> >>>> Can't see link order involved here at all. >>> >>> The link order is totally involved here :) >>> >>> Link order determines the order in which init calls are run, so you need >>> to ensure that your bus code comes before any drivers that use that bus >>> code in link order. That way, at init time, your bus is created first, >>> preventing this type of error to happen. >> >> The issue here is not due to link ordering, but due to the bus not being >> registered on a system that doesn't have that particular bus. > > But how can that happen if the bus code is not present in the system at > that point in time? Hardware doesn't matter at all here. > >> Akin to booting a kernel on an old PC without PCI, and loading a driver >> module for a PCI network card. I guess that doesn't crash (because no one >> has a PC without PCI anymore? ;-) > > No, it should work just fine, try it! :) > > The driver will not bind to anything, but the bus code should work > properly, as long as it is initialized before the driver tries to > register with that specific bus type. Before Finn's patch, the Nubus init call used to do this: static int __init nubus_init(void) { int err; if (!MACH_IS_MAC) return 0; nubus_proc_init(); err = nubus_bus_register(); if (err) return err; nubus_scan_bus(); return 0; } subsys_initcall(nubus_init); MACH_IS_MAC returns false if run on Amiga, Atari, ... anything but Mac. The Nubus bus driver is only registered on Mac hardware (working on the assumption it won't be useful anywhere else so should not be needed. That was a little naive, as we've seen now.). The initcalls for Nubus hardware drivers attempt to register the driver with the Nubus bus driver, regardless of what hardware we're running on, i.e. regardless of whether or not the Nubus bus ever registered with the core. Finn's patch sidesteps the issue by registering the Nubus bus with the core unconditionally (PCI probably does the same). Drivers can then register successfully but will never see their probe code called because the Nubus driver only scans the bus for devices if running on a Mac. So no harm done either way. An alternative might be to only allow devices to register if the Nubus bus has successfully registered with the core (which it wouldn't do unless running on Mac hardware). That would solve link order and wrong hardware issues at the same time. (Link order is Nubus before network drivers as far as I could see from drivers/built-in.a) Cheers, Michael > > thanks, > > greg k-h >