Consistency verification of an instruction execution order for a multiprocessor system

Abstract: A method and system are disclosed for verifying consistency of an instruction execution order of a multiprocessor data processing system 10 with a specified memory consistency model. Each processor 12 within the multiprocessor data processing system executes instructions from an associated one of a number of instruction streams 60, 62, which include instructions that store a number of unique values from multiple processors to a single selected address within memory. One of the unique values is loaded from the selected address to a particular processor within the data processing system. A set of valid values which may be returned by the loading step is determined according to the specified memory consistency model. By comparing the unique value with members of the set of valid values, the instruction execution order of the multiprocessor data processing system is verified. Utilizing the unique value which was returned by the load instruction, the set of valid values may then be updated.

Description: The present invention relates in general to a method and system for verifying proper operation of a data processing system and in particular to an improved method and system for verifying proper operation of a multiprocessor data processing system. Within multiprocessor data processing systems having a memory hierarchy and a globally accessible main memory store, maintaining memory coherency is a key design consideration. Memory coherency issues arise since absent architectural inhibition, each of the multiple processors may concurrently modify a local copy of data associated with a single main memory store address. Since the relative timing of data modifications propagating through the memory hierarchy to the main memory store is inexact, the multiprocessor data processing system requires a uniform method of ensuring that consistent data is seen by all processors. A common method of maintaining memory coherency within a multiprocessor data processing system is to implement a set of rules, often called a memory consistency model, that specifies an instruction execution order for each processor and between the multiple processors. Thus, when each of the multiple processors issues instructions that modify data associated with an address, the memory consistency model of the data processing system maintains vertical coherency by ordering certain instructions executed by each processor and maintains lateral coherency by prescribing an execution order for instructions issued by multiple processors. The types of memory consistency models utilized within multiprocessor data processing systems vary between strong ordering models, which require the execution of instructions in the precise sequential order defined by the software program, and weak ordering models, which allow out of order execution. An important aspect of both the design and testing of multiprocessor, data processing systems is verification of correct implementation of a selected memory consistency model. Referring now to Figure 1 , there is illustrated a high level flowchart of a conventional method utilized to verify correct implementation of a memory consistency model within a data processing system. As illustrated, an instruction stream, representing instructions to be executed by a processor, is simultaneously input to the data processing system F(x) and a simplified, yet behaviorly correct model f'(x). The output data of the data processing system F(x) and the. simplified model f'(x) are then compared to determine if the data selected as valid by the memory consistency model is returned by data processing system F(x). If F(x) does not return the data indicated by the simplified memory consistency model, an architectural error in implementing the selected memory consistency model within the data processing system has been detected. When applied to multiprocessor data processing systems, the conventional approach to verification illustrated in Figure 1 is typically implemented utilizing a verification methodology called "false sharing." When operating with false sharing enforced, multiple processors can access the same addressable memory segment (e.g., cache line), but are prohibited from accessing the same data byte within the memory segment. Since false sharing does not allow the verification of instruction execution ordering for instructions issued by multiple processors to an atomic memory element, false sharing limits detection of memory consistency model violations to certain execution scenarios. A second problem which arises in conventional implementations of the verification method depicted in Figure 1 within a multiprocessor environment is that the verification techniques typically rely on data observed through monitoring low level system events. To verify lateral coherency, that is, proper instruction execution ordering across the multiple processors, according to the model illustrated in Figure 1 , conventional verification schemes require exact completion times for store instructions issued by the multiple processors which modify data associated with a single memory address. However, in practice, low level details such as the completion times of stores from each of the processors are often unavailable. Consequently, it would be desirable to provide an improved method and system for verifying instruction execution ordering within a multiprocessor data processing system which do not require the monitoring of low level events within the data processing system. Accordingly, the present invention provides a method, within a multiprocessor data processing system having a plurality of processors and a memory, for verifying consistency of an instruction execution order with a specified memory consistency model, wherein each of said plurality of processors executes instructions from an associated instruction stream, said method comprising: storing a plurality of unique values from said plurality of processors to a single selected address within said memory; loading a unique value among said plurality of unique values from said selected address to a particular processor among said plurality of processors; determining a set of valid values which may be returned by said loading step according to said specified memory consistency model; and comparing said unique value with the members of said set of valid values to verify said instruction execution order. The method preferably further includes, in response to determining from said comparison that said unique value is not a member of said set of valid values, indicating that said instruction execution order is improper. It is also preferred to remove each unique value from said set of valid values which corresponds to a store instruction known to have completed prior to a store instruction corresponding to another unique value within said set of valid values. In the preferred embodiment said multiprocessor data processing system employs a weak consistency model of instruction execution ordering, and a unique value among said plurality of unique values comprises data encoded with an identifier specifying which processor among said plurality of processors stored said unique value to said selected address. Said set of valid values comprises a unique value associated with a most recent store issued by said particular processor, all unique values associated with store instructions not verified to have completed that were issued by processors among said plurality of processors other than said particular processor, and unique values associated with a last store instruction issued by each processor among said plurality of processors other than said particular processor that was verified as completed by a load instruction issued by said particular processor. The invention further provides a system, within a multiprocessor data processing system having a plurality of processors and a memory, for, verifying consistency of an instruction execution order with a specified memory consistency model, wherein each of said plurality of processors executes instructions from an associated instruction stream comprising: means for storing a plurality of unique values from said plurality of processors to a single selected address within said memory; means for loading a unique value among said plurality of unique values from said selected address to a particular processor among said plurality of processors; means for determining a set of valid values which may be returned by said loading step according to said specified memory consistency model; and means for comparing said unique value with the members of said set of valid values to verify said instruction execution order. Such a system and method verify instruction execution ordering within a multiprocessor data processing system, and in particular can verify consistency of an instruction execution order of a multiprocessor data processing system with a specified memory consistency model. In the preferred embodiment each processor within the multiprocessor data processing system executes instructions from an associated one of a number of instruction streams, which include instructions that store a number of unique values from multiple processors to a single selected address within memory. One of the unique values is loaded from the selected address to a particular processor within the data processing system. A set of valid values which may be returned by the loading step is determined according to the specified memory consistency model. By comparing the unique value with members of the set of valid values, the instruction execution order of the multiprocessor data processing system is verified. Utilizing the unique value which was returned by the load instruction, the set of valid values may then be updated. A preferred embodiment of the invention will now be described in detail by way of example with reference to the following cases: Figure 1 illustrates a high level flowchart of a conventional method for verifying instruction execution ordering within a data processing system having a single processor; Figure 2 depicts a block diagram of a preferred embodiment of a multiprocessor data processing system; Figures 3A and 3B are flowcharts illustrating the method utilized to verify instruction execution ordering within a multiprocessor data, processing system; Figure 4 depicts a preferred embodiment of unique data utilized within the method illustrated in Figures 3A and 3B; and Figure 5 illustrates an example of three instruction streams which are utilized to verify proper instruction execution ordering within a multiprocessor data processing system. With reference now to the figures, and in particular with reference to Figure 2 , there is illustrated a preferred embodiment of a multiprocessor data processing system. As illustrated, data processing system 10 includes a number of central processing units (CPUs) 12, which each include an on-board level one (L1) cache 14. Each L1 cache 14 comprises a small amount of high speed memory which stores a local copy of data utilized by its associated CPU 12 . When data requested by a CPU 12 is not resident within its associated L1 cache 14, CPU 12 will attempt to load the requested data from an associated L2 cache 26 which comprises the second level of the memory hierarchy. As depicted, each L2 cache 26 may be shared by multiple CPUs 12. When data requested by a CPU 12 are not resident within its associated L1 cache 14 or L2 cache 16, L2 cache 16 will forward the request to main memory 18, which is coupled to each of L2 caches 16 via interconnect 20 . After a CPU 12 modifies a local copy of data resident within its L1 cache 14, CPU 12 stores the modified data back to L1 cache 14. Depending upon the memory management protocol (e.g., write-through or write-back) implemented within data processing system 10 , the modified data may be written simultaneously to main memory 18 or may be written at a later time when a copy back operation is performed. Because each CPU 12 can modify a local copy of data associated with an address within main memory 18 by issuing store instructions, data processing system 10 must employ a memory consistency model that specifies an execution order for instructions that modify data associated with a single address within main memory 18 . As described above, the memory consistency model prescribes both a vertical consistency for each individual CPU 12 and a lateral consistency between multiple CPUs 12. The implementation of an architecturally determined memory consistency model within data processing system 10 eliminates coherency errors arising from variations in the timing of data modifications propagating through the memory hierarchy. Referring now to Figures 3A and 3B , there are illustrated two flowcharts which depict the method utilized to verify consistency of the instruction execution ordering of a multiprocessor data processing system with a specified memory consistency model. As will be appreciated by those skilled in the art, the method illustrated in Figures 3A and 3B may be utilized both as a design tool to analyze the operation of modelled data processing systems and to verify and test the design of an actual data processing system, such as data processing system 10 of Figure 2 . For example, the processes depicted in Figures 3A and 3B may be implemented as a computer-aided design (CAD) software tool utilized to evaluate proper execution ordering within a computer-modelled multiprocessor data processing system. Alternately, the processes illustrated in Figures 3A and 3B may be implemented as a diagnostic tool utilized to verify proper operation of an actual multiprocessor data processing system. Referring first to Figure 3A , the process begins at block 30 and thereafter proceeds to block 32 , which depicts the multiprocessor data processing system under test (e.g., data processing system 10 ) constructing an instruction stream for each CPU 12 . Each instruction stream may contain a variety of instruction types, but will contain at least some instructions which store data to and load data from addresses within main memory 18 . Although these instruction types will be described hereinafter as "store" and "load" instructions, those skilled in the art will appreciate that these designations represent a variety of instructions within the instruction set of CPUs 12 that load data from and store data to addresses within main memory 18. Unlike verification methodologies which implement false sharing, the instruction streams generated at block 32 are allowed to include load and store instructions issued from multiple CPUs 12 to the same address. In order to determine the execution order of store instructions issued from multiple CPUs 12 to a single address, arbitrary data are utilised for store operands, with the restriction that the operands for all unresolved store instructions must be unique. Because unique data are utilized, when multiple CPUs 12 issue store instructions to a single address this enables verification of execution ordering by simply loading the contents of the selected address. This eliminates the necessity of monitoring the completion times of store instructions for each CPU 12 , as is required in conventional methods of memory consistency model verification. However, as will be described below, if completion times of store instructions issued by CPUs 12 are available, the additional data is utilized to enhance the precision of verification provided. With reference now to Figure 4, there is illustrated a preferred embodiment of a unique data byte utilized in the above approach. Data byte 58 comprises eight bits, log 2 N of which are "colored" with a CPU ID that specifies which of the N CPUs 12 issued data byte 58 as the operand of a store instruction. The remaining bits contain unique data, such as a monotonically increasing value. As will be appreciated by those skilled in the art, data byte 58 may be replicated as many times as necessary to satisfy the operand length required by a particular data processing system. Although colored data byte 58 illustrated in Figure 4 is a preferred embodiment of the unique data generated at block 32, those skilled in the art will appreciate that any arbitrary data may be utilized as long as pending store instruction operands are not duplicated between CPUs 12 during verification. Returning to Figure 3A , the process proceeds from block 32 to block 34, which illustrates each CPU 12 within data processing system 10 executing its associated instruction stream. Those skilled the art will appreciate that the execution of an instruction by a CPU 12 is a process comprising a number of steps, including issuance, when execution is initiated, and completion, when the instruction is retired. Since load and store instructions issued by CPUs 12 to differing addresses present no possibility of an ordering violation across processors, the subsequent discussion will describe instructions issued to a single address within main memory 18. The process proceeds from block 34 to block 36, which depicts each CPU 12 transmitting a message to the monitoring process depicted in Figure 3B that describes what instruction was executed at block 34. As mentioned above, relative completion times of instructions issued by multiple CPUs 12 may not be available since the availability of completion times depends upon the provision of facilities to monitor such information. However, issuance and completion of load and store instructions may readily be monitored by snooping communication between each CPU 12 and its associated caches. Thereafter, the process returns from block 36 to block 34 , where execution of the instruction streams continues. Referring now to Figure 3B, there is depicted a process that operates concurrently with the process illustrated in Figure 3A to verify compliance of instruction execution ordering within data processing system 10 with the selected memory consistency model. The process begins at block 40 when a message is received from the process depicted in Figure 3A, indicating which instruction was issued or completed by a particular CPU 12 and the instruction's operand value, if any. Utilizing the information within messages transmitted by each CPU 12 , the process at block 42 builds instruction queues that list in execution order the instructions (and their, associated operands) within each instruction stream. The process then proceeds to block 44 , which illustrates determining if the message received at block 40 specified that a store instruction was executed. If the message indicates that the instruction is a store, the process proceeds from block 44 to block 46. Block 46 illustrates applying the memory consistency model implemented within data processing system 10 to the instruction queues constructed at block 42 to update a set of valid data values for the selected address within main memory 18. As will be appreciated by those skilled in the art, in data processing systems which employ a sequential consistency model, the set of valid values will be singular since systems which employ a strong consistency model execute instructions in strict chronological order. Thus, if the current store instruction has completed, the valid data value for the address will be the operand of the current store instruction. However, in data processing system which enforce a weak consistency model that allows out of order execution, many valid values are possible since the completion order of instructions is not predetermined by the memory consistency model. For a particular CPU 12 , the valid set determined at block 46 will include the last store completed by that CPU 12 (i.e., the current store instruction), the last store completed by other CPUs 12 which were verified by loads to the particular CPU 12 , and pending store instructions from the other CPUs 12 . Operand values of prior store instructions completed by the particular CPU 12 can be eliminated from the set of valid values since these operand values will have been overwritten by the operand value of the current store instruction. Thereafter, the process terminates at block 54 . Returning to block 44 , if the instruction specified in the message received at block 40 is not a store instruction, the process proceeds to block 47, which illustrates determining if the instruction contained in the message is a load. If the instruction is not a load, the process terminates at block 54. However, if the instruction specified by the message is a load, the process proceeds to block 48 , which depicts determining if the value returned by the load instruction to the CPU 12 which executed the load is within the set of valid values constructed for that CPU 12 at block 46 . If the value returned by the load instruction is not within the set of valid values, then an instruction execution order violation is reported at block 50 . For example, if the present invention were implemented within CAD tool, at block 50 the CAD program would notify the user that an architectural error within the modelled data processing system had been detected. If, however, the value returned by the load is within the valid, set, the process proceeds to block 52 , which illustrates updating the set of valid values for the selected address by eliminating operands of store instructions that are known to have completed prior to the instruction whose operand was loaded from the selected address. Thus, as will be appreciated by those skilled in the art, utilizing unique store instruction operands, such as data byte 58 of Figure 4, enables members of the valid set to be cast out since loading the value of the selected address reveals which of a number of pending store instructions completed last. When relative completion times for all store instructions issued by each CPU 12 are available, for example, in computer-modelled multiprocessor data processing systems, the size of the set of valid values may be further reduced by eliminating all members from the set of valid values whose associated store instructions are known to have completed before other instructions that completed prior to the load instruction. The process then proceeds from block 52 to block 54, where the process terminates. Referring now to Figure 5, the method illustrated in Figures 3A and 3B will now be described with reference to an example in which the instruction execution ordering of a data processing system having three processors is verified. As depicted, instruction streams 60, 62, and 64, which are generated at block 32 of Figure 3A, are to be executed by CPU0, CPU1, and CPU2, respectively. The instructions within each stream are indexed, with the first subscript denoting the instruction stream number and the second identifying an instruction's location within its instruction stream. Next, assume that ST t02 , LD t14 , ST t12 , ST t13 , and ST t23 have issued but not completed and that LD t03 is selected as a verification point when completed by CPU0 at block 34 of Figure 3A . As described above, the execution of LD t03 generates the transmission of a message that initiates the process depicted in Figure 3B . With reference now to block 42 of Figure 3B, the instruction LD t03 is added to the instruction queue corresponding to instruction stream 60. The process then proceeds from block 42 to block 44, which depicts determining if the instruction is a store. Since LD t03 is a load instruction, the process proceeds from block 44 through block 47 to block 48, which illustrates determining if the value returned by LD t03 is a member of the set of valid values for CPU0 previously constructed at block 46. In the present example, the multiprocessor data processing system under test employs a weak consistency model defined by the following rules: 1. Loads and stores from the same CPU to different addresses may execute in any order; 2. Loads from a CPU to a particular address will wait for the completion of stores from the same CPU to the same address; and 3. Loads and stores from different CPUs may execute in any order, unless a synchronization point, such as an atomic load/store operation, is present. Thus, when the completion times of preceding store instructions are not known, the general rule for construction of valid sets for each processor is as follows: V(LD it ) = ST itLast ∪(∀(j ≠ i)) [ST jNV ∪ST jL ], where LD it = load from CPU i at time t; V(LD it ) = value returned by load LD it ; ST itLast = last store from CPU i prior to time t; ST jNV = all stores issued from CPU j, prior to time t, but not verified at CPU i; and ST jL = last store from CPU j verified as completed by a load instruction issued by CPU i. Applying these construction rules for valid sets to instruction streams 60-64 illustrated in Figure 5, the equation for determining the valid set if given by V (LD 03 ) = ST t02 ∪(∀(j ≠ 0)) [ST jNV ∪ST jL ]. Thus, by inspection of instruction streams 60-64, it is apparent that the valid set for LD t03 is {ST t13 ; ST t12 ; ST t23 ; ST t02 }. However, if store completion times are available, the cardinality of the valid set may be reduced. For example, if ST t02 and ST t23 both completed prior to LD t03 and ST t23 completed after ST t02 , then the valid set for LD t03 comprises ST t13 and ST t12 . Returning to block 48 of Figure 3B, the value loaded from the selected address at block 48 is compared to the valid set constructed for CPU0 at block 46. If the loaded value is not within the set of valid values, then an error in the instruction execution ordering of the data processing system under test is detected and the process terminates at block 50 . However, if the instruction execution ordering of the data processing system is verified, the process utilizes the value returned by the load instruction, to update the valid set at block 52 . If the value returned by the load instruction was the last store issued by CPU i (i.e., CPU0), the valid set is updated at block 52 by removing values from the valid set that were operands of store instructions issued from CPU i, except for the last store value (ST itLast ). If the value returned by the load instruction was not the last store from CPU i, the valid set is updated by removing all values from the valid set that were stores from CPU i prior to the load instruction. Thus, to complete the example, if the value returned by LD t03 is ST t02 , then the process determines that ST t02 has completed, but that the status of ST t13 , ST t12 , and ST t23 is unknown. Therefore, the valid set is updated by discarding all operands of store instructions issued by CPU0, except for ST t02 . In the present example, no values are discarded in this case and the valid set visible to LD t04 , the subsequent load from CPU0, remains {ST t13 ; ST t12 ; ST t23 ; ST t02 }. On the other hand, if the value returned by LD t03 is ST t13 , the process determines that ST t13 completed after ST t12 and ST t02 . Therefore, the valid set for CPU0 is updated by eliminating ST t02 and ST t12 , leaving the valid set {ST t13 ; ST t23 }. The method and system described above for verifying execution ordering within a multiprocessor data processing system has the advantage that the enforcement of a selected memory consistency model may be verified without requiring the data processing system to monitor the completion times of store instructions. However, if completion times of store instructions are available, this additional information may be utilised to more precisely delineate proper execution ordering outcomes within the data processing system.

