JP2011192012A - Data processing system and access control method - Google Patents

Data processing system and access control method Download PDF

Info

Publication number
JP2011192012A
JP2011192012A JP2010057397A JP2010057397A JP2011192012A JP 2011192012 A JP2011192012 A JP 2011192012A JP 2010057397 A JP2010057397 A JP 2010057397A JP 2010057397 A JP2010057397 A JP 2010057397A JP 2011192012 A JP2011192012 A JP 2011192012A
Authority
JP
Japan
Prior art keywords
data
area
pointer
value
counter register
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
Application number
JP2010057397A
Other languages
Japanese (ja)
Inventor
Yusuke Fukumura
裕祐 福村
Yuji Kojima
佑治 小嶋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP2010057397A priority Critical patent/JP2011192012A/en
Publication of JP2011192012A publication Critical patent/JP2011192012A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To access data inside a memory at a high speed using a data structure including a pointer. <P>SOLUTION: In a computer system including the memory provided with a structure area for storing a plurality of structures and a data area for storing data, each structure includes a pointer for specifying the data stored in the data area, a data cache area for temporarily holding the data which are present in the data area and accessed once using the pointer, a flag for indicating that the data held in the data cache area are valid, and a counter value for holding the value of a counter register each time the value of the counter register is updated. When accessing the data inside the memory, the contents of the counter register and the counter value of the structure are verified, and the data inside the data cache area inside the structure or inside the data area specified by the pointer are accessed according to the verification results. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、データ処理システム及びアクセス制御方法に係り、特にデータプロセッサ及びメモリを有するデータ処理システムにおいて、データ構造体(以下単に構造体という)を用いてメモリをアクセスする制御に関する。   The present invention relates to a data processing system and an access control method, and more particularly to control for accessing a memory using a data structure (hereinafter simply referred to as a structure) in a data processing system having a data processor and a memory.

近年、コンピュータ分野だけでなく、組み込みマイコンを使用した電子機器においても、C言語等の高級言語によるソフトウェア開発が一般的に行われている。高級言語によるソフトウェア開発において、構造体やポインタの使用は開発効率や品質を向上させる上で重要である。   In recent years, not only in the computer field, but also in electronic devices using embedded microcomputers, software development using high-level languages such as C language is generally performed. In software development using a high-level language, the use of structures and pointers is important for improving development efficiency and quality.

例えば、図1に示すように、構造体とポインタを用いたデータ構造がメモリ上に存在する場合を考える。構造体中にはポインタ変数がメンバとして存在するので、そのポインタが指す幾つかのメモリアドレスを手繰り、最後に実際のデータにたどり着く。この場合、実際のデータにアクセスするためには、構造体にアクセス後、ポインタの段数分のメモリアクセス回数が必要になる。そのため、実際のデータにアクセスできるまでに、多くの時間がかかり、これによる性能低下が問題となることがある。   For example, consider a case where a data structure using a structure and a pointer exists in a memory as shown in FIG. Since a pointer variable exists as a member in the structure, several memory addresses pointed to by the pointer are processed, and finally the actual data is reached. In this case, in order to access the actual data, the number of memory accesses corresponding to the number of stages of the pointer is required after accessing the structure. Therefore, it takes a long time to access the actual data, and this may cause a problem of performance degradation.

この問題を解決する1つの方法として、データを使用する側が高速にアクセスできるハードウェアキャッシュを備えることもできるが、ハードウェアコストが多くかかるという問題がある。
なお、ポインタを用いたメモリ構造体の例としては、特許文献1に開示されたものが知られ、また、データキャッシュの例としては、特許文献1に開示のものが知られている。
One way to solve this problem is to provide a hardware cache that can be accessed at high speed by the data user, but there is a problem that the hardware cost is high.
As an example of a memory structure using a pointer, one disclosed in Patent Document 1 is known, and as an example of a data cache, one disclosed in Patent Document 1 is known.

特開2003−256267公報JP 2003-256267 A 特開2001−43130公報JP 2001-43130 A

上記のように、ポインタを用いたデータ構造では、データにアクセスするために複数回のメモリアクセスが必要となるため、多くの時間を要し、コンピュータシステムの性能が低下する。
そこで、本発明の目的は、データ構造体を用いたデータ処理システムにおいて、メモリ内のデータに高速にアクセスすることにある。
As described above, the data structure using the pointer requires a plurality of memory accesses in order to access the data. Therefore, it takes a lot of time and the performance of the computer system is deteriorated.
Therefore, an object of the present invention is to access data in a memory at high speed in a data processing system using a data structure.

本発明に係るコンピュータシステムは、好ましくは、構造体が持つポインタを用いて、記憶部内のデータをアクセスすることができるコンピュータシステムにおいて、
該記憶部は、複数の該構造体を記憶する構造体領域と、データを記憶するデータ領域を有し、
該ポインタが指すデータ領域内のあるデータが変更されたときに、その値が更新されるカウンタレジスタを備えると共に、
データ領域に記憶されたデータを指定するポインタと、該ポインタを用いてアクセスされた該データ領域にあるデータを一時的に保持するデータキャッシュ領域と、該カウンタレジスタの値が更新される度に該カウンタレジスタの値を保持するカウンタ値を有する該構造体を備え、
該記憶部内のデータにアクセスする時に、該カウンタレジスタの内容と該構造体の該カウンタ値を照合し、該照合の結果に応じて、該構造体内の該データキャッシュ領域又は該ポインタによって指定されるデータ領域のデータにアクセスすることを特徴とするデータ処理システムとして構成される。
The computer system according to the present invention is preferably a computer system that can access data in a storage unit using a pointer held by a structure.
The storage unit includes a structure area that stores a plurality of the structures and a data area that stores data.
A counter register whose value is updated when certain data in the data area pointed to by the pointer is changed;
A pointer that specifies data stored in the data area, a data cache area that temporarily holds data in the data area accessed using the pointer, and a counter register value that is updated each time the value of the counter register is updated Comprising the structure having a counter value holding a value of a counter register;
When accessing the data in the storage unit, the contents of the counter register and the counter value of the structure are collated, and specified by the data cache area or the pointer in the structure according to the result of the collation The data processing system is characterized by accessing data in the data area.

