Apparatus and method for processing write operations

By combining software protocols and hardware consistency circuits in multi-processing device systems, cache consistency is achieved, hardware costs and complexity are reduced, and the problems of high hardware cache consistency mechanism costs and competing write conflicts are solved.

CN111417934BActive Publication Date: 2024-10-25ARM LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201880076927.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2017-12-05
Filing Date
2018-11-28
Publication Date
2024-10-25
Estimated Expiration
2038-11-28

AI Technical Summary

Technical Problem

When the existing technology implements cache coherence in a multi-processing device system, the hardware cache coherence mechanism is costly in terms of hardware area and execution time, and it is difficult to effectively avoid contention write conflicts.

Method used

By executing the software protocol on the processing device to establish the permission to write data, and using the consistency circuit to realize the visibility of the written data to other processing devices at the hardware level, reducing the complexity of the hardware protocol and only performing clearing operations when necessary. to ensure data consistency.

Benefits of technology

It reduces the cost and complexity of hardware implementation of cache coherence protocols, improves system efficiency, ensures a consistent view of data in multi-processing device systems, and avoids competing write conflicts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111417934B_ABST
    Figure CN111417934B_ABST
Patent Text Reader

Abstract

An apparatus and method for processing write operations are provided. The apparatus has a first processing device, the first processing device is used to execute a sequence of instructions, wherein the sequence includes at least one instruction and at least one write instruction, the at least one instruction is used to activate a software protocol to establish ownership permissions for writing data to a first memory area, the at least one write instruction is executed after the ownership permissions are established, so as to perform one or more write operations to output write data for storage in at least one memory location in the first memory area. A write-back cache associated with the first processing device is used to store write data output during one or more write operations. A coherence circuit is coupled to the write-back cache and at least one additional cache, the at least one additional cache being associated with at least one additional processing device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present technology relates to an apparatus and method for processing a write operation. Background Art

[0002] A data processing system typically includes a plurality of processing devices that can perform data processing operations on data, and these various processing devices can be arranged to be able to access shared data in memory. Typically, the processing devices will include one or more levels of local cache in which data manipulated by these processing devices can be cached to allow faster access to the data than would be possible if the data needed to be fetched from memory each time.

[0003] However, the presence of local caches may cause consistency issues, where when the latest version is cached in the local cache of one processing device, another processing device may access outdated data.

[0004] While hardware cache coherence mechanisms have been developed for this situation, these mechanisms can be relatively expensive to implement in terms of hardware area and / or execution time. Summary of the invention

[0005] In a first example configuration, an apparatus is provided, comprising: a first processing device, the first processing device being used to execute a sequence of instructions, the sequence including at least one instruction and at least one write instruction, the at least one instruction being used to activate a software protocol to establish ownership permissions for writing data to a first memory area, the at least one write instruction being executed after the ownership permissions are established so as to perform one or more write operations to output write data for storage in at least one memory location in the first memory area; a write-back cache associated with the first processing device and arranged to store write data output during one or more write operations; and a consistency circuit coupled to the write-back cache and to at least one additional cache, the at least one additional cache being associated with at least one additional processing device; wherein: the first processing device initiates a flush operation in response to a triggering event so as to cause the write data to be written from the write-back cache to a memory; and the consistency circuit interacts with the at least one additional cache in response to the flush operation to implement a hardware protocol so as to cause the write data to be visible to the at least one additional processing device.

[0006] In another example configuration, a method of processing a write operation in an apparatus is provided, the apparatus having a first processing device, a write-back cache associated with the first processing device, and a consistency circuit coupled to the write-back cache and at least one additional cache associated with at least one additional processing device, the method comprising: executing at least one instruction and at least one write instruction on the first processing device, the at least one instruction being used to activate a software protocol to establish ownership permissions for writing data to a first memory area, the at least one write instruction being executed after the ownership permissions are established so as to perform one or more write operations to output the write data to be stored in at least one memory location in the first memory area; storing the write data output during the one or more write operations in the write-back cache; in response to a triggering event, causing the first processing device to initiate a flush operation so as to cause the write data to be written from the write-back cache to a memory; and in response to the flush operation, causing the consistency circuit to interact with at least one additional cache to implement a hardware protocol so as to cause the write data to be visible to at least one additional processing device.

[0007] In yet another example configuration, an apparatus is provided, comprising: a first processing component for executing a sequence of instructions, the sequence comprising at least one instruction and at least one write instruction, the at least one instruction for activating a software protocol to establish ownership permissions for writing data to a first memory area, the at least one write instruction being executed after the ownership permissions are established so as to perform one or more write operations to output write data for storage in at least one memory location in the first memory area; a write-back cache component associated with the first processing component for storing write data output during one or more write operations; and a consistency component for coupling to the write-back cache component and to at least one additional cache, the at least one additional cache being associated with at least one additional processing device; wherein: the first processing component is for initiating a flush operation in response to a triggering event so as to cause the write data to be written from the write-back cache component to a memory; and the consistency component is for interacting with at least one additional cache component in response to the flush operation to implement a hardware protocol so as to cause the write data to be visible to at least one additional processing component. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] The present technology will be further described, by way of illustration only, with reference to examples of the present technology as shown in the accompanying drawings, in which:

[0009] Figure 1 is a block diagram of an example system in which the techniques described herein may be implemented;

[0010] Figure 2 It shows that it can be Figure 1An example of a directory maintained by a consistency circuit;

[0011] Figure 3 It shows that it can be Figure 1 an example of a locked storage component provided in a memory of a system;

[0012] Figure 4A and Figure 4B A flow chart illustrating a process that may be performed in a processing device when performing one or more write operations;

[0013] Figure 5 is a flow chart illustrating steps performed by a coherency circuit in one example arrangement in response to a flush operation initiated by a processing device that has performed one or more write operations;

[0014] Figure 6 is to show how to make Figure 1 The consistency mechanism used by the system depends on the flowchart of the memory area to which the write operation is performed;

[0015] 7A to 7D shows a sequence of example code that may be executed by one of the processing devices in an example arrangement;

[0016] Figure 8 shows a FIFO (first in, first out) storage component that may be provided in one or more processing devices in an example arrangement to keep track of write operations that need to be cleared;

