JP2008176731A - Multiprocessor system - Google Patents
Multiprocessor system Download PDFInfo
- Publication number
- JP2008176731A JP2008176731A JP2007011816A JP2007011816A JP2008176731A JP 2008176731 A JP2008176731 A JP 2008176731A JP 2007011816 A JP2007011816 A JP 2007011816A JP 2007011816 A JP2007011816 A JP 2007011816A JP 2008176731 A JP2008176731 A JP 2008176731A
- Authority
- JP
- Japan
- Prior art keywords
- cache memory
- data
- processor
- cache
- bit
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
Abstract
Description
本発明は、簡単な構成でキャッシュコヒーレンシが維持されないことを検出可能にしたマルチプロセッサシステムに関する。 The present invention relates to a multiprocessor system capable of detecting that cache coherency is not maintained with a simple configuration.
従来、複数のプロセッサによってプログラムを実行するマルチプロセッサシステムが採用されることがある。一般的に、マルチプロセッサシステムでは、レベル2(L2)キャッシュメモリは各プロセッサによって共有され、レベル1(L1)キャッシュメモリは、各プロセッサ内部に夫々設けられる。この場合には、L1キャッシュメモリ同士のデータの一貫性(キャッシュコヒーレンシ)を維持する必要がある。 Conventionally, a multiprocessor system in which a program is executed by a plurality of processors may be employed. Generally, in a multiprocessor system, a level 2 (L2) cache memory is shared by each processor, and a level 1 (L1) cache memory is provided in each processor. In this case, it is necessary to maintain data consistency (cache coherency) between the L1 cache memories.
例えば、マルチプロセッサシステム内の、あるプロセッサがデータをメモリに書き込むものとする。この場合において、このデータがプロセッサ内部のL1キャッシュメモリに存在(キャッシュヒット)する場合には、このL1キャッシュの該当するラインの内容(旧データ)がこのデータ(新データ)によって更新されることになる。一方、他のプロセッサのL1キャッシュメモリに同一のデータ(旧データ)が存在する場合には、そのL1キャッシュメモリの対応するラインを無効化するか、または新データで更新する必要がある。 For example, assume that a processor in a multiprocessor system writes data to memory. In this case, when this data exists in the L1 cache memory inside the processor (cache hit), the contents (old data) of the corresponding line in this L1 cache are updated with this data (new data). Become. On the other hand, when the same data (old data) exists in the L1 cache memory of another processor, it is necessary to invalidate the corresponding line of the L1 cache memory or update it with new data.
このようなキャッシュメモリのコヒーレンシを保証するためのハードウエアとして、スヌープキャッシュがある。スヌープキャッシュは、バス上の各プロセッサのアクセスを監視(スヌープ)することによって、コヒーレンシを保つものであり、さまざまな方式が提案されている。(例えば、特許文献1)
スヌープキャッシュを実装した場合には、通常のプロセッサコアからのロード命令やストア命令によるアクセスに加えて、バス上のアクセスから該当するアドレスのデータがキャッシュにないかを確認するためにキャッシュメモリをアクセスする必要がある。このため、キャッシュメモリのタグ部のアクセスを調停したり、場合によっては2つのアクセスが同時にできるように2ポート化する必要があり、ハードウエア規模が増大する。
As a hardware for guaranteeing such coherency of the cache memory, there is a snoop cache. The snoop cache maintains coherency by monitoring (snooping) access of each processor on the bus, and various methods have been proposed. (For example, Patent Document 1)
When a snoop cache is implemented, in addition to access by a load instruction or store instruction from a normal processor core, the cache memory is accessed to check whether the data at the corresponding address is in the cache from the access on the bus. There is a need to. For this reason, it is necessary to mediate access to the tag portion of the cache memory, or in some cases, to have two ports so that two accesses can be performed simultaneously, increasing the hardware scale.
ところで、複数のプロセッサが各L1キャッシュの同一ラインを共有する場合でも、実際にはそのライン内の異なるデータにアクセスすること(以下、フォルス・シェアリングという)がある。キャッシュコヒーレンシを維持しようとすると、このようなフォルス・シェアリングの状況下においても、実際には必要のないキャッシュの無効化や更新が発生してしまい、性能が低下してしまう。そこで、性能の向上のため、あるいは、無駄な動作を排除して消費電力を低減するために、フォルス・シェアリングが発生しないようにする必要がある。 By the way, even when a plurality of processors share the same line of each L1 cache, there is actually access to different data in the line (hereinafter referred to as false sharing). When trying to maintain cache coherency, even in such a situation of false sharing, invalidation and updating of caches that are not actually required occur and performance deteriorates. Therefore, it is necessary to prevent false sharing in order to improve performance or to reduce power consumption by eliminating useless operations.
一方、スヌープキャッシュは、ハードウエア規模が大きく、コスト高を招来することから、組み込みプロセッサにおいては導入されないことがある。この場合には、ソフトウエアによってキャッシュコヒーレンシを維持する必要がある。フォルス・シェアリングによる同一ラインへの書き込みについても、ソフトウエアによって防止を図る必要がある。 On the other hand, the snoop cache has a large hardware scale and incurs high costs, so it may not be introduced in an embedded processor. In this case, it is necessary to maintain cache coherency by software. It is necessary to prevent the writing to the same line by false sharing by software.
しかしながら、フォルス・シェアリングを完全に無くすためのプログラミングには膨大な作業量を要する。しかも、ソフトウエアによってフォルス・シェアリングを完全に無くすことは、実際上極めて困難であり、発見し得ないフォルス・シェアリングによって、ソフトウエアにバグが発生してしまう。このバグの発見は極めて困難であり、ソフトウエアの生産性が低下する虞がある。
本発明は、フォルス・シェアリングの発生を検知可能にして、ソフトウエアのバグを容易に検出することができるマルチプロセッサシステムを提供することを目的とする。 It is an object of the present invention to provide a multiprocessor system that can detect the occurrence of false sharing and can easily detect a software bug.
本発明の一態様のマルチプロセッサシステムは、複数のプロセッサから構成されるマルチプロセッサシステムにおいて、前記複数のプロセッサに夫々対応して設けられる第1のキャッシュメモリと、複数の前記第1のキャッシュメモリに夫々設けられて、前記プロセッサによる前記第1のキャッシュメモリへのアクセスに応じた前記第1のキャッシュメモリの状態を検出して検出結果である状態信号を出力する出力部と、前記プロセッサのアクセスの対象となるデータが、前記複数の第1のキャッシュメモリ及び前記複数のプロセッサに共通に設けられる第2のキャッシュメモリのうちの2つ以上のキャッシュメモリに格納されている場合において、前記アクセスの対象となるデータに対する前記プロセッサの書き込みによる更新データと書き込み前の未更新データとが存在するときには、前記未更新データが格納されている第1のキャッシュメモリであることを、前記状態信号に基づいて検出して、検出結果である変更情報を保持する変更情報保持部と、前記状態信号及び変更情報に基づいて、前記未更新データが格納されている第1のキャッシュメモリに対して前記アクセスの対象となるデータに対する書き込み命令が発生したことを検出した場合には、検出出力を出力するエラー検出手段とを具備したものである。 A multiprocessor system according to one embodiment of the present invention is a multiprocessor system including a plurality of processors, and includes a first cache memory provided corresponding to each of the plurality of processors, and a plurality of the first cache memories. An output unit provided respectively for detecting a state of the first cache memory in response to an access to the first cache memory by the processor and outputting a state signal as a detection result; When the target data is stored in two or more cache memories of the plurality of first cache memories and the second cache memory provided in common to the plurality of processors, the access target Update data and writing by writing of the processor to the data to be When there is unupdated data before inclusion, the first cache memory storing the unupdated data is detected based on the status signal, and the change information as a detection result is held. Based on the change information holding unit, the status signal and the change information, it is detected that a write command for the data to be accessed is generated for the first cache memory in which the unupdated data is stored. In some cases, an error detection means for outputting a detection output is provided.
本発明によれば、フォルス・シェアリングの発生を検知可能にして、ソフトウエアのバグを容易に検出することができるという効果を有する。 According to the present invention, it is possible to detect occurrence of false sharing and to easily detect a software bug.
以下、図面を参照して本発明の実施の形態について詳細に説明する。図1は本発明の一実施の形態に係るマルチプロセッサシステムを示すブロック図である。 Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. FIG. 1 is a block diagram showing a multiprocessor system according to an embodiment of the present invention.
図1において、マルチプロセッサシステムは、n個のプロセッサP1〜Pn(以下、代表してプロセッサPという)によって構成されている。各プロセッサP1〜Pnは、夫々命令の実行を行うプロセッサコアC1〜Cn(以下、代表してプロセッサコアCという)とプログラムやデータを格納する1次(L1)キャッシュメモリM1〜Mn(以下、代表してL1キャッシュメモリMCという)とによって構成されている。 In FIG. 1, the multiprocessor system includes n processors P1 to Pn (hereinafter, representatively referred to as processor P). Each of the processors P1 to Pn includes a processor core C1 to Cn (hereinafter, representatively referred to as the processor core C) that executes instructions and a primary (L1) cache memory M1 to Mn (hereinafter, representative) that stores programs and data. And L1 cache memory MC).
全てのプロセッサPは、2次(L2)キャッシュメモリ11に共通に接続されている。L2キャッシュメモリ11はバス12に接続されており、バス12にはメインメモリ13及び周辺回路14が接続されている。メインメモリ13は、プロセッサPが使用するコマンドや各種データを記憶する。
All the processors P are commonly connected to the secondary (L2)
L1キャッシュメモリMC及びL2キャッシュメモリ11は、所定のビットサイズのライン単位で、書き込み及び読み出しが管理される。ラインサイズとしては、例えば、32バイト、64バイト等が設定可能である。
In the L1 cache memory MC and the
L2キャッシュメモリ11は、メインメモリ13に記憶されているデータの一部のデータのコピーを保持する。また、L1キャッシュメモリMCは、L2キャッシュメモリ11又はメインメモリ13に格納されているデータの一部のデータのコピーを保持する。L1キャッシュメモリMC及びL2キャッシュメモリ11が保持しているデータには、プロセッサコアCが、メインメモリ13のアドレスを指定することでアクセス可能である。
The
プロセッサコアCは、ロード命令及びストア命令等のために、メインメモリ13のアドレスを指定してアクセスを行う。この場合において、メインメモリ13の指定されたアドレスに記憶されていたデータがL1キャッシュメモリMCにコピーされて格納されているとき(即ち、キャッシュヒットのとき)には、プロセッサコアCは、L1キャッシュメモリMC内のアドレスによって指定されるライン(以下、対象ラインという)のデータ(以下、対象データという)にアクセスを行う。L1キャッシュメモリMCに対象データがコピーされておらず格納されていないとき(即ち、キャッシュミスのとき)には、プロセッサコアCは、L2キャッシュメモリ11にアクセスを行う。
The processor core C performs access by designating the address of the
更に、プロセッサコアCが、L2キャッシュメモリ11にアクセスした場合において、L2キャッシュメモリ11にアクセスすべき対象データが存在する場合(即ち、L2キャッシュヒットの場合)には、L2キャッシュメモリ11からL1キャッシュメモリMCに、対象データを含むラインがリフィルされる。また、L2キャッシュメモリ11に対象データが存在しない場合(キャッシュミスの場合)には、先ずメインメモリ13からL2キャッシュメモリ11に対象データを含むラインがリフィルされ、更に、L2キャッシュメモリ11からL1キャッシュメモリMCに対象データを含むラインがリフィルされる。
Further, when the processor core C accesses the
ところで、プロセッサコアCからのデータの書き込みによって、L1,L2キャッシュメモリMC,11に保持されているデータがコピー元のデータと異なる内容になることがある。また、キャッシュメモリ11から複数のL1キャッシュメモリMCにコピーされたデータ同士においても、相互に異なる内容となることがある。これらの場合には、キャッシュコヒーレンシを維持するために、所定のタイミングでコピー元及び全てのコピー先のデータを書き込みに応じた最新のデータに一致させる必要がある。なお、プロセッサPから共通のアドレスによってアクセスされるこれらのデータのうち、最新のものでないデータを未更新データといい、最新のデータを更新データともいう。
By the way, when data is written from the processor core C, the data held in the L1 and L2 cache memories MC and 11 may be different from the copy source data. Also, data copied from the
本実施の形態においては、各L1キャッシュメモリが未更新データ、更新データのいずれを保持しているかを判定するための信号を各L1キャッシュメモリMCからL2キャッシュメモリ11に出力させる。従来、L1キャッシュメモリMCとL2キャッシュメモリ11との間で、リフィルやライトバック等のトランザクションは発生していた。本実施の形態においては、更に、これらのトランザクション等の発生を示す信号をL2キャッシュメモリ11に出力するのである。
In the present embodiment, a signal for determining whether each L1 cache memory holds unupdated data or updated data is output from each L1 cache memory MC to the
L2キャッシュメモリ11は、受信した情報を保持し、各L1キャッシュメモリMCの状態を判定することで、フォルス・シェアリングの有無を検知するようになっている。
The
図2は図1中のL1キャッシュメモリMCの具体的な構成を示す回路図である。図2の例は、ダイレクトマップッド方式のキャッシュの構成を示しているが、2−wayや4−way等の他のキャッシュの構成を採用することも可能である。また、図2ではライトバック方式のキャッシュを想定して示しているが他の方式を採用することも可能である。 FIG. 2 is a circuit diagram showing a specific configuration of the L1 cache memory MC in FIG. The example of FIG. 2 shows the configuration of the direct mapped cache, but other cache configurations such as 2-way and 4-way may be employed. In FIG. 2, a write-back cache is assumed, but another method can be adopted.
各プロセッサPに内蔵されているL1キャッシュメモリMCは、同一構成であり、転送されたデータを格納するデータ格納領域21、格納したデータのアドレス情報を保持するタグ領域22及び状態格納領域23を有する。データ格納領域21は、管理単位となるラインを複数ライン分有して構成される。図2の例では、1ラインを32ビット(4バイト)×4=16バイトで構成した例を示しており、ライン数は例えば256である。
The L1 cache memory MC built in each processor P has the same configuration, and has a
プロセッサコアCがデータアクセス時に指定するアドレスは、例えば、図2に示すように、タグ、インデックス、Bof(ブロックオフセット)及び無効ビット(00)が配列されたものである。ダイレクトマップッド方式では、メインメモリ13のメモリブロックのアドレス(インデックス)によって、直接L1キャッシュメモリMCのライン番号を指定することができる。図2の例では、第4乃至第11の8ビット([11:4])のインデックスによって、256個のラインのいずれのラインかを特定することができる。
The address specified by the processor core C at the time of data access is, for example, a tag, an index, a Bof (block offset), and an invalid bit (00) arranged as shown in FIG. In the direct mapped method, the line number of the L1 cache memory MC can be directly specified by the address (index) of the memory block of the
アドレスの上位ビットのタグは、メインメモリ13のメモリブロック中のいずれの位置のデータであるかを示すものである。タグ領域22にはデータ格納領域21にデータを格納する場合に、メモリブロック中のいずれの位置のデータであるかを示すタグが格納されている。
The high-order bit tag of the address indicates which position in the memory block of the
従って、プロセッサコアCから指定されたアドレス中のタグと、インデックスによって指定されたラインのタグ領域22内のタグとが一致した場合には、キャッシュヒットとなり、不一致の場合にはキャッシュミスとなる。比較器25はアドレス中のタグと、タグ領域22からのタグとが与えられて、この比較を行い、比較結果をアンド回路26に出力するようになっている。アンド回路26には、状態格納領域23からの情報も与えられる。状態格納領域23は、各ラインに対応して、ラインに有効なデータが格納されているか否かを示すバリッドビットV及びラインにプロセッサコアCによる書き込みが行われたことを示すダーティビットDとを保持する。バリッドビットVは“1”によって有効なラインであることを示し、ダーティビットDは、ラインに書き込みが行われた場合に“1”にセットされる。アンド回路26は、アドレスによって指定されたラインについて、バリッドビットDが“1”で、且つ比較器25の比較結果が一致を示す“1”の場合にのみ、キャッシュヒットであることを示す出力(ヒット信号)を制御回路27に出力するようになっている。
Therefore, if the tag in the address specified by the processor core C matches the tag in the tag area 22 of the line specified by the index, a cache hit occurs, and if they do not match, a cache miss occurs. The
出力部としての制御回路27には、ヒット信号の他に、状態格納領域23からダーティビットVが与えられると共に、キャッシュアクセスのライト信号(Write)及びリード信号(Read)も与えられる。制御回路27は、ライト信号又はリード信号によるキャッシュアクセスに対して、アンド回路26の出力が“0”(L1キャッシュミス)である場合には、リフィル信号RDをアサートする。また、制御回路27は、アンド回路26の出力によってL1キャッシュミスが示された場合に、リフィルによってリプレースされるラインがダーティであることがダーティビットDによって示されたときには、このダーティなラインのデータをL2キャッシュメモリ11に書き戻すための要求であるライトバック無効信号WBIをアサートする。
In addition to the hit signal, the control circuit 27 serving as an output unit is provided with a dirty bit V from the
本実施の形態においては、制御回路27は、従来のL1キャッシュメモリと同様にリフィル信号RD及びライトバック無効信号WBIをバスサイクルでL2キャッシュメモリに出力するだけでなく、変更信号MOD及び無効信号INVも出力するようになっている。 In the present embodiment, the control circuit 27 not only outputs the refill signal RD and the write back invalid signal WBI to the L2 cache memory in a bus cycle, as in the conventional L1 cache memory, but also the change signal MOD and the invalid signal INV. Is also output.
更に、制御回路27は、プロセッサコアCがL1キャッシュメモリMCの所定のラインに最初に書き込みを行ったことによって、ダーティビットDが“0”から“1”に変化する場合には、有効な変更信号MODを出力する。なお、この場合には、制御回路27は、書き込みが行われたアドレス情報も同時に出力する。また、制御回路27は、対象データ以外のデータがL1キャッシュミスに対するリフィルによってリプレースされる場合には、無効信号INVをアサートする。制御回路27は、状態信号としてのリフィル信号RD、ライトバック無効信号WBI及び変更信号MODをL2キャッシュメモリ11に供給するようになっている。
Further, the control circuit 27 makes an effective change when the dirty bit D changes from “0” to “1” because the processor core C first writes to the predetermined line of the L1 cache memory MC. The signal MOD is output. In this case, the control circuit 27 also outputs address information for which writing has been performed. The control circuit 27 asserts the invalid signal INV when data other than the target data is replaced by refill for the L1 cache miss. The control circuit 27 supplies a refill signal RD, a write back invalid signal WBI, and a change signal MOD as status signals to the
図3は図1中のL2キャッシュメモリ11の具体的な構成を示す回路図である。また、図4はL2キャッシュメモリ11内の制御回路37の制御を説明するためのフローチャートである。
FIG. 3 is a circuit diagram showing a specific configuration of the
L2キャッシュメモリ11の構成は、L1キャッシュメモリMCと同様であり、転送されたデータを格納するデータ格納領域31、格納したデータのアドレス情報を保持するタグ領域32及び状態格納領域33を有する。データ格納領域31は、管理単位となるラインを複数ライン分有して構成される。また、セレクタ34、比較器35及びアンド回路36は、夫々L1キャッシュメモリMCのセレクタ24、比較器25及びアンド回路26と同様の構成である。
The configuration of the
本実施の形態においては、各プロセッサP毎の更新状況の情報を保持する更新情報領域38を有している。更新情報領域38には、不一致ビットIC、バリッドビットV及び変更ビットMが格納されるようになっている。更新情報領域38に格納される不一致ビット(ICビット)は、プロセッサPからの有効な変更信号MODによって、L1キャッシュメモリMCに更新データが格納され、L2キャッシュメモリ11に未更新データが格納された状態の場合には、“1”にセットされる。
In the present embodiment, there is an update information area 38 that holds information on the update status for each processor P. The update information area 38 stores a mismatch bit IC, a valid bit V, and a change bit M. As for the mismatch bit (IC bit) stored in the update information area 38, the update data is stored in the L1 cache memory MC and the unupdated data is stored in the
更新情報領域38に格納されるバリッドビット(Vビット)は、格納されているデータの有効,無効を各プロセッサP毎に示すものである。また、更新情報領域38に格納される変更ビット(Mビット)は、他のL1,L2キャッシュメモリMC,11に更新データが格納されている状態で、未更新データを格納していることを示している。 The valid bit (V bit) stored in the update information area 38 indicates the validity or invalidity of the stored data for each processor P. The change bit (M bit) stored in the update information area 38 indicates that unupdated data is stored in a state where the update data is stored in the other L1, L2 cache memories MC, 11. ing.
更新情報領域38に格納するICビット、Vビット及びMビットは、制御回路37において生成するようになっている。制御回路37には、各プロセッサPからリフィル信号RD、ライトバック無効信号WBI、変更信号MOD及び無効信号INVが供給される。制御回路37は、図4のステップS1において、リフィル信号RD、ライトバック無効信号WBI、変更信号MOD及び無効信号INVを取り込み、取り込んだ信号に基づいて、ICビットを生成すると共に、各プロセッサ毎にVビット及びMビットを生成して、対応するキャッシュラインの更新情報領域38に格納する。なお、制御回路37及び更新情報領域38によって、エラー検出部が構成される。
IC bits, V bits, and M bits stored in the update information area 38 are generated in the
下記表1は、制御回路37に入力される信号と制御回路37によって生成される各ビットとの対応を示す表である。
Table 1 below shows the correspondence between the signal input to the
[表1]
┌─┬─────────┬─────────┬───────────┐
│ │ │ L2キャッシュの │ L2キャッシュの │
│ │ │ 前の状態 │ 新しい状態 │
│ │プロセッサx ├─┬───┬───┼─┬───┬───┬─┤
│ │からの入力信号 │ │プロ │プロ │ │プロ │プロ │ │
│ │ │ │セッサ│セッサ│ │セッサ│セッサ│F│
│ │ │ │ x │x以外│ │ x │x以外│ │
│ ├─────────┤ ├───┼───┤ ├───┼───┤ │
│ │RD WBI INV MOD │IC│V M│V M│IC│V M│V M│ │
├─┼─────────┼─┼───┼───┼─┼───┼───┼─┤
│a│ │0│0 0│− −│0│1 0│− −│0│
├─┤1 0 0 0 ├─┼───┼───┼─┼───┼───┼─┤
│b│ │1│0 0│− −│1│1 1│− −│0│
├─┼─────────┼─┼───┼───┼─┼───┼───┼─┤
│c│0 0 1 0 │−│1 −│− −│−│0 0│− −│0│
├─┼─────────┼─┼───┼───┼─┼───┼───┼─┤
│d│0 1 0 0 │1│1 1│− −│0│0 0│− −│0│
├─┼─────────┼─┼───┼───┼─┼───┼───┼─┤
│e│ │0│1 0│0 0│1│1 1│0 0│0│
├─┤ ├─┼───┼───┼─┼───┼───┼─┤
│f│0 0 0 1 │−│1 0│1 −│1│1 1│1 1│0│
├─┤ ├─┼───┼───┼─┼───┼───┼─┤
│g│ │−│1 1│− −│−│1 1│− −│1│
└─┴─────────┴─┴───┴───┴─┴───┴───┴─┘
上記表1は、L1キャッシュメモリMCから夫々リフィル信号RD、ライトバック無効信号WBI、変更信号MOD及び無効信号INVがL2キャッシュメモリ11に供給された場合において、その供給時点において既にL2キャッシュメモリ11に設定されているIC,V,Mビットと各信号入力との関係から、新たにL2キャッシュメモリ11に格納されるIC,V,M及び後述するFビットを更新する方法を示している。なお、−は制御回路37による更新が行われないか又は“0”,“1”のいずれの値をとってもよいことを示している。
[Table 1]
┌─┬─────────┬─────────┬───────────┐
│ │ │ L2 cache │ L2 cache │
│ │ │ Previous state │ New state │
│ │Processor x ├─┬───┬───┼─┬───┬───┬─┤
Input signal from │ │ │Pro │Pro │ │Pro │Pro │ │
│ │ │ │Sessor│ Sessor│ │Sessor│Sessor│F│
│ │ │ │ x │other than x│ │ x │other than x │ │
│ ├─────────┤┤ ────┼───┤ ├───┼───┤ │
│ │RD WBI INV MOD │IC│VM │VM │IC│VM │VM │ │
├─┼─────────┼─┼───┼───┼─┼───┼───┼─┤
│a│ │0│0 0│- -│0│1 0│- -│0│
├─┤1 0 0 0 ├─┼───┼───┼─┼───┼───┼─┤
│b│ │1│0 0│- -│1│1 1│- -│0│
├─┼─────────┼─┼───┼───┼─┼───┼───┼─┤
│c│0 0 1 0 │-│1 -│- -│-│0 0│- -│0│
├─┼─────────┼─┼───┼───┼─┼───┼───┼─┤
│d│0 1 0 0 │1│1 1│- --│0│0 0│- --│0│
├─┼─────────┼─┼───┼───┼─┼───┼───┼─┤
│e│ │0│1 0│0 0│1│1 1│0 0│0│
├─┤ ├─┼───┼───┼─┼───┼───┼─┤
│f│0 0 0 1 │-│1 0│1 --│1│1 1│1 1│0│
├─┤ ├─┼───┼───┼─┼───┼───┼─┤
│g│ │-│1 1│- -│-│1 1│- -│1│
└─┴─────────┴─┴───┴───┴─┴───┴───┴─┘
Table 1 shows that when the refill signal RD, the write back invalid signal WBI, the change signal MOD, and the invalid signal INV are supplied from the L1 cache memory MC to the
表1の場合a,bは、リフィル信号RDが供給された例であり、場合cは、ライトバック無効信号WBIが供給された例であり、場合dは無効信号INVが供給された例であり、場合e〜gは変更信号MODが供給された例である。 In Table 1, a and b are examples in which the refill signal RD is supplied, the case c is an example in which the write-back invalid signal WBI is supplied, and the case d is an example in which the invalid signal INV is supplied. Cases e to g are examples in which the change signal MOD is supplied.
場合aは、L2キャッシュメモリ11の対象ラインのICビットが“0”のときに、プロセッサP中の所定のプロセッサxからリフィル信号RDが供給された例である。有効なリフィル信号RDが発生する場合には、それ以前には対応するプロセッサxのV,Mビットは“0”にクリアされていることになる。有効なリフィル信号RDによって、プロセッサxのL1キャッシュメモリMxに対象データが格納される。制御回路37は、有効なリフィル信号RDが入力されると、図4のステップS2から処理をステップS3に移行して、対応するプロセッサのVビットをセットする。
Case a is an example in which the refill signal RD is supplied from a predetermined processor x in the processor P when the IC bit of the target line of the
場合bは、L2キャッシュメモリ11の対象ラインのICビットが“1”のときに、プロセッサP中の所定のプロセッサxからリフィル信号RDが供給された例である。このリフィル信号RDによっても、L2キャッシュメモリ11から読み出された対象データがプロセッサxのL1キャッシュメモリMxに格納される。しかし、この場合には、ICビットが“1”であり、L2キャッシュメモリ11に格納されている対象データは、未更新データである。そこで、この場合には、制御回路37は、有効なリフィル信号RDの入力によって、図4のステップS3において対応するプロセッサのVビットをセットすると共に、図4のステップS4から処理をステップS5に移行して、Mビットも“1”にセットする。
Case b is an example in which the refill signal RD is supplied from a predetermined processor x in the processor P when the IC bit of the target line of the
場合cは、プロセッサP中の所定のプロセッサxから無効信号INVが供給された例である。無効信号INVによって、いままで有効であった対象ラインが無効になることが示される。即ち、制御回路37は、無効信号INVが入力されると、ステップS6から処理をステップS7に移行して、Vビットを“1”から“0”に変更する。また、制御回路37は、Mビットも“0”にクリアする。
Case c is an example in which the invalid signal INV is supplied from a predetermined processor x in the processor P. The invalid signal INV indicates that the target line that has been valid until now becomes invalid. That is, when the invalid signal INV is input, the
場合dは、プロセッサP中の所定のプロセッサxからライトバック無効信号WBIが供給された例である。有効なライトバック無効信号WBIが発生する場合には、それ以前には対応するプロセッサxのL1キャッシュメモリMxに更新データが格納され、L2キャッシュメモリ11には未更新データが格納されていることになる。従って、ライトバック無効信号WBIの入力直前には、L2キャッシュメモリ11の対象ラインのICビットは“1”である。また、更新データが格納されていたので、Vビットも“1”であり、ICビットが“1”であるので、Mビットも“1”である。有効なライトバック無効信号WBIによる書き戻しが行われて、L1キャッシュメモリMxの対象ラインに他のデータが書き込まれると、制御回路37は、ステップS8から処理をステップS9に移行して、IC,V,Mビットを全て“0”にクリアする。
Case d is an example in which the write back invalid signal WBI is supplied from a predetermined processor x in the processor P. When a valid write back invalid signal WBI is generated, update data is stored in the L1 cache memory Mx of the corresponding processor x before that, and unupdated data is stored in the
場合e〜gは、プロセッサP中の所定のプロセッサxから変更信号MODが供給された例であり、それ以前のIC,V,Mビットの状態に応じて、3つの場合に分けて説明する。場合eは、プロセッサxのVビットが“1”、Mビットが“0”で、それ以外のプロセッサのV,Mビットが“0”の場合の例である。なお、ICビットは“0”である。即ち、対象データがプロセッサxのL1 キャッシュメモリMxにのみ格納され、L1,L2キャッシュメモリMx,11の両方に更新データが格納されている場合である。この場合には、有効な変更信号MODが入力されると、制御回路37は、ステップS10から処理をステップS11に移行して、プロセッサx用のV,Mビットを“1”にセットし、ICビットも“1”にセットする。他のプロセッサ用のV,Mビットの値は“0”のままとする。
Cases e to g are examples in which the change signal MOD is supplied from a predetermined processor x in the processor P, and will be described in three cases according to the state of the previous IC, V, and M bits. Case e is an example in which the V bit of the processor x is “1” and the M bit is “0”, and the V and M bits of the other processors are “0”. The IC bit is “0”. That is, the target data is stored only in the L1 cache memory Mx of the processor x, and the update data is stored in both the L1 and L2 cache memories Mx and 11. In this case, when a valid change signal MOD is input, the
場合fは、プロセッサxのVビットが“1”、Mビットが“0”で、それ以外のプロセッサのVビットが“1”の場合の例である。即ち、対象データがプロセッサxのL1 キャッシュメモリMxだけでなく、プロセッサx以外のL1キャッシュメモリMCにも格納されている例である。この場合においても、有効な変更信号MODが入力されると、制御回路37は、プロセッサx用のV,Mビットを“1”にセットし、ICビットも“1”にセットする。また、Vビットが“1”の他のプロセッサのMビットも“1”にする(ステップS11)。
Case f is an example in which the V bit of the processor x is “1”, the M bit is “0”, and the V bits of the other processors are “1”. That is, in this example, the target data is stored not only in the L1 cache memory Mx of the processor x but also in the L1 cache memory MC other than the processor x. Also in this case, when a valid change signal MOD is input, the
即ち、制御回路37は、有効な変更信号MODが入力された場合には、Vビットを参照し、Vビットがセットされた全プロセッサのMビットを全て“1”にし、ICビットも“1”にする。
That is, when a valid change signal MOD is input, the
更に、場合gは、Mビットがセットされたプロセッサxから有効な変更信号MODが発生した場合の例である。上述したように、Vビットがセットされていれば(有効な対象データを保持していれば)、いずれのプロセッサのL1キャッシュメモリMCに対する書き込みであっても、Mビットがセットされる。また、変更信号MODは、ダーティビットDが“0”から“1”に切換る最初の書き込みのみによって発生する。即ち、場合gは、更新データを保持するL1キャッシュメモリMCから変更信号MODが発生する例ではない。従って、Mビットがセットされたプロセッサxから有効な変更信号MODが発生した場合には、このプロセッサxには未更新データが格納されており、このプロセッサx以外のいずれかのプロセッサに更新データが格納されていることを意味する。そこで、この場合には、制御回路37は、ステップS10から処理をステップS12に移行して、フォルス・シェアリングの発生を示すFビットを“1”にセットする。
Further, the case g is an example when a valid change signal MOD is generated from the processor x in which the M bit is set. As described above, if the V bit is set (if valid target data is held), the M bit is set for any processor writing to the L1 cache memory MC. The change signal MOD is generated only by the first writing when the dirty bit D is switched from “0” to “1”. That is, the case g is not an example in which the change signal MOD is generated from the L1 cache memory MC that holds the update data. Therefore, when a valid change signal MOD is generated from the processor x in which the M bit is set, unupdated data is stored in the processor x, and updated data is sent to any processor other than the processor x. Means stored. Therefore, in this case, the
なお、ステップS2〜S5、ステップS6,S7、ステップS8,S9及びステップS10〜S12は、夫々相互に独立した制御であり、どのような順番であってもよい。 Note that steps S2 to S5, steps S6 and S7, steps S8 and S9, and steps S10 to S12 are independent of each other, and may be in any order.
Fレジスタ40は、フォルス・シェアリングの発生を示すFビットがセットされると、Fビットがセットされる要因となったプロセッサ、特定のプロセッサ又は全プロセッサに対して、割り込み要求信号を発生するようになっている。
When the F bit indicating the occurrence of false sharing is set, the
また、FSAレジスタ39には、入力アドレスが供給される。FSAレジスタ39は、フォルス・シェアリングが発生すると、フォルス・シェアリングの発生の要因となったアドレスを出力するようになっている。 The FSA register 39 is supplied with an input address. When false sharing occurs, the FSA register 39 outputs the address that caused the occurrence of false sharing.
次に、このように構成された実施の形態の動作について図5乃至図9の説明図を参照して説明する。図5乃至図9は中央にL1キャッシュメモリMCからの信号を示し、左側に更新情報領域38のV,M,ICビットの値を示し、右側に各L1キャッシュメモリMC(M0〜M3)及びL2キャッシュメモリ11(L2)のデータを示している。図5乃至図9は丸印よりも二重丸印、二重丸印よりも三重丸印の方がより最新のデータが保持されていることを示している。なお、×印は、キャッシュコヒーレンシが維持されない状態、即ち、同一対象データについて、他のL1,L2キャッシュメモリMC,11に更新データが格納されている状態で、未更新データを格納しているL1キャッシュメモリMCに新たな書込みが行われることを示している。また、図5乃至図9の(a)〜(g)は、上記表1の場合a〜gに対応している。 Next, the operation of the embodiment configured as described above will be described with reference to the explanatory diagrams of FIGS. 5 to 9 show signals from the L1 cache memory MC in the center, values of the V, M, and IC bits in the update information area 38 on the left side, and the L1 cache memories MC (M0 to M3) and L2 on the right side. Data in the cache memory 11 (L2) is shown. 5 to 9 show that the latest data is retained in the double circle mark than in the circle mark and in the triple circle mark than the double circle mark. In addition, X mark is a state where cache coherency is not maintained, that is, a state where update data is stored in the other L1, L2 cache memories MC, 11 for the same target data, and L1 storing unupdated data. It shows that new writing is performed in the cache memory MC. Further, (a) to (g) in FIGS. 5 to 9 correspond to the cases a to g in Table 1 above.
なお、図5乃至図9はプロセッサP0〜P3の4つのプロセッサを有する例を示しており、各プロセッサP0〜P3にはL1キャッシュメモリM0〜M3が夫々内蔵されているものとして説明する。また、図5乃至図9の例は、L1キャッシュメモリMCに格納されているデータの全ては、L2キャッシュメモリ11にも格納されている場合(マルチレベル・インクルージョン)の例である。 FIGS. 5 to 9 show examples having four processors P0 to P3, and description will be made assuming that the L1 cache memories M0 to M3 are built in the processors P0 to P3, respectively. The examples of FIGS. 5 to 9 are examples in which all of the data stored in the L1 cache memory MC is also stored in the L2 cache memory 11 (multilevel inclusion).
図5はフォルス・シェアリングが発生しない例である。 FIG. 5 shows an example in which false sharing does not occur.
いま、図5の最上段右側に示すように、対象ラインについてL2キャッシュメモリ11にのみデータ(対象データ)が保持されているものとする。ここで、プロセッサP0のプロセッサコアが対象データにアクセスするものとする。この場合には、L1キャッシュメモリM0には対象データが保持されていないので、L1キャッシュメモリM0は、リフィル信号RDをアサートし、L2キャッシュメモリ11に供給する(上記表1の場合aに相当)。
Assume that data (target data) is held only in the
これにより、L2キャッシュメモリ11の制御回路37は、図5左側に示すように、更新情報領域38の対象ラインのVビットを“1”にする。対象データは、図5右側に示すように、L2キャッシュメモリ11から読み出されてL1キャッシュメモリM0の対象ラインに書き込まれる。
As a result, the
次に、図5右側に示すように、プロセッサP0のプロセッサコアが対象データに書き込みを行うものとする。これにより、L1キャッシュメモリM0に格納されている対象データは、図5の2重丸で示す最新のデータ、即ち更新データとなる。一方、この時点では、L2キャッシュメモリ11に格納されている対象データは、1重丸で示すように未更新データである。
Next, it is assumed that the processor core of the processor P0 writes to the target data as shown on the right side of FIG. As a result, the target data stored in the L1 cache memory M0 becomes the latest data indicated by double circles in FIG. 5, that is, update data. On the other hand, at this time, the target data stored in the
この書き込み命令によって、プロセッサP0のL1キャッシュメモリM0は、変更信号MODをアサートしてL2キャッシュメモリ11に供給する(上記表1の場合eに相当)。これにより、L2キャッシュメモリ11の制御回路37は、図5左側に示すように、Mビットをセットし、ICビットも“1”にする。
In response to this write command, the L1 cache memory M0 of the processor P0 asserts the change signal MOD and supplies it to the L2 cache memory 11 (corresponding to e in Table 1 above). As a result, the
次に、プロセッサP0のプロセッサコアが、対象データが格納されているL1キャッシュメモリM0のラインに対して他のデータのアクセスを行うものとする。この場合には、L1キャッシュメモリM0にキャッシュミスが発生し、L1キャッシュメモリM0は、ライトバック無効信号WBIをアサートしてL2キャッシュメモリ11に供給する(上記表1の場合dに相当)。これにより、L2キャッシュメモリ11に格納されている対象データは更新データとなると共に、L1キャッシュメモリM0の対象データは無効なデータとなる(図5右側)。L2キャッシュメモリ11の制御回路37は、対象ラインのVビット、Mビット及びICビットをクリアする(図5左側)。
Next, it is assumed that the processor core of the processor P0 accesses other data to the line of the L1 cache memory M0 in which the target data is stored. In this case, a cache miss occurs in the L1 cache memory M0, and the L1 cache memory M0 asserts the write-back invalid signal WBI and supplies it to the L2 cache memory 11 (corresponding to d in Table 1 above). As a result, the target data stored in the
次に、図6を参照してフォルス・シェアリングによってキャッシュコヒーレンシが保てない場合の一例について説明する。 Next, an example of a case where cache coherency cannot be maintained by false sharing will be described with reference to FIG.
いま、図6の最上段右側に示すように、所定のラインについてL2キャッシュメモリ11にのみデータ(対象データ)が保持されているものとする。ここで、図5の例と同様に、L1キャッシュメモリM0がリフィル信号RDをアサートするものとする。L2キャッシュメモリ11の制御回路37は、図6左側に示すように、更新情報領域38の対象ラインのVビットを“1”にする。対象データは、図6右側に示すように、L2キャッシュメモリ11から読み出されてL1キャッシュメモリM0の対象ラインに書き込まれる。
Assume that data (target data) is held only in the
次に、図6中央に示すように、プロセッサP1のプロセッサコアのアクセスによって、L1キャッシュメモリM1がリフィル信号RDをアサートするものとする。L2キャッシュメモリ11の制御回路37は、図6左側に示すように、更新情報領域38の対象ラインのプロセッサP1のVビットを“1”にする。対象データは、図6右側に示すように、L2キャッシュメモリ11から読み出されてL1キャッシュメモリM1の対象ラインに書き込まれる。
Next, as shown in the center of FIG. 6, it is assumed that the L1 cache memory M1 asserts the refill signal RD by accessing the processor core of the processor P1. The
次に、図6右側に示すように、プロセッサP0のプロセッサコアが対象データに書き込みを行うものとする。これにより、L1キャッシュメモリM0に格納されている対象データは、図6の2重丸で示す更新データとなる。一方、この時点では、L2キャッシュメモリ11及びL1キャッシュメモリM1に格納されている対象データは、1重丸で示すように未更新データである。
Next, as shown on the right side of FIG. 6, it is assumed that the processor core of the processor P0 writes the target data. Thus, the target data stored in the L1 cache memory M0 becomes update data indicated by double circles in FIG. On the other hand, at this time, the target data stored in the
この書き込み命令によって、プロセッサP0のL1キャッシュメモリM0は、変更信号MODをアサートしてL2キャッシュメモリ11に供給する(表1の場合fに相当)。これにより、L2キャッシュメモリ11の制御回路37は、Mビットをセットする。この場合には、制御回路37は、図6左側に示すように、プロセッサP0,P1の両方のMビットをセットする。即ち、制御回路37は、有効な変更信号MODが入力されると、Vビットを参照して、Vビットがセットされた他のプロセッサのMビットもセット状態にする。また、ICビットもセットされる。
In response to this write command, the L1 cache memory M0 of the processor P0 asserts the change signal MOD and supplies it to the L2 cache memory 11 (corresponding to f in Table 1). As a result, the
仮に、この状態で、プロセッサP0のプロセッサコアが再度L1キャッシュメモリM0の対象データに書き込みを行うものとする。この場合には、既にL1キャッシュメモリM0内のダーティビットDは“1”になっており、プロセッサP0からは有効な変更信号MODは発生しない。従って、L2キャッシュメモリ11の更新情報領域38の内容は変化しない。
In this state, it is assumed that the processor core of the processor P0 writes the target data in the L1 cache memory M0 again. In this case, the dirty bit D in the L1 cache memory M0 is already “1”, and no valid change signal MOD is generated from the processor P0. Therefore, the content of the update information area 38 of the
ここで、図6中央に示すように、プロセッサP1のプロセッサコアも対象データに対して書き込みを行うものとする。そうすると、プロセッサP1から有効な変更信号MODがL2キャッシュメモリ11の制御回路37に供給される(表1の場合gに相当)。制御回路37は、MビットがセットされたプロセッサP1から変更信号MODが入力されたことから、FビットをFレジスタ40にセットする。また、制御回路37は、プロセッサP1から指定されたアドレスをFSAレジスタ39から出力させる。Fレジスタ40は、プロセッサP1に対して割り込み要求信号を発生する。
Here, as shown in the center of FIG. 6, it is assumed that the processor core of the processor P1 also writes the target data. Then, a valid change signal MOD is supplied from the processor P1 to the
このように、本実施の形態においては、異なるL1キャッシュメモリMC同士の同一ラインに対して別々に書き込みが行われることを検知して、割り込み要求信号を発生することができる。 Thus, in this embodiment, it is possible to generate an interrupt request signal by detecting that writing is separately performed on the same line between different L1 cache memories MC.
次に、図7を参照してフォルス・シェアリングによってキャッシュコヒーレンシが保てない場合の他の例について説明する。 Next, another example in the case where cache coherency cannot be maintained by false sharing will be described with reference to FIG.
いま、図7の最上段右側に示すように、所定のラインについてL2キャッシュメモリ11にのみデータ(対象データ)が保持されているものとする。ここで、図6の例と同様に、L1キャッシュメモリM0及びL1キャッシュメモリM1が順次リフィル信号RDをアサートし、次いで、プロセッサP0のプロセッサコアが対象データに書き込みを行うことによって、L1キャッシュメモリM0が変更信号MODをアサートしてL2キャッシュメモリ11に供給するものとする。
Now, it is assumed that data (target data) is held only in the
この状態では、図7左側4段目に示すように、プロセッサP0,P1のVビット及びMビットは“1”で、ICビットも“1”となっている。また、図7右側4段目に示すように、キャッシュメモリM1,11には未更新データが格納され、L1キャッシュメモリM0には更新データが格納されている。 In this state, as shown in the fourth row on the left side of FIG. 7, the V bit and M bit of the processors P0 and P1 are “1”, and the IC bit is also “1”. Further, as shown in the fourth row on the right side of FIG. 7, unupdated data is stored in the cache memories M1 and 11, and updated data is stored in the L1 cache memory M0.
次に、図7中央に示すように、プロセッサP0のプロセッサコアが、対象データが格納されているL1キャッシュメモリM0のラインに対して他のデータのアクセスすることにより、L1キャッシュメモリM0が、ライトバック無効信号WBIをアサートしてL2キャッシュメモリ11に供給するものとする(図1の場合dに相当)。これにより、L2キャッシュメモリ11に格納されている対象データは更新データとなると共に、L1 キャッシュメモリM0の対象データは無効なデータとなる(図7右側)。また、L2キャッシュメモリ11の制御回路37は、対象ラインのVビット及びMビットをクリアし、ICビットも“0”とする(図7左側)。
Next, as shown in the center of FIG. 7, the processor core of the processor P0 accesses another line to the line of the L1 cache memory M0 in which the target data is stored, so that the L1 cache memory M0 Assume that the back invalid signal WBI is asserted and supplied to the L2 cache memory 11 (corresponding to d in FIG. 1). As a result, the target data stored in the
ここで、図7中央に示すように、プロセッサP1のプロセッサコアも対象データに対して書き込みを行うものとする。そうすると、プロセッサP1から有効な変更信号MODがL2キャッシュメモリ11の制御回路37に供給される(図1の場合gに相当)。制御回路37は、MビットがセットされたプロセッサP1から変更信号MODが入力されたことから、FビットをFレジスタ40にセットする。また、制御回路37は、プロセッサP1から指定されたアドレスをFSAレジスタ39から出力させる。Fレジスタ40は、プロセッサP1に対して割り込み要求信号を発生する。
Here, as shown in the center of FIG. 7, it is assumed that the processor core of the processor P1 also writes the target data. Then, a valid change signal MOD is supplied from the processor P1 to the
このように、本実施の形態においては、L2キャッシュメモリ11に更新データが存在する場合において、未更新データを保持するL1キャッシュメモリMCに対する書き込みを検知して、割り込み要求信号を発生することができる。
As described above, in this embodiment, when update data exists in the
次に、図8を参照してフォルス・シェアリングによってキャッシュコヒーレンシが保てない場合の更に他の例について説明する。 Next, still another example when cache coherency cannot be maintained by false sharing will be described with reference to FIG.
いま、図8の最上段右側に示すように、所定のラインについてL2キャッシュメモリ11にのみ対象データが保持されているものとする。ここで、L1キャッシュメモリM0がリフィル信号RDをアサートし、次いで、プロセッサP0のプロセッサコアが対象データに書き込みを行うことによって、L1キャッシュメモリM0が変更信号MODをアサートしてL2キャッシュメモリ11に供給するものとする。
Now, as shown in the upper right side of FIG. 8, it is assumed that the target data is held only in the
この状態では、図8左側3段目に示すように、プロセッサP0のVビット及びMビットは“1”で、ICビットも“1”となっている。また、図8右側3段目に示すように、L2キャッシュメモリ11には未更新データが格納され、L1キャッシュメモリM0には更新データが格納されている。
In this state, as shown in the third row on the left side of FIG. 8, the V bit and M bit of the processor P0 are “1”, and the IC bit is also “1”. Further, as shown in the third row on the right side of FIG. 8, unupdated data is stored in the
次に、図8中央に示すように、プロセッサP1のプロセッサコアのアクセスによって、L1キャッシュメモリM1がリフィル信号RDをアサートするものとする(表1の場合bに相当)。対象データは、図8右側4段目に示すように、L2キャッシュメモリ11から読み出されてL1キャッシュメモリM1の対象ラインに書き込まれる。L2キャッシュメモリ11の制御回路37は、図8左側に示すように、更新情報領域38の対象ラインのプロセッサP1のVビットを“1”にすると共に、他のキャッシュメモリM0に更新データが格納されている状態で、未更新データを格納することを示すMビットも“1”にセットする。
Next, as shown in the center of FIG. 8, it is assumed that the L1 cache memory M1 asserts the refill signal RD (corresponding to b in Table 1) by accessing the processor core of the processor P1. The target data is read from the
即ち、この状態では、図8左側4段目に示すように、プロセッサP0,P1のVビット及びMビットは“1”で、ICビットも“1”となっている。また、図8右側4段目に示すように、キャッシュメモリM1,11には未更新データが格納され、L1キャッシュメモリM0には更新データが格納されている。 That is, in this state, as shown in the fourth row on the left side of FIG. 8, the V bit and M bit of the processors P0 and P1 are “1”, and the IC bit is also “1”. As shown in the fourth row on the right side of FIG. 8, unupdated data is stored in the cache memories M1 and 11, and updated data is stored in the L1 cache memory M0.
次に、図8中央に示すように、プロセッサP0のプロセッサコアが、対象データが格納されているL1キャッシュメモリM0のラインに対して他のデータのアクセスすることにより、L1キャッシュメモリM0が、ライトバック無効信号WBIをアサートしてL2キャッシュメモリ11に供給するものとする(図1の場合dに相当)。これにより、L2キャッシュメモリ11に格納されている対象データは更新データとなると共に、L1 キャッシュメモリM0の対象データは無効なデータとなる(図8右側)。また、L2キャッシュメモリ11の制御回路37は、対象ラインのVビット及びMビットをクリアし、ICビットも“0”とする(図8左側)。
Next, as shown in the center of FIG. 8, when the processor core of the processor P0 accesses another line to the line of the L1 cache memory M0 in which the target data is stored, the L1 cache memory M0 Assume that the back invalid signal WBI is asserted and supplied to the L2 cache memory 11 (corresponding to d in FIG. 1). As a result, the target data stored in the
ここで、図8中央に示すように、プロセッサP1のプロセッサコアも対象データに対して書き込みを行うものとする。そうすると、プロセッサP1から有効な変更信号MODがL2キャッシュメモリ11の制御回路37に供給される(図1の場合gに相当)。制御回路37は、MビットがセットされたプロセッサP1から変更信号MODが入力されたことから、FビットをFレジスタ40にセットする。また、制御回路37は、プロセッサP1から指定されたアドレスをFSAレジスタ39から出力させる。Fレジスタ40は、プロセッサP1に対して割り込み要求信号を発生する。
Here, as shown in the center of FIG. 8, the processor core of the processor P1 also writes to the target data. Then, a valid change signal MOD is supplied from the processor P1 to the
このように、本実施の形態においては、L2キャッシュメモリ11から未更新データを読み込んだ場合にもMビットを設定することで、それ以後の書き戻し処理によって他のプロセッサ用のMビットがクリアされても、未更新データを保持するL1キャッシュメモリMCに対する書き込みを検知して、割り込み要求信号を発生することができる。
Thus, in this embodiment, even when unupdated data is read from the
次に、図9を参照してフォルス・シェアリングによってもキャッシュコヒーレンシが保たれている一例について説明する。 Next, an example in which cache coherency is maintained by false sharing will be described with reference to FIG.
いま、図9の最上段右側に示すように、所定のラインについてL2キャッシュメモリ11にのみデータ(対象データ)が保持されているものとする。ここで、図7の例と同様に、L1キャッシュメモリM0及びL1キャッシュメモリM1が順次リフィル信号RDをアサートし、次いで、L1キャッシュメモリM0が変更信号MODをアサートし、更に、L1キャッシュメモリM0がライトバック無効信号WBIをアサートしてL2キャッシュメモリ11に供給するものとする。
Assume that data (target data) is held only in the
この状態では、図9左側5段目に示すように、プロセッサP1のVビット及びMビットのみが“1”となっている。また、図9右側5段目に示すように、L2キャッシュメモリ11に更新データが格納され、L1キャッシュメモリM1には未更新データが格納されている。
In this state, as shown in the fifth row on the left side of FIG. 9, only the V bit and M bit of the processor P1 are “1”. Further, as shown in the fifth row on the right side of FIG. 9, the update data is stored in the
ここで、図9中央に示すように、プロセッサP2のプロセッサコアが対象データにアクセスするものとする。この場合には、L1キャッシュメモリM2には対象データが保持されていないので、L1キャッシュメモリM2は、リフィル信号RDをアサートし、L2キャッシュメモリ11に供給する(表1の場合aに相当)。 Here, as shown in the center of FIG. 9, it is assumed that the processor core of the processor P2 accesses the target data. In this case, since the target data is not held in the L1 cache memory M2, the L1 cache memory M2 asserts the refill signal RD and supplies it to the L2 cache memory 11 (corresponding to case a in Table 1).
これにより、L2キャッシュメモリ11の制御回路37は、図9左側に示すように、更新情報領域38の対応するプロセッサP2のVビットを“1”にする。対象データは、図9右側に示すように、L2キャッシュメモリ11から読み出されてL1キャッシュメモリM2の対応するラインに書き込まれる。なお、L1キャッシュメモリM2に読み込まれるデータは、L1キャッシュメモリM0がライトバックした更新データである。
As a result, the
次に、プロセッサP3のプロセッサコアも対象データにアクセスするものとする。これにより、L1キャッシュメモリM3は、リフィル信号RDをアサートし、L2キャッシュメモリ11に供給する。制御回路37は、図9左側に示すように、プロセッサP3のVビットを“1”にする。この場合にも、L1キャッシュメモリM3に読み込まれるデータは、L1キャッシュメモリM0がライトバックした更新データである(図9右側)。
Next, it is assumed that the processor core of the processor P3 also accesses the target data. As a result, the L1 cache memory M3 asserts the refill signal RD and supplies it to the
次に、図9中央に示すように、プロセッサP2のプロセッサコアが対象データに書き込みを行うものとする。これにより、L1キャッシュメモリM2に格納されている対象データは、図9の3重丸で示す更新データとなる。また、この書き込み命令によって、プロセッサP2のL1キャッシュメモリM2は、変更信号MODをアサートしてL2キャッシュメモリ11に供給する(表1の場合fに相当)。これにより、L2キャッシュメモリ11の制御回路37は、図9左側に示すように、VビットがセットされているプロセッサP1〜P3のMビットをセットし、ICビットもセットする。
Next, it is assumed that the processor core of the processor P2 writes the target data as shown in the center of FIG. As a result, the target data stored in the L1 cache memory M2 becomes update data indicated by a triple circle in FIG. Also, in response to this write command, the L1 cache memory M2 of the processor P2 asserts the change signal MOD and supplies it to the L2 cache memory 11 (corresponding to f in Table 1). As a result, the
このように、図9の例では、キャッシュコヒーレンシは維持されており、Fビットはセットされない。なお、図9の最終段の状態で、プロセッサP1又はP3から有効な変更信号MODが出力されると、制御回路37は、これらのプロセッサP1,P3のMビットがセットされていることから、Fレジスタ40にFビットをセットすることになる。
Thus, in the example of FIG. 9, cache coherency is maintained and the F bit is not set. Note that when a valid change signal MOD is output from the processor P1 or P3 in the state of the final stage in FIG. 9, the
このように本実施の形態においては、L1キャッシュメモリからリフィル信号RD、ライトバック無効信号WBI、変更信号MOD及び無効信号INVをL2キャッシュメモリに供給させると共に、L2キャッシュメモリにおいて、各プロセッサ毎にバリッド(V)ビット、変更(M)ビット及び不一致(IC)ビットを記憶させ、有効な変更信号MODの入力時点におけるMビットの状態に応じてFビットをセットするか否かを決定する。これにより、複数のプロセッサで共有されたラインに対して、複数のプロセッサから書き込みが起こったこと、即ち、フォルス・シェアリングが発生したことを自動的に検出することができる。更に、フォルス・シェアリングを検出すると、Fビットをセットして割り込み要求を発生させることができ、プログラムの実行を停止して、ソフトウエア不具合を解析させることが可能となる。なお、FSAレジスタとFレジスタとは、プロセッサからのロード命令で読み出すことも可能であり、ソフトウエアによって、どのアドレスのラインに対して、複数のプロセッサから書き込みがあったかを容易に把握することができる。これにより、ソフトウエアの不具合の検出が容易となり、開発効率を向上させることができる。 As described above, in the present embodiment, the refill signal RD, the write back invalid signal WBI, the change signal MOD, and the invalid signal INV are supplied from the L1 cache memory to the L2 cache memory, and each processor is validated in the L2 cache memory. The (V) bit, the change (M) bit, and the mismatch (IC) bit are stored, and it is determined whether or not to set the F bit according to the state of the M bit at the input time of the valid change signal MOD. As a result, it is possible to automatically detect that writing has occurred from a plurality of processors, that is, false sharing has occurred on a line shared by a plurality of processors. Further, when false sharing is detected, an interrupt request can be generated by setting the F bit, and execution of a program can be stopped to analyze a software fault. Note that the FSA register and the F register can also be read by a load instruction from the processor, and it is possible to easily grasp which address line has been written by a plurality of processors by software. . This facilitates detection of software defects and improves development efficiency.
このように本実施の形態においては、スヌープキャッシュを備えることなく、フォルス・シェアリングを検出することができる。本実施の形態では、L2キャッシュメモリの各ラインに各プロセッサに対応した2ビットの情報の記憶領域を追加するだけで構成することができ、ハードウェア規模の増加は僅かである。例えば、4プロセッサの場合には8ビットのみ追加すればよく、ラインサイズを32バイト(256ビット)、タグ部が22ビットのキャッシュでは、僅かに約2.9%のハードウエア増で済む。 Thus, in this embodiment, false sharing can be detected without providing a snoop cache. In the present embodiment, it is possible to configure by simply adding a 2-bit information storage area corresponding to each processor to each line of the L2 cache memory, and the increase in hardware scale is slight. For example, in the case of 4 processors, it is only necessary to add 8 bits. In a cache having a line size of 32 bytes (256 bits) and a tag portion of 22 bits, the hardware increase is only about 2.9%.
また、本実施の形態においては、制御回路及び更新情報領域によって構成されるエラー検出部をL2キャッシュメモリに内蔵した例について説明したが、状態検出部をL2キャッシュメモリとは別に設けてもよいことは明らかである。 In the present embodiment, the example in which the error detection unit configured by the control circuit and the update information area is built in the L2 cache memory has been described. However, the state detection unit may be provided separately from the L2 cache memory. Is clear.
11…L2キャッシュメモリ、13…メインメモリ、P1〜Pn…プロセッサ、C1〜Cn…プロセッサコア、M1〜Mn…L1キャッシュメモリ。
DESCRIPTION OF
Claims (5)
前記複数のプロセッサに夫々対応して設けられる第1のキャッシュメモリと、
複数の前記第1のキャッシュメモリに夫々設けられて、前記プロセッサによる前記第1のキャッシュメモリへのアクセスに応じた前記第1のキャッシュメモリの状態を検出して検出結果である状態信号を出力する出力部と、
前記プロセッサのアクセスの対象となるデータが、前記複数の第1のキャッシュメモリ及び前記複数のプロセッサに共通に設けられる第2のキャッシュメモリのうちの2つ以上のキャッシュメモリに格納されている場合において、前記アクセスの対象となるデータに対する前記プロセッサの書き込みによる更新データと書き込み前の未更新データとが存在するときには、前記未更新データが格納されている第1のキャッシュメモリであることを、前記状態信号に基づいて検出して、検出結果である変更情報を保持する変更情報保持部と、
前記状態信号及び変更情報に基づいて、前記未更新データが格納されている第1のキャッシュメモリに対して前記アクセスの対象となるデータに対する書き込み命令が発生したことを検出した場合には、検出出力を出力するエラー検出手段と
を具備したことを特徴とするマルチプロセッサシステム。 In a multiprocessor system composed of a plurality of processors,
A first cache memory provided corresponding to each of the plurality of processors;
Provided in each of the plurality of first cache memories, detects the state of the first cache memory according to the access to the first cache memory by the processor, and outputs a status signal as a detection result An output section;
In a case where data to be accessed by the processor is stored in two or more cache memories of the plurality of first cache memories and the second cache memory provided in common to the plurality of processors. When the update data written by the processor with respect to the data to be accessed and unupdated data before writing exist, the state is determined to be the first cache memory storing the unupdated data. A change information holding unit that detects based on the signal and holds change information that is a detection result;
Based on the status signal and the change information, when it is detected that a write command for the data to be accessed is generated in the first cache memory in which the unupdated data is stored, the detection output An error detection means for outputting
ことを特徴とする請求項1に記載のマルチプロセッサシステム。 The multiprocessor system according to claim 1, wherein the change information holding unit and the error detection unit are built in the second cache memory.
ことを特徴とする請求項1に記載のマルチプロセッサシステム。 The multiprocessor system according to claim 1, wherein the error detection unit generates an interrupt request to the processor as the detection output.
ことを特徴とする請求項1に記載のマルチプロセッサシステム。 The multiprocessor system according to claim 1, wherein when a detection output is output by the error detection unit, a write address of data to be accessed is stored in a register.
前記変更情報保持部は、前記変更情報の他に、前記複数の第1のキャッシュメモリに有効なデータが格納されていることを示す有効情報を前記第1のキャッシュメモリ毎に保持する領域を含み、
前記リフィル信号に基づいて前記有効情報をセットすると共に、前記変更信号に基づいて前記有効情報がセットされた前記第1のキャッシュメモリに対応させて前記変更情報をセットする
ことを特徴とする請求項1に記載のマルチプロセッサシステム。 The status signal includes a change signal indicating that writing was first performed on the target line of the first cache memory and a refill signal indicating a refill request to the target line,
The change information holding unit includes, in addition to the change information, an area for holding valid information indicating that valid data is stored in the plurality of first cache memories for each of the first cache memories. ,
The valid information is set based on the refill signal, and the change information is set corresponding to the first cache memory in which the valid information is set based on the change signal. 2. The multiprocessor system according to 1.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007011816A JP2008176731A (en) | 2007-01-22 | 2007-01-22 | Multiprocessor system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007011816A JP2008176731A (en) | 2007-01-22 | 2007-01-22 | Multiprocessor system |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2008176731A true JP2008176731A (en) | 2008-07-31 |
Family
ID=39703683
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2007011816A Pending JP2008176731A (en) | 2007-01-22 | 2007-01-22 | Multiprocessor system |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2008176731A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011141657A (en) * | 2010-01-06 | 2011-07-21 | Yokogawa Electric Corp | Data processor |
US9058270B2 (en) | 2011-06-24 | 2015-06-16 | International Business Machines Corporation | False sharing detection logic for performance monitoring |
-
2007
- 2007-01-22 JP JP2007011816A patent/JP2008176731A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011141657A (en) * | 2010-01-06 | 2011-07-21 | Yokogawa Electric Corp | Data processor |
US9058270B2 (en) | 2011-06-24 | 2015-06-16 | International Business Machines Corporation | False sharing detection logic for performance monitoring |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9513904B2 (en) | Computer processor employing cache memory with per-byte valid bits | |
JP5100176B2 (en) | Multiprocessor system | |
JP4613247B2 (en) | Arithmetic processing apparatus, information processing apparatus, and control method for arithmetic processing apparatus | |
JP4764360B2 (en) | Techniques for using memory attributes | |
US5696937A (en) | Cache controller utilizing a state machine for controlling invalidations in a network with dual system busses | |
US20080005504A1 (en) | Global overflow method for virtualized transactional memory | |
JP2002373115A (en) | Replacement control method for shared cache memory and device therefor | |
US6950909B2 (en) | System and method for reducing contention in a multi-sectored cache | |
US6665767B1 (en) | Programmer initiated cache block operations | |
US20090019306A1 (en) | Protecting tag information in a multi-level cache hierarchy | |
US20210103493A1 (en) | Memory interface having data signal path and tag signal path | |
WO2013084314A1 (en) | Processing unit and method for controlling processing unit | |
KR20200002932A (en) | Apparatus and method for managing entitlement metadata | |
US20110082981A1 (en) | Multiprocessing circuit with cache circuits that allow writing to not previously loaded cache lines | |
JP2004030000A (en) | Hit judgement control method for shared cache memory, and hit judgement control system for shared cache memory | |
US7478203B2 (en) | Technique for eliminating dead stores in a processor | |
JP5319049B2 (en) | Cash system | |
US7577791B2 (en) | Virtualized load buffers | |
JP2007156821A (en) | Cache system and shared secondary cache | |
US20100131718A1 (en) | Multiprocessor system | |
JP2008176731A (en) | Multiprocessor system | |
KR100380674B1 (en) | Method and system for maintaining cache coherency for write-through store operations in a multiprocessor system | |
JPH03163640A (en) | Multi-processor system and cache memory used therefor | |
US20050273563A1 (en) | System and method for canceling write back operation during simultaneous snoop push or snoop kill operation in write back caches | |
US9436613B2 (en) | Central processing unit, method for controlling central processing unit, and information processing apparatus |