Latest working kernel version: Earliest failing kernel version: Distribution: Hardware Environment: Clevo D410J + Optiarc DVD RW AD-7543A Software Environment: Debian Problem Description: The following warning appears in dmesg with Linux 2.6.28 when playing an audio CD with kaffeine 0.8.7. The warning message repeats until the audio playback is not stopped. [ 623.491756] ------------[ cut here ]------------ [ 623.491770] WARNING: at arch/x86/kernel/pci-nommu.c:62 nommu_map_sg+0x22/0xb0() [ 623.491776] Modules linked in: ppdev lp cpufreq_ondemand cpufreq_conservative ipv6 xt_tcpudp iptable_filter ip_tables x_tables l eds_clevo_mail led_class via via_agp drm agpgart eeprom snd_pcm_oss snd_mixer_oss cpufreq_userspace cpufreq_powersave powernow_k8 f an snd_via82xx snd_mpu401_uart snd_seq_midi snd_seq_midi_event mousedev snd_via82xx_modem snd_ac97_codec ac97_bus snd_rawmidi snd_p cm snd_seq snd_timer snd_seq_device pcmcia firmware_class i2c_viapro snd ehci_hcd pcspkr uhci_hcd k8temp hwmon psmouse serio_raw 81 39too mii snd_page_alloc soundcore ide_cd_mod cdrom i2c_core usbcore bitrev crc32 yenta_socket rsrc_nonstatic pcmcia_core 8250_pnp 8250 video backlight output serial_core parport_pc parport battery ac thermal button processor evdev [ 623.491932] Pid: 4418, comm: kaffeine Not tainted 2.6.28 #1 [ 623.491939] Call Trace: [ 623.491952] [<c0338dcf>] ? printk+0x18/0x21 [ 623.491962] [<c0123664>] warn_on_slowpath+0x54/0x80 [ 623.491976] [<c01ab0b5>] ? __find_get_block_slow+0x75/0x130 [ 623.491985] [<c0107d42>] nommu_map_sg+0x22/0xb0 [ 623.491995] [<c02b378a>] ide_build_sglist+0x4a/0x60 [ 623.492004] [<c02b3ae6>] ide_build_dmatable+0x36/0x1a0 [ 623.492012] [<c02b3c8c>] ide_dma_setup+0x3c/0x100 [ 623.492017] [<f819bb30>] ? cdrom_do_newpc_cont+0x0/0x20 [ide_cd_mod] [ 623.492017] [<f819b0a3>] ide_cd_do_request+0x473/0x8b0 [ide_cd_mod] [ 623.492017] [<c023fb6c>] ? delay_tsc+0x6c/0xb4 [ 623.492017] [<c023fabb>] ? __const_udelay+0x1b/0x20 [ 623.492017] [<c02abe92>] ? __ide_wait_stat+0x52/0x120 [ 623.492017] [<c02ac7cf>] ? ide_wait_stat+0x3f/0x90 [ 623.492017] [<c02aa01c>] ide_do_request+0x48c/0xab0 [ 623.492017] [<c033bf8d>] ? _spin_lock_irqsave+0x4d/0x60 [ 623.492017] [<c0144c0b>] ? trace_hardirqs_off+0xb/0x10 [ 623.492017] [<c033bc99>] ? _spin_unlock_irqrestore+0x39/0x70 [ 623.492017] [<c012cb46>] ? del_timer+0x66/0x80 [ 623.492017] [<c02aa849>] do_ide_request+0x19/0x20 [ 623.492017] [<c022f848>] blk_start_queueing+0x18/0x40 [ 623.492017] [<c022d6e4>] elv_insert+0x114/0x1e0 [ 623.492017] [<c012cd97>] ? mod_timer+0x37/0x80 [ 623.492017] [<c022d821>] __elv_add_request+0x71/0xc0 [ 623.492017] [<c02321f5>] blk_execute_rq_nowait+0x55/0xa0 [ 623.492017] [<c02322b0>] blk_execute_rq+0x70/0xc0 [ 623.492017] [<c0232170>] ? blk_end_sync_rq+0x0/0x30 [ 623.492017] [<c0146366>] ? trace_hardirqs_on_caller+0xf6/0x140 [ 623.492017] [<c02378c0>] ? cfq_set_request+0x0/0x330 [ 623.492017] [<c022c88f>] ? elv_set_request+0x1f/0x50 [ 623.492017] [<c022f38c>] ? get_request+0x25c/0x290 [ 623.492017] [<c022f91d>] ? get_request_wait+0x1d/0x100 [ 623.492017] [<f819c488>] ide_cd_queue_pc+0xb8/0x1b0 [ide_cd_mod] [ 623.492017] [<c0144c0b>] ? trace_hardirqs_off+0xb/0x10 [ 623.492017] [<c033bc99>] ? _spin_unlock_irqrestore+0x39/0x70 [ 623.492017] [<c02aa849>] ? do_ide_request+0x19/0x20 [ 623.492017] [<f819d46e>] ide_cdrom_packet+0x8e/0xc0 [ide_cd_mod] [ 623.492017] [<f818f3b3>] cdrom_read_block+0xa3/0xd0 [cdrom] [ 623.492017] [<f8192283>] mmc_ioctl+0x1633/0x19b0 [cdrom] [ 623.492017] [<c01461a1>] ? mark_held_locks+0x41/0x80 [ 623.492017] [<c033bc32>] ? _spin_unlock_irq+0x22/0x50 [ 623.492017] [<c01462df>] ? trace_hardirqs_on_caller+0x6f/0x140 [ 623.492017] [<c01463bb>] ? trace_hardirqs_on+0xb/0x10 [ 623.492017] [<c033bc3d>] ? _spin_unlock_irq+0x2d/0x50 [ 623.492017] [<c012c2cf>] ? run_timer_softirq+0x15f/0x1e0 [ 623.492017] [<c013b780>] ? hrtimer_interrupt+0x160/0x190 [ 623.492017] [<c023a402>] ? kobject_get+0x12/0x20 [ 623.492017] [<c022f51d>] ? blk_put_queue+0xd/0x10 [ 623.492017] [<c0235b13>] ? scsi_cmd_ioctl+0xa3/0x4d0 [ 623.492017] [<c02a8eac>] ? generic_ide_ioctl+0x2c/0x5d0 [ 623.492017] [<f819267a>] cdrom_ioctl+0x7a/0xe20 [cdrom] [ 623.492017] [<c016852b>] ? __rmqueue+0x1b/0x1f0 [ 623.492017] [<f819a6b4>] idecd_ioctl+0x104/0x180 [ide_cd_mod] [ 623.492017] [<c0164590>] ? find_get_page+0x0/0xd0 [ 623.492017] [<c01649b3>] ? find_lock_page+0x33/0x80 [ 623.492017] [<c0233350>] __blkdev_driver_ioctl+0x70/0x80 [ 623.492017] [<c023341f>] blkdev_ioctl+0x8f/0xa90 [ 623.492017] [<c0164970>] ? unlock_page+0x40/0x50 [ 623.492017] [<c0173a53>] ? __do_fault+0x1d3/0x3c0 [ 623.492017] [<c0175101>] ? handle_mm_fault+0x101/0x610 [ 623.492017] [<c033e411>] ? do_page_fault+0xf1/0x840 [ 623.492017] [<c013baa6>] ? up_read+0x16/0x30 [ 623.492017] [<c033e59a>] ? do_page_fault+0x27a/0x840 [ 623.492017] [<c0146db7>] ? __lock_acquire+0x147/0x1600 [ 623.492017] [<c01b056b>] block_ioctl+0x3b/0x50 [ 623.492017] [<c01b0530>] ? block_ioctl+0x0/0x50 [ 623.492017] [<c0198568>] vfs_ioctl+0x28/0x80 [ 623.492017] [<c019871e>] do_vfs_ioctl+0x5e/0x4b0 [ 623.492017] [<c018cd92>] ? fget_light+0x112/0x140 [ 623.492017] [<c018cccd>] ? fget_light+0x4d/0x140 [ 623.492017] [<c0198ba9>] sys_ioctl+0x39/0x70 [ 623.492017] [<c01033d9>] sysenter_do_call+0x12/0x31 [ 623.492017] ---[ end trace 2ca35fe06a780316 ]--- Steps to reproduce: 1. Boot Linux 2.6.28 on Clevo D410J laptop 2. Insert an audio CD 3. start playing it with kaffeine 0.8.7
Created attachment 19515 [details] Linux 2.6.28 .config
Created attachment 19516 [details] full 2.6.28 dmesg
I tested so far the following versions: 2.6.28 bad 2.6.28-rc9 bad 2.6.28-rc3 bad 2.6.28-rc1 good I started to git bisecting the problem but this might take a while.
Hi, can you try the following patch on a failing kernel and send me the whole dmesg output? Thanks.
Created attachment 19520 [details] dump offending cmd
Created attachment 19528 [details] git bisect log (In reply to comment #3) > I started to git bisecting the problem but this might take a while. The result of git bisecting is: 9bd27cba1aeacb6b12d05f4e5ed6361072f08fe0 is first bad commit commit 9bd27cba1aeacb6b12d05f4e5ed6361072f08fe0 Author: Borislav Petkov <petkovbb@gmail.com> Date: Sun Nov 2 21:40:07 2008 +0100 ide-cd: fix DMA alignment regression e5318b531b008c79d2a0c0df06a7b8628da38e2f ("ide: use the dma safe check for REQ_TYPE_ATA_PC") introduced a regression which caused some ATAPI drives to turn off DMA for REQ_TYPE_BLOCK_PC commands while burning and thus degrading performance and ultimately causing an excessive amount of underruns. The issue is documented also in: http://bugzilla.kernel.org/show_bug.cgi?id=11742. Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Tested-by: Valerio Passini <valerio.passini@unicam.it> [bart: fixup patch description per comments from Sergei Shtylyov] Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> :040000 040000 998c57acb8e63f2f1d64543f2c03ecfc05beb3a0 fef197de8e3c9db1308917eaeb1c10f196a8a8ab M drivers (In reply to comment #4) > can you try the following patch on a failing kernel and send me the whole > dmesg output? I'll have a look.
Created attachment 19529 [details] full dmesg of 2.6.28 + debug patch from comment #5 (In reply to comment #6) > (In reply to comment #4) > > can you try the following patch on a failing kernel and send me the whole > dmesg output? > > I'll have a look. Here you are.
It is the same problem as: http://bugzilla.kernel.org/show_bug.cgi?id=11732 [ also http://marc.info/?l=linux-ide&m=122865770510761&w=2 ] Hmm... with additional debug data it all starts to make sense now! :) Borislav, it seems that ide_map_sg() need to check for REQ_TYPE_ATA_PC now that DMA is allowed for such requests (so it can use sg_init_one() path for them instead of the usual blk_rq_map_sg() one)?
(In reply to comment #8) > It is the same problem as: > > http://bugzilla.kernel.org/show_bug.cgi?id=11732 > > [ also http://marc.info/?l=linux-ide&m=122865770510761&w=2 ] > > Hmm... with additional debug data it all starts to make sense now! :) > > Borislav, it seems that ide_map_sg() need to check for REQ_TYPE_ATA_PC now > that > DMA is allowed for such requests (so it can use sg_init_one() path for them > instead of the usual blk_rq_map_sg() one)? Hmm, shouldn't we do that for all rq's which aren't bio-backed? As a means to handle the more general case?
Created attachment 19538 [details] revert 9bd27cba1aeacb6b12d05f4e5ed6361072f08fe0 (In reply to comment #6) > Created an attachment (id=19528) [details] > git bisect log > > (In reply to comment #3) > > I started to git bisecting the problem but this might take a while. > > The result of git bisecting is: > > 9bd27cba1aeacb6b12d05f4e5ed6361072f08fe0 is first bad commit > commit 9bd27cba1aeacb6b12d05f4e5ed6361072f08fe0 > Author: Borislav Petkov <petkovbb@gmail.com> > Date: Sun Nov 2 21:40:07 2008 +0100 > > ide-cd: fix DMA alignment regression > > e5318b531b008c79d2a0c0df06a7b8628da38e2f ("ide: use the dma safe check > for > REQ_TYPE_ATA_PC") introduced a regression which caused some ATAPI drives > to > turn off DMA for REQ_TYPE_BLOCK_PC commands while burning and thus > degrading > performance and ultimately causing an excessive amount of underruns. > > The issue is documented also in: > http://bugzilla.kernel.org/show_bug.cgi?id=11742. > > Signed-off-by: Borislav Petkov <petkovbb@gmail.com> > Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> > Tested-by: Valerio Passini <valerio.passini@unicam.it> > [bart: fixup patch description per comments from Sergei Shtylyov] > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> > > :040000 040000 998c57acb8e63f2f1d64543f2c03ecfc05beb3a0 > fef197de8e3c9db1308917eaeb1c10f196a8a8ab M drivers Reverting this patch on top of 2.6.28 removes the warn_on_slowpath messages from dmesg.
(In reply to comment #9) > (In reply to comment #8) > > It is the same problem as: > > > > http://bugzilla.kernel.org/show_bug.cgi?id=11732 > > > > [ also http://marc.info/?l=linux-ide&m=122865770510761&w=2 ] > > > > Hmm... with additional debug data it all starts to make sense now! :) > > > > Borislav, it seems that ide_map_sg() need to check for REQ_TYPE_ATA_PC now > that > > DMA is allowed for such requests (so it can use sg_init_one() path for them > > instead of the usual blk_rq_map_sg() one)? > > Hmm, > > shouldn't we do that for all rq's which aren't bio-backed? As a means to > handle > the more general case? It would be even better...
(In reply to comment #11) > (In reply to comment #9) > > (In reply to comment #8) [.. ] > > > Borislav, it seems that ide_map_sg() need to check for REQ_TYPE_ATA_PC > now that > > > DMA is allowed for such requests (so it can use sg_init_one() path for > them > > > instead of the usual blk_rq_map_sg() one)? > > > > Hmm, > > > > shouldn't we do that for all rq's which aren't bio-backed? As a means to > handle > > the more general case? > > It would be even better... How about something similar to the following: diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index cc35d6d..4bee817 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -574,14 +574,15 @@ void ide_map_sg(ide_drive_t *drive, struct request *rq) ide_hwif_t *hwif = drive->hwif; struct scatterlist *sg = hwif->sg_table; - if (hwif->sg_mapped) /* needed by ide-scsi */ - return; - - if (rq->cmd_type != REQ_TYPE_ATA_TASKFILE) { - hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg); - } else { + if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE); hwif->sg_nents = 1; + } else if (!rq->bio) { + sg_init_one(sg, rq->data, rq->data_len); + hwif->sg_nents = 1; + } + else { + hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg); } } ?
Created attachment 19651 [details] fix setting up dma for non bio-backed requests
Hi Márton, can you please try the attached patch on top of the previous debugging one and send me the dmesg output, thanks. Boris.
Created attachment 19666 [details] dmesg 2.6.28 + patches from comment #5 & comment #13 I booted the system, inserted an audio CD. The kaffeine application started and tried to play the tracks but nothing was played, instead, after 3..5 seconds kaffeine jumped to the next track. Then I stopped kaffeine and removed the CD.
Hi, thanks for testing. Hmm, I can reproduce it here with kaffeine. Can you retry playing the audio cd with kscd with "Use direct digital playback" enabled, under Settings? P.S. I'll be away until Sa. and will able to look into it more seriously then. Thanks, Boris.
(In reply to comment #16) > thanks for testing. Hmm, I can reproduce it here with kaffeine. Can you retry > playing the audio cd with kscd with "Use direct digital playback" enabled, > under Settings? kscd is working with and without "Use direct digital playback" settings. There is no new message in dmesg while kscd is playing. kaffeine still does not work and debug messages are printed in dmesg. The version numbers I used: kaffeine 0.8.7, kscd 1.6. kaffeine reports the following messages on stdout/stderr when trying to play audio CD: $ kaffeine Checking /dev/hdc for cdrom... Testing /dev/hdc for SCSI/MMC interface SG_IO device: /dev/hdc CDROM model sensed sensed: Optiarc DVD RW AD-7543A 1-00 Checking for SCSI emulation... Drive is ATAPI (using SG_IO host adaptor emulation) Checking for MMC style command set... Drive is MMC style DMA scatter/gather table entries: 1 table entry size: 131072 bytes maximum theoretical transfer: 55 sectors Setting default read size to 27 sectors (63504 bytes). Verifying CDDA command set... Expected command set reads OK. CDROMREADRAW: Input/output error CDROMREADRAW: Input/output error CDROMREADRAW: Input/output error CDROMREADRAW: Input/output error CDROMREADRAW: Input/output error CDROMREADRAW: Input/output error
Plain 2.6.27.10 gives the warn_on_slowpath backtrace (as documented for 2.6.28). With patches from comment nos. 5 & 13: ide_build_sglist: Uninitialized none, cmd: 0x28 none: dev hdd: type=1, flags=10484 sector 64, nr/cnr 8/8 bio ffff88002d797240, biotail ffff88002d797240, buffer ffff88002c179000, data 0000000000000000, len 4096 ide_build_sglist: Uninitialized none, cmd: 0xbe none: dev hdd: type=b, flags=104c8 sector 18446744073709551615, nr/cnr 0/0 bio 0000000000000000, biotail 0000000000000000, buffer 0000000000000000, data ffff88002d62e000, len 2336
Hi Darren and Márton, has there been a setup/kernel with which cd audio play has been functioning using kaffeine? Thanks, Boris.
(In reply to comment #19) > has there been a setup/kernel with which cd audio play has been functioning > using kaffeine? I haven't played with different configs. What config option do you suggest to try to change?
Ok, let me put in another way: does it work after you revert 9bd27cba1aeacb6b12d05f4e5ed6361072f08fe0?
(In reply to comment #21) > let me put in another way: does it work after you revert > 9bd27cba1aeacb6b12d05f4e5ed6361072f08fe0? Yes, as I mentioned in comment #10, reverting the patch stopped sending messages to dmesg. I was able to play CDs with vanilla kernels, the only diffecence was the warning messages.
Hi, here's a fix, finally. It is against 29-rc2 + current (24.01) pata-tree. @Márton: can you please apply and test, thanks. The patch applies on plain 2.6.28 too, albeit with a little fuzz. @Bart: We should probably backport that one to 2.6.28 after enough testing, right? Thanks, Boris.
Created attachment 19979 [details] fix DMA for non bio-backed requests
On Saturday 24 January 2009, bugme-daemon@bugzilla.kernel.org wrote: > http://bugzilla.kernel.org/show_bug.cgi?id=12320 > > > bbpetkov@yahoo.de changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > AssignedTo|io_ide@kernel-bugs.osdl.org |bbpetkov@yahoo.de > Status|NEW |ASSIGNED > > > > > ------- Comment #23 from bbpetkov@yahoo.de 2009-01-24 06:19 ------- > Hi, > > here's a fix, finally. It is against 29-rc2 + current (24.01) pata-tree. > > @Márton: can you please apply and test, thanks. The patch applies on plain > 2.6.28 too, albeit with a little fuzz. > > @Bart: We should probably backport that one to 2.6.28 after enough testing, > right? That's correct -- it is a regression and fix is rather non-invasive. Thanks, Bart
(In reply to comment #23) > here's a fix, finally. It is against 29-rc2 + current (24.01) pata-tree. > > @Márton: can you please apply and test, thanks. The patch applies on plain > 2.6.28 too, albeit with a little fuzz. I applied the patch from commend #24 on top of 2.6.29-rc2. The audio CD playing seems to work correctly. I tested with Kaffeine 0.8.7 (KDE 3.5.9) and with KsCD 1.6 (KDE 3.5.9) with "Use direct digital playback" disabled and enabled also. Thank you for your work!
(In reply to comment #26) > (In reply to comment #23) > > here's a fix, finally. It is against 29-rc2 + current (24.01) pata-tree. > > > > @Márton: can you please apply and test, thanks. The patch applies on plain > > 2.6.28 too, albeit with a little fuzz. > > I applied the patch from commend #24 on top of 2.6.29-rc2. The audio CD > playing > seems to work correctly. I tested with Kaffeine 0.8.7 (KDE 3.5.9) and with > KsCD > 1.6 (KDE 3.5.9) with "Use direct digital playback" disabled and enabled also. > > Thank you for your work! > That's cool, thanks for testing.