Share via


Write-through Cache Mode Tests (Compact 7)

3/12/2014

The OAL Cache Test assesses the cache and memory subsystem of a Microsoft Windows Embedded Compact-based device. The test can expose problems in the kernel, OEM adaptation layer (OAL) cache implementation, hardware cache implementation, and memory chips.

This test verifies the behavior of write-through cache memory access.

Test Prerequisites

Your device must meet the following requirements before you run this test.

The tests should be run on a minimal OS design, such as the BTS minimal image, or a Tiny Kernel image. The run-time image must implement IOCTL_HAL_GET_CACHE_INFO IOCTL.

Subtests

The table below lists the subtests included in this test.

SubTest ID Description

1200

This test case searches for errors in consistency between data stored in the L1 data cache and data stored in main memory. By default, this test case runs for 10 minutes. This test case writes data near the boundaries of the cache into an array that is the size of the L1 data cache as reported by the CeGetCacheInfo function. If the CeGetCacheInfo function reports that the size of the cache is zero, this test case uses a 4-MB array. After the test case reaches steady state, each memory access is a cache hit. The test case verifies the accuracy of write operations by reading back the data. The test case also verifies that values surrounding the changed values are not changed. This test case writes values to array indexes that surround multiples of eight. For each multiple of eight, the test case writes a value into the array at the following array indexes: {One greater than the multiple of eight, One less than the multiple of eight, Equal to the multiple of eight}. The test case then reads and verifies the values.

1201

This test case searches for errors in consistency between data stored in the L1 data cache and data stored in main memory. By default, this test case runs for 10 minutes. This test case writes data near the boundaries of the cache into an array that is twice the size of the L1 data cache as reported by the CeGetCacheInfo function. If the CeGetCacheInfo function reports that the size of the cache is zero, this test case uses a 4-MB array. After the test case reaches steady state, each memory access is a cache miss. The test case verifies the accuracy of write operations by reading back the data. The test case also verifies that values surrounding the changed values are not changed. This test case writes values to array indexes that surround multiples of eight. For each multiple of eight, the test case writes a value into the array at the following array indexes: {One greater than the multiple of eight, One less than the multiple of eight, Equal to the multiple of eight}. The test case then reads and verifies the values.

1202

This test case searches for errors in consistency between data stored in the L1 data cache and data stored in main memory. By default, this test case runs for 10 minutes. This test case writes data near the boundaries of the cache into an array of a size that you specify by using the -arrayLen command-line parameter. For more information, see Command-Line Parameters for the OAL Cache Test. If you do not specify the -arrayLen command-line parameter, this test case uses a 4-MB array. After the test case reaches steady state, each memory access is a cache miss. The test case verifies the accuracy of write operations by reading back the data. The test case also verifies that values surrounding the changed values are not changed. This test case writes values to array indexes that surround multiples of eight. For each multiple of eight, the test case writes a value into the array at the following array indexes: {One greater than the multiple of eight, One less than the multiple of eight, Equal to the multiple of eight}. The test then reads and verifies the values.

1203

This test case searches for errors in consistency between data stored in the L1 data cache and data stored in main memory. By default, this test case runs for 10 minutes. This test case sequentially writes data into an array that is twice the size of the L1 data cache as reported by the CeGetCacheInfo function. If the CeGetCacheInfo function reports that the size of the cache is zero, this test case uses a 4-MB array. After the test case reaches steady state, the write operations force a cache miss each time a memory value is accessed. The test case verifies the accuracy of write operations by reading back the data. The read operations also force cache misses. The test case assigns each unit of data a unique identifier. The test case references this unique identifier when it compares data read to data written.

1204

This test case searches for errors in consistency between data stored in the L1 data cache and data stored in main memory. By default, this test case runs for 10 minutes. This test case sequentially writes data into an array that is twice the size of the L1 data cache as reported by the CeGetCacheInfo function. If the CeGetCacheInfo function reports that the size of the cache is zero, this test case uses a 4-MB array. After the test case reaches steady state, the write operations force a cache miss each time a memory value is accessed. The test case verifies the accuracy of write operations by reading back the data. The read operations also force cache misses. The test case assigns each unit of data a unique identifier. The test case references this unique identifier when it compares data read to data written.

1205

This test case searches for errors in consistency between data stored in the L1 data cache and data stored in main memory. By default, this test case runs for 10 minutes. This test case sequentially writes data into an array that is of a size that you specify by using the -arrayLen command-line parameter. For more information, see Command-Line Parameters for the OAL Cache Test. If you do not specify the -arrayLen command-line parameter, this test case uses a 4-MB array. After the test case reaches steady state, the write operations force a cache miss each time a memory value is accessed. The test case verifies the accuracy of write operations by reading back the data. The read operations also force cache misses. The test case assigns each array index a unique identifier. The test case references this unique identifier when it compares data read to data written.

1206

This test case searches for errors in consistency between data stored in the L1 data cache and data stored in main memory. With a cache, errors generally fall on powers of two. This test case might expose errors not exposed by a test case that performs sequential write operations. By default, this test case runs for 10 minutes. This test case writes data into values that are close to a power of two in an array that is the size of the L1 data cache as reported by the CeGetCacheInfo function. This test case exercises the cache rather than the underlying memory subsystem because in steady state, each memory access should be a cache hit. If the CeGetCacheInfo function reports that the size of the cache is zero, this test case uses a 4-MB array. The step size varies throughout the test case to expose errors that might occur only during a similar access sequence. The smallest step size is 16 bytes. For each power of two, the test case writes a value into the array at the following array indexes: {One greater than the power of two, One less than the power of two, Equal to the power of two}. The test case then reads and verifies the values in the same order that they were written.

1207