好ましい例においては、該記憶部内のデータにアクセスする時に、該カウンタレジスタの内容と該構造体の該カウンタ値を照合して、照合の結果、両者が一致する場合には、該構造体内の該データキャッシュ領域内に記憶されたデータを使用し、不一致の場合には、該ポインタによって指定されるデータ領域内のデータを使用する。
また、好ましくは、該ポインタを用いてデータ領域内のデータをアクセスした場合、取得された該データを該データキャッシュ領域に保持し、かつ該カウンタレジスタの値を該構造体の該カウンタ値に保存する。
また、好ましくは、該構造体は、該データキャッシュ領域に保持されたデータが有効又は無効であることを示すフラグを有し、該ポインタが指定する該データ領域のデータが変更された場合、該フラグを無効の状態にする。
また、好ましくは、複数の該構造体が記憶される構造体領域のエントリ数が該カウンタレジスタによって表される最大値よりも大きい場合、該カウンタレジスタの値が一周する前に全ての該エントリを無効化するように、一定の複数ずつの構造体の該フラグを無効の状態にセットする。
In a preferred example, when accessing the data in the storage unit, the contents of the counter register are compared with the counter value of the structure. The data stored in the data cache area is used, and if there is a mismatch, the data in the data area specified by the pointer is used.
Preferably, when the data in the data area is accessed using the pointer, the acquired data is stored in the data cache area, and the value of the counter register is stored in the counter value of the structure. To do.
Preferably, the structure has a flag indicating that the data held in the data cache area is valid or invalid, and the data area specified by the pointer is changed when the data area is changed. Set the flag to an invalid state.
Preferably, when the number of entries in the structure area in which a plurality of the structures are stored is larger than the maximum value represented by the counter register, all the entries are deleted before the counter register makes one round. In order to invalidate, the flag of a certain plurality of structures is set to an invalid state.

また、好ましい例では、該コンピュータシステムは、ネットワークに接続されるネットワークカードと、データ処理するCPUと、前記構造体領域及び前記データ領域を有するメインメモリを有し、
前記構造体は、複数の送信相手のそれぞれに対応した制御情報を保持し、
前記カウンタレジスタは、該ネットワークカード内に設けられ、
前記データ領域は各送信相手に対する経路情報を記憶し、かつ、前記データキャッシュ領域は、ポインタで指定されたデータ領域内の該経路情報を保持し、
ある送信相手へデータを送信する場合、該ネットワークカードは該送信相手に対する制御情報の構造体を、DMA転送で該メインメモリ内の構造体領域から読み出し、さらに該データキャッシュ領域又は該構造体内の該ポインタを用いて、DMA転送で該データ領域から経路情報を読み出す。
In a preferred example, the computer system includes a network card connected to a network, a CPU for processing data, and a main memory having the structure area and the data area.
The structure holds control information corresponding to each of a plurality of transmission partners,
The counter register is provided in the network card;
The data area stores path information for each transmission partner, and the data cache area holds the path information in the data area designated by the pointer,
When transmitting data to a transmission partner, the network card reads the structure of control information for the transmission partner from the structure area in the main memory by DMA transfer, and further, the data cache area or the structure in the structure. Using the pointer, the path information is read from the data area by DMA transfer.

また、好ましい例では、データを記憶する外部低速記録媒体が接続され、かつデータ処理するCPUと、該データ領域及び該構造体領域を持つメモリを有するコンピュータシステムであって、前記ポインタは該外部低速記録媒体に記憶されるデータを指定し、かつ前記データキャッシュ領域は、該外部低速記録媒体に記憶されるデータを保持する。   In a preferred example, the external low-speed recording medium for storing data is connected, and the computer system has a CPU for processing data and a memory having the data area and the structure area, and the pointer is the external low-speed recording medium. The data stored in the recording medium is designated, and the data cache area holds the data stored in the external low-speed recording medium.

本発明に係るアクセス制御方法は、好ましくは、複数の該構造体を記憶する構造体領域と、データを記憶するデータ領域を有する記憶部内のデータに、構造体が持つポインタを用いてアクセスすることができるアクセス制御方法であって、
該構造体は、データ領域に記憶されたデータを指定するポインタと、該ポインタを用いてアクセスされた該データ領域にあるデータを一時的に保持するデータキャッシュ領域を有し、
該記憶部をアクセスする時に、該構造体の該データキャッシュ領域に記憶されたデータが有効であれば、該データキャッシュ領域より該データを得、
該構造体の該データキャッシュ領域に記憶されたデータが有効でなければ、該ポインタを用いて該データ領域をアクセスしてデータを得ることを特徴とするアクセス制御方法として構成される。
In the access control method according to the present invention, preferably, data in a storage unit having a structure area for storing a plurality of the structures and a data area for storing data is accessed using a pointer of the structure. An access control method that can
The structure has a pointer that specifies data stored in the data area, and a data cache area that temporarily holds data in the data area accessed using the pointer,
If the data stored in the data cache area of the structure is valid when accessing the storage unit, the data is obtained from the data cache area,
If the data stored in the data cache area of the structure is not valid, the access control method is configured to obtain data by accessing the data area using the pointer.

好ましい例によれば、本発明のアクセス制御方法は、複数の該構造体を記憶する構造体領域と、データを記憶するデータ領域を有する記憶部内のデータに、構造体が持つポインタを用いてアクセスするアクセス制御方法であって、
該構造体は、データ領域に記憶されたデータを指定するポインタと、該ポインタを用いてアクセスされた該データ領域にあるデータを一時的に保持するデータキャッシュ領域と、該カウンタレジスタの値が更新される度に該カウンタレジスタの値を保持するカウンタ値を有し、
該記憶部内のデータにアクセスする時に、該ポインタが指すデータ領域内のあるデータが変更されたときにその値が更新される該カウンタレジスタの内容と、該構造体の該カウンタ値を照合し、該照合の結果に応じて、該構造体内の該データキャッシュ領域又は該ポインタによって指定されるデータ領域のデータにアクセスすることを特徴とするアクセス制御方法である。
According to a preferred example, the access control method of the present invention accesses a data in a storage unit having a structure area for storing a plurality of the structures and a data area for storing data using a pointer of the structure. An access control method,
The structure includes a pointer for designating data stored in the data area, a data cache area for temporarily holding data in the data area accessed using the pointer, and a value of the counter register updated. A counter value that holds the value of the counter register each time
When accessing data in the storage unit, the contents of the counter register, whose value is updated when some data in the data area pointed to by the pointer is changed, are compared with the counter value of the structure; According to the result of the collation, the access control method is characterized in that the data in the data cache area in the structure or the data area specified by the pointer is accessed.

