News for hackers. Stuff that matters.
Re:Deprecating the PCOMMIT Instruction by userbinator on Wednesday September 14, 2016 @10:33PM (#12502915)
It's very rare that an instruction gets removed; the few instances that I can think of are XBTS/IBTS on the very first stepping of the 386, and the CMPXCHG on early 486s that occupied the same opcode briefly. Do any CPUs have this instruction?

It looks like the encoding of PCOMMIT (+66 0F AE/7) is basically the same as CLFLUSH except with a +66 prefix, so if a CPU doesn't know about PCOMMIT it'll probably try to execute it as a CLFLUSH with an ignored prefix.

But hopefully this "deprecated" information stays around, if for nothing other than "archaeological" purposes:

http://www.os2museum.com/wp/curious-instructions/

Re:Deprecating the PCOMMIT Instruction by moosecombinator on Thursday September 15, 2016 @08:24AM (#12505473)
Author here. The PCOMMIT encoding you mention produces an undefined opcode fault on all existing CPUs (written as #UD in the specs). Since no CPU has shipped supporting PCOMMIT, this gives us high confidence that no code containing PCOMMIT is currently in-use or it would be producing #UD faults. Since the need for PCOMMIT has gone away, that fact allowed us to remove the instruction before it created legacy code we'd be signed up to support forever.

I love your examples of other removals -- didn't know about those.

Re:Deprecating the PCOMMIT Instruction by JoachimSchipper on Wednesday September 14, 2016 @03:32PM (#12500454)
For a gentler introduction/motivation, consider http://danluu.com/clwb-pcommit/.

("Deprecating pcommit" means that persistent memory is simpler to use; persistent memory itself is not deprecated.)

Re:Deprecating the PCOMMIT Instruction by eloff on Wednesday September 14, 2016 @02:38PM (#12499967)
This is a nice improvement. Now instead of having sfence/pcommit/sfence to flush writes to nvram, you would use just an sfence to ensure ordering with subsequent stores (e.g. a store that publishes the written data.)

Its analogous to fysnc() to ensure data reaches the disk in a way that survives power failure. This is like just treating all writes as fsynced and not needing to worry about fsync at all, like with O_DIRECT writes.

Re:Deprecating the PCOMMIT Instruction by koverstreet on Thursday September 15, 2016 @06:44AM (#12504835)
It's a lie that you don't need fsync with O_DIRECT - writes could still be in the hard drive's write buffer, or the filesystem could have metadata updates that haven't been written yet (e.g. unwritten extents that need to be marked as written).
Re:Deprecating the PCOMMIT Instruction by caf on Wednesday September 14, 2016 @08:58PM (#12502585)
Not exactly, you still need a cache flush if you want to ensure that your write is persistent.
Re:Deprecating the PCOMMIT Instruction by eloff on Thursday September 15, 2016 @12:05AM (#12503332)
Sorry, yes I omitted that detail. You do need the cache flush still for each written cache line.
Re:Deprecating the PCOMMIT Instruction by loeg on Wednesday September 14, 2016 @02:47PM (#12500058)
Basically they've expanded the persistence domain from just the DIMMS, to the DIMMS and memory controller, obviating PCOMMIT.
Re:Deprecating the PCOMMIT Instruction by gaius on Wednesday September 14, 2016 @04:40PM (#12501032)
They've either just averted or triggered a temporal paradox, I'm not sure which
Re:Deprecating the PCOMMIT Instruction by fowl2 on Wednesday September 14, 2016 @06:14PM (#12501650)
Both? ;)
Re:Deprecating the PCOMMIT Instruction by DiabloD3 on Wednesday September 14, 2016 @03:43PM (#12500564)
Okay HN, this is ELI5 time: is this instruction for interacting with SSDs that fit into DIMM slots?
Re:Deprecating the PCOMMIT Instruction by wmf on Wednesday September 14, 2016 @03:49PM (#12500624)
It was the instruction for interacting with XPoint DIMMs (I wouldn't call them SSDs but whatever), but now you just use CLWB instead.
Re:Deprecating the PCOMMIT Instruction by loeg on Wednesday September 14, 2016 @03:57PM (#12500699)
Previously you would use CLWB, SFENCE, then PCOMMIT. Now you use CLWB, then SFENCE.
Re:Deprecating the PCOMMIT Instruction by jdmichal on Wednesday September 14, 2016 @05:53PM (#12501522)
From the article, there was another SFENCE after PCOMMIT.
Re:Deprecating the PCOMMIT Instruction by loeg on Wednesday September 14, 2016 @06:00PM (#12501567)
Sure.
Re:Deprecating the PCOMMIT Instruction by mkj on Wednesday September 14, 2016 @11:03PM (#12503049)
So is consumer XPoint hardware really coming soon?
Re:Deprecating the PCOMMIT Instruction by jbb555 on Thursday September 15, 2016 @03:38AM (#12504112)
"Persistence domain". Ugh. This is supposed to be a CPU not some marketing speak showcase.
Re:Deprecating the PCOMMIT Instruction by moosecombinator on Thursday September 15, 2016 @08:28AM (#12505492)
Ouch -- accused of marketing speak. That one stings.

I had been using the term "power-fail safe domain" to talk about the line a store crosses where it is then persistent in the face of power failures. But that led people to think power failure was the only event considered so we started saying "persistence domain." I'm certainly open to suggestions on terminology.

Re:Deprecating the PCOMMIT Instruction by _RPM on Wednesday September 14, 2016 @04:56PM (#12501141)
Does GCC use PCOMMIT?
Re:Deprecating the PCOMMIT Instruction by caf on Wednesday September 14, 2016 @09:00PM (#12502590)
This isn't the kind of instruction a compiler would emit for regular code.
Re:Deprecating the PCOMMIT Instruction by _RPM on Wednesday September 14, 2016 @09:02PM (#12502597)
What would this be used for?
Re:Deprecating the PCOMMIT Instruction by loeg on Thursday September 15, 2016 @12:01AM (#12503317)
Kernel direct access to Xpoint and similar DIMMs. Potentially applications via mmap. You'd probably write a simple assembly function for it and invoke that from a language that can call assembly routines.

Obvious applications are filesystems and databases.

Re:Deprecating the PCOMMIT Instruction by amluto on Wednesday September 14, 2016 @09:30PM (#12502687)
Hand-written stuff. You'd do asm volatile ("pcommit"); or similar.
Re:Deprecating the PCOMMIT Instruction by wmf on Wednesday September 14, 2016 @04:59PM (#12501169)
No. "all known operating systems supporting persistent memory ... have already been updated to remove all uses of PCOMMIT."