2.6.20-rc2: kernel BUG at include/asm/dma-mapping.h:110!
I'm getting this BUG on PowerMac with 2.6.20-rc2 during probing of firewire devices:
kernel BUG at include/asm/dma-mapping.h:110!
Oops: Exception in kernel mode, sig: 5 [#1] SMP NR_CPUS=2 Modules linked in: sbp2 snd_aoa_codec_tas ide_cd ohci1394 snd_aoa_fabric_layout snd_aoa cdrom ieee1394 snd_aoa_i2sbus snd_aoa_soundbus sungem sungem_phy uninorth_agp agpgart snd_powermac snd_pcm snd_page_alloc snd_timer snd soundcore sg sata_svw libata sd_mod scsi_mod NIP: D0000000002F5A90 LR: D0000000002F5A38 CTR: 0000000000000000 REGS: c00000000f447490 TRAP: 0700 Not tainted (2.6.20-rc2) MSR: 9000000000029032 <EE,ME,IR,DR> CR: 84222482 XER: 00000000
TASK = c000000001139080[2224] 'modprobe' THREAD: c00000000f444000 CPU: 0
GPR00: 0000000000000001 C00000000F447710 D000000000303F38 C00000000F2E00F0
GPR04: D000000000282000 C000000001FD4228 C00000000F517140 0000000000000004
GPR08: 0000000000012800 0000000000000000 D0000000002F7970 D0000000002F7968
GPR12: D00000000005B200 C0000000004D1280 D0000000002EE6C0 0000000000000000
GPR16: D0000000002EE680 0000000000000009 000000001002BD88 D0000000002EDDB2
GPR20: 0000000000000000 0000000000000028 00000000000000C8 D0000000002E8000
GPR24: 0000000000000021 0000000000000022 C00000004E32D450 C00000004E32D400
GPR28: 0000000000000000 C00000004E662FB0 D000000000303A00 C000000001FD4200 NIP [D0000000002F5A90] .sbp2_probe+0x298/0x71c [sbp2]
LR [D0000000002F5A38] .sbp2_probe+0x240/0x71c [sbp2]
Call Trace: [C00000000F447710] [D0000000002F5A38] .sbp2_probe+0x240/0x71c [sbp2] (unreliable) [C00000000F4477D0] [C0000000002494A0] .really_probe+0xbc/0x180 [C00000000F447870] [C000000000249858] .__driver_attach+0xb4/0x138 [C00000000F447900] [C00000000024848C] .bus_for_each_dev+0x7c/0xd4 [C00000000F4479C0] [C00000000024928C] .driver_attach+0x28/0x40 [C00000000F447A40] [C000000000248960] .bus_add_driver+0x80/0x1ec [C00000000F447AE0] [C000000000249C58] .driver_register+0xa8/0xc4 [C00000000F447B60] [D0000000001727F8] .__hpsb_register_protocol+0x48/0xbc [ieee1394] [C00000000F447C00] [D0000000002F5FB0] .sbp2_module_init+0x9c/0xe0 [sbp2] [C00000000F447C90] [C000000000071EFC] .sys_init_module+0x17c4/0x198c [C00000000F447E30] [C0000000000086AC] syscall_exit+0x0/0x40
Instruction dump:
48001839 e8410028 7fe3fb78 3ba0fff4 48000470 e8030240 2fa00000 7c090378 40fe0008 39200000 7d200074 7800d182 <0b000000> e9290000 38800010 38c000d0
Bisecting has identified this commit:
commit 9b7d9c096dd4e4baacc21b2588662bbb56f36c4e
Author: Stefan Richter <[email protected]> Date: Wed Nov 22 21:44:34 2006 +0100
ieee1394: sbp2: convert from PCI DMA to generic DMA
API conversion without change in functionality
I'm only seeing this on ppc64, ppc32 seems to be working fine.
Andreas.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Quoted 7 lines
Bisecting has identified this commit:
commit
9b7d9c096dd4e4baacc21b2588662bbb56f36c4eAuthor: Stefan Richter <[email protected]> Date: Wed Nov 22 21:44:34 2006 +0100
Quoted 8 lines
ieee1394: sbp2: convert from PCI DMA to generic DMA
API conversion without change in functionality
Signed-off-by Stefan Richter <[email protected]>I'm only seeing this on ppc64, ppc32 seems to be working fine.
The patch looks totally bogus to me. It's passing a random struct device from the hbsp host data structure to the dma_map_* routines. which they can't do anything about.
The dma_map_* routines only know about some bus types. That's always been the case (that's why you also can't pass a usb device's struct device to them for example). Mostly, PCI, possibly others depending on the platform.
So if you are to pass a struct device pointer to dma_map_*, use the one inside the pci_dev of the host. Or have the host driver provide you with the struct device pointer (which is the one from the pci_dev * for PCI implementations, and others give you what they are on, assuming the platform can do dma-* on that device).
Ben.
Quoted 18 lines · Benjamin Herrenschmidt
Quoted 6 lines
Bisecting has identified this commit:
commit
9b7d9c096dd4e4baacc21b2588662bbb56f36c4eAuthor: Stefan Richter <[email protected]> Date: Wed Nov 22 21:44:34 2006 +0100Quoted 8 lines
ieee1394: sbp2: convert from PCI DMA to generic DMA
API conversion without change in functionality
Signed-off-by Stefan Richter <[email protected]>I'm only seeing this on ppc64, ppc32 seems to be working fine.
The patch looks totally bogus to me. It's passing a random struct device from the hbsp host data structure to the dma_map_* routines. which they can't do anything about.
[...]
Quoted 5 lines
So if you are to pass a struct device pointer to dma_map_*, use the one inside the
pci_devof the host. Or have the host driver provide you with the struct device pointer (which is the one from thepci_dev* for PCI implementations, and others give you what they are on, assuming the platform can do dma-* on that device).
[...]
The parent device of my bogus fw-host device should do the trick. Alas I can't test on ppc64 or with anything else than ohci1394 driven controllers...
From: Stefan Richter <[email protected]>
Subject: ieee1394: sbp2: fix bogus dma mapping
Need to use a PCI device, not a FireWire host device. Problem found by Andreas Schwab, mistake pointed out by Benjamin Herrenschmidt.
http://ozlabs.org/pipermail/linuxppc-dev/2006-December/029595.html
--- drivers/ieee1394/sbp2.c | 73 +++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 33 deletions(-)
drivers/ieee1394/sbp2.c +40 -33
@@ -490,11 +490,11 @@ static int sbp2util_create_command_orb_pspin_unlock_irqrestore (&lu->cmd_orb_lock, flags);return -ENOMEM ; } - cmd->command_orb_dma =dma_map_single (&hi->host->device, + cmd->command_orb_dma =dma_map_single (hi->host->device.parent, &cmd->command_orb,sizeof (struct sbp2_command_orb ),DMA_TO_DEVICE ); - cmd->sge_dma =dma_map_single (&hi->host->device, + cmd->sge_dma =dma_map_single (hi->host->device.parent, &cmd->scatter_gather_element,sizeof (cmd->scatter_gather_element),DMA_BIDIRECTIONAL );
@@ -516,10 +516,11 @@ static void sbp2util_remove_command_orb_if (!list_empty (&lu->cmd_orb_completed))list_for_each_safe (lh, next, &lu->cmd_orb_completed) { cmd = list_entry(lh, struct sbp2_command_info, list); -dma_unmap_single (&host->device, cmd->command_orb_dma, +dma_unmap_single (host->device.parent, + cmd->command_orb_dma,sizeof (struct sbp2_command_orb ),DMA_TO_DEVICE ); -dma_unmap_single (&host->device, cmd->sge_dma, +dma_unmap_single (host->device.parent, cmd->sge_dma,sizeof (cmd->scatter_gather_element),DMA_BIDIRECTIONAL );kfree (cmd);
@@ -601,17 +602,17 @@ static void sbp2util_mark_command_compleif (cmd->cmd_dma) {if (cmd->dma_type ==CMD_DMA_SINGLE ) -dma_unmap_single (&host->device, cmd->cmd_dma, +dma_unmap_single (host->device.parent, cmd->cmd_dma, cmd->dma_size, cmd->dma_dir);else if (cmd->dma_type ==CMD_DMA_PAGE ) -dma_unmap_page (&host->device, cmd->cmd_dma, +dma_unmap_page (host->device.parent, cmd->cmd_dma, cmd->dma_size, cmd->dma_dir);/* XXX: Check for CMD_DMA_NONE bug */ cmd->dma_type =CMD_DMA_NONE ; cmd->cmd_dma =0 ; }if (cmd->sge_buffer) { -dma_unmap_sg (&host->device, cmd->sge_buffer, +dma_unmap_sg (host->device.parent, cmd->sge_buffer, cmd->dma_size, cmd->dma_dir); cmd->sge_buffer =NULL ; }
@@ -836,37 +837,37 @@ static int sbp2_start_device(struct sbp2struct sbp2_fwhost_info *hi = lu->hi;int error; - lu->login_response =dma_alloc_coherent (&hi->host->device, + lu->login_response =dma_alloc_coherent (hi->host->device.parent,sizeof (struct sbp2_login_response ), &lu->login_response_dma,GFP_KERNEL );if (!lu->login_response) goto alloc_fail; - lu->query_logins_orb =dma_alloc_coherent (&hi->host->device, + lu->query_logins_orb =dma_alloc_coherent (hi->host->device.parent,sizeof (struct sbp2_query_logins_orb ), &lu->query_logins_orb_dma,GFP_KERNEL );if (!lu->query_logins_orb) goto alloc_fail; - lu->query_logins_response =dma_alloc_coherent (&hi->host->device, + lu->query_logins_response =dma_alloc_coherent (hi->host->device.parent,sizeof (struct sbp2_query_logins_response ), &lu->query_logins_response_dma,GFP_KERNEL );if (!lu->query_logins_response) goto alloc_fail; - lu->reconnect_orb =dma_alloc_coherent (&hi->host->device, + lu->reconnect_orb =dma_alloc_coherent (hi->host->device.parent,sizeof (struct sbp2_reconnect_orb ), &lu->reconnect_orb_dma,GFP_KERNEL );if (!lu->reconnect_orb) goto alloc_fail; - lu->logout_orb =dma_alloc_coherent (&hi->host->device, + lu->logout_orb =dma_alloc_coherent (hi->host->device.parent,sizeof (struct sbp2_logout_orb ), &lu->logout_orb_dma,GFP_KERNEL );if (!lu->logout_orb) goto alloc_fail; - lu->login_orb =dma_alloc_coherent (&hi->host->device, + lu->login_orb =dma_alloc_coherent (hi->host->device.parent,sizeof (struct sbp2_login_orb ), &lu->login_orb_dma,GFP_KERNEL );if (!lu->login_orb)
@@ -929,32 +930,32 @@ static void sbp2_remove_device(struct sblist_del (&lu->lu_list);if (lu->login_response) -dma_free_coherent (&hi->host->device, +dma_free_coherent (hi->host->device.parent,sizeof (struct sbp2_login_response ), lu->login_response, lu->login_response_dma);if (lu->login_orb) -dma_free_coherent (&hi->host->device, +dma_free_coherent (hi->host->device.parent,sizeof (struct sbp2_login_orb ), lu->login_orb, lu->login_orb_dma);if (lu->reconnect_orb) -dma_free_coherent (&hi->host->device, +dma_free_coherent (hi->host->device.parent,sizeof (struct sbp2_reconnect_orb ), lu->reconnect_orb, lu->reconnect_orb_dma);if (lu->logout_orb) -dma_free_coherent (&hi->host->device, +dma_free_coherent (hi->host->device.parent,sizeof (struct sbp2_logout_orb ), lu->logout_orb, lu->logout_orb_dma);if (lu->query_logins_orb) -dma_free_coherent (&hi->host->device, +dma_free_coherent (hi->host->device.parent,sizeof (struct sbp2_query_logins_orb ), lu->query_logins_orb, lu->query_logins_orb_dma);if (lu->query_logins_response) -dma_free_coherent (&hi->host->device, +dma_free_coherent (hi->host->device.parent,sizeof (struct sbp2_query_logins_response ), lu->query_logins_response, lu->query_logins_response_dma);
@@ -1445,7 +1446,7 @@ static void sbp2_prep_command_orb_sg(str cmd->dma_size = sgpnt[0 ].length; cmd->dma_type =CMD_DMA_PAGE ; - cmd->cmd_dma =dma_map_page (&hi->host->device, + cmd->cmd_dma =dma_map_page (hi->host->device.parent, sgpnt[0 ].page, sgpnt[0 ].offset, cmd->dma_size, cmd->dma_dir);
@@ -1457,8 +1458,8 @@ static void sbp2_prep_command_orb_sg(str &cmd->scatter_gather_element[0 ];u32 sg_count, sg_len;dma_addr_t sg_addr; -int i, count =dma_map_sg (&hi->host->device, sgpnt, scsi_use_sg, - dma_dir); +int i, count =dma_map_sg (hi->host->device.parent, sgpnt, + scsi_use_sg, dma_dir); cmd->dma_size = scsi_use_sg; cmd->sge_buffer = sgpnt;
@@ -1508,7 +1509,8 @@ static void sbp2_prep_command_orb_no_sg( cmd->dma_dir = dma_dir; cmd->dma_size = scsi_request_bufflen; cmd->dma_type =CMD_DMA_SINGLE ; - cmd->cmd_dma =dma_map_single (&hi->host->device, scsi_request_buffer, + cmd->cmd_dma =dma_map_single (hi->host->device.parent, + scsi_request_buffer, cmd->dma_size, cmd->dma_dir); orb->data_descriptor_hi =ORB_SET_NODE_ID (hi->host->node_id); orb->misc |=ORB_SET_DIRECTION (orb_direction);
@@ -1626,10 +1628,11 @@ static void sbp2_link_orb_command(structsize_t length;unsigned long flags; -dma_sync_single_for_device (&hi->host->device, cmd->command_orb_dma, +dma_sync_single_for_device (hi->host->device.parent, + cmd->command_orb_dma,sizeof (struct sbp2_command_orb ),DMA_TO_DEVICE ); -dma_sync_single_for_device (&hi->host->device, cmd->sge_dma, +dma_sync_single_for_device (hi->host->device.parent, cmd->sge_dma,sizeof (cmd->scatter_gather_element),DMA_BIDIRECTIONAL );
@@ -1655,14 +1658,15 @@ static void sbp2_link_orb_command(struct* The target's fetch agent may or may not have read this * previous ORB yet. */ -dma_sync_single_for_cpu (&hi->host->device, last_orb_dma, +dma_sync_single_for_cpu (hi->host->device.parent, last_orb_dma,sizeof (struct sbp2_command_orb ),DMA_TO_DEVICE ); last_orb->next_ORB_lo =cpu_to_be32 (cmd->command_orb_dma);wmb ();/* Tells hardware that this pointer is valid */ last_orb->next_ORB_hi =0 ; -dma_sync_single_for_device (&hi->host->device, last_orb_dma, +dma_sync_single_for_device (hi->host->device.parent, + last_orb_dma,sizeof (struct sbp2_command_orb ),DMA_TO_DEVICE ); addr +=SBP2_DOORBELL_OFFSET ;
@@ -1790,10 +1794,11 @@ static int sbp2_handle_status_write(struelse cmd =sbp2util_find_command_for_orb (lu, sb->ORB_offset_lo);if (cmd) { -dma_sync_single_for_cpu (&hi->host->device, cmd->command_orb_dma, +dma_sync_single_for_cpu (hi->host->device.parent, + cmd->command_orb_dma,sizeof (struct sbp2_command_orb ),DMA_TO_DEVICE ); -dma_sync_single_for_cpu (&hi->host->device, cmd->sge_dma, +dma_sync_single_for_cpu (hi->host->device.parent, cmd->sge_dma,sizeof (cmd->scatter_gather_element),DMA_BIDIRECTIONAL );/* Grab SCSI command pointers and check status. */
@@ -1931,10 +1936,11 @@ static void sbp2scsi_complete_all_commanwhile (!list_empty (&lu->cmd_orb_inuse)) { lh = lu->cmd_orb_inuse.next; cmd = list_entry(lh, struct sbp2_command_info, list); -dma_sync_single_for_cpu (&hi->host->device, cmd->command_orb_dma, +dma_sync_single_for_cpu (hi->host->device.parent, + cmd->command_orb_dma,sizeof (struct sbp2_command_orb ),DMA_TO_DEVICE ); -dma_sync_single_for_cpu (&hi->host->device, cmd->sge_dma, +dma_sync_single_for_cpu (hi->host->device.parent, cmd->sge_dma,sizeof (cmd->scatter_gather_element),DMA_BIDIRECTIONAL );sbp2util_mark_command_completed (lu, cmd);
@@ -2059,11 +2065,12 @@ static int sbp2scsi_abort(struct scsi_cmspin_lock_irqsave (&lu->cmd_orb_lock, flags); cmd =sbp2util_find_command_for_SCpnt (lu, SCpnt);if (cmd) { -dma_sync_single_for_cpu (&hi->host->device, +dma_sync_single_for_cpu (hi->host->device.parent, cmd->command_orb_dma,sizeof (struct sbp2_command_orb ),DMA_TO_DEVICE ); -dma_sync_single_for_cpu (&hi->host->device, cmd->sge_dma, +dma_sync_single_for_cpu (hi->host->device.parent, + cmd->sge_dma,sizeof (cmd->scatter_gather_element),DMA_BIDIRECTIONAL );sbp2util_mark_command_completed (lu, cmd);
Signature · 3 lines
Stefan Richter -=====-=-==- ==-- ===-= http://arcgraph.de/sr/
Quoted 3 lines · Stefan Richter
The parent device of my bogus fw-host device should do the trick. Alas I can't test on ppc64 or with anything else than ohci1394 driven controllers...
Successfully tested on ppc64.
Thanks, Andreas.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
A message that is not in the archive (sent off-list or not yet received): 1167550089.12593.11.camel@melchior
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 1167708109.12382.26.camel@melchior
A message that is not in the archive (sent off-list or not yet received): [email protected]
(list address corrected, and a question added...)
Quoted 47 lines · On 1/2/2007 4:53 PM, I wrote:
Kyuma Ohta wrote:
...Quoted 8 lines
Now,I'm testing 2.6.20-rc3 for
x86_64, submitted patch for this issue; "Fault has happened in 'cleanuped' sbp2/1394 module in *not 32bit* architecture hardwares ."As result of, sbp2 driver in 2.6.20-rc3 is seems to running w/o any faults,but communication both host and harddrive(s) was seems to be unstable yet :-(
Sometimes confuse packets,such as *very* older 1394 driver :-(That is, sbp2 on 2.6.20-rc3 works less stable for you than on 2.6.19? Or which previous kernel is the basis of your comparison? Are there any log messages or other diagnostics? And what hardware do you have?
If you can tell which kernel was good for you, I could create a set of patches for you which allows to revert sbp2 while keeping the rest of the kernel at the level of 2.6.20-rc3, so that you could find the destabilizing change (if it happened in sbp2, not somewhere else).
Although there was a certain volume of changes to sbp2 between 2.6.19 and 2.6.20-rc{1,3}, none of them should change the behavior except for:
- commit
0b885449ac6fab42cd6808c9ea8d6e456e0e65b7"ieee1394: sbp2:
remove duplicate code" modifying the extremely unlikely case that a bus reset occurs right after completion status of an unsuccessfully completed command came in,- commit
23077f1d72d279244536f11db51258fc4759c81a"ieee1394: sbp2:
slightly reordersbp2scsi_abort" which improves a SCSI error handler, mostly relevant if a command timed out.- commit
b2bb550c4a10c44e99fe469cfaee81e2e3109994"ieee1394: sbp2: passREQUEST_SENSEthrough to the target" which exposes targets to a SCSI command which was previously blocked out. But this command is either never issued by stock Linux SCSI drivers to SBP-2 targets anyway because they provide autosense data, or has to be be properly supported by SBP-2 targets if targets don't send autosense data. (This is also about error handling, unless special application software is explicitly generating this command.)The DMA mapping patch did only change behavior because it was just faulty. After its correction in 2.6.20-rc3, it really is a trivial 1:1 conversion from the
pci_dma_API to the genericdma_API. I neither added nor removed anything from the mapping operations and they should behave exactly the same as before with PCI FireWire controllers.
Quoted 7 lines
Or could there have been some hidden mistake in sbp2's old
pci_dma_usage which now turns into real problems after 1:1 conversion to thedma_API?Or are there any DMA related properties of hardware that the DMA mapping infrastructure cannot figure out from the generic device (contained in a
pci_device) compared to thepci_device?
Or are there some restrictions implicit in mappings via pci_dma_ API which are lifted when using mappings via dma_ API?
Signature · 3 lines
Stefan Richter -=====-=-=== ---= ---=- http://arcgraph.de/sr/
I wrote on 2007-01-02:
Quoted 11 lines
Kyuma Ohta wrote:
...Quoted 8 lines
Now,I'm testing 2.6.20-rc3 for
x86_64, submitted patch for this issue; "Fault has happened in 'cleanuped' sbp2/1394 module in *not 32bit* architecture hardwares ."As result of, sbp2 driver in 2.6.20-rc3 is seems to running w/o any faults,but communication both host and harddrive(s) was seems to be unstable yet :-(
Sometimes confuse packets,such as *very* older 1394 driver :-(
Quoted 8 lines
That is, sbp2 on 2.6.20-rc3 works less stable for you than on 2.6.19? Or which previous kernel is the basis of your comparison? Are there any log messages or other diagnostics? And what hardware do you have?
If you can tell which kernel was good for you, I could create a set of patches for you which allows to revert sbp2 while keeping the rest of the kernel at the level of 2.6.20-rc3, so that you could find the destabilizing change (if it happened in sbp2, not somewhere else).
[...]
So, how about it? Is there an actual regression? If so, we should find the cause and fix before 2.6.20 is released.
Note, sbp2's optional parameter serialize_io=0 does not work correctly yet with some devices (it never did), therefore use sbp2 with anything than default parameters if there are problems.
Signature · 3 lines
Stefan Richter -=====-=-=== ---= =--=- http://arcgraph.de/sr/