Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 208493

Summary: [2.6.24 regression] arcmsr causes dma_free_coherent() warning flood
Product: Gentoo Linux Reporter: Joshua Hoblitt <j_gentoo>
Component: [OLD] Core systemAssignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers <kernel>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: High    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
URL: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=69e562c234440fb7410877b5b24f4b29ef8521d1
Whiteboard: linux-2.6.24-regression
Package list:
Runtime testing required: ---
Attachments: .config
dmesg
lspci -v
patch

Description Joshua Hoblitt 2008-02-01 20:37:06 UTC
This warning completely fills up the dmesg in seconds (maybe less).  It is caused by starting up the Areca RAID card http pass through proxy called archttp.  This warning does not existing under 2.6.23.

WARNING: at arch/x86/kernel/pci-dma_64.c:169 dma_free_coherent()
Pid: 8232, comm: archttp64 Not tainted 2.6.24-gentoo #1

Call Trace:
 [<ffffffff80212f24>] dma_alloc_coherent+0x1ba/0x1d2
 [<ffffffff80212c53>] dma_free_coherent+0x43/0x82
 [<ffffffff88044b65>] :arcmsr:arcmsr_queue_command+0x368/0x959
 [<ffffffff8042078f>] scsi_dispatch_cmd+0x1a9/0x1fe
 [<ffffffff804259c4>] scsi_request_fn+0x26f/0x33e
 [<ffffffff8038a781>] blk_execute_rq_nowait+0x7a/0x8e
 [<ffffffff80425471>] scsi_execute_async+0x345/0x394
 [<ffffffff8022d813>] __wake_up_common+0x41/0x74
 [<ffffffff8045b9dc>] sg_common_write+0x6b7/0x6ef
 [<ffffffff8045bc31>] sg_cmd_done+0x0/0x1d6
 [<ffffffff8022e200>] __dequeue_entity+0x1c/0x32
 [<ffffffff8045bc0e>] sg_new_write+0x1fa/0x21d
 [<ffffffff8045c31a>] sg_ioctl+0x218/0xa31
 [<ffffffff8024dc70>] hrtimer_cancel+0xc/0x16
 [<ffffffff8058d483>] do_nanosleep+0x55/0x7e
 [<ffffffff8024de3b>] hrtimer_nanosleep+0x5b/0xfe
 [<ffffffff802a5539>] do_ioctl+0x55/0x6b
 [<ffffffff802a579c>] vfs_ioctl+0x24d/0x266
 [<ffffffff802a57f1>] sys_ioctl+0x3c/0x5f
 [<ffffffff8020be2e>] system_call+0x7e/0x83


Reproducible: Always




 emerge --info
