Page MenuHomeFreeBSD

Debugging for arrival / depature code.
ClosedPublic

Authored by imp on Jan 25 2018, 4:20 AM.

Details

Summary

Mitigate the as-yet-unknown race in device departure.

When devices are invalidated, there's some cases where ccbs for that
device still wind up in xpt_done after the path has been
invalidated. Since we don't always need sim or devq, add some guard
rails to only fail if we have to use them.

Track Ref / DeRef and Hold / Unhold that da is doing to track down
leaks. We assume each source can be taken / dropped only once and
don't recurse.

Likely needs #ifdef INVARIANTS for upstream.

Test Plan

So this is pretty green...

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

imp created this revision.Jan 25 2018, 4:20 AM
imp edited the test plan for this revision. (Show Details)Jan 25 2018, 4:23 AM
imp added reviewers: ken, scottl.
scottl requested changes to this revision.Jan 25 2018, 2:29 PM
scottl added inline comments.
sys/cam/cam_xpt.c
5429 ↗(On Diff #38421)

My compiler barfed on this, wanted the expression to be (sim != NULL)

5445 ↗(On Diff #38421)

Same here

This revision now requires changes to proceed.Jan 25 2018, 2:29 PM
scottl added inline comments.Jan 25 2018, 3:12 PM
sys/cam/cam_xpt.c
5429 ↗(On Diff #38421)

Whoops, had it backwards, the msg needs to be in the ellipsis.

Something in this patch is causing my system to spontaneously reboot late in the boot process. No panic, and the messages on the screen disappear too quickly (and are erased in the serial console by the BIOS splash screen).

ken added a comment.Jan 25 2018, 3:39 PM

This looks good and should catch duplicate releases or a release without an acquire. But obviously we need to figure out why Scott's machine is rebooting with it.

imp updated this revision to Diff 38453.Jan 25 2018, 5:46 PM

OK, cope with cam_periph_acquire returing CAM values and
cam_periph_hold returning 0/1.

I think you forgot to add the implementation for CAM_PERIPH_PRINT(). Mine looks like this in cam_periph.h:

#define CAM_PERIPH_PRINT(periph, msg, args...) \

printf("%s%d:" msg, (periph)->periph_name, (periph)->unit_number, ##args)

I chose not to do xpt_print() because I wanted a more compact print that didn't have the B:T:L noise in it.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 25 2018, 9:38 PM
This revision was automatically updated to reflect the committed changes.