[0017] Fig. 9 schematically illustrates a write-back cache in an example arrangement; and

[0018] Fig.10 An example sequence of instructions that may be executed by a data processing apparatus in one example is shown. DETAILED DESCRIPTION

[0019] In systems that include multiple processing devices with their own local cache structures, cache coherence protocols are typically implemented in order to ensure that each processing device has the same view of data shared between the processing devices. Such cache coherence protocols need to ensure that different processing devices cannot update data associated with a memory location in a conflicting manner, which could arise if two different processing devices were allowed to perform write operations on the same data at the same time (which may be referred to as a "competing write" condition). Therefore, when a write operation is required for data at a particular memory address, then in accordance with known hardware cache coherence schemes, the processing device that wishes to perform the write operation notifies the coherence circuitry so that the coherence circuitry then performs any necessary steps with respect to any cached copies of that data that may be held by other processing devices in order to ensure that the requesting processing device can then perform the write operation without the risk of any of the other processing devices performing a conflicting write to that memory address. The coherence circuitry may also ensure that whenever any processing device subsequently requests access to the memory address, it will obtain the latest version of the data.

[0020] However, in some systems where data is shared between multiple processing devices, the inventors recognize that software solutions may also be in place that can effectively ensure that only one processing device has the ability to write to a particular memory location at any point in time. By way of example only, in a rack-level computing system (where a large database of data may be shared between various processing devices), software techniques may be used to control which processing device is able to write to any particular memory location at any particular point in time. Thus, the inventors recognize that in such a system, some functions typically associated with cache coherence mechanisms would no longer need to be performed by coherence circuitry.

[0021] In particular, the inventors have observed that the functions performed by the hardware consistency mechanism essentially involve steps for establishing the permission of a processing device to write data, and other steps taken after the write operation is performed to make the updated write data visible to other processing devices. In a system where a software mechanism has been provided to effectively control which processing device can write to any particular memory location, the inventors have recognized that cache consistency can be effectively maintained without the need to fully implement the cache consistency protocol in hardware. In particular, the steps required to establish the permission to write data can be performed in software, and then the hardware mechanism is used to ensure that the updated write data is visible to other processing devices. This can result in a significant reduction in the cost (in terms of hardware area and / or execution time) associated with providing cache consistency support within the system.

[0022] In one example arrangement, an apparatus may be provided that includes a first processing device configured to execute a sequence of instructions, wherein the sequence includes at least one instruction and at least one write instruction, the at least one instruction for activating a software protocol to establish ownership permissions for writing data to a first memory region, the at least one write instruction being executed after the ownership permissions are established so as to perform one or more write operations to output write data for storage in at least one memory location in the first memory region. The first processing device has a write-back cache associated with the first processing device, and the write data output during the one or more write operations is stored in the write-back cache. In addition, a coherence circuit coupled to the write-back cache and at least one additional cache associated with at least one additional processing device is provided.

[0023] By using a software protocol, it can be ensured that when a first processing device is given ownership rights on a first memory region, no other processing device will be able to perform conflicting write operations on the first memory region. However, it is still necessary to ensure that the write data generated by the first processing device is visible to other processing devices.

[0024] According to the described example, this is achieved by the first processing device initiating a flush operation in response to a triggering event so that the write data is written from the write-back cache to the memory. The "flushing" of a write data item from the write-back cache to the memory should be understood here to mean that a modified copy of the data item stored in the write-back cache (i.e., the write data referred to here) is used to update the original data item stored in the memory. In addition to performing the flush operation, the consistency circuit is then arranged to interact with at least one other cache in response to the flush operation so as to implement a hardware protocol to make the write data visible to at least one other processing device.

[0025] According to this approach, a software programmer writing instructions to be executed on a processing device needs to know the software protocol required to establish ownership rights, and in particular needs to include appropriate instructions in the sequence of instructions executed by various processing devices so that when a write operation is to be performed for a first memory area, the relevant processing device first seeks to use the software protocol to establish ownership rights. This means that the hardware consistency circuit does not need to consider the problem of competing writes because the software is responsible for avoiding such problems. However, the hardware protocol can then be implemented by the consistency circuit to deal with the problem of making the written data visible to at least one other processing device. Since the consistency circuit can take the required steps directly in response to a notification clear operation, the software executed on the processing device does not have to take any steps to clear and / or invalidate copies of the data held by other processing devices before performing a write operation, nor does it have to take steps to invalidate copies on other processing devices after writing the data.

[0026] As a result, from a software perspective, the approach taken is far less cumbersome than if the entire cache coherence protocol were implemented in software. Furthermore, the implementation cost (in terms of hardware area and / or execution time) is much lower than a system that implements a full cache coherence protocol in hardware, since the required hardware protocol need only be concerned with making written data visible to other processing devices, while the responsibility for establishing write permissions is shifted to software. The hardware protocol implemented by the coherence circuitry can be made completely transparent to the software programmer, since no instructions need be added to the code executed on the processing device in order to implement the functionality, but rather the coherence circuitry implements the required functionality entirely in hardware triggered by a flush operation.

[0027] Therefore, according to the above technology, it should be understood that the apparatus can be arranged to implement a cache coherence protocol for the first memory region through a combination of a software protocol triggered by the first processing device and a hardware protocol implemented by the coherence circuit. This can provide a very effective mechanism for implementing cache coherence, especially in a system that has utilized appropriate software mechanisms to ensure that only one processing device can write to any particular memory location at a time.

[0028] The manner in which the coherence circuitry responds to the flush operation may vary depending on the implementation. In one example, the coherence circuitry is arranged to, in response to the flush operation, cause at least one further cache to invalidate a cache entry whose contents are associated with at least one memory location where data was written. Simply invalidating those cache entries is sufficient, since it is now known that the latest data at the memory location(s) in question was the data generated by the first processing device during the execution of the one or more write operations. Furthermore, the flush operation will cause the latest version of the data to be output to the memory, and so that in due course, when any of the at least one further processing devices requests data for the at least one memory location, there will be a miss in its local cache and the correct data will be retrieved from the memory.

