Add debug trace points for freeze/release device queue.
This commit is contained in:
parent
f4fd4d3470
commit
0d4f3c316e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=255126
@ -99,6 +99,17 @@ extern u_int32_t cam_debug_delay;
|
||||
DELAY(cam_debug_delay); \
|
||||
}
|
||||
|
||||
#define CAM_DEBUG_DEV(dev, flag, printfargs) \
|
||||
if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \
|
||||
&& (cam_dpath != NULL) \
|
||||
&& (xpt_path_comp_dev(cam_dpath, dev) >= 0) \
|
||||
&& (xpt_path_comp_dev(cam_dpath, dev) < 2)) { \
|
||||
xpt_print_device(dev); \
|
||||
printf printfargs; \
|
||||
if (cam_debug_delay != 0) \
|
||||
DELAY(cam_debug_delay); \
|
||||
}
|
||||
|
||||
#define CAM_DEBUG_PRINT(flag, printfargs) \
|
||||
if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) { \
|
||||
printf("cam_debug: "); \
|
||||
|
@ -1115,6 +1115,7 @@ cam_freeze_devq(struct cam_path *path)
|
||||
{
|
||||
struct ccb_hdr ccb_h;
|
||||
|
||||
CAM_DEBUG(path, CAM_DEBUG_TRACE, ("cam_freeze_devq\n"));
|
||||
xpt_setup_ccb(&ccb_h, path, /*priority*/1);
|
||||
ccb_h.func_code = XPT_NOOP;
|
||||
ccb_h.flags = CAM_DEV_QFREEZE;
|
||||
@ -1128,6 +1129,8 @@ cam_release_devq(struct cam_path *path, u_int32_t relsim_flags,
|
||||
{
|
||||
struct ccb_relsim crs;
|
||||
|
||||
CAM_DEBUG(path, CAM_DEBUG_TRACE, ("cam_release_devq(%u, %u, %u, %d)\n",
|
||||
relsim_flags, openings, arg, getcount_only));
|
||||
xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL);
|
||||
crs.ccb_h.func_code = XPT_REL_SIMQ;
|
||||
crs.ccb_h.flags = getcount_only ? CAM_DEV_QFREEZE : 0;
|
||||
|
@ -3561,6 +3561,40 @@ xpt_path_comp(struct cam_path *path1, struct cam_path *path2)
|
||||
return (retval);
|
||||
}
|
||||
|
||||
int
|
||||
xpt_path_comp_dev(struct cam_path *path, struct cam_ed *dev)
|
||||
{
|
||||
int retval = 0;
|
||||
|
||||
if (path->bus != dev->target->bus) {
|
||||
if (path->bus->path_id == CAM_BUS_WILDCARD)
|
||||
retval = 1;
|
||||
else if (dev->target->bus->path_id == CAM_BUS_WILDCARD)
|
||||
retval = 2;
|
||||
else
|
||||
return (-1);
|
||||
}
|
||||
if (path->target != dev->target) {
|
||||
if (path->target->target_id == CAM_TARGET_WILDCARD) {
|
||||
if (retval == 0)
|
||||
retval = 1;
|
||||
} else if (dev->target->target_id == CAM_TARGET_WILDCARD)
|
||||
retval = 2;
|
||||
else
|
||||
return (-1);
|
||||
}
|
||||
if (path->device != dev) {
|
||||
if (path->device->lun_id == CAM_LUN_WILDCARD) {
|
||||
if (retval == 0)
|
||||
retval = 1;
|
||||
} else if (dev->lun_id == CAM_LUN_WILDCARD)
|
||||
retval = 2;
|
||||
else
|
||||
return (-1);
|
||||
}
|
||||
return (retval);
|
||||
}
|
||||
|
||||
void
|
||||
xpt_print_path(struct cam_path *path)
|
||||
{
|
||||
@ -3593,6 +3627,21 @@ xpt_print_path(struct cam_path *path)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xpt_print_device(struct cam_ed *device)
|
||||
{
|
||||
|
||||
if (device == NULL)
|
||||
printf("(nopath): ");
|
||||
else {
|
||||
printf("(noperiph:%s%d:%d:%d:%d): ", device->sim->sim_name,
|
||||
device->sim->unit_number,
|
||||
device->sim->bus_id,
|
||||
device->target->target_id,
|
||||
device->lun_id);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xpt_print(struct cam_path *path, const char *fmt, ...)
|
||||
{
|
||||
@ -4114,6 +4163,8 @@ xpt_freeze_devq(struct cam_path *path, u_int count)
|
||||
struct cam_ed *dev = path->device;
|
||||
|
||||
mtx_assert(path->bus->sim->mtx, MA_OWNED);
|
||||
CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_freeze_devq() %u->%u\n",
|
||||
dev->ccbq.queue.qfrozen_cnt, dev->ccbq.queue.qfrozen_cnt + count));
|
||||
dev->ccbq.queue.qfrozen_cnt += count;
|
||||
/* Remove frozen device from sendq. */
|
||||
if (device_is_queued(dev)) {
|
||||
@ -4138,6 +4189,7 @@ xpt_release_devq_timeout(void *arg)
|
||||
struct cam_ed *device;
|
||||
|
||||
device = (struct cam_ed *)arg;
|
||||
CAM_DEBUG_DEV(device, CAM_DEBUG_TRACE, ("xpt_release_devq_timeout\n"));
|
||||
xpt_release_devq_device(device, /*count*/1, /*run_queue*/TRUE);
|
||||
}
|
||||
|
||||
@ -4146,6 +4198,8 @@ xpt_release_devq(struct cam_path *path, u_int count, int run_queue)
|
||||
{
|
||||
|
||||
mtx_assert(path->bus->sim->mtx, MA_OWNED);
|
||||
CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_release_devq(%d, %d)\n",
|
||||
count, run_queue));
|
||||
xpt_release_devq_device(path->device, count, run_queue);
|
||||
}
|
||||
|
||||
@ -4153,6 +4207,9 @@ void
|
||||
xpt_release_devq_device(struct cam_ed *dev, u_int count, int run_queue)
|
||||
{
|
||||
|
||||
CAM_DEBUG_DEV(dev, CAM_DEBUG_TRACE,
|
||||
("xpt_release_devq_device(%d, %d) %u->%u\n", count, run_queue,
|
||||
dev->ccbq.queue.qfrozen_cnt, dev->ccbq.queue.qfrozen_cnt - count));
|
||||
if (count > dev->ccbq.queue.qfrozen_cnt) {
|
||||
#ifdef INVARIANTS
|
||||
printf("xpt_release_devq(): requested %u > present %u\n",
|
||||
|
@ -35,6 +35,7 @@
|
||||
/* Forward Declarations */
|
||||
union ccb;
|
||||
struct cam_periph;
|
||||
struct cam_ed;
|
||||
struct cam_sim;
|
||||
|
||||
/*
|
||||
@ -89,7 +90,10 @@ void xpt_path_counts(struct cam_path *path, uint32_t *bus_ref,
|
||||
uint32_t *device_ref);
|
||||
int xpt_path_comp(struct cam_path *path1,
|
||||
struct cam_path *path2);
|
||||
int xpt_path_comp_dev(struct cam_path *path,
|
||||
struct cam_ed *dev);
|
||||
void xpt_print_path(struct cam_path *path);
|
||||
void xpt_print_device(struct cam_ed *device);
|
||||
void xpt_print(struct cam_path *path, const char *fmt, ...);
|
||||
int xpt_path_string(struct cam_path *path, char *str,
|
||||
size_t str_len);
|
||||
|
Loading…
Reference in New Issue
Block a user