From owner-freebsd-scsi@freebsd.org Sun Feb 7 11:31:53 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 1750DAA1B49 for ; Sun, 7 Feb 2016 11:31:53 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yw0-x22d.google.com (mail-yw0-x22d.google.com [IPv6:2607:f8b0:4002:c05::22d]) (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 DAE6AEAC for ; Sun, 7 Feb 2016 11:31:52 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yw0-x22d.google.com with SMTP id h129so84488841ywb.1 for ; Sun, 07 Feb 2016 03:31:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:date:message-id:subject:from:to:content-type; bh=p7FR6vRMgbp7WMgmKNlAptgBPm7p1jxcB0bvzEieltA=; b=NF/Eg6clk0BGZ81y4FEtNGB+cPYpb82vwT4sfK7FVOKj81m1tXVaLLeWb82Y2d11UD fcqb6tawShhOh+KWjaT82E9Y5xwg/ZCDnbrYGfEV8U1xCgMEmFZAlgRP1Sz1HsUn9o2/ JQF2QVN1Va8P5kZNzbAbdJs9cMPVxcS68f+N0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=p7FR6vRMgbp7WMgmKNlAptgBPm7p1jxcB0bvzEieltA=; b=VB+EuSkow87fQp3EZM/P3TtjiYZMJ/g89svPwX3OZ9m+wgfPi2R0dVO4Ip0gAfqhff 6iSZ9vs11+z0dL3yUtaCas9QvAG34cLiOyUPx/qVjzaOmN5gGpD6+ra8bMA5YqmJHVfp MKAs6VNVHD/EMKGRxByIaqWgI0SwUpQGmF1j4fQSusSerDsNL8pFvOuCionCzdLBOOxS 33BKsX2Inx8V1zUhJv7dCtr1uO4d6Nc6GZfxsePrspog19ZN1jw7qlVN4gHb0a/v5uDm KPBDNXxC4AWzp8KWTx2FjapHZujjtAQH8iHxWAk7SHn4c3NPa/yBb86M5InuKSusyQv4 wFew== X-Gm-Message-State: AG10YOQR3vFZC0sGJ6Sdi5+CHD+V4CugHpdJzX5Zlmsf2a0zm3fud86BxgFS93drhm5aFo05jEVdH9x0JUAaAQ== MIME-Version: 1.0 X-Received: by 10.129.71.135 with SMTP id u129mr12744651ywa.162.1454844711801; Sun, 07 Feb 2016 03:31:51 -0800 (PST) Received: by 10.37.6.66 with HTTP; Sun, 7 Feb 2016 03:31:51 -0800 (PST) Date: Sun, 7 Feb 2016 04:31:51 -0700 Message-ID: Subject: CF quirks From: Kevin Bowling To: FreeBSD-scsi Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 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: Sun, 07 Feb 2016 11:31:53 -0000 Linux has a table of what amounts to various CF IDE quirks in https://github.com/torvalds/linux/blob/master/drivers/ide/ide-cs.c#L275. Among the affects it disables DMA on all of these. I have a particular device in my router, a TS2GCF133 (it isn't in their list but exhibits DMA problem) that I would like to disable DMA on. hw.ata.ata_dma="0" in /boot/loader.conf has the needed affect. Is there an equivalent way to blacklist the device by ID in FreeBSD kernel, or must this be pushed on the end user to figure out with loader.conf? Regards, Kevin From owner-freebsd-scsi@freebsd.org Mon Feb 8 14:43:28 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 CD2AAAA0185 for ; Mon, 8 Feb 2016 14:43:28 +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 B3A291018 for ; Mon, 8 Feb 2016 14:43:28 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: by mailman.ysv.freebsd.org (Postfix) id B275EAA0183; Mon, 8 Feb 2016 14:43:28 +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 B20F4AA0182 for ; Mon, 8 Feb 2016 14:43:28 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: from mail-wm0-x230.google.com (mail-wm0-x230.google.com [IPv6:2a00:1450:400c:c09::230]) (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 5138B1015 for ; Mon, 8 Feb 2016 14:43:28 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: by mail-wm0-x230.google.com with SMTP id p63so118701109wmp.1 for ; Mon, 08 Feb 2016 06:43:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=K4Y9zlGGiBw5c/i738EIPLwBDHsM0BK3xzlkBc8Uht0=; b=cAOfNXFCHQoWYTtO2yv3lDo1p2EqS86nJ7F2RT512oIVPdOSi9XjzcVKwaiLeUTdQR PrRyH6dHo7flpcamYWFOlLWU/G4KRwzxXKiUxn3NMZx8OXsoE8jbj6ray9zmYH8Th6HE gL42NkAZalsLWAYX3iH77+Kzr75uUMfkK8oHs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc :content-type; bh=K4Y9zlGGiBw5c/i738EIPLwBDHsM0BK3xzlkBc8Uht0=; b=DrnVlUBjDswWlCURhFoA6xKsdkVBHtUSEg0jlNdBImJmcYyaR5YNx4HT2myKSmkZGZ GYB+kFpuut3Y9AGmjyJY6CkLqVMO1+ja7ukR0Vn/qr8bO443gcoFfSyJEA9U/G784z9H iUdtwkdY43b43koNeK70Wbld8EPzieE11wC1yrPmbHR1C/0q6A/w8M8VPDywY0w4iDEh ItHgFUXgmN5txbz0yaHhX1TYwz//4uD0lVV4EHXwKtYYHRJaG+v301Y0HaVjsttAiiTH XB3/+At8FqU17oikloe49F9qrt6Qxa3p14icorLyKJpkQXMPhJ0e0eJZgkG0AujxmFt3 Aw6w== X-Gm-Message-State: AG10YOSL3XfCfg8S3HtbD5wU7d6oXe+jWp8oj+eYJ7oBROq/audRTORC5Ud/qwMda+evb3phyMF9A/yc4gMAgQle MIME-Version: 1.0 X-Received: by 10.28.179.130 with SMTP id c124mr32128835wmf.76.1454942606347; Mon, 08 Feb 2016 06:43:26 -0800 (PST) Received: by 10.27.133.196 with HTTP; Mon, 8 Feb 2016 06:43:26 -0800 (PST) Date: Mon, 8 Feb 2016 20:13:26 +0530 Message-ID: Subject: Panic on reloading a driver with same DEVICE_PROBE() return value From: Sreekanth Reddy To: ken@freebsd.org Cc: 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: Mon, 08 Feb 2016 14:43:29 -0000 Hi, We are trying to rename our out-of-box driver from "mpslsi3" to "mpr" (which is the inbox driver name). From in-box to out-of-box driver diff is vary small. Here are the steps to reproduce this issue, 1. Replace the in-box mpr.ko file from out-of-box's mpr.ko file in /boot/kernel/ path 2. Added below line in the file /boot/loader.conf mpr_load="YES" 3. Then rebooted the server and verified that out-of-box driver is loaded during the boot time. 4. Then unloaded the mpr driver using "kldunload mpr" command. 5. Now when I reload the driver using "kldload mpr" then we observed below panic -------------------------------------------------------------------------------------------------------------------------------------------- Unread portion of the kernel message buffer: mpr0: port 0x8000-0x80ff mem 0xdfe40000-0xdfe4ffff,0xdfe00000-0xdfe3ffff irq 32 at device 0.0 on pci1 Fatal trap 12: page fault while in kernel mode cpuid = 2; apic id = 04 fault virtual address = 0x8 fault code = supervisor read data, page not present instruction pointer = 0x20:0xffffffff8092adf9 stack pointer = 0x28:0xfffffe085d0cb2b0 frame pointer = 0x28:0xfffffe085d0cb300 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 770 (kldload) trap number = 12 panic: page fault cpuid = 2 KDB: stack backtrace: #0 0xffffffff80984e30 at kdb_backtrace+0x60 #1 0xffffffff809489e6 at vpanic+0x126 #2 0xffffffff809488b3 at panic+0x43 #3 0xffffffff80d4aadb at trap_fatal+0x36b #4 0xffffffff80d4addd at trap_pfault+0x2ed #5 0xffffffff80d4a47a at trap+0x47a #6 0xffffffff80d307f2 at calltrap+0x8 #7 0xffffffff819a0930 at _end+0x2a7d00 #8 0xffffffff8199e5ba at _end+0x2a598a #9 0xffffffff8097bbfd at device_attach+0x43d #10 0xffffffff8069385a at pci_driver_added+0xea #11 0xffffffff80979d3a at devclass_driver_added+0x7a #12 0xffffffff80979c9c at devclass_add_driver+0x11c #13 0xffffffff8092d50b at module_register_init+0xfb #14 0xffffffff80922bf7 at linker_load_module+0xc07 #15 0xffffffff80924043 at kern_kldload+0xc3 #16 0xffffffff8092411b at sys_kldload+0x5b #17 0xffffffff80d4b3f7 at amd64_syscall+0x357 ------------------------------------------------------------------------------------------------------------------------------------------ Note: * Same panic occurs, even if we unload and load the in-box mpr driver. * Now both in-box and in out-of-box drivers return with "BUS_PROBE_DEFAULT" from device_probe() callback function. we won't observe any panic if we reload the the driver with higher device_probe() return value when compared with the drive's device_probe() return value which has loaded during the OS boot time. For example: 1. First booted the OS with the out-of-box driver which returns with "BUS_PROBE_DEFAULT" device_probe() return value. 2. Then I have unloaded this out-of-box driver using kldunload command, 3. Then in driver code, I have modified the device_probe()'s return value to "BUS_PROBE_VENDOR" and then compiled and loaded this experimented driver successfully with out any panic. 4. Again I am observing same issue if I reboot the OS with this experimented driver loaded a boot time and if reload the same experimented driver. I found that panic occurs while first time allocating memory with malloc() API, In mpr driver, it occurs while executing below line while reloading the same driver, sc->facts = malloc(sizeof(MPI2_IOC_FACTS_REPLY), M_MPR, M_ZERO|M_NOWAIT); Here are my quires: * Why driver reload will successful only if the device_probe()'s return value is higher then the driver which has loaded during OS boot time. Whether kernel will save device_probe()'s return value of the driver which is loaded during the OS boot time. * 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. Thanks, Sreekanth From owner-freebsd-scsi@freebsd.org Mon Feb 8 18:37:09 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 122DCAA1A2A for ; Mon, 8 Feb 2016 18:37:09 +0000 (UTC) (envelope-from jhb@freebsd.org) 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 F415F1F0E for ; Mon, 8 Feb 2016 18:37:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id F0A55AA1A28; Mon, 8 Feb 2016 18:37:08 +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 EFC03AA1A24; Mon, 8 Feb 2016 18:37:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFFB31F0B; Mon, 8 Feb 2016 18:37:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 32815B958; Mon, 8 Feb 2016 13:37:07 -0500 (EST) From: John Baldwin To: freebsd-current@freebsd.org Cc: Sreekanth Reddy , ken@freebsd.org, scsi@freebsd.org, current@freebsd.org Subject: Re: Panic on reloading a driver with same DEVICE_PROBE() return value Date: Mon, 08 Feb 2016 10:28:45 -0800 Message-ID: <33145844.5EAIpev2G5@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 08 Feb 2016 13:37:07 -0500 (EST) 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: Mon, 08 Feb 2016 18:37:09 -0000 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. > * 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 -- John Baldwin From owner-freebsd-scsi@freebsd.org Tue Feb 9 09:25:57 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 E653FAA234B for ; Tue, 9 Feb 2016 09:25:56 +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 C8E88D92 for ; Tue, 9 Feb 2016 09:25:56 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: by mailman.ysv.freebsd.org (Postfix) id C9089AA2349; Tue, 9 Feb 2016 09:25:56 +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 C8A46AA2348 for ; Tue, 9 Feb 2016 09:25:56 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) (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 64408D8D for ; Tue, 9 Feb 2016 09:25:56 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: by mail-wm0-x235.google.com with SMTP id g62so14569125wme.0 for ; Tue, 09 Feb 2016 01:25:56 -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=ZsqPExS5WZI2cQT5BEYzu2HaDEVgz3QQ/U/X0UqDCzc=; b=DCw4FTwPqyaxT4wISYZqN0QOE5eMavlYo1GNkc+lq45RlbsyIpZ311MAMZH1NJO+lH 2T4S+BtvCe3ycjuMjfWCg9wV7liv8O6wJJP1pYLO/j2iz0BJpHD1bMobrG9S2+NYnEil /39BdCSgyIpndoNQTWwBlY3C5KXsJlUWQgKjk= 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=ZsqPExS5WZI2cQT5BEYzu2HaDEVgz3QQ/U/X0UqDCzc=; b=cHtrRDuFg1FpzIansIQwpsuyW+JYMzVpUAg3RaBNnV/fh9lx2nsRmSk8bp7hMAzcT1 Ld0UDbNBQ/xkT90DJVwy9Uerrm6TPnv4HGDJ9xCCHl0l2fk7Ss9DmDorThkX5lbCv6JB teJ9lVfqw05TSB5A6FLS6OKyx1zrKgsFMbQPAZeSrFuaMf+1jrZKJ4LyYvemwhHodAqp LHj2XbJllC9xLj4iX2JIO6hRrFEVkygrVBvxnIr8DBfs9mft9VECnZp24+GwNdghJBIq a/Q7gnOWXnopvOVLSAOjjUllxim3JzEynPXx1moeYmFnvkm/Elb9tq7Oy3z3lNBU5/zN nq0A== X-Gm-Message-State: AG10YOQ9thmHxM9uCRKbeqhBikIRlk2/osl7B3j8NSnkkUTFBPpAFrOVkzyuioDOSd/Fq2hUZm+GXd8T2TtZB9Wp MIME-Version: 1.0 X-Received: by 10.194.58.169 with SMTP id s9mr28055695wjq.52.1455009954500; Tue, 09 Feb 2016 01:25:54 -0800 (PST) Received: by 10.27.133.196 with HTTP; Tue, 9 Feb 2016 01:25:54 -0800 (PST) In-Reply-To: <33145844.5EAIpev2G5@ralph.baldwin.cx> References: <33145844.5EAIpev2G5@ralph.baldwin.cx> Date: Tue, 9 Feb 2016 14:55:54 +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 09:25:57 -0000 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 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 From owner-freebsd-scsi@freebsd.org Tue Feb 9 22:02:12 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 642B6AA263A for ; Tue, 9 Feb 2016 22:02:12 +0000 (UTC) (envelope-from jhb@freebsd.org) 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 533A61A61 for ; Tue, 9 Feb 2016 22:02:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 50EDCAA2639; Tue, 9 Feb 2016 22:02:12 +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 50679AA2638; Tue, 9 Feb 2016 22:02:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 320FC1A60; Tue, 9 Feb 2016 22:02:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 1FB56B999; Tue, 9 Feb 2016 17:02:11 -0500 (EST) From: John Baldwin To: Sreekanth Reddy Cc: freebsd-current@freebsd.org, ken@freebsd.org, scsi@freebsd.org Subject: Re: Panic on reloading a driver with same DEVICE_PROBE() return value Date: Tue, 09 Feb 2016 14:00:12 -0800 Message-ID: <2227929.z5Tr1XC1Xs@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 09 Feb 2016 17:02:11 -0500 (EST) 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:02:12 -0000 On Tuesday, February 09, 2016 05:45:38 PM Sreekanth Reddy wrote: > 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. 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: "module_register: cannot register pci/mpr from blah.ko; already loaded from foo.ko" -- John Baldwin 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 From owner-freebsd-scsi@freebsd.org Tue Feb 9 23:17:36 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 2DC53AA2CF2 for ; Tue, 9 Feb 2016 23:17:36 +0000 (UTC) (envelope-from jhb@freebsd.org) 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 13705676 for ; Tue, 9 Feb 2016 23:17:36 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 12049AA2CE6; Tue, 9 Feb 2016 23:17:36 +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 1186EAA2CE5; Tue, 9 Feb 2016 23:17:36 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5CC6674; Tue, 9 Feb 2016 23:17:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7C77AB94A; Tue, 9 Feb 2016 18:17:34 -0500 (EST) From: John Baldwin To: Scott Long Cc: Sreekanth Reddy , freebsd-current@freebsd.org, ken@freebsd.org, scsi@freebsd.org Subject: Re: Panic on reloading a driver with same DEVICE_PROBE() return value Date: Tue, 09 Feb 2016 15:02:59 -0800 Message-ID: <1675870.rYHsh4pVC7@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <0C31DEA0-0AD0-4E1B-9656-C6ABB6AA854A@yahoo.com> References: <2227929.z5Tr1XC1Xs@ralph.baldwin.cx> <0C31DEA0-0AD0-4E1B-9656-C6ABB6AA854A@yahoo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 09 Feb 2016 18:17:34 -0500 (EST) 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 23:17:36 -0000 On Tuesday, February 09, 2016 03:17:39 PM Scott Long wrote: >=20 > > 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 requ= ired 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 loa= ded from foo.ko" >=20 >=20 > So the problem wasn=E2=80=99t that the malloc was failing, it was tha= t sc was pointing to memory > that the driver didn=E2=80=99t own, so the fault was happening from a= ssigning 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 enoug= h signal. I'm actually not certain of what triggered the fault. The check that e= mits the printf should also be failing the kldload with EEXIST (but that doe= sn't work for the case where both are compiled into the kernel). The new dr= iver should have just never been registered, but then I'm not sure how its m= ethod could be called at all. The only reference to the driver's methods are= in the struct driver which also has the associated softc size (so you shouldn'= t get a mismatch between softc size and the driver methods used). --=20 John Baldwin From owner-freebsd-scsi@freebsd.org Wed Feb 10 11:07:28 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 B7ACFAA26D3 for ; Wed, 10 Feb 2016 11:07:28 +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 98E5E6A7 for ; Wed, 10 Feb 2016 11:07:28 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: by mailman.ysv.freebsd.org (Postfix) id 99A3DAA26D1; Wed, 10 Feb 2016 11:07:28 +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 7F51EAA26CF for ; Wed, 10 Feb 2016 11:07:28 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (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 26F316A4 for ; Wed, 10 Feb 2016 11:07:28 +0000 (UTC) (envelope-from sreekanth.reddy@broadcom.com) Received: by mail-wm0-x22d.google.com with SMTP id p63so22978136wmp.1 for ; Wed, 10 Feb 2016 03:07:28 -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=4coW5Q9njeKK+A9EHJGEUo3mQ5Gl2X6KhY/L7yfP7ts=; b=NxhGRZDIV9Q5oX0qcfY+urxz2ao4Pr3+YF82hOr4a7lP2KXLN8UhA/vD/Js3cN28PC 3vqlwuXEPou9dEViOhMQPI3jYpD1fu5THFe4K+msjkivpi0Rlf/caQ24sN0Z0AcC2rSo +ww+fBGNbOfuADtcWNoDO4JDVnS6PP+tzTgas= 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=4coW5Q9njeKK+A9EHJGEUo3mQ5Gl2X6KhY/L7yfP7ts=; b=bQUava3LqH+uOhMebwM1PxSO+vILcyhNINeZyukWf3fVMofsVMIHOr8dSQUr2vELpP E11GEGco/p8bClR92x2SA6XKFEqA0asazAO3gFzIGZ1tajWiHJ8pUIbScgRN41Wnz3tQ vG8aqqp5zLovxHQufXZh25DLbE011BiPzckiGidw0BJhgvccZXnCJFtBxminbF/sJqCP 3KBug1SOzJQiTC5ML7kBxD2iLxATAfYCBLEufvIMVpyswouSu479gb4mHVZP3baiAisM LJ+qOVOi7f5x0a2jbcTFk9nJv7b985qmS0ubc10JpFd1aGhXzJwaebBCnx+oPT2PXtYt sDoA== X-Gm-Message-State: AG10YOSkxEL2w99eqVqGigLmcRXX/NsNMVJQ7Ei/HtkmtDDPnrzahcwiEzhV5HxSAysqsvesgtND7SDkPPMYF9RN MIME-Version: 1.0 X-Received: by 10.28.12.9 with SMTP id 9mr10745439wmm.76.1455102445946; Wed, 10 Feb 2016 03:07:25 -0800 (PST) Received: by 10.27.133.196 with HTTP; Wed, 10 Feb 2016 03:07:25 -0800 (PST) In-Reply-To: <2227929.z5Tr1XC1Xs@ralph.baldwin.cx> References: <2227929.z5Tr1XC1Xs@ralph.baldwin.cx> Date: Wed, 10 Feb 2016 16:37:25 +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 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: Wed, 10 Feb 2016 11:07:28 -0000 On Wed, Feb 10, 2016 at 3:30 AM, John Baldwin wrote: > On Tuesday, February 09, 2016 05:45:38 PM Sreekanth Reddy wrote: >> 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. > > 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: > > "module_register: cannot register pci/mpr from blah.ko; already loaded from foo.ko" Yes, I am getting below messages, at OS boot time for Out-of-box driver module_register: module pci/mpr already exists! Module pci/mpr failed to register: 17 > > -- > John Baldwin From owner-freebsd-scsi@freebsd.org Thu Feb 11 09:44:05 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 D93ADAA4870 for ; Thu, 11 Feb 2016 09:44:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) 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 C4C3B1201 for ; Thu, 11 Feb 2016 09:44:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: by mailman.ysv.freebsd.org (Postfix) id C5414AA486F; Thu, 11 Feb 2016 09:44:05 +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 C4B62AA486E; Thu, 11 Feb 2016 09:44:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 6141111F9; Thu, 11 Feb 2016 09:44:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id LAA01735; Thu, 11 Feb 2016 11:43:58 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1aTnn4-000EVM-Fd; Thu, 11 Feb 2016 11:43:58 +0200 Subject: Re: Panic on reloading a driver with same DEVICE_PROBE() return value To: John Baldwin , Scott Long References: <2227929.z5Tr1XC1Xs@ralph.baldwin.cx> <0C31DEA0-0AD0-4E1B-9656-C6ABB6AA854A@yahoo.com> <1675870.rYHsh4pVC7@ralph.baldwin.cx> Cc: scsi@FreeBSD.org, Sreekanth Reddy , ken@FreeBSD.org, freebsd-current@FreeBSD.org From: Andriy Gapon Message-ID: <56BC57A6.7090205@FreeBSD.org> Date: Thu, 11 Feb 2016 11:43:02 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <1675870.rYHsh4pVC7@ralph.baldwin.cx> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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: Thu, 11 Feb 2016 09:44:05 -0000 On 10/02/2016 01:02, John Baldwin wrote: > I'm actually not certain of what triggered the fault. The check that emits > the printf should also be failing the kldload with EEXIST (but that doesn't > work for the case where both are compiled into the kernel). The new driver > should have just never been registered, but then I'm not sure how its method > could be called at all. The only reference to the driver's methods are in the > struct driver which also has the associated softc size (so you shouldn't get > a mismatch between softc size and the driver methods used). I haven't really followed this thread and my memory about my own problem has significantly faded, but could the issue #2 in the following post be related? http://thread.gmane.org/gmane.os.freebsd.current/147256 Sorry for the noise if it's totally unrelated. -- Andriy Gapon