From owner-freebsd-scsi@freebsd.org Tue Feb 9 22:23:55 2016 Return-Path: Delivered-To: freebsd-scsi@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E0EEAA30CF for ; Tue, 9 Feb 2016 22:23:55 +0000 (UTC) (envelope-from scott4long@yahoo.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 521CB868 for ; Tue, 9 Feb 2016 22:23:55 +0000 (UTC) (envelope-from scott4long@yahoo.com) Received: by mailman.ysv.freebsd.org (Postfix) id 4FAD6AA30CE; Tue, 9 Feb 2016 22:23:55 +0000 (UTC) Delivered-To: scsi@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35576AA30CD for ; Tue, 9 Feb 2016 22:23:55 +0000 (UTC) (envelope-from scott4long@yahoo.com) Received: from nm5.bullet.mail.gq1.yahoo.com (nm5.bullet.mail.gq1.yahoo.com [98.136.218.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D387866 for ; Tue, 9 Feb 2016 22:23:55 +0000 (UTC) (envelope-from scott4long@yahoo.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1455056262; bh=I+V8vzKA1VdK5lQ7tjK46JjLVj6iLo6lGC9fMLuPh84=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From:Subject; b=eO6xsMQNCPToYSVasFp6o66AuMYZbVVyMcKH1q0lgA6gWaLQTCOSgtODW0Gl6W0mj4neuuC3XktlVkhvKQOjr0+Nno0BUT85JfepeOX8fqzksVZaEGfXL1glW1ZunToLLAGQY7lmurZUlheed2IYdue+tKcDiSaQwDqa98zwVSVh+etxUz+a39AfzXvH9weITZsO9k6SxQNeLdMiR+DTYToQ8mB7euTUtuqS2eUSG1W2biX3e0KeGgs05ZR28B6EA8EO2spMkS8VR64inprlaEzvvds/F1QwYVk1zIfcodjO1EOsGvcd2Tk7aj+U8vNbOTshb3+Ey7m7aw49PkEDmg== Received: from [98.137.12.59] by nm5.bullet.mail.gq1.yahoo.com with NNFMP; 09 Feb 2016 22:17:42 -0000 Received: from [208.71.42.213] by tm4.bullet.mail.gq1.yahoo.com with NNFMP; 09 Feb 2016 22:17:42 -0000 Received: from [127.0.0.1] by smtp224.mail.gq1.yahoo.com with NNFMP; 09 Feb 2016 22:17:42 -0000 X-Yahoo-Newman-Id: 920980.95248.bm@smtp224.mail.gq1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 8esn3tgVM1lYW7y7bYuzAb3hRcvwm9UjY6t_A536F0ky1gd e1hTnY0XAyICy.C7bCjgf6q3gbTTCb6gm60Pbwqq531.EWvY3EKkmuyOtYAL 9jZ5zNn0CpY8JvflT.EJnJvTADkP4_.0tCKnTC4avsoQ3Zz63TiMLEf40NH1 WpTVGfrsymeJzAJ1PCbA9cTA9T49rloexl8YuKQpvIvm8m1GY9Myv1sLWB3S 4vvzwLfedHQ48otXdd05iKSnpCFjltsudmfIrfa_PVWIfpDXttR7ZoQYufEc TGieKtIX_PhxID8ZQ7MIT_okn97L1Q_8F.lPawawdc_1jwzoFVXLAKvKuBsi UtdqSzMtk4UXYzUJSoIBqzYqOvVwZ30koMRKyBy9nX4n8CBa3ffE2rPhGUkQ 2BSZPcoRJpWs5lqg01vIna499LJDBIUMZggHumq5gTe6G2uVYgbb1Tivazne HrXjnI4Q0LN.KnRsmN4flA6o0ndPpD7bSP7EIIuwGpMF_uXiToWBixr8lmuG UEJ_XWWdhCX0EMblurNCSaVfJ2CqMlSmj66p4Dt0- X-Yahoo-SMTP: clhABp.swBB7fs.LwIJpv3jkWgo2NU8- Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Subject: Re: Panic on reloading a driver with same DEVICE_PROBE() return value From: Scott Long In-Reply-To: <2227929.z5Tr1XC1Xs@ralph.baldwin.cx> Date: Tue, 9 Feb 2016 15:17:39 -0700 Cc: Sreekanth Reddy , freebsd-current@freebsd.org, ken@freebsd.org, scsi@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <0C31DEA0-0AD0-4E1B-9656-C6ABB6AA854A@yahoo.com> References: <2227929.z5Tr1XC1Xs@ralph.baldwin.cx> To: John Baldwin X-Mailer: Apple Mail (2.3112) X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Feb 2016 22:23:55 -0000 > On Feb 9, 2016, at 3:00 PM, John Baldwin wrote: >=20 > On Tuesday, February 09, 2016 05:45:38 PM Sreekanth Reddy wrote: >> Hi, >>=20 >> While debugging more, I got one more clue, >>=20 >> = --------------------------------------------------------------------------= --------------------- >> static driver_t mps_pci_driver =3D { >> "mpr", >> mps_methods, >> sizeof(struct mps_softc) >> }; >>=20 >> static devclass_t mps_devclass; >> DRIVER_MODULE(mpr, pci, mps_pci_driver, mps_devclass, 0, 0); >> = --------------------------------------------------------------------------= ----------------------- >>=20 >> in the above code snip-set, if I changed "DRIVER_MODULE" line as >> DRIVER_MODULE(mpr3, pci, mps_pci_driver, mps_devclass, 0, 0); >> (i.e. from "mpr" to "mpr3") then I am not observing any panic and I >> can load & unload the mpr driver multiple times. >=20 > Oh, that might be required, yes. DRIVER_MODULE uses its arguments to = define > a module name (in this case as "pci/mpr") and module names are = required to > be unique. I believe you should be getting a printf warning about = this on > the console. Something like: >=20 > "module_register: cannot register pci/mpr from blah.ko; already loaded = from foo.ko" So the problem wasn=E2=80=99t that the malloc was failing, it was that = sc was pointing to memory that the driver didn=E2=80=99t own, so the fault was happening from = assigning sc->facts. Is there something that can be done to make this problem more obvious? I know = there=E2=80=99s a kernel printf, like you said, but that=E2=80=99s apparently not a good enough = signal. Scott