Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Dec 2012 10:21:17 -0700
From:      Jim Harris <jim.harris@gmail.com>
To:        Jeff Roberson <jroberson@jroberson.net>
Cc:        current@freebsd.org
Subject:   Re: Call for testers, users with scsi cards
Message-ID:  <CAJP=Hc_Aeib5OQvPiENCBnuH4No4XrdCuzAmzMhPSWsV9Jwxqw@mail.gmail.com>
In-Reply-To: <alpine.BSF.2.00.1212041131340.4081@desktop>
References:  <alpine.BSF.2.00.1212041131340.4081@desktop>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 4, 2012 at 2:36 PM, Jeff Roberson <jroberson@jroberson.net>wrote:

> http://people.freebsd.org/~**jeff/loadccb.diff<http://people.freebsd.org/~jeff/loadccb.diff>;
>
> This patch consolidates all of the functions that map cam control blocks
> for DMA into one central function.  This change is a precursor to adding
> new features to the I/O stack.  It is mostly mechanical.  If you are
> running current on a raid or scsi card, especially if it is a lesser used
> one, I would really like you to apply this patch and report back any
> problems.  If it works you should notice nothing.  If it doesn't work you
> will probably panic immediately on I/O or otherwise no I/O will happen.
>
>
Hi Jeff,

This patch breaks both ahci and isci on my system.  I still need to root
cause the isci panic, but I have some details on ahci.

Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address   = 0x6c
fault code              = supervisor read data, page not present
instruction pointer     = 0x20:0xffffffff80314f98
stack pointer           = 0x28:0xffffff884433a130
frame pointer           = 0x28:0xffffff884433a1d0
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 4 (xpt_thrd)
[ thread pid 4 tid 100174 ]
Stopped at      ahci_dmasetprd+0xb8:    movl    0x6c(%rcx),%eax
db> bt
Tracing pid 4 tid 100174 td 0xfffffe002c080480
ahci_dmasetprd() at ahci_dmasetprd+0xb8/frame 0xffffff884433a1d0
bus_dmamap_load() at bus_dmamap_load+0x91/frame 0xffffff884433a230
bus_dmamap_load_ccb() at bus_dmamap_load_ccb+0xf0/frame 0xffffff884433a280
ahci_dmasetprd() at ahci_dmasetprd+0x82e/frame 0xffffff884433a320
bus_dmamap_load_ccb() at bus_dmamap_load_ccb+0x3b/frame 0xffffff884433a370
ahciaction() at ahciaction+0x7d4/frame 0xffffff884433a3b0
xpt_run_dev_sendq() at xpt_run_dev_sendq+0x2a1/frame 0xffffff884433a3f0
xpt_action_default() at xpt_action_default+0x10bd/frame 0xffffff884433a480
probestart() at probestart+0x1e5/frame 0xffffff884433a5d0
xpt_run_dev_allocq() at xpt_run_dev_allocq+0x192/frame 0xffffff884433a610
proberegister() at proberegister+0xf9/frame 0xffffff884433a630
cam_periph_alloc() at cam_periph_alloc+0x571/frame 0xffffff884433a710
ata_scan_lun() at ata_scan_lun+0x147/frame 0xffffff884433a920
ata_scan_bus() at ata_scan_bus+0x2c0/frame 0xffffff884433aa40
xpt_scanner_thread() at xpt_scanner_thread+0x161/frame 0xffffff884433aa70
fork_exit() at fork_exit+0x9a/frame 0xffffff884433aab0
fork_trampoline() at fork_trampoline+0xe/frame 0xffffff884433aab0

The following patch to ahci.c works, but hopefully someone more familiar
with ahci can chime in.

Index: sys/dev/ahci/ahci.c
===================================================================
--- sys/dev/ahci/ahci.c (revision 243900)
+++ sys/dev/ahci/ahci.c (working copy)
@@ -1669,19 +1669,9 @@
        slot->dma.nsegs = 0;
        /* If request moves data, setup and load SG list */
        if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) {
-               void *buf;
-               bus_size_t size;
-
                slot->state = AHCI_SLOT_LOADING;
-               if (ccb->ccb_h.func_code == XPT_ATA_IO) {
-                       buf = ccb->ataio.data_ptr;
-                       size = ccb->ataio.dxfer_len;
-               } else {
-                       buf = ccb->csio.data_ptr;
-                       size = ccb->csio.dxfer_len;
-               }
-               bus_dmamap_load(ch->dma.data_tag, slot->dma.data_map,
-                   buf, size, ahci_dmasetprd, slot, 0);
+               bus_dmamap_load_ccb(ch->dma.data_tag, slot->dma.data_map,
ccb,
+                   ahci_dmasetprd, slot, 0);
        } else
                ahci_execute_transaction(slot);
 }

-Jim



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJP=Hc_Aeib5OQvPiENCBnuH4No4XrdCuzAmzMhPSWsV9Jwxqw>