kern/51352: panic: malloc(M_WAITOK) in interrupt context

dada at sbox.tugraz.at dada at sbox.tugraz.at
Thu Apr 24 07:10:07 PDT 2003


>Number:         51352
>Category:       kern
>Synopsis:       panic: malloc(M_WAITOK) in interrupt context
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 24 07:10:04 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Martin Kammerhofer
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
Graz University
>Environment:
System: FreeBSD box.at.home 4.8-STABLE FreeBSD 4.8-STABLE #1: Wed Apr 23
22:43:46 CEST 2003 toor at box.at.home:/usr/obj/usr/src-4.x/sys/LEND4 i386

>Description:
	Machine panics when resuming from APM suspend mode.
	(Repeated "panic" lines below are obtained with the little patch
	 below at "Fix:")

resumed from suspended mode (slept 00:00:02)
ata0: resetting devices .. ad0: DMA limited to UDMA33, non-ATA66 cable or device
panic: malloc(M_WAITOK) in interrupt context
panic: malloc(M_WAITOK) in interrupt context
panic: malloc(M_WAITOK) in interrupt context
panic: malloc(M_WAITOK) in interrupt context
done
ata1: resetting devices .. panic: malloc(M_WAITOK) in interrupt context
panic: malloc(M_WAITOK) in interrupt context
panic: malloc(M_WAITOK) in interrupt context
panic: malloc(M_WAITOK) in interrupt context
done

>How-To-Repeat:
	Compile, install and boot a i386 -STABLE kernel with
	        device apm0
		options INVARIANTS
		options INVARIANT_SUPPORT.
	Enable apm and suspend.
	# apm -e 1 && zzz

>Fix:
	I don't have a fix, only two lame workarounds:
	a) remove INVARIANTS from kernel, or
	b) downgrade the panic() to printf()

*** /usr/src-4.8/sys/kern/kern_malloc.c	Sat Mar 16 03:19:51 2002
--- /usr/src/sys/kern/kern_malloc.c	Sat Mar 16 03:19:51 2002
***************
*** 153,161 ****
  	register struct malloc_type *ksp = type;

  #if defined(INVARIANTS) && defined(__i386__)
