4 ms·
I view the current situation as a good time to invent 32+ core CPUs with less fancy features like all speculative execution or branch prediction (at least not t
by pdimitar 8y ago
I view the current situation as a good time to invent 32+ core CPUs with less fancy features like all speculative execution or branch prediction (at least not to the extent which made Spectre/Meltdown possible anyway). And a good time for a next-gen kernel to emerge that can make use of several kernel-reserved cores and with better preemptive scheduling overall.
Not a hardware guy or a driver programmer but I believe this area stands to get some innovation.
- gpderetta 8y agoWe have today 32+ cores CPUs with minimal or no branch prediction and speculation. They work spectacularly well on some specific workloads but are terrible for general purpose computation. They are called GPUs. Speculation and branch prediction is not going away. On the contrary is going to get more and more sophisticated. What needs to die is the belief that you can rely on just software (i.e. memory safety) for isolation between trusted and untrusted code[1]. [1] Yes, meltdown bypasses hardware protection, but that's an intel specific fuck up, not inherent issue with speculation.
- twtw 8y ago> What needs to die is the belief that you can rely on just software (i.e. memory safety) for isolation between trusted and untrusted code[1]. I don't understand how you came to this conclusion. How does spectre indicate that you can't rely on software for isolation? > meltdown bypasses hardware protection, but that's Intel specific It's not Intel specific. Certain ARM and POWER architectures are also vulnerable. Spectre bypasses hardware protections too, just in a more subtle way.
- gizmo686 8y agoThe idea behind spectre is that speculative execution bypasses software protections. Given if f(A) B else C, one cannot safely assume that B only gets executed when A resolves to true. It is not reasonable to expect programmers to produce safe code in an environment where they have to doubt if statements. This could be solved without any major overhauls in hardware, by just updating it to make speculative execution actually speculative and not commit any side effects until it knows it went down the correct branch.
- gpderetta 8y agoUnfortunately fetching a new cache line from memory is a globally visible side effect. One of the major benefits of speculation and is that it enables additional memory level parallelism. Even otherwise strictly in order designs, when aiming for high performance incorporate some form of memory speculation (scout threading, run ahead execution).
- gizmo686 8y agoRight, and CPUs could, in principle, fix this. Eg. they could speculatively fetch the cache line, and only commit it to the cache once they know what branch they took. This still lets you do the slow memory access before you know if you will need it, without causing globally visible side effects.
- gpderetta 8y agoAs soon as you fetch the cache line, every other core will know you have done that via the cache coherency protocol. You have just disclosed an address potentially derived from some sensitive information. Edit: to be precise they can, for example, see the transition from exclusive to shared.
- gizmo686 8y agoI suppose this gets into what is consider a "major" overhaul of the architecture. The idea is that you don't actually "fetch" anything until you are no longer speculating. The core that is doing the speculating can pre-fetch the memory, and then commit it to the cache only once it knows that is the correct thing to do. There are still some cache coherence concerns, but nothing that strikes me as insurmountable.
- gpderetta 8y agoI do not understand your distinction between prefect and fetch. You either have the data, and you need to notify other cores that you do or you don't. Not notifying other CPUs seems pointless because before committing you would have to do a round-trip to the other core to verify whether the data is still valid making the prefetching pointless.
- pmoriarty 8y ago"We have today 32+ cores CPUs ... They are called GPUs." There are also chips like the GA144, which has 144 cores: https://www.rs-online.com/designspark/hands-on-with-a-144-core-processor https://www.rs-online.com/designspark/hands-on-with-a-144-co...
- pdimitar 8y ago> What needs to die is the belief that you can rely on just software (i.e. memory safety) for isolation between trusted and untrusted code[1]. That is definitely true. We need a bit more security in the hardware. I am not saying we should go back to 300MHz CPUs just for the sake of security but surely there's a spectrum where Spectre / Meltdown / Rowhammer attacks are impossible and we still have very fast processors and RAM.
- gpderetta 8y agoMeltdown for sure. Spectre not so much. Note that 2+ decade old 200mhz pentium pro is very likely as vulnerable to spectre as the current generation. Frequency doesn't really factor in it.
- pdimitar 8y agoI wasn't clear. I meant that we shouldn't take huge performance hits for having some security at the hardware level.
- gpderetta 8y agoMeltdown shouldn't hopefully be an issue, as there are high performance CPUs which are immune. A proper Spectre V2 would probably require partitioning the jump prediction tables by process; in the meantime flushing seem to work (although at a non trivial performance cost). The issue is the basic spectre v1 vulnerability, the bound check bypass, is so firmly rooted in the basic mechanism of speculative execution that it is very unlikely to be fixable. But it only affect,as a first approximation, processes that try to execute code with different trust domains in the same address space. The existing software mitigations appear to help, address spac separation is probably a safer long term solution. There are simple in order CPUs that have a small speculation window and are, in practice not affected, but it is not a given that an high performance in order core is safe. Denver (an inorder VLIW design) is affected; I can't find anything about power6 (the last inorder CPU competitive with OoO).
- 8y ago
- meshenna 8y agoTo get any reasonable performance benefit out of 32+ cores the code running on those cores would have to be >75% parallelized.[1] I know very little about threading and such, but that seems like it would be a difficult thing to do for many (most?) applications. Point being that I doubt consumer CPUs will have that many cores until there's a clear benefit to it, and thus far there isn't. Even 8-16 cores is pushing it. If anyone reading this has more insight into the matter, I'd love to hear what you think. [1] https://en.wikipedia.org/wiki/Amdahl%27s_law https://en.wikipedia.org/wiki/Amdahl%27s_law
- pdimitar 8y ago> To get any reasonable performance benefit out of 32+ cores the code running on those cores would have to be >75% parallelized. Exactly this, yes. But for that we need a language that enforces and guarantees pure functions and disallows global state mutation. For now C is king in systems programming but I wonder if certain chips are made with a very different idea from the get go, then can we have a systems functional language? I also am not very informed on this front, never had enough time to dig deeper. (I did like the idea of the LISP machines several decades ago though.)
- twtw 8y agoThe real-world progression of software run over time on processors doesn't always match the assumption in amdahl's law. Frequently people want to solve harder/bigger problems in the same time, not just the same problem in less time. See, for example, how slack has taken over doing what IRC could do, just with much higher resource requirements. For that, see https://en.m.wikipedia.org/wiki/Gustafson%27s_law https://en.m.wikipedia.org/wiki/Gustafson%27s_law.