From owner-freebsd-scsi@freebsd.org Tue Feb 9 12:15:40 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 C2F34AA2641 for ; Tue, 9 Feb 2016 12:15:40 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.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 A60451E38 for ; Tue, 9 Feb 2016 12:15:40 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: by mailman.ysv.freebsd.org (Postfix) id A2FADAA2638; Tue, 9 Feb 2016 12:15:40 +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 8A4C6AA2637 for ; Tue, 9 Feb 2016 12:15:40 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1991A1E34 for ; Tue, 9 Feb 2016 12:15:40 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: by mail-wm0-x234.google.com with SMTP id g62so172000127wme.0 for ; Tue, 09 Feb 2016 04:15:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/wyPGqdyQkVrFTvlfW8VXe377C33YiBQrUP1Q9ke/QM=; b=JzAF8L1G94qM8uDxEwohtjnry/JqF9ltxvh+07vq6W0waJC800hwxinyse8bKNFK0I Flf0hzSsko4OMFKU4Xf4ndeDHAVYOtTjrEOPLTMneYIwDFoeKp/cWNGzxzgM36OkFK1E gRsDoVVb3YA7kY28VPar0XvI7rj/iGLuCRsoE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=/wyPGqdyQkVrFTvlfW8VXe377C33YiBQrUP1Q9ke/QM=; b=O7KmCYA1gDNPp4AWrCyltwc/fKRxophGUJFUIeipdLqBMZ6B7cKQkUhR8q+AH9ZlXn PIAxPNI74gHQY+5ec43l+pJYe7Puu5ooiqh3dwfHnAEn52Hy0C48/KYIU6DjbpNl//pQ 41gJVSf3pmpIj6kHd7bpc1bXqg1LxlgdrqlNIErU7+cEQ/pbKL6CAifLuQBKQUqWY7Oi CmJ7dQqy6d00q0MBUoj0rf7HNdtbZ2/MiMz8Es/DEXRUlkhxJ74E6IMEvcTQHO2r+i3q lPzj8EXk7RHI+Uq4+S4QelsJcZUIiEZolAfV4T29WfKaP4/OtVfTuIrX+km49cy9HylZ +UKg== X-Gm-Message-State: AG10YOQ6pci1XQD2fgsMT+p6mVjBURKHYsevlDsO4gsUhRZGdb+xqU4v5Bh+tous/yVOPS3r+Ysbp3bAOmVDA+9Q MIME-Version: 1.0 X-Received: by 10.194.21.163 with SMTP id w3mr33126421wje.58.1455020138340; Tue, 09 Feb 2016 04:15:38 -0800 (PST) Received: by 10.27.133.196 with HTTP; Tue, 9 Feb 2016 04:15:38 -0800 (PST) In-Reply-To: References: <33145844.5EAIpev2G5@ralph.baldwin.cx> Date: Tue, 9 Feb 2016 17:45:38 +0530 Message-ID: Subject: Re: Panic on reloading a driver with same DEVICE_PROBE() return value From: Sreekanth Reddy To: John Baldwin Cc: freebsd-current@freebsd.org, ken@freebsd.org, scsi@freebsd.org, current@freebsd.org Content-Type: text/plain; charset=UTF-8 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 12:15:40 -0000 Hi, While debugging more, I got one more clue, ----------------------------------------------------------------------------------------------- static driver_t mps_pci_driver = { "mpr", mps_methods, sizeof(struct mps_softc) }; static devclass_t mps_devclass; DRIVER_MODULE(mpr, pci, mps_pci_driver, mps_devclass, 0, 0); ------------------------------------------------------------------------------------------------- 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. ~Sreekanth On Tue, Feb 9, 2016 at 2:55 PM, Sreekanth Reddy wrote: > On Mon, Feb 8, 2016 at 11:58 PM, John Baldwin wrote: >> On Monday, February 08, 2016 08:13:26 PM Sreekanth Reddy wrote: >>> sc->facts = malloc(sizeof(MPI2_IOC_FACTS_REPLY), M_MPR, M_ZERO|M_NOWAIT); >> >> M_NOWAIT can fail with NULL. Normally in an attach routine you should use a >> blocking malloc (M_WAITOK) which will not fail with NULL. > > Yes I agree that in an attach routine we should to use a blocking > malloc (M_WAITOK) flag. > > But, here I am observing same page fault even with (M_WAITOK) flag. > > Here, page fault is occurring inside the malloc function and driver is > not receiving any NULL or any other value. > >> >>> * How can I reload the modified driver with return same device_probe() >>> value as the one which has loaded during the OS boot time. I observed >>> that whenever I try to load this modified driver using "kldload >>> ./mpr.ko" command then I see that driver in the /boot/kernel/ path has >>> executed. >> >> At runtime you can use the devctl(8) command on HEAD (it will be included >> in 10.3) to force a device to detach/attach to force a re-probe. >> >> e.g. >> >> devctl detach mpr0 >> >> # note that the device won't be named mpr0, you will need to use its PCI >> # location for this next: >> >> devctl attach pci0:4:0:0 > > I have started downloading the current kernel. I will verify this > today/tomorrow. > > >> >> -- >> John Baldwin