[0029] Although invalidating the entry in the manner described above is the simplest approach, if desired, the cache entry whose contents are associated with at least one memory location for write data may be updated to store the latest write data generated by the first processing device, rather than invalidating the entry. This will avoid having to subsequently re-request the data from memory if the data is needed at some future point in time.

[0030] The consistency circuitry may be arranged to operate in a variety of ways. For example, the consistency circuitry may be arranged to respond to a clear operation only by broadcasting an invalidation or update request to all caches associated with the additional processing devices, regardless of whether those caches may be caching copies of the data affected by the write operation. However, in alternative embodiments, the consistency circuitry may be arranged to perform more targeted operations. Specifically, in one example, at least one additional cache includes a plurality of caches, and the consistency circuitry maintains a record that provides an indication of a memory location for each of the plurality of caches, wherein the data at the memory location is cached by the cache. The consistency circuitry is then arranged to refer to the record when determining which of the plurality of caches to interact with in order to make the write data visible to at least one additional processing device.

[0031] In such an example where the record is maintained by a coherence circuit, the coherence circuit may take the form of a snoop circuit. A snoop circuit is a known type of cache coherence circuit that may maintain an indication of which memory addresses are cached by various caches in a system, and use this information to direct snoop requests to a particular cache in order to implement a cache coherence protocol. However, according to the above techniques, at least for the first memory region, a snoop circuit is not required to implement a full cache coherence protocol because the aspect of establishing permissions to write data is instead moved to a software protocol.

[0032] There are many ways to implement the software protocol in the apparatus. In one example, the apparatus further comprises a lock storage component for maintaining lock indications for a plurality of memory regions, and the software protocol is arranged to, when activated by the first processing device, determine whether the lock indication for the first memory region is cleared. In the event that the lock indication is cleared, the software protocol then causes the lock indication to be set for the first memory region and identifies to the first processing device that the first processing device has ownership rights for the first memory region.

[0033] Thus, the locking indication for each memory region may be viewed as a form of indication held as a separate variable which may be set to indicate when the associated memory region is in the process of being updated.

[0034] Depending on the implementation, each memory region tracked by the lock storage component may include a single memory address or a range of memory addresses. Each memory location is identified by a memory address, and thus there may be one or more memory locations in each memory region tracked by the lock storage component.

[0035] In one example arrangement, after being notified from the consistency circuit that the write data has been made visible to at least one other processing device, the first processing device is arranged to release the ownership rights. Thus, once the first processing device is granted the ownership rights, the first processing device will retain the ownership rights until it can be ensured that the write data generated by the first processing device is guaranteed to be visible to any of the other processing devices. It should be noted that in some cases, this does not mean that the write data has actually been written to the main memory, as long as it has reached a consistency point within the system (e.g., a buffer storage component that temporarily stores the data before it is written to the memory), and it is therefore guaranteed that when any of the other processing devices request the data at the affected memory location, these processing devices will obtain the latest write data from the consistency point (if these data have not yet been written to the main memory).

[0036] The triggering event for initiating the clearing operation by the first processing device can take a variety of forms. For example, the triggering event can occur due to a clearing instruction in a sequence of instructions executed by the first processing device, the execution of which causes the clearing operation to be performed. As another example, if an eviction event is triggered for an entry in a write-back cache containing write data, the triggering event can occur. This may occur, for example, due to capacity issues in the write-back cache, and specifically, it is necessary to select a victim entry to make room for new data to be allocated to the cache. For example, before the first processing device executes a clearing instruction to actively clear the entry, such an eviction event may designate the entry that has been written by one of the write operations as a victim entry.

[0037] The clear instruction can take a variety of forms. For example, in a simple case, there may be a clear instruction associated with each write instruction, so that once the write data is written to the required memory location, a subsequent clear instruction identifies the memory location.

[0038] However, in alternative arrangements, a single clear instruction may be arranged to trigger the clearing of multiple entries of the write-back cache, and in these cases, the apparatus may further include a storage unit for storing information that enables multiple entries to be identified. For example, the technology described in commonly owned co-pending U.S. patent application Ser. No. 15 / 501,278 may be utilized, wherein the clear instruction may take the form of an end instruction defined in that patent application, which causes multiple identified entries in the write-back cache that have been subjected to a write operation to be subsequently cleared to main memory. In the example discussed in the above co-pending case, the memory forms a non-volatile memory that forms a persistent point in the system, and execution of the end instruction causes write data from the identified entries to be propagated to the persistent point. However, in the present technique, the end instruction may be used regardless of the form of the memory, and when combined with the above-described mechanism, a very efficient technique for maintaining cache coherence in association with write data resulting from a sequence of write operations may be provided, wherein a software protocol ensures that no other processing devices may perform conflicting write operations in a memory region, and hardware coherence circuitry then makes all write data visible to at least one other processing device in response to a flush operation.

[0039] In one example arrangement, the storage unit may be arranged to store indications of write operations performed by the first processing device, the clear instruction may be an end instruction in a sequence of instructions, and the first processing device may respond to executing the end instruction by causing write data that is the subject of each of the following write operations to be cleared from the write-back cache to the memory: an indication of the write operation is stored in the storage unit; and the indication of the write operation stored in the storage unit is cleared.

[0040] By using the above-described end instruction technique, where a programmer of a data processing apparatus wishes to ensure that a particular order of write operations to memory (initiated by the execution of a write instruction) will occur, this can be accomplished by adding an end instruction to the sequence of instructions given by the programmer to define the data processing operations that the apparatus should perform.

[0041] In some example arrangements, the first processing device is further arranged such that an indication of a write operation performed by the first processing device is stored in the storage unit and is located after the start instruction in the sequence of instructions. Thus, further instructions may be added to the set of instructions to which the processing device responds, which enables a system programmer to encapsulate a "write set" of write operations (preceded by the start instruction and terminated by the end instruction). In this way, the order of writes (of the write set relative to other write operations) desired by the programmer can be ensured to be followed in the contents of the main memory by operation of the write-back cache rather than by operation of the first processing device (which may change the order in which particular instructions are executed for scheduling reasons).

[0042] In one example arrangement, the first processing device may be arranged to perform a write operation to the first memory region only if ownership permissions for writing data to the first memory region have been established and a pending write instruction specifying a memory location in the first memory region is preceded by a begin instruction and followed by an end instruction.