本発明によれば、ポインタを備えたデータ構造を用いてメモリ内のデータに高速にアクセスすることが可能となる。   According to the present invention, data in a memory can be accessed at high speed using a data structure having a pointer.

ポインタを用いたデータ構造体を示す図。The figure which shows the data structure using a pointer. 一実施例におけるデータ構造体の構成とその配列、及びキャッシュの制御を示す図。The figure which shows the structure of the data structure in one Example, its arrangement | sequence, and control of a cache. 一実施例におけるデータ更新時のキャッシュ無効化を示す図。The figure which shows the cache invalidation at the time of the data update in one Example. 一実施例によるコンピュータシステムの構成を示すブロック図。The block diagram which shows the structure of the computer system by one Example. 一実施例における構造体の例を示す図。The figure which shows the example of the structure in one Example. 一実施例による経路情報の更新時の動作を示すフローチャート。The flowchart which shows the operation | movement at the time of the update of the route information by one Example. 一実施例によるネットワークカードが経路情報を使用する場合の動作を示すフローチャート。The flowchart which shows operation | movement in case the network card by one Example uses route information. 一実施例によるコンピュータシステムにおけるデータの書込み動作を示す図。The figure which shows the write-in operation | movement of the data in the computer system by one Example. 一実施例によるコンピュータシステムにおけるデータの読出し動作を示す図。The figure which shows the read-out operation | movement in the computer system by one Example.

以下、図面を用いて本発明の実施例を具体的に説明する。   Embodiments of the present invention will be specifically described below with reference to the drawings.

図2は、データ構造体の構成とその配列、及びキャッシュの制御を示す。
コンピュータシステムにおけるメインメモリ等の記憶ユニットに、複数の構造体を格納する構造体領域21と、構造体のポインタによるアクセス先となるデータを格納するデータ領域22が確保される。複数の各構造体210は例えば送信先ごとに用意される。
各構造体210は、データが格納されたアドレスを示すポインタ211、アクセスされたデータ領域のデータを保持するデータキャッシュ領域213、そのキャッシュデータが有効であることを示すVビット212、カウンタ値214の各フィールドを有する。各構造体210は例えば64バイトのように同じ固定長の記憶容量を持つ。また、データキャッシュ領域213の記憶容量は一律に例えば16バイトの如きである。
FIG. 2 shows the structure of the data structure, its arrangement, and cache control.
In a storage unit such as a main memory in the computer system, a structure area 21 for storing a plurality of structures and a data area 22 for storing data to be accessed by a pointer of the structure are secured. The plurality of structures 210 are prepared for each transmission destination, for example.
Each structure 210 includes a pointer 211 indicating an address where data is stored, a data cache area 213 holding data in the accessed data area, a V bit 212 indicating that the cache data is valid, and a counter value 214. It has each field. Each structure 210 has the same fixed-length storage capacity such as 64 bytes. The storage capacity of the data cache area 213 is uniformly 16 bytes, for example.

最初(1回目)、構造体210内にデータが存在しない場合、構造体のポインタ211を使用して、そのポインタで指定されるデータ領域22内のアドレスのデータを取得する。その取得したデータをデータキャッシュ領域213のフィールドに保存する。これにより2回目以降のデータのアクセスは、ポインタを使用せずに、構造体210内のキャッシュ領域213このフィールドからデータを読めばよいことになる。
Vビット212は、データキャッシュ領域213のデータが有効か否かを表す。即ち、実際のデータをデータキャッシュ領域213に保存するときに、Vビットを「1」とし、また、実際のデータが変更された場合などの理由でデータキャッシュ領域213の内容を無効にしたいときにVビットを「0」とする。
First (first time), when data does not exist in the structure 210, the data of the address in the data area 22 designated by the pointer is acquired using the pointer 211 of the structure. The acquired data is stored in the field of the data cache area 213. As a result, the second and subsequent data accesses can be performed by reading the data from this field in the cache area 213 in the structure 210 without using the pointer.
The V bit 212 indicates whether the data in the data cache area 213 is valid. That is, when the actual data is stored in the data cache area 213, the V bit is set to “1”, and the contents of the data cache area 213 are invalidated because the actual data has been changed. The V bit is set to “0”.

構造体内のデータを読む側例えばプロセッサには、高速にアクセスできるカウンタレジスタ24が用意される。カウンタ値214とカウンタレジスタ24とは、構造体内のデータキャッシュ領域213の値と、ポインタ211が実際に指すメモリアドレスに対応するデータ領域22内のデータとの一貫性を保つために必要となるものである。そのため、カウンタ値214とカウンタレジスタ24の内容を比較する比較器25が用いられる。比較器25はハードウェアで構成するか或いはソフトウェアで用意してもよい。
ポインタが指すメモリアドレスに存在する実際のデータを変更した際、構造体210内のデータキャッシュ213の値は、古い値となり、そのデータは使ってはいけないことになる。そのため、構造体内のVビット212を「0」にして、データキャッシュ213の内容を無効にする。
A counter register 24 that can be accessed at high speed is prepared on the side that reads data in the structure, for example, a processor. The counter value 214 and the counter register 24 are necessary to maintain consistency between the value in the data cache area 213 in the structure and the data in the data area 22 corresponding to the memory address actually pointed to by the pointer 211. It is. Therefore, a comparator 25 that compares the counter value 214 with the contents of the counter register 24 is used. The comparator 25 may be configured by hardware or prepared by software.
When actual data existing at the memory address pointed to by the pointer is changed, the value of the data cache 213 in the structure 210 becomes an old value, and the data cannot be used. Therefore, the V bit 212 in the structure is set to “0” to invalidate the contents of the data cache 213.

