News for hackers. Stuff that matters.
Re:PCID is now a critical performance/security feature on x86 by brendangregg on Monday January 08, 2018 @05:15PM (#16101245)
+1 yes, pcid makes a big improvement (I've been testing the KPTI patches with and without pcid).
Re:PCID is now a critical performance/security feature on x86 by snaky on Monday January 08, 2018 @10:10PM (#16103268)
> I did manage to pull out an old Lenovo ThinkPad W510 with an Intel Core i7 720QM Clarksfield that is from 2009 and lacks PCID but is affected by this cpu_insecure issue.

> On that old Clarksfield-era ThinkPad I wasn't going to be surprised if the performance was disastrous, but it wound up being better than I had anticipated given all the ongoing drama... In general purpose workloads there was no reportable performance difference in our frequent benchmark test cases. Under I/O, the PTI-using kernel did yield some slower results but not by the margins seen on the newer systems with faster storage. The laptop consumer-grade HDD in this laptop appeared to be the main bottleneck and kernel inefficiencies weren't causing as dramatic slowdowns.

> To some surprise, when carrying out network benchmarks with netperf/iperf3, in at least those contexts PTI didn't have a noticeable impact on the network throughput performance.

https://www.phoronix.com/scan.php?page=article&item=linux-mo...

Re:PCID is now a critical performance/security feature on x86 by hannob on Monday January 08, 2018 @04:46PM (#16100943)
Can anyone confirm that the way to identify if a linux system has pcid support is to check /proc/cpuinfo? Or is that merely to identify if the hw supports it, independent of the kernel support?

I checked two ubuntu servers, one 14.04, the other 16.04, both have it. Which seems odd given the claim that it's only been added recently to the kernel.

Also I see nothing showing up in dmesg, no config option and no proc interface on any system.

Re:PCID is now a critical performance/security feature on x86 by ajross on Monday January 08, 2018 @04:57PM (#16101058)
Indeed /proc/cpuinfo is telling you only the capabilities of the hardware, that's what it's for.
Re:PCID is now a critical performance/security feature on x86 by pkaye on Monday January 08, 2018 @05:41PM (#16101482)
Linux kernels did not make use of PCID until version 4.14 but your hardware was capable on processors from 2010 onwards.
Re:PCID is now a critical performance/security feature on x86 by MBCook on Sunday January 07, 2018 @10:30PM (#16094442)
I saw a post in the last few days that said that most Macintoshes have this feature and Apple has been using it. Can anyone confirm that?
Re:PCID is now a critical performance/security feature on x86 by raattgift on Monday January 08, 2018 @03:47AM (#16095486)
Yes to the latter, kinda to the former.

In reverse order:

This file goes back several OS versions:

https://github.com/apple/darwin-xnu/blob/master/osfmk/x86_64...

   sysctl machdep.cpu.features | grep PCID 
(cf. xnu/osfmk/i386/cpuid.[hc], ibid.)
Re:PCID is now a critical performance/security feature on x86 by the8472 on Monday January 08, 2018 @04:49PM (#16100966)
It seems to be a double win for bare metal machines. They always have PCID and they're less at risk in the first place since they don't share the hardware.

Virtualbox seems to lack PCID too.

Re:PCID is now a critical performance/security feature on x86 by MBCook on Monday January 08, 2018 @05:50PM (#16101583)
The machine may have PCID but that doesn’t mean the OS was using it.
Re:PCID is now a critical performance/security feature on x86 by the8472 on Tuesday January 09, 2018 @02:29PM (#16109016)

    $ cat /proc/cpuinfo
    flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm pti avx2
    bugs		: cpu_insecure

    $ uname -a   
    Linux archvm 4.14.11-1-ARCH #1 SMP PREEMPT Wed Jan 3 07:02:42 UTC 2018 x86_64 GNU/Linux

    $ lspci
    00:04.0 System peripheral: InnoTek Systemberatung GmbH VirtualBox Guest Service
Re:PCID is now a critical performance/security feature on x86 by loeg on Monday January 08, 2018 @07:25PM (#16102336)
Can you name a mainstream OS (for any definition of "mainstream" you like, really) that doesn't use PCID?
Re:PCID is now a critical performance/security feature on x86 by LinuxBender on Monday January 08, 2018 @07:37PM (#16102408)
Someone please correct me if I am incorrect, but that would be any mainstream linux not using the 4.14 kernel. Redhat, CentOS, Suse at least. Looks like CoreOS that is on 4.14 is on a minor release just prior to the PCID patch.

It looks like Ubuntu 18 Bionic Beaver may have it. (4.15) I suppose some folks use Ubuntu in a datacenter, but more likely the LTS releases and 18 is not likely in many production datacenters.

Can you confirm that Redhat backported that newer PCID code into the 3.10 kernel branch? If so, people should not be seeing a performance hit on the KPTI patch.

Re:PCID is now a critical performance/security feature on x86 by loeg on Tuesday January 09, 2018 @12:33PM (#16107932)
Ah, I didn't realize Linux was so behind in supporting PCID here. Thanks! For what it's worth, Fedora Linux is on kernel 4.14.11 already.

Curiously enough, FreeBSD has had PCID support since 2013 (r255060). We found it improved performance in microbenchmarks:

> In the microbenchmarks, using the PCID decreased latency of the context switches by ~30% on SandyBridge class desktop CPUs, measured with the lat_ctx program from lmbench.

> If available, use INVPCID instruction when a TLB entry in non-current address space needs to be invalidated. The instruction is typically available on the Haswell.

Re:PCID is now a critical performance/security feature on x86 by LinuxBender on Tuesday January 09, 2018 @12:51PM (#16108091)
You're welcome! We were trying to unravel that post about PCID as well.

It appears the first PCID code was merged in 4.14.12 so you will probably have that in the coming days / weeks. CoreOS is also 4.14.11.

For those on LTS releases, we may have to venture into uncharted waters. The first that came to mind was elrepo.org, as they apply some of the same build options that Redhat uses against the latest upstream. Their kernel packages are meant to provide support for newer laptop hardware...

Re:PCID is now a critical performance/security feature on x86 by c2h5oh on Monday January 08, 2018 @09:33PM (#16103047)
Linux if it's running kernel older than 8 weeks.
Re:PCID is now a critical performance/security feature on x86 by tveita on Monday January 08, 2018 @03:22PM (#16100076)
This will be good to keep in mind when looking at performance reports.

The main performance numbers I've seen so far are from two kinds of sources:

1. Local benchmarks like the Phoronix benchmarks, which I think are all on physical hardware with PCID.

2. Reports from cloud customers like https://forums.aws.amazon.com/thread.jspa?threadID=269858 and https://twitter.com/chanian/status/949457156071288833. These are with a patched host, but with an unpatched guest OS. The best case scenario here seems to be that it doesn't degrade much further when the guest OS is patched.

I don't think I've seen any numbers yet for AWS with a patched guest OS - this would be interesting to see on instances with and without PCID support.

Re:PCID is now a critical performance/security feature on x86 by bogomipz on Monday January 08, 2018 @09:56AM (#16097097)
I had a question, the author states:

>"The PCID (Processor-Context ID) feature on x86-64 works much like the more generic ASID (Address Space IDs)"

Is ASID the RISC instruction that accomplishes the same thing that PCID does on x86 then?

Re:PCID is now a critical performance/security feature on x86 by puzzle on Monday January 08, 2018 @11:17AM (#16097731)
ASID is not an instruction. It's basically an attribute in how MMU tables are set up. Processes usually get different ASIDs from each other and all their MMU pages are tagged with it.
Re:PCID is now a critical performance/security feature on x86 by monocasa on Monday January 08, 2018 @03:13PM (#16099959)
The individual MMU pages aren't tagged with ASIDs, it's more like you have N page table root pointers in hardware, and rather than saying "this is the current root pointer", you say "this is the root pointer for ASID N, and separate from that this is the current ASID".
Re:PCID is now a critical performance/security feature on x86 by bogomipz on Monday January 08, 2018 @02:40PM (#16099577)
Sorry I didn't mean instruction. It's the RISC equivalent attribute then?
Re:PCID is now a critical performance/security feature on x86 by puzzle on Monday January 08, 2018 @03:39PM (#16100275)
Yes. There is still variety, though. On PowerPC, for example, there is the concept of segments.

On 32bit systems, the address space is divided into 16 segments of 256MB each. Each of them has a privileged register that can be setup in different ways (e.g. half could be per-process, half machine-wide). The 4 bits from the segment ID eventually map to a 24 bit value (or trigger a protection violation if e.g. the page is kernel-only), so that the original 32bit address becomes a 32 - 4 + 24 = 52 bit virtual address. The MMU, then will look up the higher order bits in the address to convert from 52bit virtual addresses to actual 32bit physical addresses. The virtual address space is larger because in theory you could have processes with completely disjoint addressing (up to 1 million of 4GB each, i.e. 4PB). In the end, you still only have 32 bits to address memory chips, though. :-)

On 64 bit systems, there are many more segments, 236. Instead of having (64 * billion) registers, there is a single register pointing to a hash table in memory that the CPU will walk through. Addresses are translated from 64->80->64 bits in a similar way.

Re:PCID is now a critical performance/security feature on x86 by bogomipz on Monday January 08, 2018 @05:15PM (#16101248)
Thanks, is your explanation all PowePC specific then?
Re:PCID is now a critical performance/security feature on x86 by monocasa on Monday January 08, 2018 @03:14PM (#16099974)
It's not a RISC/CISC thing. They're called ASIDs in AMD land as well.
Re:PCID is now a critical performance/security feature on x86 by bogomipz on Monday January 08, 2018 @05:16PM (#16101257)
I guess I am confused was to why there is both an ASID and PCID for x86 then?
Re:PCID is now a critical performance/security feature on x86 by monocasa on Monday January 08, 2018 @05:54PM (#16101635)
They're Intel and AMD extensions respectively. They're tacked onto the virtualization extensions, and since every implementor (Xen, KVM, etc.) has just wrote separate backends for VT and SVM anyway, Intel and AMD haven't found the need to negotiate cross licensing.
Re:PCID is now a critical performance/security feature on x86 by bogomipz on Tuesday January 09, 2018 @02:16AM (#16104230)
Thank you this makes sense. Cheers
Re:PCID is now a critical performance/security feature on x86 by dannyw on Monday January 08, 2018 @04:20PM (#16100705)
Can PCID (like HyperThreading, full L3 cache, or extra PCI-e slots in the latest i7s and i9s) be enabled with an update that blows those (e)fuses.
Re:PCID is now a critical performance/security feature on x86 by monocasa on Monday January 08, 2018 @06:02PM (#16101708)
I don't think it's a feature that's binned off. Intel used to bin off virtualization support (which PCID is technically part off), but they added PCID after they stopped binning on virtualization support.
Re:PCID is now a critical performance/security feature on x86 by loeg on Monday January 08, 2018 @07:26PM (#16102341)
PCID is supported by low end consumer CPUs since 2010 or so. I don't believe it exists in a disabled form on any hardware. (Maybe I'm mistaken.)
Re:PCID is now a critical performance/security feature on x86 by pgeorgi on Monday January 08, 2018 @04:50PM (#16100985)
efuses typically have a final efuse to be blown in manufacturing to prevent any further modification of the entire block. Otherwise there's way too high a risk of some broken code accidentally changing the configuration.
Re:PCID is now a critical performance/security feature on x86 by earenndil on Tuesday January 09, 2018 @03:29AM (#16104490)
Re:PCID is now a critical performance/security feature on x86 by Szpadel on Tuesday January 09, 2018 @08:17AM (#16105904)
I created script for detecting system status against Meltdown issue if anyone is interested if system is patched: https://gist.github.com/Szpadel/003798ac7f4d98bc3583c2a5f306...
Re:PCID is now a critical performance/security feature on x86 by KerrickStaley on Monday January 08, 2018 @06:05PM (#16101741)
One thing I still don't understand about all this:

Why is there still a (smaller) performance hit from the KPTI patch when PCID is used?

Re:PCID is now a critical performance/security feature on x86 by ploxiln on Monday January 08, 2018 @06:57PM (#16102156)
You still have to switch the page tables via the CR3 register. It costs.

And the code around there is more complicated now and has more conditionals ... as they say, it'll be opimized over time, this was the fastest reasonable solution they could put in there (and it still took some time).

Also keep in mind that the reason PCID wasn't used by Linux until 4.14 is that the most obvious way of using it incurred more overhead managing the IDs than it saved by not flushing the TLB between different userland processes. This is the land of fiddly details where theory and practice collide and theory often loses in practice.

Re:PCID is now a critical performance/security feature on x86 by dmitrygr on Monday January 08, 2018 @06:49PM (#16102097)
with PCID, you only flush the kernel mappings out of the TLB (as user mappings are the same). Without PCID you can only flush TLB or not, so you do, and thus user mappings are gone too and need to be repopulated.
Re:PCID is now a critical performance/security feature on x86 by yuhong on Tuesday January 09, 2018 @05:17PM (#16110672)
One problem is cross-vendor migration, because AMD don't support PCID.
Re:PCID is now a critical performance/security feature on x86 by jimktrains2 on Monday January 08, 2018 @06:31AM (#16096068)
I hate that you can't even view Google groups without an account. It also requires us to do nothing but show text. To me groups and blogger has always represented what a terrible web application is.
Re:PCID is now a critical performance/security feature on x86 by neonate on Monday January 08, 2018 @02:15PM (#16099209)
Hey! this works: http://archive.is/ma8Iw. I didn't expect it to.
Re:PCID is now a critical performance/security feature on x86 by dang on Monday January 08, 2018 @02:16PM (#16099234)
Let's try changing the URL to that from https://groups.google.com/forum/m/#!topic/mechanical-sympath....

I don't like obscuring the original domain but agree that Google Groups URLs posted to HN have consistently been annoying.

Re:PCID is now a critical performance/security feature on x86 by makomk on Monday January 08, 2018 @06:43PM (#16102053)
I think archive.is do a lot of magic on the backend so that stuff like this just works for users.
Re:PCID is now a critical performance/security feature on x86 by dingo_bat on Monday January 08, 2018 @01:00PM (#16098482)
Blogger doesn't even load if you have js disabled.
Re:PCID is now a critical performance/security feature on x86 by igravious on Monday January 08, 2018 @04:11PM (#16100635)
God I hate Google Groups. I actually need some info from some of those groups and because of account b0rkage and shenanigans it is just too much of a hassle. Weren't they originally Usenet groups or something? Initially they were being decent Web stewards of them (_that_ was a long time ago) but then they got subsumed into the corp. as all things must. It's as inevitable as night follows day. Utter shame.
Re:PCID is now a critical performance/security feature on x86 by nas on Monday January 08, 2018 @04:18PM (#16100687)
They screwed them up in pretty impressive fashion. Years ago, Google Groups used to be a great interface for searching Usenet archives. Now, it is near useless.

As an example, I wanted to do some research on early language features of Python (e.g. around 1993). The info is in Usenet postings of that time, surely present in Google Groups years ago. Now, I can't find anything useful. A advanced search using dates doesn't return anything. Their user interface is horribly bad compared to what it used to be.

Another example: I did some research on Deep Blue and Deep Thought, after reading Crazy Bird's book. With the old Google Groups, I could follow the discussion of the Deep Blue tournament, in chronological order. There was all sorts of interesting things like computer chess programmers speculating on how Deep Blue worked and people posting analysis of chess positions. All that is now gone or at least not searchable.

So sad that all of this knowledge has apparently disappeared. There was loads of information shared on Usenet and the storage space required to preserve it would be trivial.

Re:PCID is now a critical performance/security feature on x86 by igravious on Monday January 08, 2018 @05:01PM (#16101097)
I thought their mission statement was, "organise the world's information and make it accessible" or something like that. Didn't know there was an asterisk–but not Usenet…
Re:PCID is now a critical performance/security feature on x86 by LinuxBender on Monday January 08, 2018 @08:00PM (#16102530)
Usenet is still very much alive. In fact, many of the spammers have left and now target other more popular resources. The text only groups are accessible for free from multiple servers. It's only the binary groups that you have to pay to get access.
Re:PCID is now a critical performance/security feature on x86 by hinkley on Monday January 08, 2018 @04:24PM (#16100730)
Google bought Deja News and turned it into Groups.
Re:PCID is now a critical performance/security feature on x86 by igravious on Monday January 08, 2018 @05:00PM (#16101085)
That was it, was too lazy to look it up but the Internet Gods have answered.
Re:PCID is now a critical performance/security feature on x86 by dmm on Monday January 08, 2018 @09:06AM (#16096760)
Google only asks you to login if it knows you have an account.
Re:PCID is now a critical performance/security feature on x86 by acdha on Monday January 08, 2018 @02:46PM (#16099642)
The problem is that they completely botched the user experience a decade ago and since it's yet another orphaned product it's never been improved.

How it should work following a “build your first web app” tutorial:

1. User opens page

2. You detect an old login cookie and discretely ask if they want to login

3. If they do so, you see the previous page with more UI (e.g. subscribe, reply, etc.)

How it works now:

1. Users opens page

2. Instead of looking at the content they wanted to see, the user is automatically redirected over to a login page with a mandatory full two-factor check even if you've recently logged in to other Google properties

3. After completing that process, you're dumped on the groups.google.com homepage 4. Since there were a bunch of redirects, you have to know how to use your browser's history to go back 3-4 pages because simply hitting back will just redirect you to the homepage again.

Re:PCID is now a critical performance/security feature on x86 by jimktrains2 on Monday January 08, 2018 @09:20AM (#16096844)
That still feels like a problem to me. Just show it as unauthenticated if I'm not authenticated.
Re:PCID is now a critical performance/security feature on x86 by Analemma_ on Monday January 08, 2018 @01:40PM (#16098756)
That doesn’t make it ok. If anything that’s worse.
Re:PCID is now a critical performance/security feature on x86 by mrguyorama on Monday January 08, 2018 @12:09PM (#16098137)
I find the fact that google feels it's okay to track you like that disturbing
Re:PCID is now a critical performance/security feature on x86 by dingo_bat on Monday January 08, 2018 @01:00PM (#16098485)
Somehow that's even worse.
Re:PCID is now a critical performance/security feature on x86 by aceoflzlz on Monday January 08, 2018 @08:25AM (#16096517)
I don't have an account and I could read that just fine.
Re:PCID is now a critical performance/security feature on x86 by unitboolean on Monday January 08, 2018 @04:42PM (#16100900)
Many people said that if your processor support PCID, the performance will not be reduced a lot by the new patches. However, after installing new updates for windows and for my very new CPU 7600U everything becomes extremely slow. My laptop is now literally unusable. Even the simplest tasks are very slow. Before this update I was able to watch youtube videos in 4K, now I'm struggling even to watch 480p... I will never buy Intel processors again. In the last few months I only hear lies from Intel regarding Meltdown, Management Engine and other "holes" in their products. Now I can throw my super expensive laptop in garbage. Thank you Intel.
Re:PCID is now a critical performance/security feature on x86 by MBCook on Monday January 08, 2018 @05:52PM (#16101611)
Ah, memories of /.