Portage 2.1.2.9 (!..//usr/portage/profiles/default-linux/amd64/2007.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.24-gentoo x86_64)
=================================================================
System uname: 2.6.24-gentoo x86_64 Dual Core AMD Opteron(tm) Processor 280
Gentoo Base System release 1.12.9
Timestamp of tree: Tue, 29 Jan 2008 20:30:01 +0000
distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p15-r1
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.6.3, 1.7.9-r1, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=k8"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config /usr/share/genkernel"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/init.d /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=k8"
DISTDIR="/portage/distfiles"
FEATURES="buildpkg ccache digest distlocks fixpackages metadata-transfer parallel-fetch sandbox sfperms strict suidctl userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
MAKEOPTS="-j5"
PKGDIR="/data/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/data/portage"
PORTDIR_OVERLAY="/data/portage_overlay"
SYNC="rsync://gentoo.ifa.hawaii.edu/gentoo-portage-ipp"
USE="X acl acpi amd64 apache2 bash-completion berkdb bitmap-fonts cli cracklib crypt cups dri firefox fontconfig fortran gdbm gif gnome gnome2 gnutls gpm graphviz gtk gtk2 iconv imap ipv6 isdnlog jbig jpeg jpeg2k lcms mbox midi mmx mpeg mudflap ncurses nfs nls nptl openmp pam pcre perl pic png pppd python readline reflection samba session spl sse sse2 ssl svg sysfs tcpd tiff truetype truetype-fonts type1-fonts unicode vim-with-x xattr xinerama xorg xpm xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="r128 radeon nv vga"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Mike Pagano gentoo-dev 2008-02-02 19:56:15 UTC
dmesg, lspci -v  and .config please
Comment 2 Joshua Hoblitt 2008-02-02 22:09:11 UTC
Created attachment 142544 [details]
.config
Comment 3 Joshua Hoblitt 2008-02-02 22:09:27 UTC
Created attachment 142545 [details]
dmesg
Comment 4 Joshua Hoblitt 2008-02-02 22:09:41 UTC
Created attachment 142546 [details]
lspci -v
Comment 5 Kim Højgaard-Hansen 2008-02-06 17:06:11 UTC
The warning was added in 2.6.24 with this commit:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=aa24886e379d2b641c5117e178b15ce1d5d366ba

--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -167,6 +167,7 @@ EXPORT_SYMBOL(dma_alloc_coherent);
 void dma_free_coherent(struct device *dev, size_t size,
                         void *vaddr, dma_addr_t bus)
 {
+       WARN_ON(irqs_disabled());       /* for portability */

dma_free_coherent() needs irqs enabled (sigh)

On at least ARM (and I'm told MIPS too) dma_free_coherent() has a newish
call context requirement: unlike its dma_alloc_coherent() sibling, it may
not be called with IRQs disabled.  (This was new behavior on ARM as of late
2005, caused by ARM SMP updates.) This little surprise can be annoyingly
driver-visible.

Since it looks like that restriction won't be removed, this patch changes
the definition of the API to include that requirement.  Also, to help catch
nonportable drivers, it updates the x86 and swiotlb versions to include the
relevant warnings.  (I already observed that it trips on the
bus_reset_tasklet of the new firewire_ohci driver.)
Comment 6 Kim Højgaard-Hansen 2008-02-09 17:05:20 UTC
@Joshua

If you have the time, it would help us if you can do the following:

Assuming you have not modified the gentoo-sources-2.6.24 kernel config since you posted your dmesg output (if you have, we need a new one):

install gdb
cd /usr/src/linux-2.6.24-gentoo
rm drivers/scsi/arcmsr/arcmsr_hba.o
make CONFIG_DEBUG_INFO=y drivers/scsi/arcmsr/arcmsr_hba.o

this will compile the driver in question with debug information, which we can then use in GDB:

gdb drivers/scsi/arcmsr/arcmsr_hba.o

then at the GDB promt:

list *arcmsr_queue_command+0x368

and then post the output here.
Comment 7 Joshua Hoblitt 2008-02-09 19:33:04 UTC
Hi Kim,

The only modification I've made to the sources is pulling down the latest forcedeth.c from netdev-2.6.  Here ya go:

ipp000 linux # rm drivers/scsi/arcmsr/arcmsr_hba.o
ipp000 linux # make CONFIG_DEBUG_INFO=y drivers/scsi/arcmsr/arcmsr_hba.o
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CC      arch/x86/kernel/asm-offsets.s
  GEN     include/asm-x86/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CC      scripts/mod/empty.o
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CC [M]  drivers/scsi/arcmsr/arcmsr_hba.o
ipp000 linux # gdb drivers/scsi/arcmsr/arcmsr_hba.o
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) list *arcmsr_queue_command+0x368
0x16e1 is in arcmsr_queue_command (include/asm-generic/pci-dma-compat.h:29).
24
25      static inline void
26      pci_free_consistent(struct pci_dev *hwdev, size_t size,
27                          void *vaddr, dma_addr_t dma_handle)
28      {
29              dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle);
30      }
31
32      static inline dma_addr_t
33      pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
(gdb) 
Comment 8 Daniel Drake (RETIRED) gentoo-dev 2008-02-15 19:26:24 UTC
Created attachment 143585 [details, diff]
patch

Please apply this patch to 2.6.24 and see if the messages go away
Comment 9 Joshua Hoblitt 2008-02-15 20:55:06 UTC
I applied the patch to 2.6.24-r2 and the warnings are gone.  I would very much like to see this patch go into the gentoo patch set and be submitted for 2.6.24.y inclusion.  Thanks!
Comment 10 Daniel Drake (RETIRED) gentoo-dev 2008-02-15 21:05:21 UTC
thanks for testing, queued it up
Comment 11 Daniel Drake (RETIRED) gentoo-dev 2008-02-26 17:11:38 UTC
Fixed in genpatches-2.6.24-4 (gentoo-sources-2.6.24-r3), thanks for helping us out on this issue