Configurable processor interrupts for allowing an application to independently handle interrupts

Embodiments relate to configurable processor interrupts. An aspect includes sending, by an application to supervisor software in a computer system, a request, the request including a plurality of exception types to be handled by the application. Another aspect includes determining, by the supervisor software, a subset of the plurality of exception types for which to approve handling by the application. Yet another aspect includes sending a response from the supervisor software to the application notifying the application of the subset of exception types.

BACKGROUND

The present invention relates generally to computer processor systems, and more specifically, to configurable processor interrupts in a computer processor system.

In computer systems that require a variety of system functions to be controlled in a nonsequential fashion, it is a common practice to employ interrupts to determine the order in which various operations are to be performed by the processor. An interrupt is generated in response to the occurrence of a predetermined event in the operation of the system. When the processor receives an interrupt request, it stops its present operation at an appropriate point and proceeds to a predetermined subroutine that controls the function associated with that particular interrupt. The predetermined condition may be an exception condition in the processor. The occurrence of an exception may result in generation of an interrupt that passes control from an application that was running at the time the exception occurred to supervisor software, so that the supervisor software can handle the exception. However, processing of interrupts by the supervisor software may negatively impact performance of the computer system.

SUMMARY

Embodiments include a method, system, and computer program product for configurable processor interrupts. An aspect includes sending, by an application to supervisor software in a computer system, a request, the request including a plurality of exception types to be handled by the application. Another aspect includes determining, by the supervisor software, a subset of the plurality of exception types for which to approve handling by the application. Yet another aspect includes sending a response from the supervisor software to the application notifying the application of the subset of exception types.

DETAILED DESCRIPTION

Embodiments of configurable processor interrupts are provided, with exemplary embodiments being discussed below in detail. Instead of generating an interrupt that passes control to supervisor software based on encountering an exception condition, some exception conditions may be handled by the application via a lightweight interrupt, such as an event based branch (EBB). A system call is provided to request that a set of exception types trigger lightweight interrupts that are routed to the application during execution of the application. The supervisor software may approve or deny the request for each of the requested exception types. The supervisor software may comprise a hypervisor and/or an operating system (OS) in various embodiments.

Examples of exception types include, but are not limited to, performance monitor exceptions, floating-point exceptions, trap exceptions, divide by zero exceptions, out of bounds exceptions. Exceptions may also be generated corresponding to asynchronous events that occur in the processor. Such asynchronous events may include, but are not limited to, notifications regarding a change to a system parameter, a change in program priority, expiration of a system timer, or any other system change that could affect the application. An application may request to handle any types of exceptions via the system call. In some embodiments, the requested exception types may be determined by the application based on the capabilities of an exception handler in the application. For example, the application may issue the following system call to the supervisor software: REQUEST NOTIFICATION (requested exception types). This system call is used by the application to request that exceptions related to a selected set of exception types trigger lightweight interrupts.

The supervisor software responds to the system call from the application with the following response: GRANT NOTIFICATION (granted exception types). This response indicates the set of exceptions which the supervisor has determined are appropriate for handling by the application; the granted exception types may comprise less than all of the requested exception types. The supervisor may grant control over certain exceptions to the application based on whether the application is deemed capable of handling the exception. Control may be granted for exceptions that can be handled independently by the application without any side effects on other threads that are running in the processor.

FIG. 1depicts a computer system for implementing configurable processor interrupts in accordance with an embodiment. Computer system100includes a processor101in communication with a main memory105. The processor101includes one or more cores102that execute instructions using cache memory103. Computer programs, such as supervisor106and application107, are stored in main memory105and executed by the processor101. The supervisor106may include a hypervisor and/or an OS in various embodiments. Any appropriate number of applications such as application107may be executed by a computer system such as computer system100. Exceptions may be generated by various conditions in the processor101during execution of application107. Examples of exception types include, but are not limited to, performance monitor exceptions, floating-point exceptions, trap exceptions, divide by zero exceptions, out of bounds exceptions. Further exceptions may correspond to asynchronous events, such as a change to a system parameter, a change in program priority, expiration of a system timer, or any other system change that could affect the application, that occur during execution of application107. When an exception occurs during execution of application107, the exception may be either handled by an interrupt that passes control to the supervisor106, or handled by a lightweight exception handler108in the application107. In some embodiments, a control register104in processor101may indicate what types of exceptions are routed to supervisor106, and what type of exceptions are routed to application107. The application107may request that one or more exception types be routed to the application107instead of the supervisor106based on, for example, the capability of the exception handler108. The supervisor106may approve or deny the request for each of the requested exception types, set the control register104accordingly, and notify the application107.

FIG. 2illustrates an embodiment of a method200for configuring processor interrupts. Method200may be implemented in computer system100ofFIG. 1. First, in block201, the application107sends a system call comprising a request to the supervisor106requesting that a specific set of exception types be sent to the exception handler108in the application107for processing instead of to the supervisor106during execution of the application107. For example, the application107may make the following request to the supervisor106:REQUEST NOTIFICATION (FP,D0,OOB, Priority)
In the above request, the application107is requesting to receive lightweight interrupts corresponding floating-point exceptions (FP), divide by zero exceptions (D0), out of bounds exceptions (OOB), and changes to priority. This request is shown for illustrative purposes only; in various embodiments, an application107may request notifications regarding any appropriate event in the processor101, including but not limited to exceptions and asynchronous events.

Next, in block202, the supervisor106determines, for each exception type included in the request of block201, whether to grant the request. The supervisor106may use any criteria in determining the exception types for which to grant handling to the application107. The decision may be made by the supervisor106based on determining the ability of the application107to handle the exception notifications without affecting other threads in the processor101.

Then, in block203, the supervisor106sends a response to the application107indicating which exception types of the set of requested exception types will trigger lightweight interrupts to the application based on the determination of block202. For example, in response, the supervisor106may return the following response to the application107:GRANT NOTIFICATION (FP, D0, Priority)
In the above response, the supervisor106indicates that lightweight interrupts are granted for floating-point exceptions (FP), divide by zero exceptions (D0), and changes to priority, but has withheld granting control to the application107for out of bounds exceptions. In some embodiments of block203, the supervisor106also sets the control register104to indicate, to the processor101, the particular granted exceptions that are to be handled by the application107. Any appropriate means of indicating, to the processor101, the particular exceptions that are to be handled by the application107may be used in various embodiments.

FIG. 3illustrates an embodiment of a method300for handling configurable processor interrupts. Method300is implemented in computer system100ofFIG. 1. First, in block301, an exception occurs in the processor101during execution of application107. In block302, it is determined whether the type of the exception of block301is an exception type that was approved for handling by the application107in block202ofFIG. 2. The determination of block302may be made based on control register104in some embodiments. If it is determined in block302that the exception type is an exception type that was approved for handling by the application107, flow proceeds from block302to block303, and the a lightweight interrupt corresponding to the exception is sent to exception handler108in the application107. The exception handler108then handles the exception. If it is determined in block302that the exception type is not an exception type that was approved for handling by the application107, flow proceeds from block302to block304, and the exception generates an interrupt of control from the application107to the supervisor106, so that the supervisor106can handle the exception.

Technical effects and benefits include improved performance in a computer processor.