次に、データ領域22内のデータとデータキャッシュ領域213内のデータの一貫性保持の制御、及びVビット212の無効化制御について説明する。
Vビット212の無効化制御は、メモリ内に多数の構造体210が配列して存在している場合、それら全ての構造体210の要素である全てのVビット212を「0」に書き換えることで行われる。しかし、全てのVビットに「0」を書き込むには時間がかかり、コンピュータシステムの性能低下を招く。その対策として、データ領域22の変更した実際のデータをキャッシュしている構造体のみのVビットを「0」に書き換えることも考えられるが、全要素のポインタを手繰る必要があり、ポインタの段数が多い場合には現実的でない。
Next, control for maintaining consistency between data in the data area 22 and data in the data cache area 213 and invalidation control for the V bit 212 will be described.
The invalidation control of the V bit 212 is performed by rewriting all the V bits 212 that are elements of all the structures 210 to “0” when a large number of structures 210 exist in the memory. Done. However, it takes time to write “0” to all the V bits, resulting in a decrease in the performance of the computer system. As a countermeasure, it is conceivable to rewrite the V bit of only the structure caching the actual data changed in the data area 22 to “0”, but it is necessary to carry out the pointers of all elements, and the number of stages of the pointers When there are many, it is not realistic.

本実施例では、カウンタ値214を用いて性能の低下を回避する。その方法について以下説明する。ポインタ211が指すメモリアドレスに存在する実際のデータを読み、データキャッシュ領域213にそのデータを保存するときに、カウンタレジスタ24の値を構造体210内のカウンタ値214に保存する。また、ポインタが指すデータ領域22内のメモリアドレスに存在する実際のデータが変更したときには、カウンタレジスタ24の値がインクリメントされる。構造体21のデータキャッシュ領域213内のデータを用いる場合には、構造体内のカウンタ値214とカウンタレジスタ24の値を比較器25で比較し、その結果両者が一致した場合には、データキャッシュ領域内のデータは最新であると判断して、データキャッシュ領域内のデータを使用する。   In the present embodiment, the counter value 214 is used to avoid performance degradation. The method will be described below. When the actual data present at the memory address pointed to by the pointer 211 is read and stored in the data cache area 213, the value of the counter register 24 is stored in the counter value 214 in the structure 210. When the actual data existing at the memory address in the data area 22 pointed to by the pointer is changed, the value of the counter register 24 is incremented. When the data in the data cache area 213 of the structure 21 is used, the counter value 214 in the structure and the value of the counter register 24 are compared by the comparator 25. If the two match as a result, the data cache area The data in the data cache is determined to be the latest, and the data in the data cache area is used.

比較の結果、両者が一致しない場合には、データキャッシュ領域213内のデータは古いとみなし、ポインタ211を使ってデータ領域22から最新のデータを読み込み、そのデータを使用する。そして、以後のデータの使用のために、最新のデータをデータキャッシュ領域213に保存し、そのときのカウンタレジスタ24の値を構造体内のカウンタ値214に保存する。これにより、ポインタが指すメモリアドレスに存在する実際のデータを変更した際に、構造体内のデータを無効化する必要はない。   If they do not match as a result of the comparison, the data in the data cache area 213 is regarded as old, the latest data is read from the data area 22 using the pointer 211, and the data is used. Then, for the subsequent use of data, the latest data is stored in the data cache area 213, and the value of the counter register 24 at that time is stored in the counter value 214 in the structure. Thus, when the actual data existing at the memory address pointed to by the pointer is changed, it is not necessary to invalidate the data in the structure.

しかし、データ領域22のデータの変更回数が多い場合、カウンタのラップが起こり、構造体内のデータキャッシュが古いにも拘らず、構造体内のカウンタ値214とカウンタレジスタ24の値が等しくなってしまうことがあり得る。例えば、カウンタのビット幅が5ビットの場合、カウンタ値は32通りなので、33回目のカウント値は一周して「0」に戻るので、前回の「0」なのか、一周した後の「0」(実際には33に相当している)なのか、不明になり、Vビットの無効化制御が混乱する。   However, when the number of data changes in the data area 22 is large, counter wrapping occurs, and the counter value 214 in the structure and the value of the counter register 24 become equal even though the data cache in the structure is old. There can be. For example, if the bit width of the counter is 5 bits, there are 32 counter values, so the count value of the 33rd round goes around to return to “0”, so it is “0” after going round the previous “0”. (Actually corresponds to 33), it becomes unclear and the invalidation control of the V bit is confused.

そこで、カウンタレジスタ24の値が一周する前に、複数全ての構造体210内のデータキャッシュ領域213を無効にするように制御すればよい。つまり、実際のデータを更新した場合に更新した側が複数のVビットを「0」にするように制御する。
例えば、カウンタレジスタのビット幅が5ビット、構造体のエントリ数が256の場合、32通りのカウンタ値が一周する時点で全エントリを無効化制御する。図3に示すように、256/32=8エントリを1回の更新で無効化制御する。これにより1回の更新で全て構造体のVビットを「0」に書き換えて、データキャッシュ領域内のデータを無効化する必要がなくなり、性能の低下を防ぐことができる。
Therefore, control may be performed so that the data cache areas 213 in all the plurality of structures 210 are invalidated before the value of the counter register 24 goes around. That is, when the actual data is updated, the updated side controls the plurality of V bits to “0”.
For example, when the bit width of the counter register is 5 bits and the number of structure entries is 256, all entries are controlled to be invalidated when 32 counter values go around. As shown in FIG. 3, 256/32 = 8 entries are invalidated by one update. As a result, it is not necessary to rewrite the V bits of all structures to “0” in one update and invalidate the data in the data cache area, thereby preventing performance degradation.