[0043] While the above techniques may be employed for all memory regions in the memory, in other examples the above techniques may be restricted to particular memory regions and for other memory regions a full hardware cache coherence scheme may be implemented if desired. Thus, in one such arrangement, for at least one further memory region, a cache coherence protocol is implemented solely by the coherence circuitry and the first processing device is arranged to obtain exclusive write access to the at least one further memory region by steps performed by the coherence circuitry for the at least one further cache. Thus, for the at least one further memory region, a software protocol is not used, but rather steps taken directly by the coherence circuitry for various other caches within the system are used to ensure that the first processing device obtains exclusive write access to the memory region before performing a write operation.

[0044] Specific examples will now be described with reference to the accompanying drawings.

[0045] Figure 1is a block diagram of a system in which the above-described techniques may be implemented. A plurality of processing devices 10, 20, 30 are arranged to have access to a memory 70. Each processing device may be provided with one or more levels of local cache 15, 25, 35 in which local copies of data being processed by the processing device are temporarily stored. Each data value has an associated memory address identifying a memory location in the memory 70, and according to standard practice, a copy of the data value is typically stored in the cache together with an indication of the memory address. If the data in the local cache is updated (e.g., as a result of one or more write operations performed by the processing device for the data), the updated data may be written back to the memory 70. The cache may be arranged in various ways. For example, if the cache is arranged as a write-through cache, any updates made to the data stored in the cache line are also propagated to the memory 70 via the interconnect 40 so that the update is replicated in the memory without delay. However, at least one level of local cache is typically arranged as a write-back cache, in which the updated version of the data stored in the cache is not immediately propagated to the memory. Instead, a dirty flag may be associated with cache lines containing data that is more up-to-date than the memory, so that when those cache line contents are subsequently evicted from the cache, the necessary updates to the memory may be made. The techniques described herein may be applied with respect to any processing device having at least one level of local cache arranged as a write-back cache. Figure 1 , cache 15 is identified as a write-back cache, but in one example arrangement, each of the local caches 15, 25, 35 may be a write-back cache.

[0046] Since the individual processing devices are able to cache copies of the data locally in their respective local caches 15, 25, 35, it is necessary to implement a cache coherence protocol in order to ensure that conflicting write operations do not occur to the same memory location in different processing devices, and to ensure that each processing device has the same view of the shared data. In particular, although some of the data stored in the memory may be specific to a particular processing device, it is often the case that the processing devices will share some of the data stored in the memory. As an example, the memory may include a shared database 75, and each of the processing devices may be assigned processing tasks related to the information stored in the shared database 75. It is important to ensure that particular data in the shared database is not subject to conflicting updates by multiple processing devices, and that each of the processing devices is provided with a consistent view of the data stored in the shared database 75.

[0047] In one example arrangement, a consistency circuit 50 may be provided in the interconnect 40 to implement at least a portion of a cache consistency protocol. When implementing a cache consistency protocol, essentially two tasks need to be undertaken. In particular, when a processing device wishes to perform a write operation with respect to a particular memory location, it must be ensured that the processing device wishing to perform the write operation has established permission to perform the write operation for that memory location. This can be used to avoid the possibility of conflicting writes to the same memory location. In addition, once the data for a particular memory location has been updated by such a write operation, it is important to ensure that whenever any other processing device requests access to that memory location, it can see the updated data. Therefore, as part of the cache consistency protocol, it must be ensured that the results of any write operation are made visible to all other processing devices.

[0048] Although consistency circuits can be arranged in the interconnect to fully implement the cache consistency protocol in hardware to take into account the above-mentioned required functions, according to the technology described herein, for at least some memory areas, the implementation of the cache consistency protocol is separated between software and hardware. In particular, the consistency circuit 50 can be used to ensure that updated data generated by one processing device as a result of a write operation is visible to other processing devices. However, the authority to write data to the memory location is transferred to the software protocol so that the consistency circuit 50 does not need to consider this aspect. As will be discussed in more detail later, the software protocol can use a lock-based mechanism that uses a lock component 80 maintained in the memory 70 to ensure that before any processing device performs a write operation on a memory address in a memory area where cache consistency is controlled by a separate software / hardware mechanism, the processing device obtains ownership rights for the relevant memory area. In this way, the software has the task of avoiding competitive write conditions for such memory areas, and the consistency circuit then implements the hardware protocol to make any updated write data visible to other processing devices.

[0049] According to the techniques described herein, once a write operation (or in some cases, a series of write operations) is performed to produce updated write data in one or more memory locations of a specified memory region, a purge operation is triggered to cause the updated write data in the local write-back cache 15 to propagate to the appropriate memory locations in the memory 70. In one example, the memory is a non-volatile memory and therefore represents a persistent point in the system. In particular, once the data has been committed to the memory 70, the data will be retained even if power is removed from the system. The purge operation can therefore cause the data to propagate to a persistent point in the system. However, in another example, the memory need not be a non-volatile memory.

[0050] According to the described techniques, a coherency circuit responds to the initiation of a flush operation and subsequently takes a number of coherency actions in order to make the written data visible to other processing devices.

[0051] For example, consider the following situation: the processing device 10 executes instructions to activate a software protocol to establish ownership rights for the processing device to write data to a first memory region, and then performs one or more write operations on at least one memory location in the first memory region, so that the updated write data is stored in the local write-back cache 15. The processing device 10 can then execute a flush instruction to initiate a flush operation so that all affected write data is propagated to the memory 70 to be stored at (one or more) appropriate memory locations. The consistency circuit can then respond to the flush operation by taking steps associated with the local caches 25, 35 of other processing devices 20, 30 to ensure that if these processing devices need to access the updated data, they will see the updated data. In one case, the consistency circuit can be arranged to propagate only invalidation requests to each of the local caches 25, 35, thereby specifying (one or more) affected memory locations. Each local cache will then perform a lookup for each specified memory location to determine whether there is an entry for the memory location in the cache. If so, the current contents are invalidated in the local cache. This will ensure that if the processing device subsequently requests the data at that memory address, a miss will be detected in the local cache, causing the data to be subsequently obtained from memory, with the result that the processing device 20, 30 will receive the correct data.

