Changes

Jump to: navigation, search

MISC-TN-017: Persistent storage and read-write file systems

3,086 bytes added, 08:58, 18 January 2022
Logging the accesses
A possible example of access monitoring is shown below, as it appears in the trace views available in TRACE32:
<pre class="workstation-terminal">
2| ptrace  \\vmlinux\core_core\mmc_start_request  24.228827980s
0| info                                           24.231308210s         00000000
</pre>
This is, typically, a few trace records for each eMMC access. Stress tests have verified that logging an eMMC access (functions <code>mmc_start_request() </code> and <code>mmc_request_done() </code> with related data) requires about 416 trace records in the PowerTrace memory and these accesses occur on average every 4 mSec. This corresponds to approximately 1GB/416 = 2.5 million eMMC logs, or approximately 10,000 seconds (2h45min) for each gigabyte of trace storage. The PowerTrace family provides either 10 million eMMC logs (11h) for a 4GB PowerTrace or 20 million (22h) for an 8GB module.By extending the trace duration with trace streaming, the limit becomes the size of the computer hard-disk/SSD or the TRACE32 limit which is 1 Tera-frame, i.e., 2.5 billion eMMC logs (over 100 days!). The trace data can be filtered and saved on disk, and then converted into a more suitable format for analysis using a TRACE32 script (PRACTICE script), Python script, or an external conversion program. For example, the trace shown above can be converted into the format shown below, which is more suitable for importing into specific eMMC analysis tools: <pre class="workstation-terminal">24.228827980 mmc_start_req_cmd: host=mmc1 CMD25 arg=01620910 flags=000000B5 blksz=00000200 blks=0000001024.231239610 mmc_request_done: host=mmc1 CMD25 err=00000000 resp1=00000900 resp2=00000000</pre> These tools perform a complete analysis of the eMMC device application accesses, in terms of addresses accessed, frequency and access methods. The end goal is to calculate the Write Amplification Factor (WAF) seen by the eMMC (or by any other managed-NAND block device). WAF is defined as the ratio of physical data written onto the NAND and the data written by the host. When the host writes logical sectors of the eMMC, the internal eMMC controller erases and re-programs physical pages of the NAND device. This could cause a management overhead. Large sequential writes aligned to physical page boundaries typically result in minimal overhead and optimal NAND write activity (WAF=~1). Small chunks of random writes could result in a higher overhead (WAF>>1). This becomes important when considering the life of the raw-NAND memory inside the eMMC, which has a finite number of Program/Erase cycles. See the example below: TBD To estimate the WAF for any particular eMMC device, and hence its expected lifetime on your application, you can capture the log file of the activity. Once a log is obtained, it's recommended to contact your eMMC vendor to get more information about the log analysis tools required for analyzing the specific eMMC product.
==== Implementation example for Linux OS ====
Below is an example of how the TRACE32-based log method can be applied to a Linux system. The solution is based on light instrumentation of the <code>mmc_start_request()</code> and <code>mmc_request_done()</code> functions defined in the Linux <code>drivers/mmc/core/core.c</code> source code file. Relevant eMMC device accesses are captured through the instrumentation code and they are written to a static data structure making them immediately traceable if data trace is available in the SoC. If data tracing is not possible, the instrumentation code writes the data to the Arm®/Cortex® Context ID register.
 
The solution was successfully tested on the aforementioned embedded platform.
==== Comparison with the software method ftrace ====
4,650
edits

Navigation menu