The present application relates to the field of data processing. More particularly, the invention relates to handling interrupts in a data processing apparatus having multiple processors.
In a data processing apparatus, interrupt requests are used to signal to a processor that it should interrupt its current processing and execute an interrupt handling routine. For example, interrupts may be used to signal errors or to notify the processor of an event occurring at a peripheral device. In a multi-processor system, it is often desirable for only one processor to actually service an interrupt request, even if more than one processor could service the interrupt request. The present technique seeks to improve the way in which one of multiple available processors is selected for handling an interrupt request.
Viewed from one aspect, the present invention provides a data processing apparatus comprising:
a plurality of processors;
a plurality of interrupt interfaces each configured to handle interrupt requests for a corresponding processor; and
an interrupt distributor configured to control routing of the interrupt requests to the plurality of interrupt interfaces for the corresponding processors, the interrupt requests including a shared interrupt request which is serviceable by multiple processors;
wherein in response to the shared interrupt request, a target interrupt interface corresponding to one of the multiple processors is configured to issue an interrupt ownership request to the interrupt distributor, without passing the shared interrupt request to the corresponding processor, if the target interrupt interface estimates that the corresponding processor is available for servicing the shared interrupt request; and
the target interrupt interface is configured to pass the shared interrupt request to the corresponding processor in response to an ownership confirmation from the interrupt distributor indicating that the corresponding processor has been selected for servicing the shared interrupt request.
In a data processing apparatus having multiple processors, a plurality of interrupt interfaces may be provided, each for handling interrupt requests for a corresponding processor. An interrupt distributor may control routing of the interrupt request to the interrupt interfaces for the corresponding processors. The interrupt requests include a shared interrupt request which is serviceable by multiple processors. By allowing the shared interrupt request to be serviced by any of multiple processors, the shared interrupt request may often be serviced more quickly than an interrupt request which targets a specific processor. An interrupt interface which receives a shared interrupt request may be referred to as a “target interrupt interface”.
The inventors of the present technique recognised that determining which of multiple processors should service a shared interrupt request can take some time, which could delay processing by the processors. Typically, in order to find out whether a processor is available for handling an interrupt, the interrupt would be passed to the processor, which would respond if it is available. However, the inventors realised that if the shared interrupt request was issued to all, or a subset, of the multiple processors in order to find out which processors are available, then the processors could suspend processing in response to the interrupt. This can lead to the processors remaining idle during a period between receiving the interrupt request and it being determined which processor should service the interrupt. Since all but one of the processors would not be selected to service the interrupt, then halting processing at each processor can cause a significant loss of performance.
To address this issue, in the present technique the shared interrupt request is not passed to the corresponding processor when it is received by a target interrupt interface.
Instead, the target interrupt interface estimates whether the corresponding processor is available for servicing the shared interrupt request, without passing the shared interrupt request to the corresponding processor. If it is estimated that the corresponding processor is available for servicing the shared interrupt request, then the target interrupt interface issues an interrupt ownership request to the interrupt distributor. When an ownership confirmation is received from the interrupt distributor indicating that the processor corresponding to the target interface has been selected for servicing the shared interrupt request, then the target interrupt interface passes the shared interrupt request to the corresponding processor. Since the shared interrupt request is not passed to the processor until the processor has already been selected for servicing the shared interrupt request, the processor can continue to perform its current processing during the period when ownership of the interrupt is being determined. This is possible because the target interrupt interface makes an estimation of whether the processor is available for servicing without actually issuing the interrupt to the processor.
The processors may comprise any destination which is capable of servicing an interrupt request. For example, the processors may comprise central processing units (CPUs) or graphic processing units (GPUs). Also, a processor may comprise a cluster of processing units.
The shared interrupt request may be distributed from the interrupt distributor to the interrupt interfaces in different ways. In one example, the interrupt interfaces may periodically poll the interrupt distributor to check whether a shared interrupt request has been received. However, it may be preferable for the interrupt distributor to route a received shared interrupt request to the target interrupt interfaces corresponding to at least some of the processors which are eligible for servicing the shared interrupt request. In response to receiving the shared interrupt request from the interrupt distributor, each target interrupt interface may estimate whether the corresponding processor is available for servicing the shared interrupt request, and if so, to issue the interrupt ownership request to the interrupt distributor.
The interrupt interfaces may be implemented in different ways. In one example, each interrupt interface may be part of the corresponding processor. In another example, an interrupt controller may comprise the interrupt distributor and the interrupt interfaces, with the interrupt interfaces being separate from the corresponding processors.
The interrupt distributor may receive one or more interrupt ownership requests from different target interrupt interfaces indicating that the corresponding processors are estimated to be available for servicing the shared interrupt request. In response, the interrupt distributor may select a target interrupt interface from which an interrupt ownership request has been received and issue an ownership confirmation to the selected target interrupt interface. The selection may be performed in various ways. To allow the shared interrupt request to be handled as quickly as possible, the interrupt distributor may select the target interrupt interface from which the first interrupt ownership request is received. However, other selection schemes could also be used.
If interrupt ownership requests are received from more than one target interrupt interface, then the interrupt distributor may issue an ownership rejection to at least one non-selected target interrupt interface indicating that the corresponding processor has not been selected for servicing the shared interrupt request. The ownership rejection need not be issued immediately. For example, deferring at least some ownership rejections may be useful so that if the processor corresponding to the selected target interrupt interface is not able to handle the shared interrupt signal, then the shared interrupt request can instead by handled by another processor corresponding to a target interrupt interface for which an ownership rejection has not yet been sent. For example, the ownership rejection may be issued once the interrupt has been acknowledged by a processor, indicating that the interrupt is being serviced.
In response to receiving an ownership rejection, a non-selected target interrupt interface may prevent the shared interrupt request being passed to the corresponding processor. This means that processors which are not selected for servicing the interrupt will not receive the shared interrupt request and so do not halt their current processing. By avoiding unnecessary interruptions to data processing, this helps to improve the processing performance of the data processing apparatus. In contrast, if the shared interrupt request had been passed to all the candidate processors before determining which processor should service the interrupt request, then the non-selected processors would unnecessarily have been interrupted.
The target interrupt interface may estimate whether the corresponding processor is available for servicing the shared interrupt request without checking with the corresponding processor whether it is actually available for servicing the shared interrupt request. Checking whether the processor is actually available for servicing the interrupt would often require the processor to interrupt its current processing and so avoiding this check can help to improve processing performance.
The target interrupt interface may be provided with access to a subset of processor state of the corresponding processor, and may estimate, based on the subset of processor state, whether the corresponding processor is available for servicing the shared interrupt request. The subset of processor state does not need to provide a completely accurate indication of whether the processor is available.
For example, the subset of processor state may include at least one of:
Hence, the target interrupt interface may have access to various processor state which can indicate that the corresponding processor cannot service the interrupt. If the subset of processor state does not indicate that the processor cannot service the interrupts, then the interrupt ownership request may be issued. That is, the interrupt interface assumes that, unless there is something in the processor state that rules out handling of the shared interrupt request, then the processor is likely to be available for servicing a request, and so speculatively issues an interrupt ownership request in this case.
Nevertheless, even if the processor state does not rule out servicing the interrupt, the processor may still be unavailable for handling the interrupt request. For example, the processor may have reached a stage of execution at which it cannot halt processing to service the interrupts. Alternatively, the processor may be in a condition, of which the interrupt interface is not aware, which means that the processor cannot service the shared interrupt request. Therefore, the estimation of the target interrupt interface may be incorrect, and so once a processor has been selected for servicing the interrupts, the processor may find that it cannot service the interrupt. Also, even if the prediction of processor availability by the target interrupt interface is initially correct, it is possible that the processor state may then change so that, by the time the processor is passed the interrupt, the processor cannot handle the interrupt anymore.
To address this issue, the target interface may provide an ownership release indication to the interrupt distributor if, after passing the shared interrupt request to the corresponding processor, the corresponding processor cannot service the shared interrupt request. This enables the processor to relinquish ownership of the shared interrupt request to allow other processors to service the interrupt if possible.
In response to the ownership release indication, the interrupt distributor can allow another processor to service the shared interrupt request. This can be done in various ways. In one example, the interrupt distributor may simply re-issue the shared interrupt request to trigger fresh interrupt ownership requests from any target interrupt interfaces which estimate that the corresponding processor is available. Optionally, the re-issued shared interrupt request may be issued to just a subset of the target interrupt interfaces to which the original shared interrupt request was issued. For example, target interrupt interfaces which did not issue an interrupt ownership request, or the target interrupt interface which provided the ownership release indication, may be excluded from receiving the re-issued shared interrupt request, as it may be assumed that the processors corresponding to these target interrupt interfaces still cannot service the interrupt. Alternatively, it may be simpler for the re-issued shared interrupt request to be routed to all target interrupt interfaces. Another way of allowing other processors to service the shared interrupt request is for the interrupt distributor to defer issuing the ownership rejection to at least one non-selected target interrupt interface when making the initial ownership selection, and, when the ownership release indication is received from the previously selected target interrupt interface, to issue an ownership confirmation to a target interrupt interface for which no ownership rejection has yet been sent. In another example, if a shared interrupt request targets a subset of the processors, and one of the processors releases ownership of the shared interrupt request while none of the other processors in the subset has requested ownership, then the interrupt distributor could re-issue the shared interrupt request to a different subset of the processors.
There are different ways in which the target interrupt interface may determine whether the processor can service the shared interrupt request. For example, if, after passing the shared interrupt request to the corresponding processor, the corresponding processor has not serviced the shared interrupt request within a predetermined time, then the target interrupt interface may assume that the processor cannot service the shared interrupt request and may issue the ownership release indication.
Also, if the corresponding processor enters an interrupt service routine corresponding to the shared interrupt signal and exits the interrupt service routine without servicing the shared interrupt request, then again it may be assumed that the corresponding processor cannot service the interrupt and the ownership release indication may be issued.
If it is found that the selected processor cannot service the shared interrupt request, but the corresponding target interrupt interface was the only interrupt interface to have issued an interrupt ownership request, then issuing an ownership release indication may not be useful since there would not be any other processors which are estimated to be available for servicing of the interrupt. Therefore, in such a situation it may be better to wait for the selected processor to become available. To achieve this, the interrupt distributor may indicate to the target interrupt interface whether the target interrupt interface is the only interface to have issued an interrupt ownership request in response to the shared interrupt request. If the target interrupt interface is the only interrupt interface to have issued an interrupt ownership request, then issuing of the ownership release indication may be suppressed by the target interrupt interface. In this case, the interrupt may simply remain pending at the selected processor until the processor does become available for handling the interrupt. This avoids extra processing at the interrupt distributor and at other target interrupt interfaces for handling the ownership release indication.
There may be different ways in which the processor can indicate to the interrupt interface whether it is available for servicing the shared interrupt request after it has been passed to the processor. In one example, the interrupt interface may comprise an interrupt knowledge register which stores interrupt identifying data relating to the shared interrupt request passed to the corresponding processor. When the processor receives the shared interrupt request, then the processor may read the interrupt identifying data from the interrupt acknowledge register if the processor is available for servicing the interrupt. The target interrupt interface can assume that the processor is not available for servicing the interrupt if the processor does not read the interrupt acknowledge register. The interrupt identifying data may be any data relating to the interrupt. In some examples, the interrupt identifying data may comprise just an identifier which indicates the highest priority interrupt which is pending for the corresponding processor. In other examples, additional data may also be provided in the interrupt acknowledge register.
Viewed from another aspect, the present invention provides a computer-readable storage medium storing a computer program which, when executed on a computer, causes the computer to act as a virtual machine corresponding to the data processing apparatus described above. The virtual machine enables the computer to act as if it has the features of the data processing apparatus and allows the computer to execute instructions and handle interrupts in an environment corresponding to the data processing apparatus. The storage medium may, for example, be a non-transitory computer-readable storage medium.
Viewed from another aspect, the present invention provides a data processing apparatus comprising:
a plurality of processing means for processing data;
a plurality of interrupt interface means for handling interrupt requests for a corresponding processing means; and
an interrupt distributing means for controlling routing of the interrupt requests to the plurality of interrupt interface means for the corresponding processing means, the interrupt requests including a shared interrupt request which is serviceable by multiple processing means;
wherein in response to the shared interrupt request, a target interrupt interface means corresponding to one of the multiple processing means is configured to issue an interrupt ownership request to the interrupt distributing means, without passing the shared interrupt request to the corresponding processing means, if the target interrupt interface means estimates that the corresponding processing means is available for servicing the shared interrupt request; and
the target interrupt interface means is configured to pass the shared interrupt request to the corresponding processing means in response to an ownership confirmation signal from the interrupt distributing means indicating that the corresponding processing means has been selected for servicing the shared interrupt request.
Viewed from a further aspect, the present invention provides an interrupt interface for handling interrupt requests for a corresponding processor of a data processing apparatus having a plurality of processors; wherein:
in response to a shared interrupt request which is serviceable by multiple processors including the processor corresponding to the interrupt interface, the interrupt interface is configured to estimate whether the corresponding processor is available for servicing the shared interrupt request;
the interrupt interface is configured to issue an interrupt ownership request to an interrupt distributor, without passing the shared interrupt request to the corresponding processor, if the corresponding processor is estimated to be available for servicing the shared interrupt request; and
in response to an ownership confirmation signal from the interrupt distributor indicating that the corresponding processor has been selected for servicing the shared interrupt request, the interrupt interface is configured to pass the shared interrupt request to the corresponding processor.
Viewed from yet another aspect, the present invention provides a method for handling interrupt requests in a data processing apparatus having a plurality of processors, the method performed by an interrupt interface corresponding to one of the plurality of processors and comprising the steps of:
receiving a shared interrupt request which is serviceable by multiple processors including the processor corresponding to the interrupt interface;
estimating whether the corresponding processor is available for servicing the shared interrupt request;
if the corresponding processor is estimated to be available for servicing the shared interrupt request, issuing an interrupt ownership request to an interrupt distributor, without passing the shared interrupt request to the corresponding processor; and
in response to an ownership confirmation signal from the interrupt distributor indicating that the corresponding processor has been selected for servicing the shared interrupt request, passing the shared interrupt request to the corresponding processor.
Further particular and preferred aspects of the present invention are set out in the accompanying independent and dependent claims. Features of the dependent claims may be combined with features of the independent claims as appropriate, and in combinations other than those explicitly set out in the claims.
An interrupt distributor 10 is provided for receiving interrupt requests from various interrupt sources and distributing the interrupt requests to the different interrupt interfaces 6 for the corresponding processors 4. The distributor 10 controls the flow of interrupts throughout the system and provides additional support for configuration and for global interrupts. Although
Some interrupt requests target a specific processor and can only be serviced by that processor. Such interrupt requests are routed by the distributor 10 to the interface 6 corresponding to the target processor and remain pending until the target processor has serviced the interrupt (servicing of the interrupt request may be delayed if a higher priority interrupt request targets the same processor). However, other interrupt requests are known as shared interrupt requests and may be serviced by any of several eligible processors 4 of the data processing apparatus 2. By allowing the shared interrupt request to be serviced by any of the eligible processors, it is more likely that the interrupt can be handled more quickly, since if one processor is not available for servicing interrupts then another may be available.
In response to the shared interrupt request 20, each target interrupt interface 6 estimates whether the corresponding processor is available for servicing the interrupt. In this example, interface IF0 determines that processor CPU0 is not available for servicing the interrupt, and so does not issue an interrupt ownership request. On the other hand, interfaces IF1, IF2 estimate that the corresponding processors CPU1, CPU2 are available for servicing the interrupts, and so issue an interrupt ownership request 22 to the distributor 10. The distributor 10 determines, among the target interrupt interfaces 6 from which ownership requests 22 have been received, which interface 6 should handle the interrupt. In this example, the distributor 10 selects interface IF1 corresponding to processor CPU1. An ownership confirmation 24 is sent to the selected interface IF1, while an ownership rejection 26 is selected to any non-selected interfaces from which an ownership request was received.
When the shared interrupt request signal is routed to several target interrupt interfaces 6 as shown in
In
In
As shown in
To address this problem, the present technique recognises that it is not necessary to issue the interrupt signal to the processor 4 in order to determine which processor should service the interrupt. Instead, an estimation of whether the processor could accept the interrupt can be made by the interface 6, and the interface 6 can speculatively send an interrupt ownership request if the processor is estimated to be available, without actually sending the interrupt signal to the processor 4 to check whether the processor is available. The interrupt distributor 10 may then determine which of the processors for which interrupt ownership requests have been received should service the interrupt. The interface 6 corresponding to the selected processor 4 may wait until receiving the ownership confirmation from the interrupt distributor 10 before issuing the interrupt signal to the corresponding processor 4.
This technique is shown in
To allow the interface 6 to estimate whether the corresponding processor could accept the interrupt, the interface 6 may have access to a subset of the processor state of the corresponding processor 4. Typically the subset of processor state will include information which would enable the interface 6 to determine that the processor 4 definitely cannot service the interrupt. If the processor state does not rule out servicing of the interrupt, then the interface 6 assumes that the processor 4 could service the interrupt and so an ownership request is issued to the interrupt distributor 10 without the processor 4 attempting to service the interrupt.
At step 30, a shared interrupt request is received by the interface 6. At step 32, the interface checks whether the shared interrupt request has a higher priority than the current processing being performed by the processor 4. If not, then at step 33 it is estimated that the interrupt cannot be serviced and at step 34 no ownership request is issued to the distributor 10. On the other hand, if the shared interrupt priority level is greater than the current priority level then the method proceeds to step 35. At step 35 the interface 6 checks whether the shared interrupt priority level is greater than the priority mask level. If not, then again at steps 33 and 34 the interrupt cannot be serviced and so no ownership request is issued. If the shared interrupt priority level is greater than the priority mask level then at step 36 it is determined whether interrupts are currently being masked by the corresponding processor 4. If so, then at steps 33 and 34 the interrupt cannot be serviced. If interrupts are not being masked, then at step 38 it is detected whether the shared interrupt request is one of a group of interrupt requests that is currently disabled. If so, then at step 33 the interrupt cannot be serviced and so no ownership request is issued at step 34. If the group of interrupts including the shared interrupt is not disabled then at step 40 it is detected whether the current execution mode of the processor 4 enables interrupts to be serviced. If not then again at step 33 the interrupt cannot be serviced. If at step 40 the current execution mode of the processor 4 does enable interrupts to be serviced, then at step 42 it is estimated that the interrupt can be serviced and at step 44 an ownership request for the interrupt is issued to the distributor 10.
If no ownership request has yet been issued and the interrupt remains pending, then the checks shown in
In summary, steps 32, 35, 36, 38, 40 of
While steps 32 and 35 of
The interface 6 will not typically have access to all the information which would allow a completely accurate determination of whether the processor could handle the interrupt. Therefore, it is possible that the estimation turns out to be incorrect. Also, even if the estimation made by the interface 6 was initially correct, the processor 4 may change state after the prediction has been made, so that after it has been selected for servicing the interrupt the processor decides that it cannot service the interrupt. Therefore, the present to technique also provides a mechanism for allowing a processor 4 which has been selected to service the interrupt to relinquish ownership of the interrupt. In this case, then the corresponding interface 6 may issue an ownership release indication to the distributor 10, which may then allow another processor 4 to service the interrupt.
There may also be other ways in which the interrupt interface 6 can determine that the selected processor 4 will not be able to service the interrupt and so ownership of the interrupt should be released.
In the example of
On the other hand, as shown in
At step 104, a target interrupt interface 6 receives a shared interrupt request from the distributor 10. The target interrupt interface 6 estimates at step 106 whether the corresponding processor is likely to be available for servicing the interrupt. The estimation may be performed using a subset of processor state, as shown in
At step 110, the distributor 10 detects whether any ownership requests have been received from the interfaces 6. If not, then the distributor 10 continues waiting for an ownership request. When at least one ownership request is received, then at step 112 the distributor 10 selects one of the interfaces 6 from which an ownership request has been received. For example, the distributor 10 may select the interface 6 from which the first ownership request has been received. At step 114 an ownership confirmation is sent to the selected interface 6. Optionally, at step 116 the distributor 10 may indicate to the selected interface 6 whether it was the only interface to send an ownership request. If there are any other interfaces 6 from which an ownership request was received, but which have not been selected at step 112, then at step 118 an ownership rejection is sent to these interfaces 6.
Meanwhile, at step 120 the target interrupt interface 6 checks whether it has received an ownership confirmation or ownership rejection from the distributor 10. If an ownership rejection is received, then at step 122 the interface 6 acknowledges the rejection and the method then ends for that interface. On the other hand, if an ownership confirmation is received, then at step 124 the target interrupt interface 6 passes the shared interrupt request to the corresponding processor 4. At step 126, the interface 6 checks whether the processor 4 is available for servicing the interrupt (for example, the interface 6 detects whether a read of the interrupt acknowledge register 8 has occurred). If the processor 4 is available for servicing the interrupt, then at step 128 a response to the interrupt acknowledge register read is sent, and at step 130 the interface 6 indicates the distributor 10 that the interrupt is now active and is being processed via the corresponding processor 4.
On the other hand, if the corresponding processor 4 is not available for servicing the interrupt, then the interface 6 may release ownership of the interrupt at step 132. The interface 6 may detect that the corresponding processor 4 is not available for servicing the interrupt if, for example, no read of the interrupt acknowledge register 8 is detected within a given time, or if the processor 4 enters and exits an interrupt service routine without servicing the interrupt. Optionally, if an indication of whether the interface 6 was the only interface 6 to issue an ownership request was provided by the distributor 10 at step 116, then the interface 6 may check at step 134 whether it was the only interface and may only proceed to release ownership at step 132 if the interface 6 was not the only interface which sent an ownership request (if ownership is not released, then the method may return to step 126 to await servicing of the interrupt by the processor 4). At step 140 the distributor 10 may check whether an ownership release indication has been received. If so, the distributor 10 may reissue the interrupt at step 102 or may otherwise allow another processor to service the interrupt. Eventually, at step 142 an indication that the interrupt is active is received from one of the target interrupt interfaces 6, and then the method ends at the distributor 10.
Although illustrative embodiments of the invention have been described in detail herein with reference to the accompanying drawings, it is to be understood that the invention is not limited to those precise embodiments, and that various changes and modifications can be effected therein by one skilled in the art without departing from the scope and spirit of the invention as defined by the appended claims.
This application is a Continuation of U.S. patent application Ser. No. 14/695,325 filed Apr. 24, 2015, which is a continuation of U.S. patent application Ser. No. 13/653,472, filed Oct. 17, 2012, (now U.S. Pat. No. 9,043,522 issued May 26, 2015) the entire contents of which are hereby incorporated by reference in this application.
Number | Date | Country | |
---|---|---|---|
Parent | 14695325 | Apr 2015 | US |
Child | 15464892 | US | |
Parent | 13653472 | Oct 2012 | US |
Child | 14695325 | US |