[0052] While in a simple arrangement the coherence circuitry may simply broadcast an invalidation request to all other local caches, in an alternative embodiment the coherence circuitry may take the form of a snooping circuit comprising a snooping controller 55 and an associated directory 60. The directory is maintained by the snooping controller to provide an indication of the memory locations for which data is cached by each of the local caches 15, 25, 35. Thus, in relation to one or more memory locations affected by the flush operation, the snooping controller 55 may perform a lookup within the directory to identify which of the local caches may have a cached local copy of the affected data, and may therefore direct the invalidation request to the relevant caches, rather than simply broadcasting the invalidation request to each cache.

[0053] In this way, it can be seen that the consistency circuitry can respond to the flush operation to ensure that at the time the updated write data is written to the memory, it can be ensured that all processing devices will have a consistent view of the data.

[0054] In the period before the clear operation is performed, and when the processing device 10 is executing one or more write instructions to generate updated write data for one or more memory locations, the software protocol can control (regulate) access to these one or more memory locations by other processing devices. In some cases, the intended software use of the data may be such that the software protocol allows another processing device to read the old value of the data from the memory; while in other cases, such a read operation may be prohibited at that time.

[0055] Figure 2 It is schematically shown Figure 1 FIG. 6 is a diagram of an example arrangement of a directory 60 of FIG. In this example, the directory has a plurality of entries 100, 105, each entry identifying a memory address or a range of memory addresses, and then identifying which caches may contain a copy of the data at that memory address or range of memory addresses. This can be used by the snoop controller to determine which local caches need to be invalidated in response to the previously mentioned clear operation. Figure 2 In the example of , a check mark is used to indicate that the associated cache may store a cached copy, and a cross is used to indicate that the associated cache does not store a copy. It should be understood that the check mark and the cross can be encoded with any suitable value, for example, a logical one value can indicate a check mark, and a logical zero value can indicate a cross.

[0056] It should be understood that Figure 2 Only one example arrangement of directory 60 is shown, and any other suitable arrangement may be used to provide information to the snoop controller regarding which caches require invalidation operations in response to received flush operations.

[0057] Figure 3 An example arrangement of a lock storage component 80 that can be used is shown. The lock storage component can include multiple entries 110, 115, 120, each entry being associated with a specific memory region. A lock indication can be maintained for each memory region to identify whether at least one memory address in the region is in the process of having its data value updated. If the lock indication is set, it indicates that the data of at least one memory address in the region is being updated, and if the lock indication is cleared, it indicates that no address in the region contains data that is in the process of being updated.

[0058] When the processing device wishes to perform a write operation for a memory address in one of the regions managed by the lock storage component, the processing device will execute instructions to seek to set the associated lock indication. If the associated lock indication is currently cleared, it will be set, and a confirmation will be returned to the processing device, which actually identifies to the processing device that ownership rights have now been established for the associated memory region, and therefore can be freely performed for the memory region. Write operations. However, if the lock indication is already set, the processing device will be prevented from continuing beyond the instructions seeking to set the lock, specifically, the processing device will not be allowed to execute any write instructions seeking to write to the memory address in the relevant region at this stage. In one example, execution will be paused (stall) until the lock indication for the relevant region returns to a cleared state, at which time the lock indication can be set again, and a confirmation is issued to the processing device to identify that it now has ownership rights for the memory region, after which (one or more) write instructions can be executed. In this way, ownership rights for multiple memory regions can therefore be maintained using a software protocol to ensure that at any particular point in time, only one processing device is given the following authority: perform write operations for memory locations in each such region. This simplifies the operation required of the coherency circuit 50 as it need not take any steps to ensure exclusive ownership of a particular processing device, but only needs to respond to subsequent clear operations to ensure that the processing device has a consistent view of the data after it has been updated.

[0059] Figure 4A and Figure 4B A flow chart is provided that illustrates steps performed in a processing device when the processing device wishes to update data in a particular memory region for which cache coherence is achieved using a combined software / hardware mechanism in one example arrangement.

[0060] In step 200, a get lock instruction is executed by the processing circuit for the desired memory area. This causes the lock component 80 in the memory to be accessed, and in particular the lock indication state for the relevant area to be accessed. If the lock indication is set, the process is suspended in step 205 until it is determined that the lock indication is currently cleared, and then the lock indication can be set at this moment to indicate that the processing device executing the get lock instruction has obtained the lock. Once the lock is obtained, this actually means that the requesting processing device has established ownership rights for writing data to the location in the desired memory area, as shown in step 210. At this stage, the software protocol prevents other processing devices from being able to write to the memory area in question, because if any of those other processing devices were to execute the get lock instruction, it would be determined that the lock indication is set, and therefore they would not be able to obtain a lock for the memory area. Therefore, steps 200, 205, and 210 can be regarded as implementing a software protocol to establish rights to write data.

[0061] After step 210, the processing device may then perform one or more write operations to generate write data for the memory location in the locked memory region and then store the generated write data in the local write-back cache of the processing device at step 215. This process may continue until a trigger for a flush operation is detected at step 220.

[0062] In an example arrangement, the triggering of the clearing operation can occur for various reasons. For example, in a simple case, a separate clearing instruction can be associated with each write instruction, so that the process performed is for the processing device to obtain a lock, so as to then perform a single write operation to the desired memory location, and then for the clearing instruction to be executed to trigger the clearing operation for the write data. However, in another example arrangement, a series of write operations for the memory address in the locked memory area can be grouped together, wherein a single clearing operation is triggered after these write operations have been performed. For example, a suitable mechanism for implementing this function is a mechanism described in the co-owned co-pending application number 15 / 501,278 of the U.S. patent application, the entire content of which is incorporated herein by reference. In particular, the end instruction defined therein can be used as a clearing instruction to trigger the clearing operation, and if necessary, the associated start instruction can be used to identify the beginning of the sequence of write instructions, and when the end instruction is encountered, the write data of the sequence of the write instruction will need to be cleared. A separate storage structure can be maintained to track the memory locations that need to be cleared in response to the end instruction.

