Page MenuHomeFreeBSD

adaasync: Harmonize with daasync
ClosedPublic

Authored by imp on Apr 25 2022, 5:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 3 2024, 1:49 AM
Unknown Object (File)
Dec 23 2023, 1:30 AM
Unknown Object (File)
Nov 29 2023, 10:07 PM
Unknown Object (File)
Nov 26 2023, 12:21 PM
Unknown Object (File)
Nov 26 2023, 5:30 AM
Unknown Object (File)
Nov 25 2023, 2:51 PM
Unknown Object (File)
Nov 22 2023, 3:43 PM
Unknown Object (File)
Nov 22 2023, 3:08 PM
Subscribers
None

Details

Reviewers
mav
Group Reviewers
cam
Commits
rGae1955cd67c2: adaasync: Harmonize with daasync
Summary

We should call cam_periph_async() always, like SCSI does. This routine
is supposed to be more of a catch-all.

cam_periph_async() only does actions for AC_LOST_DEVICE. It ignores all
other events (today), but this may not always be true. So this is a nop
change.

Drop in a 'break' so we don't fall through unnecessarily.

Test Plan

Note to reviewers: Is this the right thing to do? I was torn between making this call always and last, and doing what I did. I convinced myself the mental model of 'do what you want, and call this only if you don't handle it' rather than a 'and call this always after you do what you are going to do'. I settled on this based on this comment:

/*
 * Generic Async Event handler.  Peripheral drivers usually
 * filter out the events that require personal attention,
 * and leave the rest to this function.
 */

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

imp requested review of this revision.Apr 25 2022, 5:01 PM
imp added a reviewer: mav.

async handlers are called only for the events explicitly specified to xpt_register_async(). As such, every periph driver specifies there AC_LOST_DEVICE, handled by cam_periph_async(). It means every driver has to know what cam_periph_async() can actually handle and how better call it. In such situation "default" case (calling always) can be useful only to not explicitly list new event types sometimes in the future, that may actually be more confusing.

In D35057#794531, @mav wrote:

async handlers are called only for the events explicitly specified to xpt_register_async(). As such, every periph driver specifies there AC_LOST_DEVICE, handled by cam_periph_async(). It means every driver has to know what cam_periph_async() can actually handle and how better call it. In such situation "default" case (calling always) can be useful only to not explicitly list new event types sometimes in the future, that may actually be more confusing.

So should I add AC_LOST_DEVICE as an explicit case here? I'm sorry, but I'm having trouble understanding your point...

imp retitled this revision from adaasync: Don't call cam_periph_async when not needed to adaasync: Harmonize with daasync.Apr 25 2022, 11:35 PM
imp edited the summary of this revision. (Show Details)
In D35057#794539, @imp wrote:
In D35057#794531, @mav wrote:

async handlers are called only for the events explicitly specified to xpt_register_async(). As such, every periph driver specifies there AC_LOST_DEVICE, handled by cam_periph_async(). It means every driver has to know what cam_periph_async() can actually handle and how better call it. In such situation "default" case (calling always) can be useful only to not explicitly list new event types sometimes in the future, that may actually be more confusing.

So should I add AC_LOST_DEVICE as an explicit case here? I'm sorry, but I'm having trouble understanding your point...

I saw a comment on another comment that suggests, I think, adaasync() and daasync() should be harmonized on this point. I agree and the next update will do that.

In D35057#794539, @imp wrote:

So should I add AC_LOST_DEVICE as an explicit case here? I'm sorry, but I'm having trouble understanding your point...

May be. And assert everything else unreachable. Since adaasync() has to know what events cam_periph_async() handles, I don't see problem to either call cam_periph_async() always or only AC_LOST_DEVICE. Unless we define some global macro of event types handled by cam_periph_async() to be used in all drivers, in which case cam_periph_async() will need to be called always.

This revision is now accepted and ready to land.Apr 26 2022, 12:12 AM
This revision was automatically updated to reflect the committed changes.