Source: http://www.google.com/patents/US6256775?dq=7,053,767
Timestamp: 2017-11-24 11:57:16
Document Index: 490438552

Matched Legal Cases: ['application No. 08', 'application No. 08', 'application No. 08', 'application No. 08', 'application No. 08', 'application No. 08', 'application No. 08', 'application No. 08', 'application No. 08', 'application No. 08', 'application No. 08']

Patent US6256775 - Facilities for detailed software performance analysis in a multithreaded ... - Google Patents
A method, apparatus, and article of manufacture for monitoring performance of an application or a system program executed by a multithreaded processor arranged and configured to process a plurality of threads and facilitate thread switch. The low-level invisible events, such as cache misses, or other...http://www.google.com/patents/US6256775?utm_source=gb-gplus-sharePatent US6256775 - Facilities for detailed software performance analysis in a multithreaded processor
Publication number US6256775 B1
Application number US 08/989,220
Publication number 08989220, 989220, US 6256775 B1, US 6256775B1, US-B1-6256775, US6256775 B1, US6256775B1
Inventors William Thomas Flynn
Patent Citations (25), Non-Patent Citations (22), Referenced by (200), Classifications (23), Legal Events (5)
Facilities for detailed software performance analysis in a multithreaded processor
US 6256775 B1
A method, apparatus, and article of manufacture for monitoring performance of an application or a system program executed by a multithreaded processor arranged and configured to process a plurality of threads and facilitate thread switch. The low-level invisible events, such as cache misses, or other events of interest of an application or a system program, are detected and recorded by using a software monitor program running on a thread of the multithreaded processor via thread switching techniques. The monitoring thread gains control once a selected event is detected while executing the application or system program, and it relinquishes the control after completing the recording of the selected event. The recorded information allows one to dynamically profile the application or the system program and to provide insight into the performance characteristics of the application or the system program.
1. A multithreaded processor, arranged and configured to process a plurality of threads and facilitate thread switch, for monitoring performance of the application executed by the processor, comprising:
(a) a first thread arranged and configured for executing the application on the first thread;
(b) a second thread arranged and configured for executing recording of at least one selectable thread switch event upon detection of the selectable thread switch event during execution of the application on the first thread; and
(c) a thread switch controller for detecting the selectable thread switch event and controlling thread switch between the first thread and the second thread, wherein in response to detection of the selectable thread switch event, the thread switch controller switches processing from the first thread to the second thread, whereby the second thread records information of the selectable thread switch event, and upon completion of recording, the thread switch controller switches processing from the second thread to a thread other than the second thread to continue execution of the application.
2. A multithreaded processor of claim 1, wherein the thread switch controller comprises a thread switch control register including a first bit for forcing a thread switch, a second bit for indicating whether the thread switch has occurred, a third bit for blocking a thread switch, a fourth bit for allowing exactly two thread switches to occur, and a set of bits for encoding a latest thread switch reason.
3. A multithreaded processor of claim 1, wherein the first thread is normally an active thread, the second thread is normally a dormant thread.
4. A multithreaded processor of claim 2, wherein the thread switch control register is an architected software-accessible special purpose register in which the second bit, the third bit, and the set of bits are set by hardware operatively connecting to the processor.
5. A multithreaded processor of claim 1, wherein the selectable thread switch event includes at least one from the group consisting of: L1 data cache miss, L2 data cache miss, L1 instruction cache miss, L2 instruction cache miss, instruction translation lookaside buffer (TLB) miss, data translation lookaside buffer (TLB) miss, and thread time-out.
6. A method of monitoring at least one selectable event of at least one application by a multithreaded processor which is arranged and configured to process a plurality of threads and facilitate thread switch, the method comprising the steps of:
(a) executing the application on a first thread of the multithreaded processor;
(b) detecting the selectable event of the application by a thread switch controller;
(c) switching processing from the first thread to a second thread responsive to detecting the selectable event;
(d) executing the second thread to record information of the selectable event; and
(e) switching processing from the second thread to a thread other than the second thread, upon completion of recording.
7. The method of claim 6, the thread switch controller providing a thread switch control register including a first bit for forcing a thread switch, a second bit for indicating whether the thread switch has occurred, a third bit for blocking thread switch, a fourth bit for allowing exactly two thread switches to occur, and a set of bits for encoding a latest thread switch reason.
8. The method of claim 6, the first thread being normally an active thread, the second thread being normally a dormant thread.
9. The method of claim 7, the thread switch control register being an architected software-accessible special purpose register in which the second bit, the third bit, and the set of bits are set by hardware operatively connecting to the processor.
10. The method of claim 6, wherein the selectable event includes at least one from the group consisting of: L1 data cache miss, L2 data cache miss, L1 instruction cache miss, L2 instruction cache miss, instruction translation lookaside buffer (TLB) miss, data translation lookaside buffer (TLB) miss, and thread time-out.
11. An article of manufacture for a computer-based user-interface, the article of manufacture comprising a computer readable medium having instructions for causing a computer to perform a method, by a multithreaded processor arranged and configured to process a plurality of threads and facilitate thread switch, the method comprising the steps of:
(b) detecting at least one selectable event of the application by a thread switch controller of the multithreaded processor;
a multithreaded processor, said multithreaded processor supporting the concurrent execution of a plurality of threads and including:
(a) a plurality of sets of registers, each set corresponding to a respective thread, and
(b) thread switch logic, said thread switch logic switching execution from one of said plurality of threads to another of said plurality of threads in response to detection of a thread switch condition; and
a performance monitor embodied as a plurality of processor-executable instructions in a monitoring thread stored on said computer system, wherein said monitoring thread records the occurrence of a thread switch event responsive to said thread switch logic switching execution from a monitored thread to said monitoring thread, and wherein said monitoring thread causes said thread switch logic to switch execution to a thread other than said monitoring thread after recording the occurrence of said thread switch event.
13. A computer system of claim 12, wherein the thread switch logic comprises a software-accessible thread switch control register having a plurality of thread switch control bits, wherein at least one of said control bits is set by hardware operatively connected to the processor.
14. A computer system of claim 13, wherein said thread switch control bits include a bit for forcing a thread switch.
15. A computer system of claim 13, wherein said thread switch control bits include a plurality of bits specifying a reason for a thread switch.
The present invention generally relates to the following U.S. applications, the subject matter of which is hereby incorporated by reference: (1) U.S. patent application entitled Using Multithreading Resources For Improving Branch Instruction Handling, RO997-172 (unknown serial no., filing date Oct. 29, 1997); (2) U.S. patent application entitled Method and Apparatus to Force a Thread Switch In a Multithreaded Processor, RO997-107 (unknown serial no., filing date Oct. 23, 1997); (3) U.S. patent application entitled Method and Apparatus for Selecting Thread Switch Events in a Multithreaded Processor, RO997-104 (unknown serial no., filing date Oct. 23, 1997); (4) U.S. patent application entitled Forward Progress Guarantee in a Multithreaded Processor, RO997-105 (unknown serial no., filing date Oct. 23, 1997); (5) U.S. patent application entitled Altering Thread Priorities in a Multithreaded Processor, RO997-106 (unknown serial no., filing date Oct. 23, 1997); (6) U.S. patent application entitled Thread Switch Control in a Multithreaded Processor System, RO996-042 (unknown serial no., filing date Oct. 23, 1997); (7) U.S. Ser. No. 08/773,572 filed Dec. 27, 1996 entitled Background Completion of Instruction and Associated Fetch Request in a Multithread Processor; (8) U.S. Ser. No. 08/761,378 filed Dec. 9, 1996 entitled Multi-Entry Fully Associative Transition Cache; (9) U.S. Ser. No. 08/761,380 filed Dec. 9, 1996 entitled Method and Apparatus for Prioritizing and Routing Commands from a Command Source to a Command Sink; (10) U.S. Ser. No. 08/761,379 filed Dec. 9, 1996 entitled Method and Apparatus for Tracking Processing of a Command; and (11) U.S. Ser. No. 08/473,692 filed Jun. 7, 1995 entitled Method and System for Enhanced Multithread Operation in a Data Processing System by Reducing Memory Access Latency Delays.
The present invention relates in general to an improved method for and apparatus of a computer data processing system, and in particular, to an improved high performance processor and method embodied in the combination of hardware and software of the processor by using threadswitch techniques to monitor low-level events throughout a chip without external monitoring devices.
The fundamental structure of a modem computer includes peripheral devices to communicate information to and from the outside world; such peripheral devices may be keyboards, monitors, tape drives, communication lines coupled to a network, etc. Also included in the basic structure of the computer is the hardware necessary to receive, process, and deliver this information to and from the outside world, including busses, memory units, input/output (I/O) controllers, storage devices, and at least one central processing unit (CPU), etc. By analogy, the CPU is the brain of the system since it executes the instructions which comprise a computer program and directs the operation of the other system components.
And yet another technique to improve the efficiency of hardware within the CPU is to divide a processing task into independently executable sequences of instructions called threads. This technique is related to breaking a larger task into smaller tasks for independent execution by different processors except here the threads are to be executed by the same processor. When a CPU then, for any of a number of reasons, cannot continue the processing or execution of one of these threads, the CPU switches to and executes another thread. One technique is to incorporate hardware multithreading to tolerate memory latency. The term “multithreading” as defined in the computer architecture community is not the same as the software use of the term which means one task subdivided into multiple related threads. In the architecture definition, the threads may be independent. Therefore, the term “hardware multithreading” is often used to distinguish the two uses of the term “multithreading”. The present invention incorporates the term multithreading to connote hardware multithreading.
Existing multithreading techniques describe switching threads on a cache miss or a memory reference. A primary example of this technique may be reviewed in “Sparcle: An Evolutionary Design for Large-Scale Multiprocessors,” by Agarwal et al., IEEE Micro Volume 13, No. 3, pp. 48-60, June 1993. As applied in a RISC architecture, multiple register sets normally utilized to support function calls are modified to maintain multiple threads. For example, eight overlapping register windows are modified to become four non-overlapping register sets, wherein each register set is a reserve for trap and message handling. This system discloses a thread switch which occurs on each first level cache miss that results in a remote memory request. While this system represents an advance in the art, modem processor designs often utilize a multiple level cache or high speed memory which is attached to the processor. The processor system then utilizes some well-known algorithm to decide what portion of its main memory store will be loaded within each level of cache. Therefore, each time a memory reference occurs which is not present within the first level of cache, the processor must attempt to obtain that memory reference from a second or higher level of cache.
It is often desirable to dynamically profile an application or system program so as to provide insight into its performance characteristics, such as the normally invisible low-level events throughout the chip, such as L1 and L2 cache misses, etc. Various methods including software methods and hardware methods exist to monitor performance of an application or a system program. Software methods offer flexibility and user convenience but usually cannot acquire the necessary details of the performance of the application or system program. Hardware methods require connection of external devices to a processor to monitor buses, etc., which are not convenient and also very costly. Current various methods and systems merely provide frequency of occurrence of the low-level events by counting the occurrence. These methods do not provide information as to what kind of event it is, where it is, or when it is, etc. There are other information of an application or a system program that is of interest in profiling the application and the system program. Traditional methods do not provide a monitoring program to detect or record the information of interest so as to improve the performance of the application or a system program.
It should thus be apparent that a need exists for a method, an apparatus, and an article of manufacture to monitor performance of an application or a system program. Threadswitch techniques are used in the present invention to monitor selectable low-level events throughout hardware of a chip.
In accordance with the principles of the present invention, a multithreaded processor, arranged and configured to process a plurality of threads and facilitate thread switch, contains a thread switch control logic to monitor low-level events throughout a computer chip, as a means to assist in deciding when to switch control from an active thread to a dormant thread. The multithreaded processor of the present invention detects the low-level events, such as L1 and L2 cache misses, which are not normally detectable at the software level. By adding some hardware features, the thread switch control logic can be used as a means of detecting, counting, monitoring, etc., selectable events of interest. A thread which interacts with these hardware facilities is used as a monitor program. This thread is thus called “monitor thread”. One or more other threads are the processes of an application or a system program being monitored. A dual-threaded processor is the simplest case, where the process being monitored and the monitor itself (or called a software monitor program) are the two threads being executed. In other embodiments, more than one monitor threads can be used to monitor one or more processes of one or more applications or system programs.
Therefore, according to one aspect of the invention, there is provided a multithreaded processor, arranged and configured to process a plurality of threads and facilitate thread switch, for monitoring performance of at least one application running on the processor. The multithreaded processor includes a first thread arranged and configured for executing at least one application on the first thread, a second thread arranged and configured for executing recording of at least one selectable event upon detection of the selectable event during execution the program on the first thread, and a thread switch controller for detecting the selectable event and controlling thread switch between the first thread and the second thread. Upon occurrence of the selectable event, the thread switch controller switches processing from the first thread to the second thread, whereby the second thread records information of the selectable event. Upon completion of recording, the thread switch controller switches processing from the second thread to the first thread. If desired, the first thread can continue executing the application or system program.
One aspect of the invention is the thread switch controller. In one embodiment, the thread switch controller includes a thread switch control register having a first bit for forcing a thread switch, a second bit for indicating whether the thread switch has occurred, a third bit for blocking threadswitch, a fourth bit for allowing exactly two thread switches to occur, and a set of bits for encoding a latest thread switch reason.
Another aspect of the invention is that the first thread is normally an active thread and the second thread is normally a dormant thread prior to occurrence of the selectable event or after completion of recording of the selectable event.
According to a further aspect of the invention, the thread switch control register is an architected software-accessible special purpose register in which the second bit, the third bit, and the set of bits are set by hardware operatively connecting to the processor. The first, second, third, and fourth bits and the set of bits are set and/or reset by a software monitor program operatively implemented in the processor.
Yet another aspect of the invention, the selectable event includes one from the group, but not limited to, of: L1 data cache miss, L2 data cache miss, L1 instruction cache miss, L2 instruction cache miss, instruction translation lookaside buffer (TLB) miss, data translation lookaside buffer (TLB) miss, and thread time-out.
In an alternative embodiment, the software monitor program can be executed on a plurality of threads.
The present invention is also a method of monitoring a selectable event of at least one application by a multithreaded processor arranged and configured to process a plurality of threads and facilitate thread switch. The method includes the steps of executing at least one application on a first thread of the multithreaded processor, detecting the selectable event of the application by a thread switch controller, switching processing from the first thread to a second thread to record the selectable event and information of the selectable event including a thread switch reason, and switching processing from the second thread to the first thread, upon completion of recording, if desired to continue execution of the application. The multithreaded processor executes processes in a normal mode (i.e. non-monitoring mode) until a monitor program is initialized (monitoring mode). In the monitoring mode, the processor switches between a processing thread and a monitoring thread. The processing thread executes an application or a system program to be monitored, and the monitoring thread executes a monitor program wherein it is active upon detection of at least one selectable event and records the selectable event.
According to a further aspect of the invention, there is provided the method as recited above in which the thread switch controller provides a thread switch control register including a first bit for forcing a thread switch, a second bit for indicating whether the thread switch has occurred, a third bit for blocking threadswitch, a fourth bit for allowing exactly two thread switches to occur, and a set of bits for encoding a latest thread switch reason.
According to another aspect of the invention, there is provided the method as recited above in which the first thread being normally an active thread and the second thread being normally a dormant thread prior to occurrence of the a selectable event or after completion of recording of the selectable event.
According to a further another aspect of the invention, there is provided the method as recited above in which the thread switch control register is an architected software-accessible special purpose register in which the second bit, the third bit, and the set of bits are set by hardware operatively connecting to the processor. The first, second, third, and fourth bits, and the set of bits can be set and/or reset by monitor software operative with respect to the hardware registers.
Another aspect of the method as recited above is that the selectable event includes one from the group, but not limited to, of: L1 data cache miss, L2 data cache miss, L1 instruction cache miss, L2 instruction cache miss, instruction translation lookaside buffer (TLB) miss, data translation lookaside buffer (TLB) miss, and thread time-out.
The invention is also an article of manufacture for a computer-based user-interface. The article of manufacture includes a computer readable medium having instructions for causing a computer to perform a method by a multithreaded processor arranged and configured to process a plurality of threads and facilitate thread switch, the method comprising the steps of executing the application on a first thread of the multithreaded processor, detecting the selectable event of the application by a thread switch controller, switching processing from the first thread to a second thread to record information of the selectable event, and switching processing from the second thread to the first thread, upon completion of recording, and if desired to continue execution of the application.
One of the advantages is that the present invention provides software with information related to low-level hardware events within a processor. The invention allows software to control characteristics of thread switching which enables an efficient program monitor to be created in a multithreaded processor.
Another advantage is that the present invention has the ability to record a low-level event occurring during execution of a program and specific information related to the low-level event, e.g. what kind of event, where it occurs, and when it occurs, without requiring special hardware.
A further advantage of the present invention relates to the monitor's efficiency or to application's performance. During some of the time the monitor program is running, i.e. on an active thread, the application does not make progress (i.e., the hardware may be servicing a cache miss type of thread switch condition caused by the application or system program). Accordingly, the monitor uses processor cycles which would never have been used by the application or system program. Normally, if the application is running on a non-multithreaded processor, it would be stalled, and the cycles would be lost. This means that some of the processor cycles used by the monitor program to record selectable event(s) are “free” relative to the application or system program—the application or system program notices no performance degradation since it would not have used these processor cycles anyway. Thus, the monitor program does not affect the application's or system program's performance.
The inventions themselves, however, as well as a preferred mode of use, further objectives and advantages thereof, will be best understood by reference to the following detailed description of an illustrative embodiment when read in conjunction with the accompanying drawings, wherein:
FIG. 1 is a block diagram of a generic computer system capable of implementing the present invention described therein.
FIG. 2 is a block diagram of a multithreaded data processing system according to the principles of the present invention.
FIG. 3 is a flowchart illustrating an operation of a dual-threaded processor the multithreaded data processing system consistent with the present invention.
FIG. 4 is a flowchart illustrating an operation of a monitoring thread with respect to the dual-threaded processor consistent with the present invention.
FIG. 5 is a timeline illustration of an operation of the dual-threaded processor consistent with the present invention.
With reference now to the figures and in particular with reference to FIG. 1, there is depicted a high level block diagram of a computer data processing system 10 which may be utilized to implement the method and system of the present invention. The primary hardware components and interconnections of a computer data processing system 10 arranged and configured for utilizing the present invention are shown in FIG. 1. Multithreaded processor 100 including a central processing unit (CPU) is arranged and configured to process a plurality of threads and facilitate thread switch. The multithreaded processor 100 communicates via bus interface 152 with system bus 155. Various input/output processors (IOPs) 160-168 attach to the system bus 155 and support communication with a variety of storage and input/output (I/O) devices, such as direct access storage devices (DASD) 170, tape drives 172, remote communication lines 174, workstations 176, and printers 178. It should be understood that FIG. 1 is intended to depict representative components of a computer data processing system at a high level, and that the number and types of such components may vary without departing the scope and spirit of the present invention.
Within the multithreaded processor 100 as shown in FIG. 2, the CPU has a processor core containing specialized functional units, each of which perform primitive operations, such as sequencing instructions, executing operations involving integers, executing operations involving real numbers, transferring values between addressable storage and logical register arrays. FIG. 2 illustrates the processor core of the multithreaded processor 100. In a preferred embodiment, the processor core of the data processing system 10 is a single integrated circuit, pipelined, superscalar microprocessor, which may be implemented utilizing any computer architecture such as the family of Reduced Instruction Set Computer (RISC) processors sold under the trade name PowerPC™; for example, the PowerPC™ 604 microprocessor chip sold by IBM.
In FIG. 2, the multithreaded processor 100 of the data processing system 10 preferably includes a level one data cache, L1 D-cache 120, a level two L2 cache 130, a main memory 140, and a level one instruction cache, L1 I-cache 150, all of which are operationally interconnected utilizing various bus connections and a storage control unit 200. The storage control unit 200 includes a transition cache 210 for interconnecting the L1 D-cache 120 and the L2 cache 130, the main memory 140, and a plurality of execution units. The L1 D-cache 120 and the L2 cache 130 preferably are provided on chip as part of the processor 100 while the main memory 140 and the L2 cache 130 are provided off chip. The memory of the data processing system preferably represents random access main memory which may or may not be within the processor 100, other data buffers and caches, if any, external to the processor 100, and other external memory, for example, DASD 170, tape drives 172, and workstations 176 as shown in FIG. 1. The L2 cache 130 is preferably a higher speed memory system than the main memory 140, and by storing selected data within the L2 cache 130, the memory latency which occurs as a result of a reference to the main memory 140 can be minimized. The storage unit 200 is directly connected to an instruction unit 220.
Instructions from the Level-1 instruction cache 150 are preferably output to the instruction unit 220 which, in accordance with the method and system of the present invention, controls the execution of multiple threads by the various subprocessor units, e.g., branch units 260, fixed point units 270, and floating point unit 280 and others as specified by the architecture of the data processing system 10. In addition to the various execution units depicted within FIG. 1, those skilled in the art will appreciate that modern superscalar microprocessor systems often include multiple versions of each such execution unit which may be added without departing from the spirit and scope of the present invention. Most of these units will have as an input source operand information from various registers such as general purpose registers GPRs 272, and floating point registers FPRs 282. Additionally, multiple special purpose registers SPRs 274 may be utilized in accordance with the method and system of the present invention to store processor state information in response to thread operation including starting a thread, ending a thread, switching threads, etc. As shown in FIG. 2, the Level-1 data cache 120 is coupled to the general purpose registers 272 and the floating point registers 282 via the storage control unit 200. The general purpose registers 272 are connected to the special purpose registers 274. Further, both general purpose registers 272 and special purpose registers 274 are directly coupled to the fixed point units 270, respectively. Further, the branch units 260, the fixed point units 270, and the specific purpose registers SPRs 274 are coupled to each other. The floating point registers FPRs 282 are connected between the floating point units 280 and the Level-1 data cache 120 via the storage control unit 200. Further, a translation lookaside buffer TLB 250 is provided between the L-1 instruction cache 150 and the storage control unit 200. The translation lookaside buffer TLB 250 contains virtual-to-real address mapping.
Among the functional hardware units unique to this multithreaded processor is a thread switch logic unit 400. The thread switch logic unit 400 contains various registers that determine which thread will be the active or running thread and which thread(s) will be dormant thread(s). The thread switch logic unit as shown in FIG. 2 includes a thread switch controller 402 for detecting a selectable event such that upon occurrence and detection of the selectable event, the thread switch controller 402 switches from one thread to the other thread. In one preferred embodiment, one thread is used to run or execute a system program or an application which is to be monitored, and another thread is used to run a monitor program to monitor the occurrence of the selectable event(s), i.e. to record or save the event(s) for analysis of the performance of the application. The first thread is hereinafter called processing thread, and the second thread is hereinafter called monitoring thread. Upon detection of a selected event, the thread switch controller 402 switches from the processing thread to the monitoring thread. After completion of the monitoring event, the thread switch controller 402 switches back from the monitoring thread to the processing thread. It may be desirable to keep the monitoring process short to limit its effect on the computer system, such as processor cycles and resources affected during the monitoring. To shorten the monitoring latency, the monitoring thread may merely detect and record the events. The information can be further processed or analyzed to a user or a program at a later time when monitoring process is completed. It will be appreciated that the monitoring process can be arranged and configured to include an on-site feedback to a user or the program monitored.
The thread switch controller 402 includes a plurality of thread switch control registers, one of which is a thread switch control register HID0 404. The register HID0 404 is an architected software-accessible special purpose register. The register HID0 contains the features which provide the ability to switch threads on events important to the program profiler, other information related to threadswitch, and the ability to force a switch from the monitoring thread back to the processing thread being monitored. As a result, the thread control register allows software to selectively control individual events it desires to track via thread switching techniques. The events of interest can be a thread switch reason such as the data cache miss, instruction cache miss, etc. A detailed list of the thread switch reasons is provided later. Information related to the events of interest that can also be accessed includes the next instruction address (NIA) and the machine state registers (MSR) of a dormant thread, the effective address (EA) of a data cache miss, etc. In one embodiment, the register HID0 404 has bits readable by the monitor program. One set of bits represent a list of thread switch reasons. In one embodiment, the list of the thread switch reasons represented by 64 bits is as follows:
BIT LIST OF THREAD SWITCH REASONS
(3) Switch on instruction translation lookaside buffer (TLB) miss
(7) Switch on data translation lookaside buffer (TLB)/segment
lookaside buffer miss
(19) Switch on or 1,1,1 instruction if machine state register (problem
state) bit, msr(pr)=l. Allows software priority change
independent of msr(pr). If bit 19 is one, or 1,1,1 instruction sets
low priority. If bit 19 is zero, priority is set to low only if
msr(pr)=0 when the or 1,1,1, instruction is executed.
(22-29) Reserved
(30-31) Forward progress count
(32-63) Reserved in 64 bit register implementation.
*A double-X load/store refers to loading or storing an elementary halfword, a word, or a double word, that crosses a doubleword boundary. A double-X load/store in this context is not a load or store of multiple words or a string of words.
It will be appreciated that the register HID0 404 may have additional bits or less bits depending on various events in different monitoring programs.
In addition, the register HID0 404 of one preferred embodiment of the present invention includes a bit which forces a thread switch (called force-thread-switch bit). The force-thread-switch bit can be set by software method, e.g. via the software monitor program. For example, when the bit is updated (from 0 to 1, 1 to 1, 1 to 0, or 0 to 0) depending on the hardware implementation, a thread switch is forced from the active thread to a dormant thread. The register HID0 404 includes another bit which indicates whether a thread switch has occurred (called thread-switch-occurred bit). The thread-switch-occurred bit can be set by hardware when a thread switch has occurred and can be reset or modified by software monitor program before the monitoring thread relinquishes control to the processing thread. The register HID0 404 further includes a bit which allows exactly two thread switches to occur. This thread-switch-twice bit can be set by software monitor program. The thread-switch-twice bit indicates that the controller 402 only allows two thread switches at which time it sets a block-thread-switch bit of the register HID0 404 which blocks thread switching. The block-thread-switch bit is set by hardware such that no thread switching can be made during the recording of the selected event. Once the recording of the selected event is complete, the block-thread-switch bit is reset by software so that a subsequent selected event can be detected. This ensures that once the monitor gains control, i.e. the monitoring thread becomes active, it can execute without interruption by other potential threadswitches until the monitor relinquishes control after completion of the recording of the event.
The use of the above mentioned bits is one example of a monitoring method. It will be appreciated that different monitoring methods can be implemented without departing from the scope or spirit of the present invention. Additional or less bits or additional registers can be configured and arranged in various different monitoring methods.
FIG. 3 is a flowchart illustrating an operation of a dual-threaded processor of the multithreaded data processing system 10. The dual-threaded processor is the simplest case for the multithreaded processor 100, one embodiment of which includes the features discussed above as shown in FIG. 2. The dual-threaded processor executes a program to be monitored on a first thread (the processing thread) in box 406. The controller 402 checks to determine whether a selected event has occurred in box 408. If a selected event has not occurred, the dual-threaded processor continues executing the program on the first thread in box 406. Once a selected event occurs, the thread switch controller 402 of the dual-threaded processor switches processing from the first thread to a second thread (the monitoring thread) in box 412. Then the monitor software gathers information from the register HID0 in box 414 regarding the selected event, such as the thread switch reason (as listed above), the cycle counts which indicate the time spent on the processing thread, or a dormant thread facility (e.g. the next instruction address (NIA), the machine state register (MSR), or the effective address (EA) of the data cache miss), etc. In box 416, the thread switch controller 402 switches processing back from the second thread (monitoring thread) to the first thread (processing thread). Thereafter, the dual-threaded processor continues executing the process of the monitored program on the first thread until the next selected event occurs.
FIG. 4 is a flowchart illustrating an operation of a monitoring thread with respect to the dual-threaded processor consistent with the present invention. The processor starts with box 418 and initializes software variables and hardware registers, etc., in box 420, including the variables and registers in the thread switch controller 402, one of which is the thread switch control register HID0 404. For example, in one embodiment, the bit which allows exactly two thread switches to occur (i.e. thread-switch-twice bit) of the register HID0 404 is set to “1”. It will be appreciated that one skilled in the art may set or initialize variables, such as the thread-switch-twice bit, differently without departure from the principles of the present invention.
Still in FIG. 4, if the monitor software determines to terminate or suspend the monitoring process in box 422, i.e. the stop monitoring flag=“1”, the thread designated for the monitoring process (the monitoring thread) will be released and/or used for other processes by the multithreaded processor via a clean up process in box 424, and the monitoring process is ended in box 426. The data processing system 10 is then restored to a normal mode, i.e., a running or executing mode without monitoring. If the monitor software determines that it should continue monitoring, the monitor software modifies the register HID0 404. The bit which forces a thread switch (i.e. force-thread-switch bit) is set to “1”, the bit which indicates whether a thread switch has occurred (i.e. thread-switch-occurred bit) is set to “0”, and the bit which blocks thread switching (i.e. block-thread-switch bit) is set to “0”. At this point of time, the monitor program is ready to become dormant, and the hardware performs a thread switch.
In box 430, the monitor program loops while checking for the thread-switch-occurred bit to be “1”. The purpose of this loop is to prevent the monitor program from re-recording information before the processing thread regains control. Depending on the design of the processor, this loop may not be required. For example, if hardware guarantees a thread switch within a certain number of cycles after the monitor software program sets the force-thread-switch bit, a string of no-operation instructions could be used to prevent re-recording information. Then the monitor program becomes dormant while hardware switches to a processing thread.
Once a selected event is detected, the monitoring thread becomes active, at which time information about the selected event is gathered in box 432. The information includes the last thread switch reason, the cycle counts, and the dormant thread facilities such as the next instruction address (NIA), the machine state register (MSR), and the effective address (EA) for the data cache miss, etc., can be gathered from the architected software-accessible special purpose registers, such as the register HID0 404. After completion of the information gathering in box 432, the controller 402 switches the process from the monitoring thread to the processing thread in box 406 as shown in FIG. 3.
FIG. 5 is a timeline illustration of an operation of the dual-threaded processor consistent with the present invention. The left vertical line represents a timeline starting from the top. To shorten the timeline illustration of executing a program on the first thread, some portions of the timeline are shown in broken dots. T1 stands for an application processing thread and T2 for a monitoring thread. Horizontal lines stand for occurrence of the thread switches after detecting a selected event. “A0, A1 . . . An, An+1” are a sequence of stages to execute initialization processes of the monitor program on the second thread T2 including variables of the controller 402 and registers such as the register HID0 404. Until the monitor program is fully initialized, i.e., all the variables and registers are reset, the hardware treats the monitor program as any other programs for thread switch purposes. Accordingly, the initialization may be broken into several stages A0 to An+1 as shown between which slices “S0, S1 . . . Sx” of a program are executed on the first thread T1. An+1 represents that the initialization of the monitor is complete. Between A and S, a thread switch is made by the controller 402. It will be appreciated to a person skilled in the art that the initialization can be completed in a single stage. It will also be appreciated that to synchronize the data collection, a master task dispatcher could start the program to be monitored after the monitor has initialized.
Still in FIG. 5, TS# is the thread switch number along the timeline. The thread switches before TS0, i.e. TS-, can be ignored by the processes. It will be appreciated that the TS- can be blocked by the controller 402 if the initialization is completed in one stage. “−” can be used to indicate “don't-care” type of states. “B” stands for the state where the register HID0 is modified. “C” stands for the state where the monitor loops around as shown in box 430 waiting for occurrence of a selected event. The monitor can loop around a number of cycles, C0 to Ci or Cj or Ck depending on the design of the processor. “D” stands for a state of gathering information of the selected event.
The three bits on the right side of FIG. 5 represent the force-thread-switch bit, the thread-switch-occurred bit, and the block-thread-switch bit. During initialization, the system is running in a non-monitoring mode, the force-thread-switch bit is “0”, the thread-switch-occurred bit is “1”, and the block-thread-switch bit is “0”. The initialization is completed at state An+1, whereby the register HID0 is modified such that the force-thread-switch bit is “1”, and the monitor loops around and waits for the thread-switch-occurred bit to be set to “1” by hardware. So at TS2, the loop is interrupted by a thread switch caused by the force-thread-switch bit set to “1”, and the processing thread continues executing the application or a system program. Once a selected event is detected, the controller 402 switches (TS3) from processing Sx+1 on the first thread to processing the monitor on the second thread, whereby the block-thread-switch bit of the register HID0 is changed to “1” so that no threadswitch is allowed until it is reset to “0”. Information related to the selected event is gathered at D. Upon completion of the information gathering, the register HID0 is modified at B. The block-thread-switch bit indicates the allowance of a threadswitch, and the force-thread-switch bit is set to “1”. As a result, the controller 402 switches (TS4) from processing the monitor on the second thread back to processing the application slice Sx+2 on the first thread. This routine repeats when TS5 occurs as shown in FIG. 5. It will be appreciated that other types of presentations or illustrations for alternating application/monitoring thread switches and processing can be used without departing from the principles of the present invention.
US5079725 Nov 17, 1989 Jan 7, 1992 Ibm Corporation Chip identification method for use with scan design systems and scan testing techniques
US5197138 Dec 26, 1989 Mar 23, 1993 Digital Equipment Corporation Reporting delayed coprocessor exceptions to code threads having caused the exceptions by saving and restoring exception state during code thread switching
US5361334 Mar 15, 1993 Nov 1, 1994 Quantel Limited Data processing and communication
US5490272 Jan 28, 1994 Feb 6, 1996 International Business Machines Corporation Method and apparatus for creating multithreaded time slices in a multitasking operating system
US5535361 May 24, 1993 Jul 9, 1996 Matsushita Electric Industrial Co., Ltd. Cache block replacement scheme based on directory control bit set/reset and hit/miss basis in a multiheading multiprocessor environment
US5613114 Apr 15, 1994 Mar 18, 1997 Apple Computer, Inc System and method for custom context switching
GB2234613A Title not available
1 Dongarra, J. J., "A Survey of High Performance Computers", U.S. Government Work, pp. 8-11, (Jan. 10, 1986).
2 Eickemeyer, R. J. et al., "Evaluation of Multithreaded Uniprocessors for Commercial Application Environments", ISCA, pp. 203-212 (May 1996).
3 Hidaka et al., "Multiple Threads in Cyclic Register Windows", ACM, pp. 131-142, May 1993.*
4 Iannucci, R. A., "Two Fundamental Issues in Multiprocessing", Laboratory for Computer Science, Massachusetts Institute of Technology, Proceeding of the DFVLR Conference, pp. 61-88 (Jun. 25-29, 1987).
5 IBM Technical Disclosure Bulletin, 39(8):113-116 (Aug. 1996).
6 Kuck, D. J. et al., "The Burroughs Scientific Processor (BSP)", IEEE Transactions on Computers, C-31(5):363-376 (May 1982).
7 Song, P., "Multithreading Comes of Age", Microdesign Resources, pp. 13-18 (Jul. 14, 1997).
8 Thekkath, R. et al., "The Effectiveness of Multiple Hardware Contexts", Department of Computer Science and Engineering, FR-35, University of Washington, pp. 328-337 (1994).
9 Tomasulo, R. M., "An Efficient Algorithm for Exploiting Multiple Arithmethic Units", IBM Journal, pp. 25-33 (Jan. 1967).
10 U.S. application No. 08/473,692, filed Jun. 7, 1995.
11 U.S. application No. 08/675,315, filed Jul. 3, 1996.
12 U.S. application No. 08/761,378, filed Dec. 9, 1996.
13 U.S. application No. 08/761,379, filed Dec. 9, 1996.
14 U.S. application No. 08/761,380, filed Dec. 9, 1996.
15 U.S. application No. 08/773,572, filed Dec. 27, 1996.
16 U.S. application No. 08/956,577, filed Oct. 23, 1997.
17 U.S. application No. 08/956,875, filed Oct. 23, 1997.
18 U.S. application No. 08/957,002, filed Oct. 23, 1997.
19 U.S. application No. 08/958,716, filed Oct. 23, 1997.
20 U.S. application No. 08/958,718, filed Oct. 23, 1997.
21 Weber W. et al., "Exploring the Benefits of Multiple Hardware Contexts in a Multiprocessor Architecture: Preliminary Results", The 16th Annual International Symposium on Computer Architecture, IEEE Computer Society Press, pp. 272-280 (1989).
22 Willis J. et al., "What is Data-driven, Multithreaded Architecture?" IBM, pp. 1-21 (Aug. 24, 1995).
US6539339 * Sep 9, 1999 Mar 25, 2003 International Business Machines Corporation Method and system for maintaining thread-relative metrics for trace data adjusted for thread switches
US6629139 * Sep 1, 1999 Sep 30, 2003 International Business Machines Corporation Reactive detection of conditions of interest in distributed systems
US6748558 * May 10, 2000 Jun 8, 2004 Motorola, Inc. Performance monitor system and method suitable for use in an integrated circuit
US6772412 * Mar 16, 2001 Aug 3, 2004 Omron Corporation Data processing device equipped with a thread switching circuit
US6954922 * Apr 29, 1998 Oct 11, 2005 Sun Microsystems, Inc. Method apparatus and article of manufacture for time profiling multi-threaded programs
US7013400 * Apr 24, 2003 Mar 14, 2006 International Business Machines Corporation Method for managing power in a simultaneous multithread processor by loading instructions into pipeline circuit during select times based on clock signal frequency and selected power mode
US7174554 * Dec 20, 2002 Feb 6, 2007 Microsoft Corporation Tools and methods for discovering race condition errors
US7296123 * Feb 1, 2005 Nov 13, 2007 Delphi Technologies, Inc. Electronic control unit analysis
US7448025 * Dec 29, 2000 Nov 4, 2008 Intel Corporation Qualification of event detection by thread ID and thread privilege level
US7516209 Jun 27, 2003 Apr 7, 2009 Microsoft Corporation Method and framework for tracking/logging completion of requests in a computer system
US7546598 * Sep 3, 2004 Jun 9, 2009 Sap Aktiengesellschaft Measuring software system performance using benchmarks
US7555753 Feb 26, 2004 Jun 30, 2009 International Business Machines Corporation Measuring processor use in a hardware multithreading processor environment
US7962314 Dec 18, 2007 Jun 14, 2011 Global Foundries Inc. Mechanism for profiling program software running on a processor
US8104036 Mar 25, 2008 Jan 24, 2012 International Business Machines Corporation Measuring processor use in a hardware multithreading processor environment
US8286139 * Mar 19, 2008 Oct 9, 2012 International Businesss Machines Corporation Call stack sampling for threads having latencies exceeding a threshold
US8291395 * Mar 31, 2006 Oct 16, 2012 Apple Inc. Fast function call dispatching
US8423972 * Feb 27, 2009 Apr 16, 2013 International Business Machines Corporation Collecting profile-specified performance data on a multithreaded data processing system
US8843927 * Apr 23, 2009 Sep 23, 2014 Microsoft Corporation Monitoring and updating tasks arrival and completion statistics without data locking synchronization
US9081629 * May 19, 2013 Jul 14, 2015 Frank Eliot Levine Excluding counts on software threads in a state
US20020010733 * Mar 16, 2001 Jan 24, 2002 Yosuke Baba Data processing device equipped with a thread switching circuit
US20020095614 * Mar 8, 2002 Jul 18, 2002 Intel Corporation Method and apparatus for disabling a clock signal within a multithreaded processor
US20020099760 * Apr 29, 1998 Jul 25, 2002 Sheng Liang Method apparatus and artical of manufacture for time profiling multi-threaded programs
US20040123185 * Dec 20, 2002 Jun 24, 2004 Microsoft Corporation Tools and methods for discovering race condition errors
US20040215984 * Apr 24, 2003 Oct 28, 2004 International Business Machines Corporation Method and circuitry for managing power in a simultaneous multithread processor
US20050021708 * Jun 27, 2003 Jan 27, 2005 Microsoft Corporation Method and framework for tracking/logging completion of requests in a computer system
US20050108687 * Nov 18, 2003 May 19, 2005 Mountain Highland M. Context and content sensitive distributed application acceleration framework
US20050120341 * Sep 3, 2004 Jun 2, 2005 Andreas Blumenthal Measuring software system performance using benchmarks
US20050198635 * Feb 26, 2004 Sep 8, 2005 International Business Machines Corporation Measuring processor use in a hardware multithreading processor environment
US20060174072 * Feb 1, 2005 Aug 3, 2006 Mcfarland Bernard M Electronic control unit analysis
US20070234289 * Mar 31, 2006 Oct 4, 2007 Steve Naroff Fast function call dispatching
US20080168445 * Mar 25, 2008 Jul 10, 2008 International Business Machines Corporation Measuring processor use in a hardware multithreading processor environment
US20090157359 * Dec 18, 2007 Jun 18, 2009 Anton Chernoff Mechanism for profiling program software running on a processor
US20090241095 * Mar 19, 2008 Sep 24, 2009 International Business Machines Corporation Call Stack Sampling for Threads Having Latencies Exceeding a Threshold
US20100223598 * Feb 27, 2009 Sep 2, 2010 International Business Machines Corporation Collecting profile-specified performance data on a multithreaded data processing system
US20100275207 * Apr 23, 2009 Oct 28, 2010 Microsoft Corporation Gathering statistics in a process without synchronization
US20140344831 * May 19, 2013 Nov 20, 2014 Frank Eliot Levine Excluding counts on software threads in a state
US20150277994 * May 31, 2015 Oct 1, 2015 Frank Eliot Levine Excluding counts on software threads in a state
US20160019178 * Jul 27, 2015 Jan 21, 2016 Intel Corporation Memory mapping in a processor having multiple programmable units
US20160034420 * Oct 14, 2015 Feb 4, 2016 Intel Corporation Memory mapping in a processor having multiple programmable units
US20160070664 * Oct 14, 2015 Mar 10, 2016 Intel Corporation Memory mapping in a processor having multiple programmable units
US20160071558 * Oct 14, 2015 Mar 10, 2016 Intel Corporation Memory mapping in a processor having multiple programmable units
EP2179350B1 * Aug 14, 2008 May 10, 2017 Imagination Technologies Limited Compound instructions in a multi-threaded processor
WO2009085088A1 * Dec 3, 2008 Jul 9, 2009 Advanced Micro Devices, Inc. Mechanism for profiling program software running on a processor
U.S. Classification 717/127, 712/E09.053, 718/108, 717/130, 718/107, 714/E11.2
International Classification G06F11/34, G06F9/38, G06F9/46, G06F9/48, G06F9/445
Cooperative Classification G06F9/542, G06F2201/88, G06F2201/865, G06F11/3466, G06F9/3851, G06F9/4843, G06F2201/885, G06F2201/86
European Classification G06F9/54B, G06F9/48C4, G06F11/34T, G06F9/38E4
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:FLYNN, WILLIAM THOMAS;REEL/FRAME:008938/0742