[0063] As yet another example of a trigger that may occur at step 220, this may be an eviction event targeting a cache entry containing updated write data resulting from the write operation performed at step 215. An eviction event may occur, for example, due to a capacity issue in a local cache, where a victim entry needs to be selected to make room for new data to be allocated into the cache. When the victim entry is an entry containing write data generated at step 215, then this may trigger a flush operation at step 220. If the previous example arrangement is employed, where a series of write operations are associated with a start instruction and an end instruction, then an eviction for one of the affected cache entries may be used to cause a flush operation to be triggered for at least that entry, or, if desired, may result in flushing all entries for which write data has been generated between the start instruction and the end instruction when the eviction trigger occurs.

[0064] When a triggering event occurs at step 220, the process proceeds to step 225 where a clear operation is performed on the write data generated for the locked memory region so that the memory content is updated to reflect the updated data generated by the write operation(s).

[0065] As previously described, the coherence circuit 50 will respond to the presence of such a purge operation to perform an invalidation operation for any relevant entries in the local caches of other processing devices in order to ensure that the write data to be written to the memory is visible to all processing devices. At step 230, the processing device that has obtained a lock for the required memory region waits for confirmation from the coherence circuit that the write data is visible to other processing devices. In the event that multiple cache entries may be purged during the purge process, confirmation will be waited for at step 230 that all relevant write data has been made visible to other processing devices, i.e., all required invalidation operations have been performed.

[0066] Once such an acknowledgement is received at step 230, the clear operation is complete and a determination is made at step 235 whether there are any other write operations or clear operations to be performed. This may be determined to be the case, for example, if there are one or more additional write instructions or clear instructions in the sequence of instructions preceding the instruction whose execution would cause the lock to be released. If there is at least one other write operation or clear operation to be performed, the process proceeds to step 220 where it is determined whether there is a trigger for another clear operation, and if not, the process returns to step 215 to perform one or more additional write operations.

[0067] Once it is determined at step 235 that there are no more write operations or clear operations to be performed, the processing circuitry may then be arranged to execute a release lock instruction to release the lock for the memory region at step 240. This is achieved by performing an access to the appropriate entry in the lock storage component 80 to reset the lock indication for the region to a clear state.

[0068] Figure 5 is a flow chart illustrating the operation of the consistency circuit 50 in one example. At step 300, the consistency circuit 50 waits for a signal from executing a previous reference Figure 4A and Figure 4B The process proceeds to step 310 in which the directory 60 is referenced to identify which other caches, if any, may store data for the memory address associated with the clear operation. Then, at step 315, the snoop controller 55 is arranged to send an invalidation request to each cache indicated by the directory information. The invalidation request will identify the memory address in question and will cause the local cache receiving the invalidation request to perform a lookup operation to identify whether there is actually an entry that caches a copy of the data at that memory address, and if so, that entry will be invalidated. This will ensure that if the associated processing device requests the data at that memory address, the associated processing device will no longer receive a hit in the local cache, but will retrieve the correct data from the memory 70.

[0069] Although in the described example, the snoop controller 55 sends an invalidation request to the relevant local cache at step 315, in an alternative approach, an update request may be sent along with the new write data to cause the local cache contents to be updated to correctly reflect the required data.

[0070] At step 320, the snoop controller 55 waits for confirmation that all required invalidations have occurred. Once this confirmation is received, the snoop controller may notify the processing device that initiated the flush operation to identify that the data is now visible to other processing devices at step 325. It should be noted that if at step 310, the directory indicates that no other cache can store the data for the required memory address, the process may proceed directly from step 310 to step 325.

[0071] In the case where the flush operation is applied to multiple memory addresses, such as when the previously mentioned begin and end instructions are used, then invalidate requests may be sent to the required cache for each updated cache line content, and at step 320 the snooping controller will wait for confirmation that all required invalidations have occurred for all updated data values ​​before proceeding to step 325.

[0072] It will be appreciated that steps 310 to 325 are initiated entirely by the coherence circuit 50 and do not require any visibility to the software programmer and in particular do not require any explicit instructions to be executed by any processing device. Thus, it can be seen that steps 310 to 325 implement a hardware protocol to make write data visible to all processing devices.

[0073] Although the data output at step 305 may take many clock cycles to actually be written to memory, the write data will typically reach a coherent point (e.g., one or more write buffers associated with the interface to memory) shortly after it has propagated from the cache to the interconnect 40. Figure 5 , it is assumed that a consistent point is reached when at least the check at step 310 has been performed, and therefore when step 325 is reached, it should be understood that the write data will be available from a consistent point even if it has not yet been written back to main memory.

[0074] While the above described mechanism (which uses a combination of software and hardware protocols to implement the required cache coherence protocol) may be implemented for all memory regions of memory 70 that may be shared between processing devices, in alternative examples this approach may be used for some regions, but full hardware cache coherence may be implemented for other regions if desired. This is accomplished by Figure 6 The flowchart of is schematically shown. Specifically, at step 350, it is determined whether the area in question requires full hardware consistency. If so, the process proceeds to step 355, in which the consistency circuit is used to fully implement the cache consistency protocol in hardware. Specifically, the following existing monitoring mechanism can be used: it not only implements the above steps in response to the clear operation to ensure that the updated data is visible to all processing devices, but also before any processing device performs a write operation, performs a consistency action on the local cache to ensure that the processing device that wishes to perform a write operation has a cache copy marked as exclusive to the processing device. Therefore, this method enables the establishment of the right to write data to be embedded in the hardware protocol executed by the consistency circuit 50. Any known hardware cache consistency scheme can be used at step 355.

[0075] However, if the region does not require full hardware coherency, the process proceeds to step 360 where write permissions to the region are managed using the software protocol techniques previously described and with reference to the locking component 80 in the memory 70. Then, at step 365, the steps required to make updated write data visible to all processing devices are managed using the hardware protocol previously discussed and implemented by the coherency circuit 50.