図4を参照して、コンピュータシステムにおける構造体のメモリアクセス制御について説明する。
このコンピュータシステム4は、データ処理するCPU41と、CPUにバスにより接続されるメインメモリ42と、CPUにチップセット43を介して接続されるネットワークカード44を有して構成される。ネットワークカード44はネットワーク9に接続される。メインメモリ42には、図2に示すような、複数の構造体21及びデータ領域22が形成される。ネットワークカード44内のコントローラLSI内にはハードウェアとしてカウンタレジスタ45が用意される。
図中の点線(矢印)はDMA書き込み、DMA読み出しのルートを表す。これらは、CPU41をルートとして通るが、CPUに内蔵されたメモリコントローラが処理を行うため、CPU中の命令がDMA処理により阻害されることはない。
With reference to FIG. 4, the memory access control of the structure in the computer system will be described.
The computer system 4 includes a CPU 41 for data processing, a main memory 42 connected to the CPU via a bus, and a network card 44 connected to the CPU via a chipset 43. The network card 44 is connected to the network 9. In the main memory 42, a plurality of structures 21 and data areas 22 are formed as shown in FIG. A counter register 45 is prepared as hardware in the controller LSI in the network card 44.
The dotted lines (arrows) in the figure represent the DMA write and DMA read routes. These pass through the CPU 41 as a route, but since a memory controller built in the CPU performs processing, instructions in the CPU are not hindered by DMA processing.

図5も参照して、構造体21について説明する。ネットワークカード44においてネットワーク9へ送信する場合の、送信相手に関する制御情報が構造体21として用意される。通常、複数の送信相手が存在するので、それらの送信相手に対応して複数のエントリ分の構造体が保持される。各送信相手に対する経路情報は、制御情報を保持する構造体とは別に管理される、メインメモリ42のデータ領域22に格納されている。ポインタ211は、その経路情報が格納されているデータ領域22のアドレスを指している。
ある送信相手へデータを送信する場合、ネットワークカード44はその送信相手に対する制御情報の構造体21を、DMA転送でメインメモリ42から読み出し、さらにその構造体内のポインタ211を用いて、DMA転送でメインメモリ42のデータ領域22から経路情報を読み出す必要がある。ここで、構造体21のデータキャッシュ領域213に経路情報を保持しておき、制御情報の構造体を読む時に、経路情報も高速にアクセスできるようにする。これにより、送信時に経路情報を読む時間を短縮することができ、送信動作の高速化が図れる。
The structure 21 will be described with reference to FIG. Control information relating to a transmission partner when the network card 44 transmits to the network 9 is prepared as the structure 21. Usually, since there are a plurality of transmission partners, a structure for a plurality of entries is held corresponding to the transmission partners. The path information for each transmission partner is stored in the data area 22 of the main memory 42 managed separately from the structure holding the control information. The pointer 211 points to the address of the data area 22 where the path information is stored.
When transmitting data to a transmission partner, the network card 44 reads the control information structure 21 for the transmission partner from the main memory 42 by DMA transfer, and further uses the pointer 211 in the structure to perform main transfer by DMA transfer. It is necessary to read path information from the data area 22 of the memory 42. Here, path information is held in the data cache area 213 of the structure 21 so that the path information can be accessed at high speed when the control information structure is read. As a result, it is possible to reduce the time for reading the route information at the time of transmission, and to increase the speed of the transmission operation.

次に図6を参照して、図5のコンピュータシステムにおけるCPU41が経路情報を変更する場合の処理動作について説明する。
メインメモリ42のデータ領域22内に記憶されている経路情報が更新されると(S602)、ネットワークカード44内のカウンタレジスタ45がインクリメントされる(S603)。次に、幾つかの構造体21中のVビットを「0」にしてキャッシュを無効化する(S604)。この無効化制御の動作は前述した通りである。その後、経路情報の更新処理を終了する(S605)。
Next, a processing operation when the CPU 41 in the computer system of FIG. 5 changes the route information will be described with reference to FIG.
When the path information stored in the data area 22 of the main memory 42 is updated (S602), the counter register 45 in the network card 44 is incremented (S603). Next, the V bit in some structures 21 is set to “0” to invalidate the cache (S604). The invalidation control operation is as described above. Thereafter, the route information update process is terminated (S605).

次に、図7を参照して、ネットワークカードが経路情報を使用する場合の処理について説明する。
経路情報の使用処理が開始されると(S701)、メインメモリ42から制御情報の構造体210をDMA転送で読み出す(S702)。そして、Vビットをチェックした結果、Vビットが「1」であり、かつ、構造体内のカウンタ値214とネットワークカード44内のカウンタレジスタ45の値を比較して、両者の値が一致したら、データキャッシュ領域213内データを最新と見なして、データキャッシュ領域内のデータ(経路情報)を使用する(S704)。
Next, with reference to FIG. 7, a process when the network card uses route information will be described.
When the path information use process is started (S701), the control information structure 210 is read from the main memory 42 by DMA transfer (S702). Then, as a result of checking the V bit, if the V bit is “1” and the counter value 214 in the structure is compared with the value of the counter register 45 in the network card 44, the two values match. Data in the cache area 213 is regarded as the latest, and data (path information) in the data cache area is used (S704).

一方、Vビットが「1」でなく、上記比較の結果、両者が一致しない場合には、データキャッシュ領域内のデータ(経路情報)は最新でないため、構造体210内のポインタ211を使用して、当該ポインタが示すメインメモリ42のデータ領域22のアドレスに記憶されたデータをDMA転送で読み出してそれを使用する(S705)。その場合、最新の経路情報は、構造体210内のデータキャッシュ領域213に保管し、同時にそのときのカウンタレジスタ45の値を構造体210内のカウンタ値214にコピーする。併せてVビットを「1」にする(S706)。その後、使用したその構造体210を、DMA転送でメインメモリ42に書き戻す(S707)。   On the other hand, if the V bit is not “1” and the result of the comparison is that they do not match, the data (path information) in the data cache area is not up-to-date, so the pointer 211 in the structure 210 is used. The data stored at the address of the data area 22 of the main memory 42 indicated by the pointer is read out by DMA transfer and used (S705). In this case, the latest path information is stored in the data cache area 213 in the structure 210, and at the same time, the value of the counter register 45 at that time is copied to the counter value 214 in the structure 210. At the same time, the V bit is set to “1” (S706). Thereafter, the used structure 210 is written back to the main memory 42 by DMA transfer (S707).

図8及び9を参照して、外部低速媒体を用いたデータ処理システムにおけるデータの書き込み及び読み出しの例について説明する。
最近、SDカードや光学ドライブなどの外部低速媒体の大容量化が進み、これまでのようなHDD(ハードディスクドライブ)にOS(オペレーティングシステム)を入れるだけでなく、外部低速媒体にOSを入れて、外部低速媒体から起動することが提唱されている。
An example of data writing and reading in a data processing system using an external low-speed medium will be described with reference to FIGS.
Recently, the capacity of external low-speed media such as SD cards and optical drives has been increased, and not only OS (operating system) is put in HDD (hard disk drive) like before, but also OS is put in external low-speed media, It has been proposed to start from an external low-speed medium.

例えば、図8に示すように、CPU81とメモリ(メインメモリ)82を有するマイクロプロセッサのようなコンピュータ80と、外部低速記録媒体88とが接続されたコンピュータシステムにおいて、メモリ82内に複数の構造体821を持つ。この場合、低速記憶媒体にあるポインタをたどっていくと、同じ低速記録媒体88にデータが存在し、そのデータをアクセスする際、CPU81がメモリ82にアクセスするのに比べて、非常に遅くなってしまう。   For example, in a computer system in which a computer 80 such as a microprocessor having a CPU 81 and a memory (main memory) 82 and an external low-speed recording medium 88 are connected as shown in FIG. 821 is held. In this case, if the pointer in the low-speed storage medium is followed, the data exists in the same low-speed recording medium 88, and when accessing the data, the CPU 81 is much slower than accessing the memory 82. End up.

本発明は、ポインタと、外部低速媒体88中のデータを保管するキャッシュ領域と、当該キャッシュ領域のデータの有効、無効を示すVビットと、データが最新であるかどうかを示すカウンタ値を1つの構造体として構成し、この構造体をコンピュータ80内のメモリ82の一部に保持することによって、外部低速媒体に対するアクセスの高速化を可能とする。   The present invention provides a pointer, a cache area for storing data in the external low-speed medium 88, a V bit indicating validity / invalidity of data in the cache area, and a counter value indicating whether the data is the latest. By configuring as a structure and holding this structure in a part of the memory 82 in the computer 80, it is possible to speed up access to an external low-speed medium.

以下、図8及び図9を参照して、データの書込み及び読出しの動作について説明する。
図8に示すように、データ書き込み時はCPU81が外部低速媒体に直接データを書き込む(S801)。この時、メモリ82内のキャッシュデータと外部低速媒体88中のデータは異なり、それに対応するポインタのキャッシュデータは正しいデータではなくなるため、メモリ82内キャッシュデータを使わないようにしなければならない。このような場合、CPU81とメモリ82で構成されたソフトウェアカウンタ85をインクリメントして、最新のキャッシュでないことを表す(S802)。
そして、ソフトウェアカウンタ85がオーバーフローし、ラップアラウンドするため、最新のデータがキャッシュされていないにも拘らず、最新であると判定される場合がある。そのため、ソフトウェアカウンタがラップアラウンドするまでに構造体の全エントリのVビットが無効と判定されていれば上記のケースがなくなる。これより、全エントリ/ソフトウェアカウンタの最大値+1の分だけ構造体のVビットを無効とする(S803)。
Hereinafter, data writing and reading operations will be described with reference to FIGS.
As shown in FIG. 8, when writing data, the CPU 81 writes data directly to the external low-speed medium (S801). At this time, the cache data in the memory 82 and the data in the external low-speed medium 88 are different, and the cache data of the pointer corresponding thereto is not correct data. Therefore, the cache data in the memory 82 must not be used. In such a case, the software counter 85 constituted by the CPU 81 and the memory 82 is incremented to indicate that it is not the latest cache (S802).
Since the software counter 85 overflows and wraps around, it may be determined that the latest data is not cached even though the latest data is not cached. Therefore, if the V bit of all entries of the structure is determined to be invalid before the software counter wraps around, the above case is eliminated. Thus, the V bit of the structure is invalidated by the maximum value + 1 of all entries / software counter (S803).

次に、図9のように、ポインタに対応するデータ読み込み時に、必要なポインタの構造体にキャッシュされているデータが最新かどうかを判定するために、Vビットが有効(1である)であり、かつ構造体の中のカウンタ値とソフトウェアカウンタ85の値を比較して両者が一致するかをチェックする(S804)。チェックの結果、両者が一致した場合、最新の正しいデータがこの構造体にキャッシュされていると判断して、キャッシュされているデータを読み出す(S805)。   Next, as shown in FIG. 9, the V bit is valid (is 1) in order to determine whether or not the data cached in the necessary pointer structure is the latest when reading the data corresponding to the pointer. In addition, the counter value in the structure and the value of the software counter 85 are compared to check whether they match (S804). If they match as a result of the check, it is determined that the latest correct data is cached in this structure, and the cached data is read (S805).

一方、構造体のVビットが無効(0である)であり、または構造体の中のカウンタ値とソフトウェアカウンタの値とが一致しない場合、最新のデータがその構造体にないと判断して、構造体にあるポインタをたどって低速記録媒体からデータを読み出す(S805´)。
そして、低速記録媒体からデータを読み出した後、読み出したデータをキャッシュし、次回同じデータを読み出すようにする。そのために、読み出したデータを構造体のキャッシュにコピーし、ソフトウェアカウンタの値を構造体のカウンタ値にコピーする。そしてVビットを有効にする(S806´)。
On the other hand, if the V bit of the structure is invalid (it is 0) or the counter value in the structure and the value of the software counter do not match, it is determined that the latest data is not in the structure, Following the pointer in the structure, data is read from the low-speed recording medium (S805 ').
Then, after reading data from the low-speed recording medium, the read data is cached and the same data is read next time. For this purpose, the read data is copied to the structure cache, and the software counter value is copied to the structure counter value. Then, the V bit is validated (S806 ′).

21,210:構造体 22:データ領域 211:ポインタ
212:Vビット 213:データキャッシュ領域 214:カウンタ値
24:カウンタレジスタ 25:比較器
4:コンピュータシステム 41:CPU 42:メインメモリ
43:チップセット 44:ネットワークカード 45:カウンタレジスタ。
21, 210: Structure 22: Data area 211: Pointer
212: V bit 213: Data cache area 214: Counter value 24: Counter register 25: Comparator 4: Computer system 41: CPU 42: Main memory
43: Chipset 44: Network card 45: Counter register.

Claims (10)

構造体が持つポインタを用いて、記憶部内のデータをアクセスすることができるコンピュータシステムにおいて、
該記憶部は、複数の該構造体を記憶する構造体領域と、データを記憶するデータ領域を有し、
該ポインタが指すデータ領域内のあるデータが変更されたときに、その値が更新されるカウンタレジスタを備えると共に、
データ領域に記憶されたデータを指定するポインタと、該ポインタを用いてアクセスされた該データ領域にあるデータを一時的に保持するデータキャッシュ領域と、該カウンタレジスタの値が更新される度に該カウンタレジスタの値を保持するカウンタ値を有する該構造体を備え、
該記憶部内のデータにアクセスする時に、該カウンタレジスタの内容と該構造体の該カウンタ値を照合し、該照合の結果に応じて、該構造体内の該データキャッシュ領域又は該ポインタによって指定されるデータ領域のデータにアクセスすることを特徴とするデータ処理システム。
In a computer system that can access data in a storage unit using a pointer of a structure,
The storage unit includes a structure area that stores a plurality of the structures and a data area that stores data.
A counter register whose value is updated when certain data in the data area pointed to by the pointer is changed;
A pointer that specifies data stored in the data area, a data cache area that temporarily holds data in the data area accessed using the pointer, and a counter register value that is updated each time the value of the counter register is updated Comprising the structure having a counter value holding a value of a counter register;
When accessing the data in the storage unit, the contents of the counter register and the counter value of the structure are collated, and specified by the data cache area or the pointer in the structure according to the result of the collation A data processing system for accessing data in a data area.
該記憶部内のデータにアクセスする時に、該カウンタレジスタの内容と該構造体の該カウンタ値を照合して、照合の結果、両者が一致する場合には、該構造体内の該データキャッシュ領域内に記憶されたデータを使用し、不一致の場合には、該ポインタによって指定されるデータ領域内のデータを使用することを特徴とする請求項1記載のデータ処理システム。 When accessing the data in the storage unit, the contents of the counter register are compared with the counter value of the structure, and if the result of the comparison is that they match, the data cache area in the structure 2. The data processing system according to claim 1, wherein the stored data is used, and if there is a mismatch, the data in the data area specified by the pointer is used. 該ポインタを用いてデータ領域内のデータをアクセスした場合、取得された該データを該データキャッシュ領域に保持し、かつ該カウンタレジスタの値を該構造体の該カウンタ値に保存することを特徴とする請求項1乃至2のいずれかの項記載のデータ処理システム。 When the data in the data area is accessed using the pointer, the acquired data is held in the data cache area, and the value of the counter register is stored in the counter value of the structure The data processing system according to any one of claims 1 to 2. 該構造体は、該データキャッシュ領域に保持されたデータが有効又は無効であることを示すフラグを有し、該ポインタが指定する該データ領域のデータが変更された場合、該フラグを無効の状態にすることを特徴とする請求項1乃至3のいずれかの項記載のデータ処理システム。 The structure has a flag indicating that the data held in the data cache area is valid or invalid, and when the data in the data area designated by the pointer is changed, the flag is invalidated. The data processing system according to claim 1, wherein the data processing system is a data processing system. 複数の該構造体が記憶される構造体領域のエントリ数が該カウンタレジスタによって表される最大値よりも大きい場合、該カウンタレジスタの値が一周する前に全ての該エントリを無効化するように、一定の複数ずつの構造体の該フラグを無効の状態にセットすることを特徴とする請求項1乃至4のいずれかの項記載のデータ処理システム。 When the number of entries in the structure area in which a plurality of the structures are stored is larger than the maximum value represented by the counter register, all the entries are invalidated before the counter register makes a round. 5. The data processing system according to any one of claims 1 to 4, wherein the flag of a certain plurality of structures is set to an invalid state. 該コンピュータシステムは、ネットワークに接続されるネットワークカードと、データ処理するCPUと、前記構造体領域及び前記データ領域を有するメインメモリを有し、
前記構造体は、複数の送信相手のそれぞれに対応した制御情報を保持し、
前記カウンタレジスタは、該ネットワークカード内に設けられ、
前記データ領域は各送信相手に対する経路情報を記憶し、かつ、前記データキャッシュ領域は、ポインタで指定されたデータ領域内の該経路情報を保持し、
ある送信相手へデータを送信する場合、該ネットワークカードは該送信相手に対する制御情報の構造体を、DMA転送で該メインメモリ内の構造体領域から読み出し、さらに該データキャッシュ領域又は該構造体内の該ポインタを用いて、DMA転送で該データ領域から経路情報を読み出すことを特徴とする請求項1乃至5のいずれかの項記載のデータ処理システム。
The computer system includes a network card connected to a network, a CPU for data processing, and a main memory having the structure area and the data area,
The structure holds control information corresponding to each of a plurality of transmission partners,
The counter register is provided in the network card;
The data area stores path information for each transmission partner, and the data cache area holds the path information in the data area designated by the pointer,
When transmitting data to a transmission partner, the network card reads the structure of control information for the transmission partner from the structure area in the main memory by DMA transfer, and further, the data cache area or the structure in the structure. 6. The data processing system according to claim 1, wherein path information is read from the data area by DMA transfer using a pointer.
データを記憶する外部低速記録媒体が接続され、かつデータ処理するCPUと、該データ領域及び該構造体領域を持つメモリを有するコンピュータシステムであって、前記ポインタは該外部低速記録媒体に記憶されるデータを指定し、かつ前記データキャッシュ領域は、該外部低速記録媒体に記憶されるデータを保持することを特徴とする請求項1乃至5のいずれかの項記載のデータ処理システム。 A computer system connected to an external low-speed recording medium for storing data and having a data processing CPU and a memory having the data area and the structure area, wherein the pointer is stored in the external low-speed recording medium 6. The data processing system according to claim 1, wherein data is designated, and the data cache area holds data stored in the external low-speed recording medium. 複数の該構造体を記憶する構造体領域と、データを記憶するデータ領域を有する記憶部内のデータに、構造体が持つポインタを用いてアクセスすることができるアクセス制御方法であって、
該構造体は、データ領域に記憶されたデータを指定するポインタと、該ポインタを用いてアクセスされた該データ領域にあるデータを一時的に保持するデータキャッシュ領域を有し、
該記憶部をアクセスする時に、該構造体の該データキャッシュ領域に記憶されたデータが有効であれば、該データキャッシュ領域より該データを得、
該構造体の該データキャッシュ領域に記憶されたデータが有効でなければ、該ポインタを用いて該データ領域をアクセスしてデータを得ることを特徴とするアクセス制御方法。
An access control method capable of accessing data in a storage unit having a structure area for storing a plurality of the structures and a data area for storing data using a pointer of the structure,
The structure has a pointer that specifies data stored in the data area, and a data cache area that temporarily holds data in the data area accessed using the pointer,
If the data stored in the data cache area of the structure is valid when accessing the storage unit, the data is obtained from the data cache area,
An access control method comprising: obtaining data by accessing the data area using the pointer if the data stored in the data cache area of the structure is not valid.
複数の該構造体を記憶する構造体領域と、データを記憶するデータ領域を有する記憶部内のデータに、構造体が持つポインタを用いてアクセスするアクセス制御方法であって、
該構造体は、データ領域に記憶されたデータを指定するポインタと、該ポインタを用いてアクセスされた該データ領域にあるデータを一時的に保持するデータキャッシュ領域と、該カウンタレジスタの値が更新される度に該カウンタレジスタの値を保持するカウンタ値を有し、
該記憶部内のデータにアクセスする時に、該ポインタが指すデータ領域内のあるデータが変更されたときにその値が更新される該カウンタレジスタの内容と、該構造体の該カウンタ値を照合し、該照合の結果に応じて、該構造体内の該データキャッシュ領域又は該ポインタによって指定されるデータ領域のデータにアクセスすることを特徴とするアクセス制御方法。
An access control method for accessing data in a storage unit having a structure area for storing a plurality of the structures and a data area for storing data using a pointer of the structure,
The structure includes a pointer for designating data stored in the data area, a data cache area for temporarily holding data in the data area accessed using the pointer, and a value of the counter register updated. A counter value that holds the value of the counter register each time
When accessing data in the storage unit, the contents of the counter register, whose value is updated when some data in the data area pointed to by the pointer is changed, are compared with the counter value of the structure; An access control method comprising: accessing data in the data cache area or the data area designated by the pointer in the structure according to the result of the collation.
該構造体は、該データキャッシュ領域に保持されたデータが有効又は無効であることを示すフラグを有し、該ポインタが指定する該データ領域のデータが変更された場合、該フラグを無効の状態にすることを特徴とする請求項8又は9のアクセス制御方法。 The structure has a flag indicating that the data held in the data cache area is valid or invalid, and when the data in the data area designated by the pointer is changed, the flag is invalidated. 10. The access control method according to claim 8 or 9, wherein
JP2010057397A 2010-03-15 2010-03-15 Data processing system and access control method Pending JP2011192012A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010057397A JP2011192012A (en) 2010-03-15 2010-03-15 Data processing system and access control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010057397A JP2011192012A (en) 2010-03-15 2010-03-15 Data processing system and access control method

Publications (1)

Publication Number Publication Date
JP2011192012A true JP2011192012A (en) 2011-09-29

Family

ID=44796852

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010057397A Pending JP2011192012A (en) 2010-03-15 2010-03-15 Data processing system and access control method

Country Status (1)

Country Link
JP (1) JP2011192012A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023184285A1 (en) * 2022-03-30 2023-10-05 华为技术有限公司 Data transmission method and apparatus

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023184285A1 (en) * 2022-03-30 2023-10-05 华为技术有限公司 Data transmission method and apparatus

Similar Documents

Publication Publication Date Title
EP2016499B1 (en) Migrating data that is subject to access by input/output devices
US8131945B2 (en) Disowning cache entries on aging out of the entry
US20110173400A1 (en) Buffer memory device, memory system, and data transfer method
US10997078B2 (en) Method, apparatus, and non-transitory readable medium for accessing non-volatile memory
US10860481B2 (en) Data recovery method, data recovery system, and computer program product
US20160179671A1 (en) Mirroring a cache having a modified cache state
JP5583274B2 (en) Method for managing computer memory, corresponding computer program product, and data storage device therefor
US8352646B2 (en) Direct access to cache memory
WO2012137098A1 (en) Extending cache for an external storage system into individual servers
JP2000227878A (en) Data managing method for asynchronous i/o cache memory
JP2007048296A (en) Method, apparatus and system for invalidating multiple address cache entries
US20130042068A1 (en) Shadow registers for least recently used data in cache
JP2011022926A (en) Data storage device and cache control method
US7577791B2 (en) Virtualized load buffers
JP4113524B2 (en) Cache memory system and control method thereof
JP4666511B2 (en) Memory caching in data processing
US10489300B1 (en) Increasing caching efficiency using cache data patterns
US10649902B2 (en) Reducing translation latency within a memory management unit using external caching structures
JP2011192012A (en) Data processing system and access control method
EP3136245A1 (en) Computer
US20130173862A1 (en) Method for cleaning cache of processor and associated processor
JP3335919B2 (en) Disk cache controller
JP2976867B2 (en) I / O buffer device and management method thereof
JP3260566B2 (en) Storage control method and storage control device in information processing system
JP2001229074A (en) Memory controller and information processor and memory control chip