From owner-freebsd-current@freebsd.org Tue Feb 9 12:15:40 2016 Return-Path: Delivered-To: freebsd-current@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 73CFAAA2635 for ; Tue, 9 Feb 2016 12:15:40 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::22a]) (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 0BB861E33 for ; Tue, 9 Feb 2016 12:15:40 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: by mail-wm0-x22a.google.com with SMTP id g62so20709443wme.0 for ; Tue, 09 Feb 2016 04:15:39 -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=BcJFg/fOjlpPKnVPpUq4M5PhwWNB4YUWSsFdbSZuvYmFKJCk90XV6sXdXHs8Yi2+06 IGddh85HCy2ZWl85SO+QwSmMWNeGTIJU/yYwa13xLKqnlFG2Mmb2FZ3Af7ZLxwhZAamH n/+NfcEuvFyCbVCCN6ygp8sJbKfHxpdBUfZCtj6m/Kq2xc2TOGZYbLgl1qT4fzci64Sq UOO4oz+fbVpBAeYr5iA6KxvCfD15NvyAfNhv+xwTTgBzeRAlM10OF+0pybxfMUsGOq+J va0Hv+Tn9+wzpsHLZHCnuHH5RgFxGyQXEHJo3Z2lhODye9zVxORqki6YIpjAAHKKnrEi c0qg== X-Gm-Message-State: AG10YOSCj2fBvHfSBX43/109cRX43CnAPpynJmEt076CO/z2rGVnKldLUGFWSmODpO1qb8iepw7wzAHaQs9EkI6M 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-Mailman-Approved-At: Tue, 09 Feb 2016 13:06:02 +0000 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current 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