[0076] 7A to 7D An example instruction sequence that may be executed by a processing device having a local write-back cache is shown when a software protocol and a hardware protocol are used in combination to achieve cache coherence. Fig. 7A As shown, a single write instruction and associated clear instruction may be executed between the acquire lock instruction and the release lock instruction. In an alternative arrangement, as Figure 7B As shown, a group of write instructions can be identified using the previously mentioned start instruction and end instruction, wherein the end instruction is used to start a clearing operation for all write data generated by the series of write instructions. Figure 7C and Fig.7D Shown as Fig. 7A A further alternative arrangement is a variation of the arrangement shown, and in particular wherein a plurality of write instructions and associated clear instructions are executed between an acquire lock instruction and a release lock instruction. Fig.7D It should be noted that the clear instruction associated with a particular write instruction does not necessarily need to immediately follow the write instruction in sequence.

[0077] As previously described, in an example arrangement using the previously described start and end instructions, a storage unit may be provided in association with a processing device (which executes a sequence of instructions including such start and end instructions) so as to maintain an indication of write operations performed by the processing device between the start and end instructions. Figure 8 One example arrangement of such a storage unit is shown, where the storage unit takes the form of a FIFO storage circuit 450 .

[0078] When encountering a write instruction sandwiched between a begin instruction and an end instruction, the processing device indicates to the FIFO control 448 and the associated write-back cache that an indication of a write operation performed in response to the write instruction should be added to the entry of the FIFO storage component 446 . Figure 8An example configuration is shown in which four entries of the FIFO storage component 446 are currently filled with indications of write operations A to D. As shown in the figure, these indications may include the target memory address of the write operation (or indeed only a portion of the memory address, if this is sufficient to identify the corresponding entry in the write-back cache) or may alternatively be a cache block indicator to show where the corresponding entry will be found in the write-back cache. The FIFO control unit 448 maintains overall control of the FIFO storage component 446, thereby managing the addition of entries and the removal of entries (either individual contents of the FIFO or the entire contents of the FIFO) as required. In the event that the FIFO storage circuit 450 is required to respond to queries from the write-back cache regarding whether a particular data item in the write-back cache has a corresponding entry in the FIFO storage component 446, the FIFO storage circuit 450 may be configured in a content-addressable manner to provide this functionality. An example of when such a separate query may be received is after a data item is evicted from the write-back cache, in response to which the FIFO control 448 may be configured to cause the corresponding entry in the FIFO storage component 446 to be removed. Alternatively, as part of its participation in a cache coherence mechanism, a content query may be received from the write-back cache in response to a snoop query received by the write-back cache, but as will be referred to below Fig. 9 As described, the write-back cache itself may be configured to store an indication of whether a corresponding entry is currently stored in the FIFO storage component 446, so as to avoid the FIFO storage component 446 having to be provided with this content addressable memory configuration and thus facilitate providing the FIFO storage component 446 as a relatively small addition to the processing device. Finally, as Figure 8 As shown, the FIFO control 448 is also configured to monitor whether the FIFO storage component 446 becomes completely filled (and therefore will not be able to produce more entries). In the event that the FIFO storage component 446 is completely filled, the FIFO control 448 signals this fact to the write-back cache, so that the corresponding entry in the write-back cache is then quickly written back to the memory 70, and the contents of the FIFO 446 are cleared.

[0079] Fig. 9A write-back cache 432 is schematically shown having a controller 460 and a plurality of cache lines 462. The cache controller 460 monitors data items and control signals received from an associated processing device, the control signals being received from both the pipeline and FIFO control 448 of the processing device. The cache lines 462 are configured to store data items used by the processing device in its data processing operations, and each cache line stores both the data items themselves and an associated state marker (in the usual manner of dirty / valid, etc.). However, note that an additional bit of each cache line is defined here as a dedicated marker 464 that can be viewed as a clean-on-snoop marker, where if a snoop is received from another cache / CPU that hits one of the cache lines 462, the presence of the marker 464 causes the cache line to be cleared to memory. The eviction of a cache line is just one such example, for which the marker 464 can therefore be viewed as a clean-on-evict marker. In the configuration shown, the cache controller 460 is configured to monitor snoops received from other caches in the system, and when a snoop is received from another cache related to a data item stored in a cache line 462 of the tag 464 cache 432 (for which the tag is set), the cache controller 460 is configured to immediately cause the cache line to be evicted. This event is also signaled to the FIFO control 448 so that any corresponding contents in the FIFO storage component 446 can be cleared.

[0080] Fig.10A sequence of instructions of an example that can be executed by a processor device in one example is shown. In this case, it is assumed that a start instruction and an end instruction are used to identify a series of writes to be performed on a non-volatile memory (forming a persistent point within the system). Specifically, the non-volatile memory can be a non-volatile byte addressable (NVBA) memory. The first part of the sequence (labeled A) has a plurality of instructions related to reading and writing and data processing instructions, wherein these instructions access data items not stored in the non-volatile byte addressable memory. Thereafter follows the nvba_begin instruction (an example of the start instruction mentioned previously), which defines the beginning of the first area (write set), wherein the read instructions, data processing instructions, and write instructions are (at least partially) related to data items stored in the non-volatile byte addressable memory. The first area (write set) (labeled B) ends with the nvba_end instruction (an example of the end instruction mentioned previously). Thereafter, a second set of instructions (A) follows, which is independent of the data items stored in the non-volatile byte addressable memory. Finally, a second region (write set) of read instructions, data processing instructions, and write instructions associated with data items stored in the non-volatile write-addressable memory is defined (at least in part) by a second nvba_begin instruction and a second nvba_end instruction (B). The provision of nvba_begin and nvba_end instructions enables the programmer to define write sets, and the present technique enables the order of these write sets to be maintained (relative to each other) even when the accessed data items are stored in the non-volatile memory (accesses to which are cached by the write-back cache).

[0081] According to the techniques described herein, each block identified by the begin and end instructions is preceded by an acquire lock instruction and followed by a release lock instruction, so that the previously mentioned software protocol mechanism can be used to ensure that the processing device obtains permission to write before performing any write operations. As a result, once the clear operation triggered by the end instruction occurs, the hardware protocol incremented by the consistency circuit only needs to ensure that the written data is visible to various other processing devices.

[0082] In this application, the phrase "configured to..." is used to indicate that an element of a device has a configuration that can perform a defined operation. In this context, "configuration" means the arrangement or manner of interconnection of hardware or software. For example, the device may have dedicated hardware that provides the defined operation, or a processor or other processing device that can be programmed to perform the function. "Configured to" does not mean that the device elements need to be changed in any way in order to provide the defined operation.

