Hardware counter for tracking resource utilization in a multithreaded computer system
By employing hardware counters to track utilization in multithreaded environments, the operating system can manage thread densities effectively, reducing variability in response times and improving billing consistency in multithreaded computer systems.
Patent Information
- Application Number
- DE112015001477
- Authority / Receiving Office
- DE · DE
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2014-03-27
- Filing Date
- 2015-03-17
- Publication Date
- 2024-09-26
- Estimated Expiration
- 2035-03-17
AI Technical Summary
Current multithreading technologies in computer systems lead to high variability in response times and billing due to the operating system's inability to manage thread densities effectively, resulting in inconsistent utilization of core resources.
A method and system that allows the operating system to explicitly manage thread densities by using hardware counters to track utilization in multithreaded environments, enabling consistent high thread densities and optimizing core resource utilization.
This approach reduces variability in transaction response times and improves billing accuracy by ensuring consistent utilization of core resources through explicit OS management of thread densities.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
BACKGROUND
[0001] The present invention relates generally to a computer system that supports multiple threads, and more particularly to hardware counters for tracking utilization in a multithreaded computer system.
[0002] While the processor speed of computer systems has increased in recent decades, there has been no corresponding increase in the speed at which such computer systems' memory can be accessed. Therefore, the shorter the processor cycle time, the more pronounced the delay due to waiting for data to be retrieved from memory. The effects of such delays have been mitigated by various levels of caching and, in newer processors, by multithreading (MT).
[0003] MT allows multiple instruction streams, also known as threads, to share different core processes of a processor. Core resources can include instruction execution units, caches, translation lookaside buffers (TLBs), and the like, which can be collectively referred to as a core. If latency occurs due to a cache miss or other delay in one thread, one or more other threads can use the core resources, thus increasing the utilization of the core resources. When implemented with a superscalar processor and simultaneous multithreading (SMT), multiple threads can be executed simultaneously using the core resources of one or more cores.
[0004] On current hardware platforms, MT is typically implemented in a manner that is transparent to an operating system (OS) running on the MT hardware. One aspect of this feature is that the OS does not need to be modified to utilize the MT hardware. However, MT operation that is transparent to the OS can lead to significant variability in response time, capacity provisioning, capacity scheduling, and accounting. This variability can occur because the OS does not know whether its tasks have exclusive control of a core or whether their tasks are running as threads sharing a core. By design, the highest capacity for a memory-intensive process on MT-capable hardware can be achieved when a high average thread density is maintained across cores.Additional capacity can result from increased cache utilization provided by MT. If an OS does not maintain consistently high average thread densities for busy cores, the additional throughput capacity provided by MT will not be available. For example, if the hardware runs a single MT thread per core during low compute load and runs at high thread density during high compute load, it can be very difficult to determine how much total MT compute capacity is available to the processing process. This hardware variability in MT thread utilization can lead to variability in both transaction response times and billing, in a similar way to that described previously with regard to capacity.
[0005] A number of documents have already been published in this context. Document US 7 426 731 B2 relates to determining processor usage by a thread. For this purpose, start and stop times are related to thread execution points. Document US 2010 0 125 179 A1 describes a communication device with a protocol stack that has at least two protocol modules, with a number of threads responsible for executing the protocol modules. It is also possible to adjust the number of active threads. Document US 6 658 654 B describes a measurement of per-thread performance information in a multi-threaded environment, wherein the measurement generates only comparatively low overhead. For this purpose, sets of events are recorded using different metrics. Document JP 4 536 717 B2 also describes a recording of system usage of an SMT processor.Furthermore, document US 2007 0 220 515 A1 describes the detection of wait states in a data processing system. Wait states are detected and stored to identify historical data change patterns. Finally, document US 2005 0 183 065 A1 describes performance counters in a multi-threaded processor. Counter events within the processor are evaluated for this purpose. Furthermore, document JP 3 876 818 B2 describes a multi-processor computer in which a plurality of processors share a main memory, whereby an index is determined that indicates how efficiently a program is executed in parallel.
[0006] Despite these advances, there is still a need to provide improved multi-threading utilization information for an SMT processor. SUMMARY
[0007] This object is achieved by the subject matter of the independent claims. Further embodiments are specified by the respective dependent claims. As claimed, the invention provides a method, system, and computer program for tracking utilization in an MT computer system. BRIEF DESCRIPTION OF THE DIFFERENT VIEWS OF THE DRAWINGS
[0008] The subject matter considered as embodiments of the invention is particularly pointed out and distinctly claimed in the claims at the end of the specification. The above and other features and advantages of the embodiments will become apparent from the following detailed description taken in conjunction with the accompanying drawings, in which: Fig. 1A illustrates a computing environment that may be implemented according to one embodiment; Fig.1B illustrates a computing environment that may be implemented according to one embodiment; Fig. 2 illustrates a processing circuit of a core that may be implemented according to an embodiment; Fig. 3 illustrates a computing environment that may be implemented according to one embodiment; Fig. 4 illustrates an example of hypervisor context retention in a computing environment that may be implemented according to one embodiment; Fig. 5 illustrates a process flow for dynamic multithreading activation according to one embodiment; Fig. 6A illustrates an example CPU address extension process according to one embodiment; Fig. 6B illustrates an example CPU address shrink process according to one embodiment; Fig.7 illustrates a process flow for an instruction to set multithreading according to one embodiment; Fig. 8 illustrates an example of a core's processing circuitry that may be implemented to track utilization according to one embodiment; Fig. 9 illustrates an example configuration that tracks utilization counters according to one embodiment; Fig. 10 illustrates a process flow for tracking utilization according to one embodiment; and Fig. 11 illustrates a computer-readable medium according to one embodiment. DETAILED DESCRIPTION
[0009] Example embodiments described herein provide performance monitoring of MT operations in a computer system that supports single-threaded (ST) and MT modes of operation. The system described herein enables software to mitigate hardware variability by requiring an OS to explicitly choose to utilize MT hardware. If the OS knows that it is an MT execution environment, it is able to selectively manage thread densities on a per-processor core basis (to the best of its ability and based on a processing thread allocation pattern). The OS has the ability to maintain high thread densities even when compute resources are less heavily utilized, thereby greatly mitigating the variability in overall compute capacity that can occur with other MT implementations.As a direct result of maintaining high thread densities, both transaction response times and accounting aspects can be more consistent. The benefits of multithreading can be increased by maintaining consistently high thread densities per processor core.
[0010] To identify any untapped opportunity for capacity increase, according to embodiments, the OS control program is provided with the ability to query the machine for the number of executed instructions and cycles a particular core has spent executing one thread, two threads, and so on, up to the total number of threads on the core. In embodiments, hardware counters are provided to count events (e.g., the number of executed instructions and the number of clock cycles) in the core at various thread densities (e.g., one thread, two threads, etc.) rather than on a per-thread or per-CPU basis. The amount the hardware counters are incremented may vary based on the number of active threads in the core.
[0011] Software can obtain information from the counters and use the counter information to determine when there is an unused opportunity to perform more work on another thread of the core. Using this information, the software can also determine what percentage of core resources was used by a single thread and use this information for software costing. By consolidating all information from the cores in a system, the OS can perform capacity planning, such as calculating total capacity, used capacity, and free capacity.
[0012] A logical thread refers here to a single instruction stream and its associated state. This means that at an architectural level, each logical thread represents an independent central processing unit (CPU) or processor. At a hardware level, a thread is the execution of an instruction stream associated with a logical thread, combined with the management of guest state when the thread is dispatched. For this reason, the terms "thread" and "CPU" can be used interchangeably here.
[0013] In an exemplary embodiment, a CPU includes sequencing and processing facilities for instruction execution, interrupt actions, control functions, initial program loading (IPL), and other machine-related functions. A CPU defines logical functions that may be mapped to a variety of underlying physical implementations. When executing instructions, the CPU may process fixed-length binary integers and floating-point numbers (e.g., binary, decimal, and hexadecimal), variable-length decimal integers, and fixed-length or variable-length logical information. Processing may occur in parallel or sequentially.The width of the processing elements, the variety of shift paths, and the degree of concurrency in performing different types of arithmetic operations can vary from CPU model to CPU model without affecting the logical results.
[0014] The instructions executed by the CPU can include a number of instruction classes, including general-purpose instructions, decimal instructions, floating-point support (FPS) instructions, binary floating-point (BFP) instructions, decimal floating-point (DFP) instructions, hexadecimal floating-point (HFP) instructions, control instructions, and I / O instructions. General-purpose instructions can perform arithmetic operations on binary integers, as well as logical, branch, and other non-arithmetic operations. Decimal instructions process data in decimal format. BFP, DFP, and HFP instructions process data in BFP, DFP, and HFP formats, respectively. FPS instructions process floating-point data regardless of format or convert from one format to another.Privileged control instructions and I / O instructions can be executed when the CPU is in a supervisor state, and semi-privileged control instructions can be executed in a problem state, taking into account appropriate mechanisms for authorization checking.
[0015] The CPU provides registers that are available to programs without having addressable representations in main memory. The registers can include, for example, a current program status word (PSW), general-purpose registers, floating-point registers and a floating-point control register, vector registers, control registers, access registers, a prefix register, a time-of-day (TOD) programmable register, and registers for a clock comparator and a CPU timer. This set of registers can be referred to as the CPU's architectural register context. Each CPU in a configuration can provide access to a TOD timer that can be shared by all CPUs in the configuration. An instruction opcode can determine which type of register to use during an operation.
[0016] Each CPU can have a type attribute that indicates whether it provides a complete set of functions and facilities (e.g., a general-purpose CPU) or whether it is intended to handle specific types of processing (e.g., a special-purpose CPU). A primary CPU is either a general-purpose CPU or a CPU of the same type as the CPU that was started after a last IPL operation (the IPL CPU). A secondary CPU is any CPU that is not a general-purpose CPU and whose CPU type differs from the IPL CPU.
[0017] On a computer system that implements a supporting architecture, a multithreading facility may be available. The multithreading facility provides multithreading support to enable a group of threads, which may also be referred to as CPUs, to share a core. When the multithreading facility is enabled, the CPUs within a core can share certain hardware resources, such as execution units or cache memory. When a CPU in a core is waiting for hardware resources (usually while waiting for a memory access), other CPUs in the core can use the shared resources in the core instead of remaining idle. When the multithreading facility is installed and enabled, a thread is synonymous with a CPU belonging to a core.If the multithreading facility is not installed, or if the facility is installed but not enabled, a core has a single CPU or a single thread.
[0018] If the multithreading facility is installed, it can be enabled by executing a Set Multithreading Signal Processor (SIGP) instruction. When the multithreading facility is enabled, in one exemplary embodiment, the number of CPUs in a configuration is increased by a multiple determined by a Program-Specified Maximum Thread Identification (PSMTID). The number of CPUs in a core can be one CPU greater than the PSMTID. A number of CPUs equal to this multiple is grouped into a core. Each core with the same CPU type in a configuration has the same number of CPUs. Each CPU within a core has the same CPU type; however, depending on the model and CPU type, some CPUs within a core may be inoperative.
[0019] In an exemplary embodiment, a controlling program such as an OS explicitly enables multithreading for use by the configuration that the OS manages. Alternatively, a hypervisor can enable multithreading, and guests of the hypervisor and their applications can transparently benefit from it. An application program generally does not know whether multithreading has been enabled. With multithreading enabled, the CPU addresses of all CPUs in the configuration are adjusted to include a core identifier (or core ID) in the leftmost bits of the address and a thread identifier (thread ID or TID) in the rightmost bits of the address. The core ID may also be referred to as a core address value, and the TID may be referred to as a thread address value. CPUs within a core may use certain hardware features such asShare execution units or lower-level cache memory, which means that execution within one CPU in a core can affect the performance of other CPUs in the core.
[0020] To manage changes associated with dynamically switching one or more cores of a configuration between single-threaded and multi-threaded modes, a number of support features are included. To maintain compatibility with programs that do not support multi-threading, single-threaded mode may be the default mode after a reset or disablement. Example embodiments include features to retain, transfer, and restore a thread context from multi-threaded mode, thus supporting analysis and / or restoration of the thread context after a transition from multi-threaded mode to single-threaded mode.
[0021] A computing environment that may be realized by an example embodiment may be based, for example, on the z / Architecture offered by International Business Machines Corporation of Armonk, New York. The z / Architecture is described in an IBM® publication entitled "z / Architecture Principles of Operation," IBM Publication No. SA22-7832-09, August 2012. In one example, a computing environment based on the z / Architecture includes a zSeries eServer offered by International Business Machines Corporation of Armonk, New York. A computing environment may include, for example, a processor complex having one or more partitions (e.g., logical partitions) with one or more cores (e.g., processor cores) and one or more levels of hypervisor units, as described further below.
[0022] Fig.1A shows a computer system 100 as an example of a data processing environment that supports multithreading (MT). In the example of Fig. 1A, the computer system 100 includes a plurality of processor cores 102, an input / output (I / O) subsystem 104, and system memory 160. The I / O subsystem 104 may provide access to I / O devices as is known in the art. The processor cores 102, also referred to herein simply as "cores," may include processing circuitry with supporting elements. In the example of Fig.1A, the five cores 102 are illustrated as Core1 110, Core2 120, Core3 130, Core4 140, and Core5 150; however, a fewer or greater number of cores 102 is also conceivable. An MT device 103 may be a hardware component of each core 102. In this example, each of the cores 102 is capable of supporting up to four threads. For example, Core1 110 may support threads 111, 112, 113, and 114. Core2 120 may support threads 121, 122, 123, and 124. Core3 130 may support threads 131, 132, 133, and 134. Core4 140 may support threads 141, 142, 143, and 144. Core 5 150 can support threads 151, 152, 153, and 154. Note that not all four threads of each core 102 may be active at any given time. For example, in core 3 130, threads 131 and 132 may be active, while threads 133 and 134 are inactive.Also, in core4 140, threads 141 and 142 may be active while threads 143 and 144 are not active, and in core5 150, thread 151 may be active while threads 152, 153, and 154 are not active.
[0023] Fig. 1A also illustrates the system memory 160 of the computer system 100, with portions of the system memory 160 allocated to a logical partition 1 (LPAR1) 170, LPAR2 180, and LPAR3 190. The LPARs 170, 180, 190 represent virtualized (also known as configurations) data processing systems in which an operating system such as Linux or the IBM® z / OS™, z / VM, or zTPF operating system may be executed. Fig.1A also shows the allocation of cores 102 to LPARs 170, 180, 190. In this illustration, core 1 110 and core 2 120 are intended for use by LPAR1 170. Core 3 130 is intended for use by LPAR2 180, and core 5 150 is intended for use by LPAR3 190. Core 4 140 can be shared by LPAR2 180 and LPAR3 190, but is Fig. 1A, however, is shown as being assigned to LPAR2 180. LPAR3 190 shows an example of two different types of cores 102 provided by the partition, where core 4 140 allows multiple threads to be active, while core 5 150 does not allow multiple threads to be active in this example. In the example from Fig.1A, LPAR1 170 provides processing resources for an OS 171 and for programs 172, 173, 174, and 175. LPAR2 180 provides processing resources for an OS 181 and for programs 182, 183, and 184. LPAR4 190 provides processing resources for an OS 191 and for programs 192 and 193.
[0024] Under the control of an operating system executing in an LPAR, programs execute on the threads of a core. In an exemplary embodiment, a single thread executes only one program at a time; however, a program designed to be reentrant may execute concurrently on multiple threads or in multiple cores. For example, program 172 of OS 171 of LPAR1 170 may execute on threads 111 and 113 in core1 110 and on threads 121 and 124 of core2 120. Under the control of an OS and depending on scheduling rules and service level agreements, different programs may be scheduled on the same or different threads.
[0025] In addition, various levels of firmware are stored in system memory 160, such as a millicode 162 and an LPAR hypervisor 163. Millicode 162 may be implemented as firmware to support lower-level system functions. LPAR hypervisor 163 may be, for example, licensed internal code such as IBM Processor-Resource / System Manager™ (PR / SM™). LPAR hypervisor 163 may create LPARs 170, 180, and 190 and manage allocation on cores 102. When MT device 103 is installed in computer system 100, Millicode 162 and LPAR hypervisor 163 also include code 164 and 165, respectively, to support the MT device. The code 164 and 165 for supporting the MT device can be considered part of the MT device 103, since logic for MT support can be divided between the millicode 162, the LPAR hypervisor 163 and the cores 102.Although not shown, each of the operating systems 171, 181, 191 may also include code for supporting MT facility to enable and utilize MT in its respective LPARs 170, 180, 190.
[0026] Fig. 1B shows the same data processing system 100 as Fig. 1A with the exception that in the data processing environment of Fig. 1B, the core4 140 is now not assigned to the LPAR2 180, but to the LPAR3 190. Furthermore, it should be noted that, in contrast to Fig. 1A, where threads 143 and 144 were not active, in Fig. 1B, all four threads 141 to 144 are active when LPAR3 190 is allocated on core 4 140. The allocation and deallocation of an LPAR on a core 102 occurs dynamically, although other LPARs (not shown) may otherwise be operating on the same cores 102.
[0027] With a view to Fig.2 is generally a block diagram of a processing circuit 200 for implementing a processing core such as one of the cores 102 of the Fig. 1A and Fig. 1B according to one embodiment. The processing circuit 200 is an example of a processing circuit that can support one or more threads simultaneously in an MT environment. Fig. The processing circuit 200 shown in Figure 2 includes a system controller interface unit 202 that can connect the processing circuit 200 to other processors and peripheral devices. The system controller interface unit 202 can also connect a DCache 204 that reads and stores data values, an ICache 208 that reads program instructions, and a cache interface unit 206 to an external memory, processors, and other peripheral devices.
[0028] In conjunction with an instruction fetch unit (IFU) 210, which prefetches instructions and may include speculative loading and branch prediction capabilities, the Icache 208 may provide for loading instruction streams. The fetched instructions may be provided to an instruction decode unit (IDU) 212 for decoding into instruction execution data.
[0029] The IDU 212 may provide the instructions to an issue unit 214, which controls the issue of the instructions to various execution units, e.g., one or more fixed-point units (FXUs) 216 for performing general operations and one or more floating-point units (FPUs) 218 for performing floating-point operations. The FPUs 218 may include a binary floating-point unit (BFU) 220, a decimal floating-point unit (DFU) 222, or any other floating-point unit. The issue unit 214 may also be connected to one or more load / store units (LSUs) 228 via one or more LSU pipelines. The multiple LSU pipelines are used as execution units to perform load and store operations and to generate addresses for branches.Both the LSU 228 and the IFU 210 can use a TLB 230 to provide cached translations for the operand and instruction addresses.
[0030] The FXU 216 and the FPU 218 are connected to various resources such as general purpose registers (GPRs) 224 and floating point registers (FPRs) 226. The GPR 224 and the FPR 226 provide a data value storage for data values loaded and stored from the DCache 204 by an LSU 228.
[0031] Processing circuitry 200 may also include counters and / or timers 250 to support generation and diagnostic actions based on the system time. For example, counters and / or timers 250 may be used to support a time of day and various diagnostic and measurement devices.
[0032] Fig. 3 provides a similar processing environment to Fig. 1A, with the exception that in Fig.3, a second-level hypervisor 300 is executed in the LPAR2 180 of the computer system 100. The second-level hypervisor 300, for example, the IBM z / VM operating system, includes MT support code 301 similar to the MT support code 165 provided by the LPAR hypervisor 163 (of the first level). The second-level hypervisor 300 provides support for a plurality of virtual machines 310, 320, and 330 (also referred to as configurations) in which guest operating systems 311, 321, and 331 are executed, respectively. The guest operating systems 311, 321, and 331 may be, for example, Linux or IBM z / OS, z / VM, or z / TPF, or may be a guest development environment such as the IBM Conversational Monitor System (CMS).Each guest OS 311, 321 and 331 may optionally enable multithreading, whereupon it may be the task of the second-level hypervisor 300 to allocate the guest operating systems 311, 321, 331 and the associated programs 312, 313, 322, 323, 332 and 333 using the physical processing resources (cores 130, 140 and threads 131 to 134, 141 to 144) available to the LPAR2 180 in which the second-level hypervisor 300 is executed. The programs 312, 313, 322, 323, 332, 333 of the various virtual machines 310, 320, 330 can be executed on threads 131 to 134, 141 to 144, which are available to the respective guest operating systems 311, 321, and 331. The guest operating systems 311, 321, and 331 do not need to include MT support code, as they can utilize MT in a transparent manner. In the embodiment of FIG. Fig.3, in core 3 130, threads 131 and 132 may be active while threads 133 and 134 are inactive. Similarly, in core 4 140, threads 141 and 142 may be active while threads 143 and 144 are inactive, and in core 5 150, thread 151 may be active while threads 152, 153, and 154 are inactive.
[0033] Fig. Figure 4 illustrates an example of hypervisor context retention in a computing environment that may be implemented according to one embodiment. In the example of Fig. 4, a number of support structures within the LPAR hypervisor 163 are created from the Fig. 1A and Fig. 1B. For example, the structures 410 can be LPAR1 170 from Fig. 1A, such as state descriptions and satellite blocks that store an architectural register context (ie thread context) for logical threads 411, 412, 413, 414, 421, 422, 423, 424 currently executing on the Fig. 1A are executed. While these logical threads are dispatched, the physical threads store the current architectural register context of the threads. The architectural register context is retained in the state descriptions and satellite blocks even when the threads are no longer dispatched. The structures 430 may include LPAR2 180 from Fig. 1A, such as state descriptions and satellite blocks that store an architectural register context for logical threads 431, 432, 441, 442 currently running on the Fig. 1A shown physical threads 131, 132, 141, 142. The structures 450 can LPAR3 190 from Fig. 1A, such as state descriptions and satellite blocks that store an architectural register context for a logical thread 451 currently running on the Fig.1A. Structures 450 also include state descriptions and satellite blocks that store architectural register context for logical threads 461, 462, 463, and 464 that are not currently allocated on a physical processor. Other structures for supporting LPARs that are not allocated on physical cores may also be maintained by LPAR hypervisor 163, e.g., structures 470 for a (in Fig. 1A not shown) LPAR A, such as state descriptions and satellite structures for logical threads 471, 472, 473 and 474. Further structural examples include structures 480, which contain an unallocated (and in Fig. 1A not shown) LPAR B, for example, state descriptions and satellite structures for logical threads 481 and 482, as well as structures 484 for an unallocated (and in Fig. 1A not shown) LPAR C for a logical thread 485.
[0034] Although in the example from Fig. 4, it should be understood that additional structures may be supported by the LPAR hypervisor 163 and other units in the computer system 100 to manage multithreading. Thus, structures that support the multithreading of the virtual machines 310, 320, 330 from Fig. 3 is supported by the second-level hypervisor 300 from Fig. 3 should be retained.
[0035] Fig.5 illustrates a process flow 500 for dynamic multithreading activation according to one embodiment. In block 502, a primary thread is executed in ST mode. In block 504, a set MT mode instruction is retrieved in ST mode. Upon executing this instruction, as summarized at 505, a number of threads requested from a memory location specified by the set MT mode instruction is obtained in block 506. The memory location may be specified by a parameter register when the set MT mode instruction is issued. The set MT mode instruction may be a signal processing (SIGP) instruction including a set MT order instruction and a maximum thread count PSMTID associated with the number of requested threads. An example process associated with a set MT mode instruction of a SIGP instruction is described herein with reference to FIG. Fig. 7 described.
[0036] Continuing with process 500, at block 508, it is determined whether the number of requested threads indicates multiple threads. For example, multiple threads may be indicated by a value greater than one. In embodiments where a value of zero indicates a single thread, a value of one or greater may indicate multiple threads. Based on the determination that the number of requested threads does not indicate multiple threads, at block 510, the core remains in ST mode, execution of the set MT mode instruction completes, and control returns to block 502. Based on the determination that the number of requested threads indicates multiple threads, at block 512, MT mode is enabled, and execution of the set MT mode instruction completes. At block 514, multiple threads, such as the primary and one or more secondary threads, are executing.If there is no reset or deactivation at block 516, process 500 loops back to block 514; otherwise, MT mode is deactivated at block 518 based on a reset or deactivation of the configuration that returns to ST mode. As part of deactivating MT mode, the number of threads (PSMTID) is maintained on a no-clear reset or set to zero on a clear reset. Process 500 returns to block 502.
[0037] A CPU can enter a load state if a key for normal load, dump load, erase load, or list-driven erase load is enabled. When a CCW-type IPL operation completes successfully, the CPU transitions from the load state to the run state.
[0038] A CPU reset can be used to clear device test notes and any resulting unpredictability of the CPU state with minimal information loss. In particular, it can be used to clear test conditions when the CPU state needs to be preserved for analysis or resumption of operation. If a CPU reset is caused by activating the normal load or dump load key, it can (a) set an architectural mode to a default mode, and (b) if the multithreading facility is installed and enabled, disable multithreading. If the CPU reset sets the default mode, it can save the current PSW so that the PSW can be restored.
[0039] An initial CPU reset provides CPU reset functions along with initialization of the current PSW, CPU timer, clock comparator, and other registers, such as the interrupt event address, PSW capture, control, floating-point control, prefix, and TOD programmable registers. An initial CPU reset can set the architectural mode to standard mode if caused by the normal load or dump load key being enabled. If an initial CPU reset is caused by the normal load or dump load key being enabled and multithreading is enabled, the initial CPU reset functions can be performed for the lowest-numbered CPU in a core, and the CPU reset is performed for all other CPUs in the core.A reset with clear results in the initial CPU reset and the subsystem reset, and it also clears or initializes all memory locations and registers in all CPUs in the configuration, except for the TOD timer. The clear does not affect external memory, such as random access memory units used by the control program to store the contents of unaddressable pages.
[0040] A power-on CPU reset performs an initial CPU reset, clearing the contents of general-purpose registers, access registers, control registers, and floating-point registers, and setting them to zero / default values with a valid check block code. It should be understood that clearing or initializing states does not have to be zero, but can default to non-zero values in the cleared state. If a power-on CPU reset establishes the configuration, it can set the architectural mode to the default mode; otherwise, it can set the architectural mode to the mode of the CPUs already in the configuration. The CPU reset, initial CPU reset, subsystem reset, and clear reset can be initiated manually.
[0041] In example embodiments, each CPU is assigned a number called its CPU address. A CPU address uniquely identifies a CPU within a configuration. A CPU is addressed by specifying this address in a CPU address field of a SIGP instruction. A CPU issuing a fault alarm, distress signal, or external call can be identified by storing this address in the CPU address field with the interrupt. The CPU address is assigned by a configuration definition process and is typically not changed upon reconfiguration. A program can determine a CPU's address by using a store CPU address instruction. The store CPU address instruction can also be used to identify a CPU address, which is used to identify a CPU in a multiprocessor environment.
[0042] When multithreading is enabled, the CPU address may contain a core identifier (core ID) concatenated with an identifier of a CPU within the core. The CPU identifier within a core is a thread identifier (thread ID or TID). Within a configuration, all cores provide the same number of CPUs; however, depending on the model and CPU type, some CPUs within a core may not be operational.
[0043] Based on the PSMTID of a parameter register used by the signal processor instruction to set multithreading mode, a fixed number of bits represents the thread identifier. This number of bits is referred to as the TID width.
[0044] The core ID can be formed from the rightmost bits of the CPU address before multithreading is enabled. The core ID is shifted left by the number of bits corresponding to the TID width, resulting in the leftmost bits of the CPU address after multithreading is available. The thread ID has the same number of bits as the TID width and occupies the rightmost bits of the CPU address after multithreading is enabled. Thread IDs can be assigned in a contiguous range of numbers. Table 1 illustrates an example relationship between the PSMTID, the TID width, and the CPU address bits, which include the core ID and the thread ID. Table 1 - Example of address bit mapping PSMTID TID width CPU address bits Core ID Thread ID 0 0 0 to 15 - 1 1 0 to 14 15 2 and 3 2 0 to 13 14 and 15 4 to 7 3 0 to 12 13 to 15 8 to 15 4 0 to 11 12 to 15 16 to 31 5 0 to 10 11 to 15
[0045] The address extension is in Fig.6A illustrates an example of a CPU address extension process 600A according to one embodiment. At block 602, a primary thread may be accessed in ST mode using a core address value 604 as a number of CPU address bits. Arrow 606 indicates a transition from ST to MT mode. At block 608, the primary thread or the one or more secondary threads may be accessed in MT mode using an extended address value 610. The extended address value 610 includes the core address value 604, which is relocated as a relocated core address value 612 and concatenated with a thread address value 614. The relocated core address value 612 is a core identifier (core ID), and the thread address value 614 is a thread identifier (TID). The shifted core address value 612 may be shifted by an amount based on a requested maximum thread count identifier such as a PSMTID.A number of TID bits in the thread address value 614 can be determined based on the PSMTID, as shown earlier in Table 1. The thread address value 614 can be concatenated with the least significant bits of the shifted core address value 612 to form the extended address value 610. An all-zero thread address value 614 would identify the primary thread, while values greater than zero identify and address secondary threads.
[0046] When switching between MT and ST modes, either the core address value 604 (ST mode) or the extended address value 610 (MT mode) is selected to be used as a CPU address in ST or MT mode, respectively. The core address value 604 is an example of a standard format address used in ST mode, and the core returns from MT mode to ST mode based on disabling MT mode. In one exemplary embodiment, only the primary thread (i.e., not the secondary threads) can be accessed based on disabling MT mode. Fig. 6B illustrates an example of a CPU address reduction process 600B according to one embodiment. Arrow 616 from Fig.6B illustrates a transition from MT mode of block 608 back to ST mode of block 602. The return from MT to ST mode may include right-shifting the extended address value 610 and clearing the thread address value 614 to form a standard format address, such as the core address value 604 (core ID), from the shifted address value 612 as the CPU address.
[0047] When a reset function disables multithreading, (a) the CPU address(es) of the CPU(s) with thread ID zero are shifted right by the same number of bits, equal to the TID width, as when enabled, (b) zero values are inserted into the number of bits to the left of the address equal to the TID width, and (c) the CPU address returns to its original non-multithreading format (i.e., the standard format address). Any CPU(s) in a core that have non-zero thread IDs when multithreading is enabled will become inoperable when multithreading is disabled.
[0048] If multithreading is disabled, the CPU address remains the value assigned by the configuration definition process. In this case, the thread identifier is not present.
[0049] A set of signal processor instructions can provide commands to CPUs, such as instructions to start, stop, restart, stop and save state, initial CPU reset, reset the CPU, save state to an address, set the architecture, detect the running state, set multithreading, save additional state to an address, and the like. An initial CPU reset or a CPU reset can be initiated by a signal processor instruction and has no effect on the architecture mode or other CPUs, does not disable multithreading, and does not cause an I / O reset.
[0050] A set architecture command specifies an architecture mode to which all CPUs in the configuration must be set. Architecture differences can include different addressing styles, register definitions, and instructions supported by the CPUs. When changing the architecture mode, selected bit fields of registers can be set to a default state (e.g., zero), access register translation lookaside buffers (ALBs) and TLBs of all CPUs in the configuration can be cleared, and a serialization and checkpoint synchronization function for all CPUs in the configuration can be performed.
[0051] A run status detection instruction can indicate whether an addressed CPU is running. In ST mode, an indicator can be returned indicating a running or not running status. In MT mode, an indicator can be used to indicate whether any CPU in the core to which the addressed CPU belongs is running, or whether all CPUs in the core to which the addressed CPU belongs are not running.
[0052] A set MT mode instruction enables multithreading. Bit positions of a parameter register can contain the PSMTID to be provided in the configuration. The PSMTID can be defined to be one less than the number of CPUs to be made addressable in each core. For example, a value of 3 in certain bit positions indicates that a maximum of four threads are to be provided. The contents of a CPU address register of the SIGP instruction can be ignored, as all CPUs in the configuration are considered addressed. If accepted, the set MT mode instruction completes during execution of the SIGP instruction by all CPUs. Fig.7 illustrates a process 700 for a SIGP command 702 to set MT mode. An error indication may be provided and activation of MT mode prevented based on a determination that the SIGP command 702 to set MT mode was issued with one or more of the following factors: an invalid command, a faulty condition, and an invalid parameter, as discussed here with respect to the process 700 of Fig. 7 is further described.
[0053] If the multithreading facility is not installed in block 704 or if the CPU is not enabled in a valid architecture mode 708, the command to set the MT mode is not accepted, and an invalid command indication may be returned in block 706 or 710, respectively. If the other CPUs in the configuration are not in the stop or check stop state in block 712, or if the configuration is already enabled for multithreading in block 716, the command to set the MT mode is not accepted, and an error indication may be returned in block 714 or 718, respectively.
[0054] If the PSMTID is invalid at block 720, the command to set MT mode is not accepted, and an invalid parameter indication may be returned at block 722. If the PSMTID is zero at block 724, the configuration is not enabled for multithreading, remains in ST mode, and provides any status as a condition code at block 728. In an exemplary embodiment, if the PSMTID is valid and non-zero at block 726, the configuration is enabled for multithreading, resulting in a CPU address extension, the contents of the ALBs and TLBs of all CPUs in the configuration are cleared, and a serialization and checkpoint synchronization function is performed for all CPUs in the configuration. Status may be provided in a check code at block 728.Upon successful completion, all CPUs except the CPU executing the MT mode setting instruction remain in the stop or checkstop state. However, if a CPU was in the checkstop state before multithreading is enabled, it may not be possible to predict whether the CPUs with non-zero thread IDs in the same core will enter the stop or checkstop state.
[0055] A thread context can also be referred to as an architectural register context. The architectural register context (i.e., the contents of the PSW, CPU timer, clock comparator, general-purpose registers, floating-point and floating-point control registers, vector registers, control registers, access registers, prefix registers, and TOD programmable registers, etc.) of each CPU before multithreading is enabled becomes the architectural register context of the CPU with a TID of zero of each relevant core after multithreading is enabled. Similarly, the architectural register context of the CPU with a TID of zero of each core of an MT-enabled configuration becomes the architectural register context of each relevant CPU when multithreading is disabled as a result of the activation of a normal load or dump load key.
[0056] The architectural register context of all CPUs with a non-zero thread ID can be preserved if the multithreading facility is disabled as a result of enabling a key normal load or dump load operation. If the multithreading facility is subsequently re-enabled without an intervening clear reset, the architectural register context of all CPUs with a non-zero thread ID is restored.
[0057] If multithreading is re-enabled after being disabled by enabling the normal load or dump load key, and if the value of the PSMTID in bits of the parameter register is different from the value from the previous enablement, the architectural register context of all CPUs with non-zero thread IDs may be unpredictable.
[0058] A save system information command can be used to save information about a component or components of a configuration to a system information block (SYSIB). The SYSIB can include an MT installation field, a general MT field, a total CPUs or cores count, a configured CPUs or cores count, a standby CPUs or cores count, a reserved CPUs or cores count, and other fields. The MT installation field can indicate whether the multithreading facility is installed and can also indicate the largest supported TID for a first core type, such as a specialty core type. The general MT field can indicate the highest supported TID for a second core type, such as a general purpose core type.The highest supported TID in the general MT field may be constrained to be less than or equal to the largest supported TID in the MT installation field. The total CPUs or cores count may specify a total number of general CPUs or cores that have general CPUs in the configuration, regardless of whether they are in the configured, standby, or reserved state. The configured CPUs or cores count may specify a total number of general CPUs or cores that have general CPUs in the configured state, that is, that are in the configuration and ready to execute programs. The standby CPUs or cores count specifies a number of general CPUs or cores that have general CPUs in the standby state, that is, that are unavailable for program execution until they are brought into the configured state.The standby CPUs or cores count indicates a number of general purpose CPUs or cores that have general purpose CPUs in the reserved state, that is, CPUs that are not available for program execution and cannot be brought into the configured state.
[0059] Fig. Figure 8 generally shows a block diagram of a processing circuit 800 for implementing hardware counters to provide MT utilization information according to one embodiment. In one embodiment, the Fig. 8 shown processing circuit 800 in the processing circuit of Fig.2. The processing circuit 800 includes utilization counters 802, a core clock 806, a control signal 804, a PSW 810, and a thread validity mask (TVM) 808. In an embodiment where a physical core contains four threads, a first set of counters 802 is assigned to count completed instructions and clock cycles while one thread is active, a second set of counters 802 is assigned to count completed instructions and clock cycles while two threads are active, a third set of counters 802 is assigned to count completed instructions and clock cycles while three threads are active, and a fourth set of counters 802 is assigned to count completed instructions and clock cycles while four threads are active.
[0060] A thread is active if it is valid and is not currently in a wait state (e.g., waiting for an interrupt and / or not fetching instructions). Thus, an active thread may be fetching instructions at that moment. The validity of a thread may be determined, for example, based on the contents of the thread validity mask (TVM) 808, which is provided as part of the state information about the logical threads currently executing on the core. In one embodiment, the TVM 808 includes a bit for each thread, regardless of whether a particular thread is valid or invalid, and may be cached in hardware on the core 110. The validity of a thread may also be determined based on one or more signals containing thread validity information received from system management software (e.g., a hypervisor or BIOS).
[0061] In one embodiment, a PSW 810 for a thread may be used to determine whether a thread is currently in a wait state. Generally, an interrupt causes a waited thread to become active. Alternatively, in another embodiment, other internal processor state information may be used to determine when a thread is active. Fig. The core clock 806 shown in Figure 2, with which the counters 802 count clock cycles, may be implemented by or obtained from a system clock used by the processing circuit 200. Fig. Figure 8 also shows a control signal 804 that can be used to determine when instructions have been completed. Alternatively, information can be provided by an output unit (e.g., the output unit 214 of Fig. 2) or an instruction retrieval unit (e.g. the instruction retrieval unit 210 of Fig.2) to indicate to counters 802 a number of completed instructions.
[0062] Fig. Figure 9 illustrates an example configuration that tracks utilization counters according to one embodiment. In the example of Fig. 9, a configuration 950 includes a pair of cores 900A and 900B. Each core 900A and 900B includes utilization counters 902 and four threads, Thread0, Thread1, Thread2, and Thread3. The utilization counters 902 can also be divided into different counter sets for each possible count of active threads (in this case, 1, 2, 3, 4). The Fig.9 include: Set 1 - MT1CC for counting a number of clock cycles while one of the four threads is active, and MT1IC for counting a number of instructions that have completed while one of the four threads is active; Set 2 - MT2CC for counting a number of clock cycles while two of the four threads are active, and MT2IC for counting a number of instructions that have completed while two of the four threads are active; Set 3 - MT3CC for counting a number of clock cycles while three of the four threads are active, and MT3IC for counting a number of instructions that have completed while three of the four threads are active; and Set 4 - MT4CC for counting a number of clock cycles while all four threads are active, and MT4IC for counting a number of instructions that have completed while all four threads are active.
[0063] In one embodiment, the utilization counters 902 on core 900A are enabled when MT is enabled on core 900A, for example, upon completion of an accepted SIGP instruction. Similarly, the utilization counters 902 on core 900B may be enabled when MT is enabled on core 900B. In one embodiment, the utilization counters 902 on core 900A are disabled by any action that causes MT to be disabled on core 900A. Similarly, the utilization counters 902 on core 900B may be enabled when MT is enabled on core 900B. After MT is disabled in a core, in one embodiment, the counter set of MT1CC and MT1IC may be further incremented when the core is operating in ST mode.
[0064] In one embodiment, the contents of the utilization counters may be read by a software instruction executed, for example, by an operating system or a hypervisor.
[0065] Fig. 10 generally shows a process flow for counting MT utilization according to one embodiment. Utilization counters for a core are enabled in block 1002. Enabling the utilization counters may include resetting the counters. In one embodiment, the Fig. 10, the processing shown from block 1004 through block 1026 is performed once per clock cycle. Fig. 10, one or more utilization counters may be incremented based on a confluence of one or more execution events in the multiple threads of the core.
[0066] In block 1004, it is determined (e.g., based on the contents of a TVM and / or a PSW) whether exactly one thread is active. If a single thread is active, processing continues to block 1006, where the MT1 CC counter, which counts the number of clock cycles in which the core has a single active thread, is incremented by one. In block 1008, it is determined (e.g., based on the value of a control signal) whether one or more instructions have completed. If an instruction has completed, block 1010 is performed to increment the MT1 IC counter, which counts the number of instructions completed by the core while a single thread is active. In the next clock cycle, processing then continues to block 1004. If it is determined in block 1008 that an instruction has not completed, processing continues to block 1004 in the next clock cycle.
[0067] If it is determined at block 1004 that more than one thread is active (thereby implying that exactly one thread is not active), the process continues to block 1012, where it is determined if exactly two threads are active. If two threads are active, processing continues to block 1014, where the MT2CC counter, which counts the number of clock cycles in which the core has two active threads, is incremented by one. At block 1016, it is determined if an instruction has completed. If one or more instructions have completed on either thread, block 1018 is performed to increment the MT2IC counter, which counts the number of instructions completed by the core while two threads are active. In one embodiment, the MT2IC counter is incremented by two if an instruction has completed on both threads. In the next clock cycle, processing then continues to block 1004.If it is determined in block 1016 that an instruction has not completed, processing continues in the next clock cycle to block 1004.
[0068] Similar processing continues for each thread in the core. If it is determined in block 1020 that exactly N threads are active, processing continues to block 1022; otherwise, an error condition may be reported. In block 1022, the MTNCC counter, which counts the number of clock cycles in which the core has N active threads, is incremented by one. In block 1024, it is determined whether an instruction has completed. If one or more instructions have completed on any of the N threads, block 1026 is performed to increment the MTNIC counter, which counts the number of instructions completed by the core while N threads are active. In the next clock cycle, processing then continues to block 1004. If it is determined in block 1024 that an instruction has not completed, processing continues to block 1004 in the next clock cycle.
[0069] In this way, instruction completion (i.e., a type of execution event) is tracked, and the results across multiple cores are aggregated. An execution event here refers to any event on a thread of the core that can be tracked, including, but not limited to, a clock cycle, an instruction completion, a cache access miss, and a branch prediction miss.
[0070] Technical implications and benefits include the ability to collect utilization information for a core in a computer system that supports both single-threaded and multi-threaded modes of operation.
[0071] Embodiments include a method, system, and computer program for tracking utilization in an MT computer system. In one aspect, a computer system includes a configuration having a core configured to operate in an MT mode that supports multiple threads in shared resources of the core. The core is configured to perform a method that includes resetting a plurality of utilization counters. The utilization counters include a plurality of counter sets. During each clock cycle on the core, a set of counters is selected from the plurality of counter sets. The selecting is based on a number of currently active threads on the core. Additionally, a counter in the selected set of counters is incremented based on a coincidence of one or more execution events in the multiple threads of the core during each clock cycle.The values of the utilization counters are provided to a software program.
[0072] According to another aspect, a computer-implemented method for tracking utilization in a configuration is provided. The configuration includes a core configured to operate in an MT mode. The MT mode supports multiple threads in shared resources of the core. The method includes resetting a plurality of utilization counters. The utilization counters include a plurality of counter sets. During each clock cycle on the core, a set of counters is selected from the plurality of counter sets. The selecting is based on a number of currently active threads on the core. Additionally, based on a confluence of one or more execution events in the multiple threads of the core during each clock cycle, a counter in the selected set of counters is incremented. The values of the utilization counters are provided to a software program.
[0073] Another aspect is a computer program product for tracking utilization in a configuration. The configuration includes a core configured to operate in an MT mode. The MT mode supports multiple threads in shared resources of the core. The computer program product includes a computer-readable storage medium having program instructions embodied thereon, wherein the computer-readable storage medium is not a signal, and wherein the program instructions are readable by processing circuitry to cause the processing circuitry to perform a method. The method includes resetting a plurality of utilization counters. The utilization counters include a plurality of sets of counters. During each clock cycle on the core, a set of counters is selected from the plurality of sets of counters. The selecting is based on a number of currently active threads on the core.Additionally, based on the occurrence of one or more execution events in the core's multiple threads during each clock cycle, a counter in the selected set of counters is incremented. The values of the utilization counters are provided to a software program.
[0074] In addition to one or more of the features described above, further embodiments may include that an execution event includes a clock cycle and that the counter in the selected set of counters is incremented by the value one.
[0075] In addition or alternatively to one or more of the features described above, further embodiments may include that the execution event further includes an instruction completion and that another counter from the selected set of counters is incremented based on a number of instruction completions on all threads currently active during the clock cycle.
[0076] In addition or alternatively to one or more of the features described above, further embodiments may include that the execution event further includes a cache access miss and that another counter from the selected set of counters is incremented based on a number of cache access misses on all threads currently active during the clock cycle.
[0077] In addition or alternatively to one or more of the features described above, further embodiments may include the execution event further including a branch prediction miss and incrementing another counter from the selected set of counters based on a number of branch prediction misses on all threads currently active during the clock cycle.
[0078] In addition or alternatively to one or more of the features described above, further embodiments may include a thread being currently active if the thread is valid and not in a wait state.
[0079] In addition or alternatively to one or more of the features described above, further embodiments may include the software program being an operating system or a hypervisor.
[0080] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the singular forms "a" and "an" are intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the verbs "comprises" and / or "comprising" in this specification indicate the presence of the recited features, integers, steps, acts, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, acts, element components, and / or groups thereof.
[0081] The contemplated structures, materials, acts, and equivalents of all means or steps in addition to the functional elements in the following claims are intended to include any structure, material, or act capable of performing the function in conjunction with other claimed elements as expressly claimed herein. The description of the present invention has been presented for purposes of illustration and explanation and is not intended to be exhaustive or limiting of the invention as described. Those skilled in the art will recognize that numerous changes and modifications may be made without departing from the spirit and scope of the invention.The embodiment was chosen and described in order to best explain the principles of the invention and its practical application, and to enable others skilled in the art to understand the invention by reference to various embodiments with various modifications as are suited to the particular use contemplated.
[0082] The descriptions of the various embodiments of the present invention have been presented for illustrative purposes and are not intended to be exhaustive or limited to the disclosed embodiments. Those skilled in the art will appreciate that numerous changes and modifications are possible without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen to best explain the principles of the embodiments, practical application, or technical improvement over current technologies, or to enable others skilled in the art to understand the embodiments disclosed herein.
[0083] Fig. 11 generally illustrates a computer program product 1100 according to one embodiment, including a computer-readable storage medium 1102 and program instructions 1104.
[0084] The present invention may be a system, a method, and / or a computer program product. The computer program product may include a computer-readable storage medium (or media) having computer-readable program instructions embodied thereon for causing a processor to perform aspects of the present invention.
[0085] The computer-readable storage medium may be a tangible unit capable of retaining and storing instructions for use by an instruction execution unit. The computer-readable storage medium may be, for example, an electronic storage unit, a magnetic storage unit, an optical storage unit, an electromagnetic storage unit, a semiconductor storage unit, or any suitable combination of the foregoing units, but is not limited thereto. A non-exhaustive list of more specific examples of the computer-readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable CD-ROM, a DVD, a memory stick, a floppy disk, a mechanically encoded device such asPunched cards or raised structures in a groove with instructions recorded thereon, as well as any suitable combination of the foregoing. A computer-readable storage medium, as used herein, is not intended to be inherently transient signals such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., light pulses traveling through a fiber optic cable), or electrical signals transmitted over a wire.
[0086] Computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to corresponding computing / processing devices or to an external computer or storage device over a network such as the Internet, a local area network (LAN), a wide area network (WAN), and / or a wireless network. The network may include copper transmission cables, fiber optic cables, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage on a computer-readable storage medium within the respective computing / processing device.
[0087] Computer-readable program instructions for performing operations of the present invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state-specifying data, or either source code or object code written in any combination of one or more programming languages, such as an object-oriented programming language such as Smalltalk, C++, or the like, as well as conventional procedural programming languages such as the C programming language or similar programming languages.The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer via any type of network, including a LAN or a WAN, or the connection may be made to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, an electronic circuit such asa programmable logic circuit, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs) that execute computer-readable program instructions by using state data of the computer-readable program instructions to personalize the electronic circuit and perform aspects of the present invention.
[0088] Aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, may be implemented by computer-readable program instructions.
[0089] These computer-readable program instructions may be provided to a processor of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, executing via the processor of the computer or other programmable data processing apparatus, produce a means for performing the functions / acts specified in the flowchart and / or block diagram block(s). These computer-readable program instructions may also be stored on a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and / or other devices to function in a particular manner, such that the computer-readable storage medium with instructions stored thereon comprises an article of manufacture that includes instructions that perform aspects of the functions specified in the flowchart and / or block diagram block(s).implement the function / action specified in the blocks of the flow chart and / or the block diagram.
[0090] The computer-readable program instructions may also be loaded into a computer, other programmable data processing apparatus, or other device to cause a series of functional steps to be performed on the computer, other programmable data processing apparatus, or other device, such that the instructions executing on the computer, other data processing apparatus, or other device implement the functions / acts specified in the block(s) of the flowchart and / or block diagram.
[0091] The flowcharts and block diagrams in the figures provide the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Thus, each block of the flowcharts or block diagrams may represent a module, segment, or portion of instructions comprising one or more executable instructions that may implement the one or more specified logical functions. In some alternative embodiments, the functions mentioned in the block may occur in a different order than that mentioned in the figures. For example, two consecutively illustrated blocks may actually occur substantially concurrently, or the blocks may sometimes execute in reverse order, depending on the functionality involved.It should also be noted that each block of the block diagrams and / or flowchart illustrations, as well as combinations of blocks in the block diagrams and / or flowchart illustrations, may be implemented or performed by special purpose hardware-based systems that perform the specified functions or acts or combinations thereof, or by combinations of special purpose hardware and computer instructions.
Claims
[1] A processor with simultaneous multithreading (SMT) and a processing circuit for implementing multiple sets of hardware counters to provide multithreading utilization information, where each set of hardware counters is assigned a different number of threads, wherein a first hardware counter of a set of hardware counters counts the number of instructions completed by the active threads and a second hardware counter of the set counts the completed clock cycles while the threads assigned to the set of hardware counters are active, where a thread is active if it is valid and not in a wait state, wherein the processor is further configured to provide values of the hardware counters as multithreading utilization information to a software program. [2] The processor of claim 1, wherein a thread is valid if its validity can be determined based on a content of a validity mask. [3] The processor of claim 2, wherein the validity mask is cacheable in hardware in a core of the processor. [4] A processor according to any preceding claim, further comprising a third hardware counter of the set capable of counting a number of cache access misses on all threads active during the clock cycle. [5] The processor of any preceding claim, further comprising a fourth hardware counter of the set capable of counting a number of branch prediction misses on all threads active during the clock cycle. [6] Processor according to one of the preceding claims, wherein the software program is an operating system or a hypervisor. [7] A method for providing multithreading utilization information by a processor with simultaneous multithreading (SMT) and a processing circuit for implementing multiple sets of hardware counters according to any one of claims 1 to 6, the method comprising - Resetting the hardware counters of multiple sets, - Perform for each clock cycle on a core of the processor: - Selecting one of the multiple sets of hardware counters based on a number of active threads on the core, - Increment the first counter by one based on completed instructions from active threads. - Incrementing the second counter by one based on completed clock cycles of active threads, and - Providing hardware counter values as multithreading utilization information to the software program. [8] Method according to claim 7, additionally comprising - Determining the validity of a thread based on the content of the validity mask. [9] Method according to claim 7 or 8, additionally comprising - Increment the third hardware counter of the set based on a number of cache access misses on all threads active during the clock cycle. [10] A computer program comprising instructions for performing all the steps of the method according to any preceding method claim when the computer program is executed on a computer system.
Citation Information
Patent Citations
Food content detector
US20100125179A1
multiprocessor computer and program
JP3876818B2
Accounting method and logic for determining processor resource usage per thread in a simultaneous multithreaded (SMT) processor.
JP4536717B2
Performance counters in a multi-threaded processor
US20050183065A1
Method and Apparatus for Analyzing Wait States in a Data Processing System
US20070220515A1
