ARM11对于缓存有什么改进 [英] What is the improvement in ARM11 for cache

查看:23
本文介绍了ARM11对于缓存有什么改进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据说在ARM11中,缓存是物理寻址的,解决了很多缓存别名问题,减少了上下文切换开销

如何理解物理地址?它如何帮助解决缓存别名问题并减少上下文切换开销?

How to understand physically addressed? How does it help to solve the cache aliasing problems and to reduce the context switch overhead?

推荐答案

常见的缓存类型有 3 种.

There are three common types of cache.

  • VIVT = 虚拟索引虚拟标记
  • VIPT = 虚拟索引物理标记
  • PIPT = 物理索引物理标记

还有

  • PIVT = 物理索引虚拟标记

PIPT 通常用于 2nd Level 和更深的缓存,因为无论如何必须在那一刻知道物理地址,但是 armv7 也引入了 PIPT L1 DCaches.PIVT 并不实用,因此在现实世界中没有使用.

PIPT is usually used for 2nd Level and deeper caches because the physical address has to be known at that moment anyway, but armv7 also introduced PIPT L1 DCaches. PIVT is not really practical and so not used in the real world.

不同之处在于缓存线如何连接到底层内存.

The difference is how the cache lines are connected to the underlying memory.

虚拟索引意味着纯缓存行查找是使用虚拟地址完成的,因此可以在任何虚拟到物理地址转换之前完成.然后标记将决定缓存行是否真的映射到您的底层内存或包含某些其他内存位置的数据,这些数据恰好映射到同一缓存行.

Virtually Indexed means that the pure cache line lookup is done with the virtual address and so can be done BEFORE any Virtual to Physical address-translation. The tagging then will decide if the cache line really maps to your underlying memory or contains data for some other memory location which happens to map to the same cache line.

如果标记是使用虚拟地址完成的,那么碰巧使用相同虚拟地址的两个进程可能会相互绊倒,因为一个进程可能会访问另一个进程放入缓存中的数据.因此,对于 VIVT 缓存的 CPU,内核必须在上下文切换时刷新整个缓存.因此,新进程不会意外访问不正确的数据,这意味着通常上下文切换在 VIVT 缓存的 CPU 上是一项非常昂贵的操作.在 ARMv5 及更高版本上,支持所谓的快速上下文切换扩展,它使用标签修改虚拟地址.但这涉及很多限制.

If the tagging is done with the virtual address then two processes which happen to use the same virtual address could trip on each other, because one process might access data which the other process put into the cache. So for a VIVT-cached cpu the kernel has to flush the whole cache on a context-switch. So the new process will not access incorrect data by accident, which means in general a context-switch is a VERY expensive operation on VIVT-cached CPUs. On ARMv5 and upwards there is support for so called Fast Context Switch Extensions, which modifies the virtual address with an tag. But that involves a lot of limitations.

相比之下,VIPT 仍然会使用虚拟地址来查找缓存行,但随后会根据物理地址检查标签,因此 MMU 查找可以与缓存行查找并行完成.

In contrast VIPT will still use the virtual address to find the cache line, but then will check the tag against the physical-address, so the MMU lookup can be done in parallel to the cache line lookup.

别名是 VIVT 缓存的另一个大问题.因为两个虚拟地址可能指向同一个物理内存位置(当您在用户空间和内核空间之间共享内存时可能会发生这种情况).因此,您的缓存中可能有两个包含不同数据的位置,这可能很难正确管理(以正确的顺序显式刷新和使缓存失效).

Aliasing is another big problem with VIVT-caches. Because two virtual addresses might point to the same physical memory location (which might happen when you share memory between user and kernel space). So you could have two locations in your cache with different data, which can be very hard to manage properly (explicitly flushing and invalidating the cache in the right order).

这篇关于ARM11对于缓存有什么改进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