[0083] Although illustrative embodiments of the present invention have been described in detail herein with reference to the accompanying drawings, it should be understood that the present invention is not limited to these precise embodiments and that various changes, additions and modifications may be implemented therein by those skilled in the art without departing from the scope and spirit of the present invention as defined by the appended claims. For example, various combinations of the features of the dependent claims and the features of the independent claims may be made without departing from the scope of the present invention.

Claims

1. A device for processing a write operation, include: a first processing device for executing a sequence of instructions, the sequence comprising at least one instruction for activating a software protocol to establish ownership permissions for writing data to a first memory region, and at least one write instruction, the at least one instruction for activating a software protocol to establish ownership permissions for writing data to a first memory region, the at least one write instruction being executed after establishing the ownership permissions to perform one or more write operations to output write data for storage in at least one memory location in the first memory region; a write-back cache associated with the first processing device and arranged to store the write data output during the one or more write operations; as well as a coherence circuit coupled to the write-back cache and to at least one additional cache associated with at least one additional processing device; in: The first processing device initiates a flush operation in response to a triggering event so as to cause the write data to be written from the write-back cache to a memory; and The coherency circuit interacts with the at least one further cache in response to the flush operation to implement a hardware protocol to make the write data visible to the at least one further processing device.

2. The device according to claim 1, in, The apparatus implements a cache coherence protocol for the first memory region through a combination of the software protocol triggered by the first processing device and the hardware protocol implemented by the coherence circuit.

3. The device according to claim 1 or 2, in, The coherency circuitry is arranged to, in response to the flush operation, cause the at least one further cache to invalidate any cache entry whose contents are associated with the at least one memory location of the write data.

4. The device according to claim 1 or 2, in: The at least one additional cache comprises a plurality of caches; The coherence circuit maintains a record that provides, for each cache of the plurality of caches, an indication of a memory location at which data is cached by the cache; and The coherency circuit is arranged to refer to the record when determining which caches of the plurality of caches to interact with in order to make the write data visible to the at least one further processing device.

5. The device according to claim 4, in, The consistency circuit is a snooping circuit.

6. The device according to claim 1 or 2, further comprising: include: a lock storage component for maintaining lock indications for a plurality of memory regions; as well as The software protocol is arranged to, when activated by the first processing device, determine whether a lock indication for the first memory region is cleared, and if the lock indication is cleared, set the lock indication for the first memory region and identify to the first processing device that the first processing device has ownership rights to the first memory region.

7. The device according to claim 1 or 2, in, After being informed from the coherence circuit that the write data has been made visible to the at least one further processing device, the first processing device is arranged to release the ownership rights.

8. The device according to claim 1 or 2, in, The triggering event includes one of the following: executing, by the first processing device, a purge instruction in the sequence that initiates the purge operation; and An eviction event is triggered for an entry in the write-back cache that contains the write data.

9. The device according to claim 8, in, The flush instruction identifies a specific entry of the write-back cache, wherein data of the specific entry is to be flushed.

10. The device according to claim 8, in, The flush instruction triggers flushing of multiple entries of the write-back cache, and the apparatus further comprises a storage unit configured to store information enabling the multiple entries to be identified.

11. The device according to claim 10, in: The storage unit is arranged to store an indication of the write operation performed by the first processing device; The clear instruction is an end instruction in the sequence of instructions, and the first processing device responds to the execution of the end instruction by: causing write data that is the subject of each write operation for which an indication is stored in the storage unit to be cleared from the write-back cache to the memory; as well as An indication of the write operation stored in the memory cell is cleared.

12. The device according to claim 11, in, The memory is a nonvolatile memory forming a persistent point, and executing the end instruction causes the write data to be propagated to the persistent point.

13. The device according to claim 11 or claim 12, in, The first processing device is further arranged such that an indication of the write operation performed by the first processing device is stored in the storage unit following a start instruction in the sequence of instructions.

14. The device according to claim 13, in, The first processing device is arranged to perform a write operation to the first memory area only if the ownership rights for writing data to the first memory area have been established and a pending write instruction specifying a memory location in the first memory area is located after the start instruction and before the end instruction.

15. The device according to claim 2, in, For at least one further memory region, the cache coherence protocol is implemented only by the coherence circuitry, and the first processing device is arranged to obtain exclusive write access to the at least one further memory region by steps performed by the coherence circuitry for the at least one further cache.

16. A method of processing a write operation in an apparatus having a first processing device, a write-back cache associated with the first processing device, and a coherence circuit coupled to the write-back cache and at least one further cache associated with at least one further processing device, the method include: executing, on the first processing device, at least one instruction for activating a software protocol to establish ownership permissions for writing data to a first memory region and at least one write instruction, the at least one write instruction being executed after establishing the ownership permissions to perform one or more write operations to output write data for storage in at least one memory location in the first memory region; storing in the write-back cache the write data output during the one or more write operations; In response to a triggering event, causing the first processing device to initiate a clearing operation so as to cause the write data to be written from the write-back cache to a memory; as well as In response to the flush operation, the coherency circuit is caused to interact with the at least one other cache to implement a hardware protocol to make the write data visible to the at least one other processing device.

17. A device for processing a write operation, include: a first processing component for executing a sequence of instructions, the sequence comprising at least one instruction for activating a software protocol to establish ownership permissions for writing data to a first memory region, and at least one write instruction, the at least one instruction for activating a software protocol to establish ownership permissions for writing data to a first memory region, the at least one write instruction being executed after establishing the ownership permissions to perform one or more write operations to output write data for storage in at least one memory location in the first memory region; a write-back cache component, the write-back cache component being associated with the first processing component and configured to store the write data output during the one or more write operations; as well as a coherence component to be coupled to the write-back cache component and to at least one additional cache associated with at least one additional processing device; in: The first processing component is used to initiate a flush operation in response to a triggering event so that the write data is written from the write-back cache component to a memory; and The coherency component is to interact with the at least one further cache component to implement a hardware protocol in response to the flush operation so as to make the write data visible to the at least one further processing component.