From owner-freebsd-hackers@FreeBSD.ORG Thu Jan 27 14:57:15 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E5D1B16A4CE for ; Thu, 27 Jan 2005 14:57:15 +0000 (GMT) Received: from brolloks.trispen.com (brolloks.trispen.com [196.22.177.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9DFA643D1D for ; Thu, 27 Jan 2005 14:57:13 +0000 (GMT) (envelope-from jf@trispen.com) Received: from localhost (unknown [127.0.0.1]) by brolloks.trispen.com (Postfix) with ESMTP id A6A1322E6E for ; Thu, 27 Jan 2005 14:57:10 +0000 (GMT) Received: from brolloks.trispen.com ([127.0.0.1]) by localhost (brolloks.trispen.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 83488-09 for ; Thu, 27 Jan 2005 16:57:04 +0200 (SAST) Received: from [10.7.146.143] (tpnnat.trispen.com [196.22.177.50]) by brolloks.trispen.com (Postfix) with ESMTP id A279B22E6A for ; Thu, 27 Jan 2005 16:57:04 +0200 (SAST) Message-ID: <41F90140.3020705@trispen.com> Date: Thu, 27 Jan 2005 09:57:04 -0500 From: Jacques Fourie User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org X-Enigmail-Version: 0.89.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/mixed; boundary="------------020505080904080900050008" X-Virus-Scanned: by amavisd-new at trispen.com Subject: kernel vm question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: jf@trispen.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2005 14:57:16 -0000 This is a multi-part message in MIME format. --------------020505080904080900050008 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I have a kernel module with the following entry point : static int test_modevent(module_t mod, int type, void *unused) { int s; unsigned char *p = NULL; unsigned char v = 0x55; switch (type) { case MOD_LOAD: p = (unsigned char *)ip_output; s = splhigh(); v = p[0]; /* Page fault without this line */ p[0] = v; printf("val = %02X\n", v); splx(s); break; case MOD_UNLOAD: break; default: break; } return 0; } If I remove the line "Page fault without this line" line, I get a page fault when loading this module. This crash seems to be hardware as well as version specific - I can not reproduce the crash on 4.8 but on one particular piece of hardware it crashes consistently on 4.9 and 4.10. Could someone please help me in understanding this behaviour? Attached is the full kernel module source and a dmesg of the hardware in question. regards, jacques --------------020505080904080900050008 Content-Type: text/plain; name="dmesg" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="dmesg" Copyright (c) 1992-2004 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 4.10-RELEASE #2: Thu Jan 27 14:36:20 SAST 2005 jacques@fbsd410.trispen.com:/usr/src/sys/compile/MYKERN Timecounter "i8254" frequency 1193182 Hz Timecounter "TSC" frequency 2657822812 Hz CPU: Intel(R) Xeon(TM) CPU 2.66GHz (2657.82-MHz 686-class CPU) Origin = "GenuineIntel" Id = 0xf29 Stepping = 9 Features=0xbfebfbff Hyperthreading: 2 logical CPUs real memory = 4160225280 (4062720K bytes) avail memory = 4054249472 (3959228K bytes) Preloaded elf kernel "kernel" at 0xc0353000. Warning: Pentium 4 CPU: PSE disabled Pentium Pro MTRR support enabled md0: Malloc disk Using $PIR table, 20 entries at 0xc00fde80 npx0: on motherboard npx0: INT 16 interface pcib0: on motherboard pci0: on pcib0 pci0: (vendor=0x8086, dev=0x2541) at 0.1 pcib1: at device 2.0 on pci0 pci1: on pcib1 pci1: (vendor=0x8086, dev=0x1461) at 28.0 pcib2: at device 29.0 on pci1 pci2: on pcib2 pci1: (vendor=0x8086, dev=0x1461) at 30.0 pcib3: at device 31.0 on pci1 pci3: on pcib3 em0: port 0x7000-0x703f mem 0xfc200000-0xfc23ffff,0xfc280000-0xfc29ffff irq 10 at device 1.0 on pci3 em0: Speed:N/A Duplex:N/A em1: port 0x7040-0x707f mem 0xfc240000-0xfc27ffff,0xfc2a0000-0xfc2bffff irq 10 at device 1.1 on pci3 em1: Speed:N/A Duplex:N/A pci0: (vendor=0x8086, dev=0x2544) at 2.1 pci0: at 29.0 irq 10 pci0: at 29.1 irq 5 pci0: at 29.2 irq 10 pcib4: at device 30.0 on pci0 pci4: on pcib4 pci4: at 3.0 irq 11 fxp0: port 0x8400-0x843f mem 0xfc300000-0xfc31ffff,0xfc341000-0xfc341fff irq 10 at device 4.0 on pci4 fxp0: Ethernet address 00:04:23:ae:8c:1d inphy0: on miibus0 inphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto em2: port 0x8440-0x847f mem 0xfc320000-0xfc33ffff irq 11 at device 5.0 on pci4 em2: Speed:N/A Duplex:N/A isab0: at device 31.0 on pci0 isa0: on isab0 atapci0: port 0x6c60-0x6c6f,0-0x3,0-0x7,0-0x3,0-0x7 irq 0 at device 31.1 on pci0 ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 pci0: (vendor=0x8086, dev=0x2483) at 31.3 irq 0 orm0: