"This discussion was all triggered by some unrelated code that wanted to do 64-bit accesses and had other entirely [different] approaches to avoiding CMPXCHG8B," he told iTWire in response to a query on Tuesday.
Torvalds' suggestion about removing i486 support was made on the Linux kernel mailing list.
However, his comments indicated that it was still up in the air. "It's still just being discussed, and there are a couple of people who seem to have that old hardware, so who knows," he said.
|
"The TSC is already used in some core code in certain configurations that simply wouldn't work on an older CPU. And in other cases we go out of our way to have extra code to say 'check if it exists'.
Torvalds explained that CMPXCHG8B was meant for times when some code wanted to do atomic operations on 64-bit entities. "We kind of fake it right now, knowing that we don't support SMP on i486-class CPUs (it did exist in some non-standard configurations, but it was rare even at the time, and Linux never supported those machines)," he added.
"So we have some fallback code for 'fake this instruction that works as long as you only run on UP and without NMIs', and (again) the extra logic to then pick that code."
He said developers who actually touched this code were not using 32-bit machines in the first place, and thus any testing tended to be done on virtual machines that had all these features.
"Which is how new code, that uses the TSC without actually checking whether it exists, gets in and has been there for some time now," he noted.
"There's some additional clean-up that we could do - once you move the base requirement up, some other code just ends up being essentially dead legacy code that can be removed entirely. It already essentially is in practice, but we drag it along because it *could* be used on old machines (like the software FP emulation etc)."
Torvalds pointed out that the kernel had dropped i386 support a decade ago for similar reasons: "back then it was the XADD instruction and the (very broken) original 80386 kernel page fault behaviour that caused some operations on i386 hardware to just be fundamentally racy.
"IOW, it's just the next step in 'there was a real reason those features were added to hardware almost 30 years ago'."