From owner-freebsd-current@FreeBSD.ORG Sun Feb 28 04:31:54 2010 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D1231065670; Sun, 28 Feb 2010 04:31:54 +0000 (UTC) (envelope-from nork@ninth-nine.com) Received: from sakura.ninth-nine.com (unknown [IPv6:2001:2f0:104:80a1::25]) by mx1.freebsd.org (Postfix) with ESMTP id 189288FC1D; Sun, 28 Feb 2010 04:31:52 +0000 (UTC) Received: from nadesico.ninth-nine.com (ns1.ninth-nine.com [219.127.74.121] (may be forged)) (authenticated bits=0) by sakura.ninth-nine.com (8.14.4/8.14.3/NinthNine) with ESMTP id o1S4Vk1K076552; Sun, 28 Feb 2010 13:31:51 +0900 (JST) (envelope-from nork@ninth-nine.com) Date: Sun, 28 Feb 2010 13:31:45 +0900 From: Norikatsu Shigemura To: Alexander Motin Message-Id: <20100228133145.e0c8bc68.nork@ninth-nine.com> In-Reply-To: <20100226014718.c0a07c84.nork@FreeBSD.org> References: <20100218023945.848cd01a.nork@FreeBSD.org> <4B7EF63C.7030008@FreeBSD.org> <20100226014718.c0a07c84.nork@FreeBSD.org> X-Mailer: Sylpheed 2.7.1 (GTK+ 2.18.5; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-arm@FreeBSD.org, freebsd-current@FreeBSD.org, Shigemura , Norikatsu Subject: Re: ATA_CAM-ed mvsata(4) on OpenRD-client X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Feb 2010 04:31:54 -0000 Hi mav. I didn't know what's happen. So I'll report code trace and cam related struct dump with ddb which I made. The first, cam ddb patch: show cam show cam_eb show cam_et show cam_ed show cam_sim show cam_periph I saw gibbs'd document, and made it. If not enough, please tell me! (*) http://people.freebsd.org/~gibbs/ARTICLE-0001.html I got following results: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - : sata0: at mem 0xf1080000-0xf1085fff irq 21 on mbus0 sata0: [MPSAFE] sata0: [ITHREAD] ata0: on sata0 ata0: [MPSAFE] ata0: [ITHREAD] ata1: on sata0 ata1: [MPSAFE] ata1: [ITHREAD] pcib0: at mem 0xf1040000-0xf1041fff on mbus0 pcib0: PCI IO/Memory space exhausted device_attach: pcib0 attach returned 12 Timecounter "CPU Timer" frequency 200000000 Hz quality 1000 Timecounters tick every 10.000 msec lo0: bpf attached spin lock 0xc36c8d00 () held by 0xc361bb08 (tid -1061281488) too long panic: spin lock held too long KDB: enter: panic [ thread pid 0 tid 100000 ] Stopped at 0xc09e1d04 = kdb_enter+0x48: ldrb r15, [r15, r15, ror r15]! db> show cam Transport layer configuration information: cam_eb = 0xc36c88c0: path_id = 0, sim_name = ata cam_et = 0xc36c8880: target_id = 4294967295 cam_ed = 0xc376e000: lun_id = 4294967295 cam_eb = 0xc3770840: path_id = 1, sim_name = ata cam_et = 0xc3770800: target_id = 4294967295 cam_ed = 0xc376e800: lun_id = 4294967295 cam_eb = 0xc35df5c0: path_id = 4294967295, sim_name = xpt cam_et = 0xc35df540: target_id = 4294967295 cam_ed = 0xc356d800: lun_id = 4294967295 cam_periph = 0xc3574b80: unit_number = 0, periph_name = xpt - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [cam_eb = 0xc36c88c0] OK line - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - db> show cam_eb 0xc36c88c0 CAM Existing Bus information: et_entries = -> 0xc36c8880 (struct cam_et *) links = -> 0xc3770840 (struct cam_eb *) path_id = 0 sim = 0xc3604780 (struct cam_sim *) last_reset = 0.0[s] flags = 0x0 refcount = 4 generation = 1 parent_dev = 0 (device_t) xport = 0xc0bbfe80 (struct xpt_xport *) db> show cam_sim 0xc3604780 SIM(SCSI Interface Module) information: sim_action = 0xc0929c38 sim_poll = 0xc09294e8 sim_name = ata softc = 0xc35e5800 (void *) mtx = 0xc35e5974 (struct mtx *) sim_doneq = -> 0 (struct ccb_hdr *) links = -> 0 (struct cam_sim *) path_id = 0 unit_number = 0 bus_id = 0 max_tagged_dev_openings = 0 max_dev_openings = 1 flags = 0x2 callout = 0xc36047bc (struct callout) devq = 0xc3604800 (struct cam_devq) refcount = 2 ccb_freeq = -> 0 (struct ccb_hdr *) max_ccbs = 9 ccb_count = 0 db> show cam_et 0xc36c8880 CAM Existing Target information: ed_entries = -> 0xc376e000 (struct cam_ed *) links = -> 0 (struct cam_et *) bus = 0xc36c88c0 (struct cam_eb *) target_id = 4294967295 refcount = 3 generation = 1 last_reset = 0.0[s] db> show cam_ed 0xc376e000 CAM Existing Device information: links = -> 0 (struct cam_ed *) alloc_ccb_entry send_ccb_entry target = 0xc36c8880 (struct cam_et *) sim = 0xc3604780 (struct cam_sim *) lun_id = 4294967295 drvq ccbq asyncs periphs = -> 0 (struct cam_periph *) generation = 0 owner = 0 (struct cam_periph *) quirk = 0 (void *) maxtags = 1 mintags = 1 protocol protocol_version = 0 transport transport_version = 0 inq_data ident_data inq_flags = 0x0 queue_flags = 0x0 serial_num_len = 0 serial_num = 0 (u_int8_t *) flags = 0x1 tag_delay_count = 0 tag_saved_openings = 0 refcount = 2 callout = 0xc376e3d0 (struct callout) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [cam_eb = 0xc35df5c0] Freeze Line - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - db> show cam_eb 0xc35df5c0 CAM Existing Bus information: et_entries = -> 0xc35df540 (struct cam_et *) links = -> 0 (struct cam_eb *) path_id = 4294967295 sim = 0xc3574c00 (struct cam_sim *) last_reset = 0.0[s] flags = 0x0 refcount = 3 generation = 3 parent_dev = 0 (device_t) xport = 0xc0bbfc6c (struct xpt_xport *) db> show cam_sim 0xc3574c00 SIM(SCSI Interface Module) information: sim_action = 0xc0906df8 sim_poll = 0xc0904018 sim_name = xpt softc = 0xc3574b80 (void *) mtx = 0xc0be5204 (struct mtx *) sim_doneq = -> 0 (struct ccb_hdr *) links = -> 0 (struct cam_sim *) path_id = 4294967295 unit_number = 0 bus_id = 0 max_tagged_dev_openings = 0 max_dev_openings = 0 flags = 0x2 callout = 0xc3574c3c (struct callout) devq = 0xc3574c80 (struct cam_devq) refcount = 2 ccb_freeq = -> 0 (struct ccb_hdr *) max_ccbs = 8 ccb_count = 0 db> show cam_et 0xc35df540 CAM Existing Target information: ed_entries = -> 0xc356d800 (struct cam_ed *) links = -> 0 (struct cam_et *) bus = 0xc35df5c0 (struct cam_eb *) target_id = 4294967295 refcount = 2 generation = 1 last_reset = 0.0[s] db> show cam_ed 0xc356d800 CAM Existing Device information: links = -> 0 (struct cam_ed *) alloc_ccb_entry send_ccb_entry target = 0xc35df540 (struct cam_et *) sim = 0xc3574c00 (struct cam_sim *) lun_id = 4294967295 drvq ccbq asyncs periphs = -> 0xc3574b80 (struct cam_periph *) generation = 1 owner = 0 (struct cam_periph *) quirk = 0 (void *) maxtags = 1 mintags = 1 protocol protocol_version = 0 transport transport_version = 0 inq_data ident_data inq_flags = 0x0 queue_flags = 0x0 serial_num_len = 0 serial_num = 0 (u_int8_t *) flags = 0x1 tag_delay_count = 0 tag_saved_openings = 0 refcount = 2 callout = 0xc356dbd0 (struct callout) db> show cam_periph 0xc3574b80 CAM Peripheral information: pinfo periph_start = 0 (periph_start_t *) periph_oninval = 0 (periph_oninval *) periph_dtor = 0 (periph_dtor_t *) periph_name = xpt path = 0xc35613b0 (struct cam_path *) softc = 0 (void *) sim = 0xc3574c00 (struct cam_sim *) unit_number = 0 type = 0x0 flags = 0x0 immediate_priority = 4294967295 refcount = 0 ccb_list = -> 0 (struct ccb_hdr *) periph_links = -> 0 (struct cam_periph *) unit_links = -> 0 (struct cam_periph *) deferred_callback = 0 (ac_callback_t *) deferred_ac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - patch: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --- sys/cam/cam_periph.c.orig 2010-01-28 17:41:30.000000000 +0900 +++ sys/cam/cam_periph.c 2010-02-28 11:09:19.984247259 +0900 @@ -58,6 +58,12 @@ #include #include +#include "opt_ddb.h" + +#ifdef DDB +#include +#endif + static u_int camperiphnextunit(struct periph_driver *p_drv, u_int newunit, int wired, path_id_t pathid, target_id_t target, @@ -1859,3 +1865,42 @@ return (error); } + +#ifdef DDB +static void +cam_show_cam_periph(struct cam_periph *periph) +{ + if (periph == NULL) + return; + + db_printf("CAM Peripheral information:\n"); + + db_printf(" pinfo\n"); + db_printf(" periph_start = %p (periph_start_t *)\n", periph->periph_start); + db_printf(" periph_oninval = %p (periph_oninval *)\n", periph->periph_oninval); + db_printf(" periph_dtor = %p (periph_dtor_t *)\n", periph->periph_dtor); + db_printf(" periph_name = %s\n", periph->periph_name); + db_printf(" path = %p (struct cam_path *)\n", periph->path); + db_printf(" softc = %p (void *)\n", periph->softc); + db_printf(" sim = %p (struct cam_sim *)\n", periph->sim); + db_printf(" unit_number = %u\n", periph->unit_number); + db_printf(" type = 0x%x\n", periph->type); + db_printf(" flags = 0x%x\n", periph->flags); + db_printf(" immediate_priority = %u\n", periph->immediate_priority); + db_printf(" refcount = %u\n", periph->refcount); + db_printf(" ccb_list = -> %p (struct ccb_hdr *)\n", SLIST_FIRST(&periph->ccb_list)); + db_printf(" periph_links = -> %p (struct cam_periph *)\n", SLIST_NEXT(periph, periph_links)); + db_printf(" unit_links = -> %p (struct cam_periph *)\n", TAILQ_NEXT(periph, unit_links)); db_printf(" deferred_callback = %p (ac_callback_t *)\n", periph->deferred_callback); + db_printf(" deferred_ac\n"); +} + +DB_SHOW_COMMAND(cam_periph, db_show_cam_periph) +{ + if (!have_addr) { + db_printf("usage: show cam_periph \n"); + return; + } + + cam_show_cam_periph((struct cam_periph*)addr); +} +#endif --- sys/cam/cam_sim.c.orig 2010-01-28 22:45:23.512540000 +0900 +++ sys/cam/cam_sim.c 2010-02-28 11:10:17.866613899 +0900 @@ -41,6 +41,12 @@ #include #include +#include "opt_ddb.h" + +#ifdef DDB +#include +#endif + #define CAM_PATH_ANY (u_int32_t)-1 MALLOC_DEFINE(M_CAMSIM, "CAM SIM", "CAM SIM buffers"); @@ -145,3 +151,43 @@ { sim->path_id = path_id; } + +#ifdef DDB +static void +cam_show_cam_sim(struct cam_sim *sim) +{ + if (sim == NULL) + return; + + db_printf("SIM(SCSI Interface Module) information:\n"); + db_printf(" sim_action = %p\n", sim->sim_action); + db_printf(" sim_poll = %p\n", sim->sim_poll); + db_printf(" sim_name = %s\n", sim->sim_name); + db_printf(" softc = %p (void *)\n", sim->softc); + db_printf(" mtx = %p (struct mtx *)\n", sim->mtx); + db_printf(" sim_doneq = -> %p (struct ccb_hdr *)\n", TAILQ_FIRST(&sim->sim_doneq)); + db_printf(" links = -> %p (struct cam_sim *)\n", TAILQ_NEXT(sim, links)); + db_printf(" path_id = %u\n", sim->path_id); + db_printf(" unit_number = %u\n", sim->unit_number); + db_printf(" bus_id = %u\n", sim->bus_id); + db_printf(" max_tagged_dev_openings = %d\n", sim->max_tagged_dev_openings); + db_printf(" max_dev_openings = %d\n", sim->max_dev_openings); + db_printf(" flags = 0x%x\n", sim->flags); + db_printf(" callout = %p (struct callout)\n", &sim->callout); + db_printf(" devq = %p (struct cam_devq)\n", sim->devq); + db_printf(" refcount = %d\n", sim->refcount); + db_printf(" ccb_freeq = -> %p (struct ccb_hdr *)\n", SLIST_FIRST(&sim->ccb_freeq)); + db_printf(" max_ccbs = %u\n", sim->max_ccbs); + db_printf(" ccb_count = %u\n", sim->ccb_count); +} + +DB_SHOW_COMMAND(cam_sim, db_show_cam_sim) +{ + if (!have_addr) { + db_printf("usage: show cam_sim \n"); + return; + } + + cam_show_cam_sim((struct cam_sim*)addr); +} +#endif --- sys/cam/cam_xpt.c.orig 2010-02-26 19:33:48.000000000 +0900 +++ sys/cam/cam_xpt.c 2010-02-28 11:24:55.338945930 +0900 @@ -69,6 +69,11 @@ #include #include /* for xpt_print below */ #include "opt_cam.h" +#include "opt_ddb.h" + +#ifdef DDB +#include +#endif /* * This is the maximum number of high powered commands (e.g. start unit) @@ -4920,3 +4925,135 @@ } } +#ifdef DDB +static void +cam_show_cam_eb(struct cam_eb *bus) +{ + if (bus == NULL) + return; + + db_printf("CAM Existing Bus information:\n"); + db_printf(" et_entries = -> %p (struct cam_et *)\n", TAILQ_FIRST(&bus->et_entries)); + db_printf(" links = -> %p (struct cam_eb *)\n", TAILQ_NEXT(bus, links)); + db_printf(" path_id = %u\n", bus->path_id); + db_printf(" sim = %p (struct cam_sim *)\n", bus->sim); + db_printf(" last_reset = %lu.%ld[s]\n", (long)bus->last_reset.tv_sec, bus->last_reset.tv_usec/1000); + db_printf(" flags = 0x%x\n", bus->flags); + db_printf(" refcount = %u\n", bus->refcount); + db_printf(" generation = %u\n", bus->generation); + db_printf(" parent_dev = %p (device_t)\n", bus->parent_dev); + db_printf(" xport = %p (struct xpt_xport *)\n", bus->xport); +} + +static void +cam_show_cam_et(struct cam_et *tar) +{ + if (tar == NULL) + return; + + db_printf("CAM Existing Target information:\n"); + db_printf(" ed_entries = -> %p (struct cam_ed *)\n", TAILQ_FIRST(&tar->ed_entries)); + db_printf(" links = -> %p (struct cam_et *)\n", TAILQ_NEXT(tar, links)); + db_printf(" bus = %p (struct cam_eb *)\n", tar->bus); + db_printf(" target_id = %u\n", tar->target_id); + db_printf(" refcount = %u\n", tar->refcount); + db_printf(" generation = %u\n", tar->generation); + db_printf(" last_reset = %lu.%ld[s]\n", (long)tar->last_reset.tv_sec, tar->last_reset.tv_usec/1000); +} + +static void +cam_show_cam_ed(struct cam_ed *dev) +{ + if (dev == NULL) + return; + + db_printf("CAM Existing Device information:\n"); + db_printf(" links = -> %p (struct cam_ed *)\n", TAILQ_NEXT(dev, links)); + db_printf(" alloc_ccb_entry\n"); + db_printf(" send_ccb_entry\n"); + db_printf(" target = %p (struct cam_et *)\n", dev->target); + db_printf(" sim = %p (struct cam_sim *)\n", dev->sim); + db_printf(" lun_id = %u\n", dev->lun_id); + db_printf(" drvq\n"); + db_printf(" ccbq\n"); + db_printf(" asyncs\n"); + db_printf(" periphs = -> %p (struct cam_periph *)\n", SLIST_FIRST(&dev->periphs)); + db_printf(" generation = %u\n", dev->generation); + db_printf(" owner = %p (struct cam_periph *)\n", dev->owner); + db_printf(" quirk = %p (void *)\n", dev->quirk); + db_printf(" maxtags = %u\n", dev->maxtags); + db_printf(" mintags = %u\n", dev->mintags); + db_printf(" protocol\n"); + db_printf(" protocol_version = %u\n", dev->protocol_version); + db_printf(" transport\n"); + db_printf(" transport_version = %u\n", dev->transport_version); + db_printf(" inq_data\n"); + db_printf(" ident_data\n"); + db_printf(" inq_flags = 0x%x\n", dev->inq_flags); + db_printf(" queue_flags = 0x%x\n", dev->queue_flags); + db_printf(" serial_num_len = %u\n", dev->serial_num_len); + db_printf(" serial_num = %p (u_int8_t *)\n", dev->serial_num); + db_printf(" flags = 0x%x\n", dev->flags); + db_printf(" tag_delay_count = %u\n", dev->tag_delay_count); + db_printf(" tag_saved_openings = %u\n", dev->tag_saved_openings); + db_printf(" refcount = %u\n", dev->refcount); + db_printf(" callout = %p (struct callout)\n", &dev->callout); +} + +DB_SHOW_COMMAND(cam_eb, db_show_cam_eb) +{ + if (!have_addr) { + db_printf("usage: show cam_eb \n"); + return; + } + + cam_show_cam_eb((struct cam_eb*)addr); +} + +DB_SHOW_COMMAND(cam_et, db_show_cam_et) +{ + if (!have_addr) { + db_printf("usage: show cam_et \n"); + return; + } + + cam_show_cam_et((struct cam_et*)addr); +} + +DB_SHOW_COMMAND(cam_ed, db_show_cam_ed) +{ + if (!have_addr) { + db_printf("usage: show cam_ed \n"); + return; + } + + cam_show_cam_ed((struct cam_ed*)addr); +} + +DB_SHOW_COMMAND(cam, db_show_cam) +{ + struct cam_eb *bus, *next_bus; + struct cam_et *tar; + struct cam_ed *dev; + struct cam_periph *periph; + + db_printf("Transport layer configuration information:\n"); + for (bus = TAILQ_FIRST(&xsoftc.xpt_busses); + bus != NULL; bus = next_bus) { + next_bus = TAILQ_NEXT(bus, links); + db_printf(" cam_eb = %p: path_id = %u, sim_name = %s\n", bus, bus->path_id, bus->sim->sim_name); + TAILQ_FOREACH(tar, &bus->et_entries, links) { + db_printf(" cam_et = %p: target_id = %u\n", tar, tar->target_id); + TAILQ_FOREACH(dev, &tar->ed_entries, links) { + db_printf(" cam_ed = %p: lun_id = %u\n", dev, dev->lun_id); + SLIST_FOREACH(periph, &dev->periphs, periph_links) { + db_printf(" cam_periph = %p: unit_number = %u, periph_name = %s\n", periph, periph->unit_number, periph->periph_name); + } + } + } + if (db_pager_quit) + break; + } +} + +#endif - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -