page 1 of 6 Date: April 23, 1988 X3T9.2/88-049R2 Revised: May 13, 1988 To: X3T9.2 Committee (SCSI) From: James McGrath (Quantum) Subject: Proposed Read and Write Caching Pages On April 22 a special working group met to discuss the formation of a proposal for caching mode parameters for DASDs. The focus of the meeting was on read caching for embedded (typically 64K to 256K cache memory size) drives. It was envisioned that such focus would quickly lead to a solid proposal, that it would address the coming introduction of a number of such products in the marketplace, and that this proposal could later incorporate the special needs of other caching devices. Participants at the meeting include Adaptec, ENDL, Fujitsu, Micropolis, Miniscribe, NCR, Quantum, and Seimens. While we reached general agreement on the parameters and their definition, specific wording was not agreed to at that time. One important point to note is that these parameters are, in a sense, default parameters for caching. The specific cache commands (LOCK/UNLOCK and PRE-FETCH), along with the cache control bits (DPO, FUA, and DP) would, if used in conjunction with these parameters, supersede the advice to the target embodied in these parameters. This proposal creates a new page of mode parameters for read caching. Some of the terms used are defined in 88-030R0 (note that in that draft the term "anticipatory prefetch" is referred to as "auto-prefetch"). UPDATE: On April 25, a brief meeting was held after the first day of the plenary to examine a draft of this proposal. Issues arose that will be discussed at the working group. These include: 1) controlling prefetching if substantial media delays would be encountered (e.g. across tracks and cylinder boundaries) 2) reducing confusion between the PRE-FETCH command and the term anticipatory prefetching. 3) adding a disable prefetch DP bit (byte 1, bit 2) to the READ (group 1) command (section 8.1.6). 4) whether the page parameters should advise or instruct the target (may vs shall) - this will be settled as a more general issue for all MODE SELECT/MODE SENSE parameters. 5) simplifying the computation of the prefetch amounts by reducing the number of parameters (e.g. eliminating absolute) page 2 of 6 REVISION 1: This revision incorporates suggestions made by various members since the plenary meeting. The focus has been to narrow the functionality of the page, in order to obtain quick agreement on its inclusion. Advanced features and other issues (such as making the currently advisory prefetch quantities mandatory, so as to facilitate evaluation and testing, automatically disabling prefetching if substantial media delays are encountered, or a Disable Prefetch (DP) bit) can be addressed in subsequent proposals. Thus the obstacles posed by points 1, 3, 4, and 5 of the update section are either addressed or deferred. Point 2 is not directly addressed, since it is a marketing, not a technical, point. I prefer to continue to refer to it as caching, since really all this proposal currently does is provide advisory information to the target on various caching issues, information that can be used by any caching target, including those that do not implement anticipatory prefetching. REVISION 2: In response to working group comments, some terms used in the proposal were modified, a write caching page with a single control bit defined, and the retention priority fields reduced in complexity. While the write caching page has only bit, SCSI-3 will address write cachin control issues in detail, and it is thus expected that this page will increase in size. Insert, immediately following current section 8.2.7: 8.2.8 Write Caching Parameters Table 8-62: Write Caching Parameters ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 |Reserved|Reserved| Page Code (0Ch) | -----|-----------------------------------------------------------------------| 1 | Parameter Length (02h) | -----|-----------------------------------------------------------------------| 2 | Reserved | WCE | -----|-----------------------------------------------------------------------| 3 | Reserved | ============================================================================== The write caching parameters page specifies the parameters that control or advise the target on the use of it's cache. page 3 of 6 The WRITE CACHE ENABLE (WCE) bit is a control parameter. A WCE bit of zero indicates that the target shall only return GOOD status for a WRITE (group 0) or WRITE (group 1) command after successfully writing to the media all of the data transferred to the target. A WCE bit of one indicates that the target may return GOOD status for a WRITE (group 0) or WRITE (group 1) command after successfully storing all of the data transferred to the target either in the cache or on the media or both, but before all of the data has been successfully writen to the media. Insert, immediately following current section 8.2.6: 8.2.7 Read Caching Parameters Table 8-56: Read Caching Parameters ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 |Reserved|Reserved| Page Code (08h) | -----|-----------------------------------------------------------------------| 1 | Parameter Length (0Ah) | -----|-----------------------------------------------------------------------| 2 | Reserved | MS | RCD | -----|-----------------------------------------------------------------------| 3 | Demand Read Retention Priority | Write Retention Priority | -----|-----------------------------------------------------------------------| 4 | (MSB) | -----|--- Disable Prefetch Transfer Length ---| 5 | (LSB) | -----|-----------------------------------------------------------------------| 6 | (MSB) | -----|--- Minimum Prefetch ---| 7 | (LSB) | -----|-----------------------------------------------------------------------| 8 | (MSB) | -----|--- Maximum Prefetch ---| 9 | (LSB) | -----|-----------------------------------------------------------------------| 10 | (MSB) | -----|--- Maximum Prefetch Ceiling ---| 11 | (LSB) | ============================================================================== The read caching parameters page specifies the parameters that control or advise the target on the use of it's cache. page 4 of 6 The READ CACHE DISABLE (RCD) bit is a control parameter. A RCD bit of zero indicates that the target may return some or all of the the data requested by a READ (group 0) or READ (group 1) command by accessing the cache, not the media. A RCD bit of one indicates that the target shall not return any of the the data requested by a READ (group 0) or READ (group 1) command by accessing the cache. Rather, all of the data requested shall be read from the media. The MULTIPLE SELECTION (MS) bit is a control parameter. A MS bit of zero indicates that the target shall consider the Minimum and Maximum Prefetch fields to be specified in terms of the number of logical blocks for each of the respective types of prefetch. A MS bit of one indicates that the target shall consider the Minimum and Maximum Prefetch fields to be specified in terms of a scalar number which, when multiplied by the number of logical blocks to be transferred for the current command, yields the number of logical blocks for each of the respective types of prefetch. The DEMAND READ RETENTION PRIORITY field is an advisory parameter. It advises the target on the retention priority to assign data read into the cache that has also been transferred from the target to the initiator. A value of Fh indicates that the priority should be high - that data should not be replaced in favor of data fetched into the cache by another strategy (e.g. prefetching or writing). A value of 1h indicates that the priority should be low - the data can be replaced at the target's earliest opportunity. A value of 0h indicates that the priority should be the same as the average priority for all data in the cache. Note that this value necessarily implies a vendor specific assignment of priority, and should be used whenever no distinction should be made between demand read data and other data. All other values for this field are reserved. The WRITE RETENTION PRIORITY field is an advisory parameter. It advises the target on the retention priority to assign data written into the cache that has also been transferred from the initiator to the target. A value of Fh indicates that the priority should be high - that data should not be replaced in favor of data fetched into the cache by another strategy (e.g. prefetching or reading). A value of 1h indicates that the priority should be low - the data can be replaced at the target's earliest opportunity. A value of 0h indicates that the priority should be the same as the average priority for all data in the cache. Note that this value necessarily implies a vendor specific assignment of priority, and should be used whenever no distinction should be made between demand read data and other data. page 5 of 6 All other values for this field are reserved. An ANTICIPATORY PREFETCH occurs when data that has not yet been specifically requested by an initiator is read and stored in the cache memory, usually in conjunction with the reading of data that has been specifically requested by an initiator. The following parameters are advisory, and give an indication to the target of which and how much data should be stored into the cache given the most recent READ command. Anticipatory prefetching may be done using other information at the target's discretion. The DISABLE PREFETCH TRANSFER LENGTH field is an advisory parameter. It is used to selectively disable anticipatory prefetching on long requests for data. The value in this field is compared to the number of blocks requested by the current READ (group 0) or READ (group 1) command. If the number of blocks is greater than the disable prefetch transfer length, then the target is advised that no anticipatory prefetch should be done for that command. Otherwise the target is advised that it should attempt an anticipatory prefetch. If the prefetch disable transfer length is set to zero, then all anticipatory prefetching is disabled for any request for data, including those for zero logical blocks. The MINIMUM PREFETCH field is an advisory parameter. It is interpreted as specifying either a number of blocks or a scalar multiplier of the transfer length, depending upon the setting of the AMS bit. In either case, the resulting number of blocks is the number that the initiator advises the target to prefetch regardless of the delays it might cause in executing subsequent commands. The prefetching begins at the logical block immediately after the last logical block in the previous READ (group 0) or READ (group 1) command. Prefetching shall always halt before the end of the media. Errors during prefetching shall not be reported to the initiator unless that target cannot, as a result of the error, execute subsequent commands correctly. In this case the error may be reported either immediately as an error for the current READ command, or as a deferred error, at the discretion of the target and according to the rules for reporting deferred errors. IMPLEMENTOR'S NOTE: by setting the minimum prefetch field to zero, the initiator is advising the target that prefetching should be terminated whenever another command is ready for executing. The initiator can advise the target to ignore this consideration by setting the minimum prefetch equal to the maximum prefetch. page 6 of 6 The MAXIMUM PREFETCH field is an advisory parameter. It is interpreted as specifying either a number of blocks or a scalar multiplier of the transfer length, depending upon the setting of the AMS bit. In either case, the resulting number of blocks is the number that the initiator advises the target to prefetch if there are no delays in executing subsequent commands. The prefetching begins at the logical block immediately after the last logical block in the previous READ (group 0) or READ (group 1) command. Prefetching shall always halt before the end of the media. Errors during prefetching shall not be reported to the initiator unless that target cannot, as a result of the error, execute subsequent commands correctly. In this case the error may be reported either immediately as an error for the current READ command, or as a deferred error, at the discretion of the target and according to the rules for reporting deferred errors. IMPLEMENTOR'S NOTE: the maximum prefetch field advises the target on the maximum amount of data to ever prefetch into the cache as a result of one READ command. It is used in conjunction with the disable prefetch transfer length and maximum prefetch ceiling parameters to advise the target on how to trade off prefetching new data from the media with displacing old data already stored in the cache. The MAXIMUM PREFETCH CEILING field is a control parameter. It serves as a upper limit on the number of logical blocks computed as the maximum prefetch. If this number of blocks is greater thatn the maximum prefetch ceiling, then the number of logical blocks to maximally prefetch shall be truncated to the value stored in the ceiling field. IMPLEMENTOR'S NOTE: The maximum prefetch ceiling field can be used to limit the amount of data to be prefetched, and is useful only if the AMS bit is set to one.