Claims: A method, within a multiprocessor data processing system (10) having a plurality of processors (12) and a memory (18), for verifying consistency of an instruction execution order with a specified memory consistency model, wherein each of said plurality of processors executes instructions from an associated instruction stream (60, 62), said method characterized by the steps of: storing a plurality of unique values from said plurality of processors to a single selected address within said memory; loading a unique value among said plurality of unique values from said selected address to a particular processor among said plurality of processors; determining a set of valid values which may be returned by said loading step according to said specified memory consistency model; and comparing said unique value with the members of said set of valid values to verify said instruction execution order. The method for verifying consistency of an instruction execution order of Claim 1, further comprising: in response to determining from said comparison that said unique value is not a member of said set of valid values, indicating that said instruction execution order is improper. The method for verifying consistency of an instruction execution order of Claim 1 or 2, said method further comprising: removing each unique value from said set of valid values which corresponds to a store instruction known to have completed prior to a store instruction corresponding to another unique value within said set of valid values. The method for verifying consistency of an instruction execution order of any preceding Claim, wherein a unique value among said plurality of unique values comprises data (58) encoded with an identifier specifying which processor among said plurality of processors stored said unique value to said selected address. The method for verifying consistency of an instruction execution order of any preceding Claim, wherein said multiprocessor data processing system employs a weak consistency model of instruction execution ordering. The method for verifying consistency of an instruction execution order of Claim 5, wherein said set of valid values comprises a unique value associated with a most recent store issued by said particular processor, all unique values associated with store instructions not verified to have completed that were issued by processors among said plurality of processors other than said particular processor, and unique values associated with a last store instruction issued by each processor among said plurality of processors other than said particular processor that was verified as completed by a load instruction issued by said particular processor. A system, within a multiprocessor data processing system (10) having a plurality of processors (12) and a memory (18), for verifying consistency of an instruction execution order with a specified memory consistency model, wherein each of said plurality of processors executes instructions from an associated instruction stream (60, 62), characterized in that it comprises: means for storing a plurality of unique values from said plurality of processors to a single selected address within said memory; means for loading a unique value among said plurality of unique values from said selected address to a particular processor among said plurality of processors; means for determining a set of valid values which may be returned by said loading step according to said specified memory consistency model; and means for comparing said unique value with the members of said set of valid values to verify said instruction execution order. The system for verifying consistency of an instruction execution order of Claim 7, further comprising: means for indicating that said instruction execution order is improper in response to determining from said comparison that said unique value is not a member of said set of valid values. The system for verifying consistency of an instruction execution order of Claim 7 or 8, said method further comprising: means for removing each unique value from said set of valid values which corresponds to a store instruction known to have completed prior to a store instruction corresponding to another unique value within said set of valid values. The system for verifying consistency of an instruction execution order of Claim 7, 8 or 9, wherein a unique value among said plurality of unique values comprises data (58) encoded with an identifier specifying which processor among said plurality of processors stored said unique value to said selected address. The system for verifying consistency of an instruction execution order of any of Claims 7 to 10, wherein said multiprocessor data processing system employs a weak consistency model of instruction execution ordering. The system for verifying consistency of an instruction execution order of Claim 11, wherein said set of valid values comprises a unique value associated with a most recent store issued by said particular processor, all unique values associated with store instructions not verified to have completed that were issued by processors among said plurality of processors other than said particular processor, and unique values associated with a last store instruction issued by each processor among said plurality of processors other than said particular processor that was verified as completed by a load instruction issued by said particular processor.

Inventors: MALIK NADEEM, O'KRAFKA BRIAN, SAHA AVIJIT, SALAMIAN SHAHRAM, MALIK, NADEEM, O'KRAFKA, BRIAN, SAHA, AVIJIT, SALAMIAN, SHAHRAM
Applicants: IBM, INTERNATIONAL BUSINESS MACHINES CORPORATION
Application year: 1996
Main classification: G06F11
IPC codes: G06F12, G06F11, G06F15