! 	if (flags == M_WAITOK)
! 		KASSERT(intr_nesting_level == 0,
! 		   ("malloc(M_WAITOK) in interrupt context"));
  #endif
  	/*
  	 * Must be at splmem() prior to initializing segment to handle
--- 153,160 ----
  	register struct malloc_type *ksp = type;

  #if defined(INVARIANTS) && defined(__i386__)
! 	if (flags == M_WAITOK && intr_nesting_level != 0)
! 		 printf("panic: malloc(M_WAITOK) in interrupt context\n");
  #endif
  	/*
  	 * Must be at splmem() prior to initializing segment to handle



	Here is my kernel configuration:
machine		i386
ident		LEND4
maxusers	0
makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
options 	PQ_CACHESIZE=512	# color for 512k/16k cache
options 	INCLUDE_CONFIG_FILE     # Include this file in kernel
options 	ROOTDEVNAME=\"ufs:ad0s1a\"
cpu		I686_CPU		# aka Pentium Pro(tm)
options 	CPU_ENABLE_SSE
options 	NO_F00F_HACK
options 	COMPAT_43
options 	USER_LDT		#allow user-level control of i386 ldt
options 	SYSVSHM		# include support for shared memory
options 	SYSVSEM		# include support for semaphores
options 	SYSVMSG		# include support for message queues
options 	DDB
options 	KTRACE			#kernel tracing
options 	INVARIANTS
options 	INVARIANT_SUPPORT
options 	PERFMON
options 	UCONSOLE
options 	USERCONFIG		#boot -c editor
options 	VISUAL_USERCONFIG	#visual boot -c editor
options 	INET			#Internet communications protocols
options 	IPSEC			#IP security
options 	IPSEC_ESP		#IP security (crypto; define w/ IPSEC)
pseudo-device	ether			#Generic Ethernet
pseudo-device	loop			#Network loopback device
pseudo-device	bpf			#Berkeley packet filter
pseudo-device	disc			#Discard device (ds0, ds1, etc)
pseudo-device	tun			#Tunnel driver (ppp(8), nos-tun(8))
pseudo-device	gre			#IP over IP tunneling
options 	IPFIREWALL		#firewall
options 	IPFW2			#use ipfw in 4.X-STABLE
options 	IPFIREWALL_VERBOSE	#enable logging to syslogd(8)
options 	IPFIREWALL_FORWARD	#enable transparent proxy support
options 	IPFIREWALL_VERBOSE_LIMIT=100	#limit verbosity
options 	IPDIVERT		#divert sockets
options 	IPSTEALTH		#support for stealth forwarding
options 	TCPDEBUG
options 	RANDOM_IP_ID
options                ACCEPT_FILTER_DATA
options                ACCEPT_FILTER_HTTP
options 	TCP_DROP_SYNFIN		#drop TCP packets with SYN+FIN
options 	ICMP_BANDLIM
options 	DUMMYNET
options         DEVICE_POLLING
options 	FFS			#Fast filesystem
options 	MFS			#Memory File System
options 	NFS			#Network File System
options 	CD9660			#ISO 9660 filesystem
options 	FDESC			#File descriptor filesystem
options 	KERNFS			#Kernel filesystem
options 	MSDOSFS			#MS DOS File System
options 	PROCFS			#Process filesystem
options 	FFS_ROOT		#FFS usable as root device
options 	SOFTUPDATES
options 	UFS_DIRHASH
options 	MD_ROOT
options 	MD_NSECT=40000
options 	NSWAPDEV=5
options 	QUOTA			#enable disk quotas
options 	SUIDDIR
options 	EXT2FS
options 	P1003_1B
options 	_KPOSIX_PRIORITY_SCHEDULING
options 	_KPOSIX_VERSION=199309L
options 	HZ=440
device		scbus			#base SCSI code
device		da			#SCSI direct access devices (aka disks)
device		cd			#SCSI CD-ROMs
device		pass			#CAM passthrough driver
options 	SCSI_DELAY=1000	# Be optimistic about Joe SCSI device
pseudo-device	pty		#Pseudo ttys
pseudo-device	speaker		#Play IBM BASIC-style noises out your speaker
pseudo-device	gzip		#Exec gzipped a.out's
pseudo-device	vn		#Vnode driver (turns a file into a device)
pseudo-device	md		#Memory/malloc disk
pseudo-device	snp		#Snoop device - to look at pty/vty/etc..
options 	LIBICONV
options 	MSGBUF_SIZE=40960
device		isa
device		atkbdc0	at isa? port IO_KBD
device		atkbd0	at atkbdc? irq 1
options 	ATKBD_DFLT_KEYMAP	# specify the built-in keymap
makeoptions	ATKBD_DFLT_KEYMAP="german.iso"
device		psm0	at atkbdc? irq 12
device		vga0	at isa?
options 	VGA_WIDTH90		# support 90 column modes
options 	VESA
pseudo-device	splash
device		sc0	at isa?
options 	MAXCONS=16		# number of virtual consoles
options 	SC_DFLT_FONT		# compile font in
makeoptions	SC_DFLT_FONT=iso
options 	SC_HISTORY_SIZE=2000	# number of history buffer lines
options 	SC_PIXEL_MODE		# add support for the raster text mode
options 	SC_NORM_ATTR="(FG_GREEN|BG_BLACK)"
options 	SC_NORM_REV_ATTR="(FG_YELLOW|BG_GREEN)"
options 	SC_KERNEL_CONS_ATTR="(FG_YELLOW|BG_BLACK)"
options 	SC_KERNEL_CONS_REV_ATTR="(FG_YELLOW|BG_BLUE)"
device		npx0	at nexus? port IO_NPX flags 0x0 irq 13
device		ata
device		atadisk		# ATA disk drives
device		atapicd		# ATAPI CDROM drives
device		atapifd		# ATAPI floppy drives
device		atapist		# ATAPI tape drives
device		atapicam	# emulate ATAPI devices as SCSI ditto via CAM
options 	ATA_STATIC_ID
device		fdc0	at isa? port IO_FD1 irq 6 drq 2
device		fd0	at fdc0 drive 0
device		fd1	at fdc0 drive 1
device		sio0	at isa? port IO_COM1 flags 0x10 irq 4
device		sio1	at isa? port IO_COM2            irq 3
device		pcm
device		sbc
device		pca0 at isa? port IO_TIMER1
device		apm0
device		joy0	at isa? port IO_GAME
device		pci
options 	PCI_ENABLE_IO_MODES
device		agp
device		ahc		# AHA2940 and onboard AIC7xxx devices
device		smbus		# Bus support, required for smb below.
device		intpm
device		smb
device		ppc0	at isa? irq 7
device		ppbus
device		vpo
device		lpt
device		plip
device		ppi
options		DIRECTIO
device		uhci
device		ohci
device		usb
device		ugen
device		ukbd
device		ulpt
device		ums
device		uscanner
options 	SHOW_BUSYBUFS	# List buffers that prevent root unmount

>Release-Note:
>Audit-Trail:
>Unformatted:
 To: FreeBSD-gnats-submit at freebsd.org
 From: Martin Kammerhofer <dada at sbox.tugraz.at>
 Reply-To: Martin Kammerhofer <dada at sbox.tugraz.at>
 Cc:
 X-send-pr-version: 3.113
 X-GNATS-Notify:
 
 


More information about the freebsd-bugs mailing list