> On 18. Nov 2024, at 23.36, John Meneghini <jmeneghi@xxxxxxxxxx> wrote: > > > On 11/16/24 10:35, Kai Mäkisara (Kolumbus) wrote: >> ... >> Besides Power on/Reset, the same problem applies to the New Media case. > > It seems to me this would apply for any Unit Attention. A hardware device can set a unit attention when ever acted upon by a third party. It is difficult to test this type of event w/out a multi-initiator bus... some kind of configuration that connects multiple host to the same SCSI target/lun device. Large tape library configurations can do this. I don't have a test bed like this. Yes, this applies to all Unit Attentions. I just mentioned the ones st is interested in. > >> One solution might be the following: the midlevel maintains counters for >> the Power on/Reset and the Media change UNIT ATTENTIONs. The ULDs >> can read these counters (using wrappers). If the ULD find for a device that >> the counter value has changed, then the event corresponding to the counter >> has occurred. The problem of clearing event flags is avoided, > > I'm not sure I understand what problem you are trying to solve... are you trying to get the mid layer to report Unit Attentions to all ULDs that are attached? That is, you want the mid layer to report the UA to all ULDs, not just the last/latest ULD? I would rather say that midlevel provides a method for all ULDs to see if certain Unit Attentions have happened. One gets all the sense data, but others can at least see that something has happened. > >> A drawback comes from the counter wrap-arounds. If, e.g., four-bit counters >> are used and there are 16 Power on/Resets between the checks by the ULD, >> the event is missed when the counter is used. > > I don't think that would be a problem. As long as the latest and highest priority UA is reported, older, lower priority UAs can be overwritten. For example, a New Media UA followed by a POR UA - the Power On reset should take precedence. My text seems to be somewhat ambiguous. I meant that there would be two counters, one for New Media events and one for PORs. St needs to know which one (or both) has occurred. ... >> Other solutions that have come into my mind are much more complicated >> than the counters. Here are examples: >> - the UNIT ATTENTIONs would be sent to all ULDs attached to the device >> when they issue the next SCSI command >> - the ULDs would have possibility to register a callback for UNIT ATTENTIONs > > This is actually what the SCSI device is supposed to do. If you have a truly SCSI compliant tape device, designed to support multi-initiator access, unit attentions are supposed to be maintained on an I_T by I_T basis. So a device reset from one I_T will set a UA on all I_Ts, and clearing one I_T will clear only that I_T nexus UA. But I'm sure that some of the older, legacy, tape devices don't do this. Yes, this is what has motivated the suggestions above. SCSI does send Unit Attentions to all initiators. Linux could extend this so that all ULDs attached to a device get the Unit Attentions. However, one big problem is, where to find someone to implement this?