From owner-p4-projects@FreeBSD.ORG Sun Apr 30 17:06:44 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2B10B16A416; Sun, 30 Apr 2006 17:06:44 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8269316A415 for ; Sun, 30 Apr 2006 17:06:43 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C92E43D70 for ; Sun, 30 Apr 2006 17:06:37 +0000 (GMT) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k3UH6bmk043717 for ; Sun, 30 Apr 2006 17:06:37 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3UH6aTd043714 for perforce@freebsd.org; Sun, 30 Apr 2006 17:06:36 GMT (envelope-from scottl@freebsd.org) Date: Sun, 30 Apr 2006 17:06:36 GMT Message-Id: <200604301706.k3UH6aTd043714@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to scottl@freebsd.org using -f From: Scott Long To: Perforce Change Reviews Cc: Subject: PERFORCE change 96417 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2006 17:06:44 -0000 http://perforce.freebsd.org/chv.cgi?CH=96417 Change 96417 by scottl@scottl-junior on 2006/04/30 17:05:53 Take a stab at fixing the problems with crashdumps. xpt_done assumes that it is always safe to call swi_sched, even when in a panic state where the scheduler is in an unknown state. swi_sched should be fixed to not blow up the scheduler in this scenario, but we also need to make CAM more deterministic. So when a periph goes into poll driving more, mark a flag so that xpt_done knows not to bother with swi_sched. It would be better to set this flag on a per-CCB basis, but there are no more bits available in the ccb flags field. That will be fixed later as part of the camlock work. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/cam_periph.h#6 edit .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#21 edit .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#9 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/cam_periph.h#6 (text+ko) ==== @@ -113,6 +113,7 @@ #define CAM_PERIPH_INVALID 0x08 #define CAM_PERIPH_NEW_DEV_FOUND 0x10 #define CAM_PERIPH_RECOVERY_INPROG 0x20 +#define CAM_PERIPH_POLLED 0x40 u_int32_t immediate_priority; u_int32_t refcount; SLIST_HEAD(, ccb_hdr) ccb_list; /* For "immediate" requests */ ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#21 (text+ko) ==== @@ -4959,7 +4959,9 @@ sim_links.tqe); done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; mtx_unlock(&cam_bioq_lock); - swi_sched(cambio_ih, 0); + if ((done_ccb->ccb_h.path->periph->flags & + CAM_PERIPH_POLLED) == 0) + swi_sched(cambio_ih, 0); break; default: panic("unknown periph type %d", ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#9 (text+ko) ==== @@ -734,6 +734,7 @@ return (ENXIO); if (length > 0) { + periph->flags |= CAM_PERIPH_POLLED; xpt_setup_ccb(&csio.ccb_h, periph->path, /*priority*/1); csio.ccb_h.ccb_state = DA_CCB_DUMP; scsi_read_write(&csio, @@ -759,10 +760,11 @@ else printf("status == 0x%x, scsi status == 0x%x\n", csio.ccb_h.status, csio.scsi_status); + periph->flags |= CAM_PERIPH_POLLED; return(EIO); } return(0); - } + } /* * Sync the disk cache contents to the physical media. @@ -801,6 +803,7 @@ } } } + periph->flags &= ~CAM_PERIPH_POLLED; return (0); }