This test case searches for errors in consistency between data stored in the L1 data cache and data stored in main memory. With a cache, errors generally fall on powers of two. This test case might expose errors not exposed by a test case that performs sequential write operations. By default, this test case runs for 10 minutes. This test case writes data into values that are close to a power of two in an array that is twice the size of the L1 data cache as reported by the CeGetCacheInfo function. If the CeGetCacheInfo function reports that the size of the cache is zero, this test case uses a 4-MB array. The step size varies throughout the test case to expose errors that might occur only during a similar access sequence. The smallest step size is 16 bytes. For each power of two, the test case writes a value into the array at the following array indexes: {One greater than the power of two, One less than the power of two, Equal to the power of two}. The test case then reads and verifies the values in the same order that they were written.

1208

This test case searches for errors in consistency between data stored in the L1 data cache and data stored in main memory. With a cache, errors generally fall on powers of two. This test case might expose errors not exposed by a test case that performs sequential write operations. By default, this test case runs for 10 minutes. This test case writes data into values that are close to a power of two in an array of a size that you specify by using the -arrayLen command-line parameter. For more information, see Command-Line Parameters for the OAL Cache Test. If you do not specify the -arrayLen command-line parameter, this test case uses a 4-MB array. The step size varies throughout the test case to expose errors that might occur only during a similar access sequence. The smallest step size is 16 bytes. For each power of two, the test case writes a value into the array at the following array indexes: {One greater than the power of two, One less than the power of two, Equal to the power of two}. The test case then reads and verifies the values in the same order that they were written.

1209

This test case searches for errors in consistency between data stored in the L1 data cache and data stored in main memory. By default, this test case runs for 10 minutes. This test case writes data in a semi-random way into an array that is twice the size of the L1 data cache as reported by the CeGetCacheInfo function. If the CeGetCacheInfo function reports that the size of the cache is zero, this test case uses a 4-MB array. This test case produces both cache misses and cache hits, thereby exercising the cache in a more random way than a sequential set of read and write operations would. The test case writes each value in the tested array once and verifies the value during a subsequent read pass. The sequence of write operations that this test case uses is semi-random. The sequence is not as random as a random number generator because the test case must access each value once and only once. The first 16 values in the sequence are 0, 3, 1, 2, 12, 15, 13, 14, 4, 7, 5, 6, 8, 11, 9, and 10.

1210

This test case searches for errors in consistency between data stored in the L1 data cache and data stored in main memory. By default, this test case runs for 10 minutes. This test case writes data in a semi-random way into an array of a size that you specify by using the -arrayLen command-line parameter. The length that you specify for the -arrayLen command-line parameter must be a power of two. For more information, see Command-Line Parameters for the OAL Cache Test. If you do not specify the -arrayLen command-line parameter, this test case uses a 4-MB array. This test case produces both cache misses and cache hits, thereby exercising the cache in a more random way than a sequential set of read and write operations would. The test case writes each value in the tested array once and verifies the value during a subsequent read pass. The sequence of write operations that this test case uses is semi-random. The sequence is not as random as a random number generator because the test case must access each value once and only once. The first 16 values in the sequence are 0, 3, 1, 2, 12, 15, 13, 14, 4, 7, 5, 6, 8, 11, 9, and 10.

Setting Up the Test

The test is able to run once the device is booted. There are no other setup steps.

Running the Test

The default test command line is:

tux -o -n -d oalTestCaches.dll -x1200-1210 -c "-runTime 1"

This test runs in kernel mode through the -n tux option. The -x option selects test cases 1200 through 1210 which correspond to the "Write-through mode" tests. The -runTime 1 option runs each test for 1 minute.

Verifying the Test

The test should return "PASS" results for all sub-cases. In case of a failure, please read the debug output and see the troubleshooting steps.

Troubleshooting the Test

Use a minimal image, with the least number of SYSGENs. The cache can be impacted by other processes or threads on the system and their memory usage. This can make results inconsistent or difficult to investigate. We recommend running the test on a minimal image such as "min kernel" image.

Best Practices Description

Run the Print Cache Info test case and verify that the return value of CeGetCacheInfo is valid and expected.

Compare the return value of the CeGetCacheInfo function to the hardware specifications.

Run the OAL Cache Tests on more than one target device.

Testing multiple devices can help you to identify random flaws in memory chips and other hardware problems. Even if you can reproduce a problem on multiple devices, the source of the problem might be hardware. Each test case walks memory in a deterministic way. If a test case is faulty, it most likely fails at the same array index during each subsequent run, unless a stray pointer incorrectly changes memory values. The existence of a stray pointer is unlikely because the OAL Cache Tests do not use pointers extensively. If a problem occurs at different array indexes during subsequent runs, most likely the test is working correctly and there is something wrong with the device.

Observe the physical address values displayed in the debug output to determine in which memory blocks faults occur.

If the same memory block consistently causes a fault, most likely the cache incorrectly stores data for the block or there is something physically wrong with the memory at that location.

Use a hash function that is less complex if you cannot discern a pattern in the output of the test.

A complex hash function can hide patterns in the output of the test. For more information, see the CacheTest.cpp file in the %_WINCEROOT%\private\test\BaseOs\pqoal\cetk\caches directory. The OAL Cache Test does not use less complex hash functions by default because a less complex hash function is less likely to find an error. Note: Install Windows Embedded Compact Shared Source in order to view this directory. The Shared Source license must be agreed upon to access this directory.

If a test case fails because it cannot allocate memory, reduce the array length or free memory on the device.

Each test case allocates a contiguous chunk of memory and fails if a contiguous chunk of memory is not allocated.

For additional platform specific issues, consult the CTK articles on the TechNet wiki.

See Also

Other Resources

OAL - Cache Tests