Linux 5.9 Boosts CPU Performance With FSGSBASE Support (phoronix.com) 75
FSGSBASE support in Linux "has the possibility of helping Intel/AMD CPU performance especially in areas like context switching that had been hurt badly by Spectre/Meltdown and other CPU vulnerability mitigations largely on the Intel side," Phoronix wrote back in August. As it started its journey into the kernel, they provided a preview on August 10:
The FSGSBASE support that was finally mainlined a few days ago for Linux 5.9 is off to providing a nice performance boost for both Intel and AMD systems... FSGSBASE support for the Linux kernel has been around a half-decade in the making and finally carried over the finish line by one of Microsoft's Linux kernel engineers...
FSGSBASE particularly helps out context switching heavy workloads like I/O and allowing user-space software to write to the x86_64 GSBASE without kernel interaction. That in turn has been of interest to Java and others...On Linux 5.9 where FSGSBASE is finally mainlined, it's enabled by default on supported CPUs. FSGSBASE can be disabled at kernel boot time via the "nofsgsbase" kernel option.
Today on the Linux kernel mailing list, Linus Torvalds announced the release of Linux 5.9: Ok, so I'll be honest - I had hoped for quite a bit fewer changes this last week, but at the same time there doesn't really seem to be anything particularly scary in here. It's just more commits and more lines changed than I would have wished for.
And Phoronix reported: Linux 5.9 has a number of exciting improvements including initial support for upcoming Radeon RX 6000 "RDNA 2" graphics cards, initial Intel Rocket Lake graphics, NVMe zoned namespaces (ZNS) support, various storage improvements, IBM's initial work on POWER10 CPU bring-up, the FSGSBASE instruction is now used, 32-bit x86 Clang build support, and more. See our Linux 5.9 feature overview for the whole scoop on the many changes to see with this kernel.
FSGSBASE particularly helps out context switching heavy workloads like I/O and allowing user-space software to write to the x86_64 GSBASE without kernel interaction. That in turn has been of interest to Java and others...On Linux 5.9 where FSGSBASE is finally mainlined, it's enabled by default on supported CPUs. FSGSBASE can be disabled at kernel boot time via the "nofsgsbase" kernel option.
Today on the Linux kernel mailing list, Linus Torvalds announced the release of Linux 5.9: Ok, so I'll be honest - I had hoped for quite a bit fewer changes this last week, but at the same time there doesn't really seem to be anything particularly scary in here. It's just more commits and more lines changed than I would have wished for.
And Phoronix reported: Linux 5.9 has a number of exciting improvements including initial support for upcoming Radeon RX 6000 "RDNA 2" graphics cards, initial Intel Rocket Lake graphics, NVMe zoned namespaces (ZNS) support, various storage improvements, IBM's initial work on POWER10 CPU bring-up, the FSGSBASE instruction is now used, 32-bit x86 Clang build support, and more. See our Linux 5.9 feature overview for the whole scoop on the many changes to see with this kernel.
interesting (Score:5, Insightful)
finally carried over the finish line by one of Microsoft's Linux kernel engineers
hopefully many will appreciate that companies can change and even if they don't too much, Linux can still benefit a lot from them
Re:interesting (Score:5, Insightful)
Re: (Score:1)
Re: (Score:2)
I'd say enemy #1 to Linux right now would be Google, after all they are the ones letting the cellphone and tablet OEMs make un-upgradeable locked down future e-waste despite the fact that they are running on a Linux kernel and thus would be trivially easy to be opened up and allowed a second life doing other tasks.
If Google doesn't let handset manufacturers make locked phones then no one will use Android and the only remaining mobile phone OS anyone uses will be iOS.
If you want to buy unlocked phones, they exist. If you took the cheap way out and got a subsidized phone, you have only yourself to blame, since there are still unlocked Android phones on the market.
Re: (Score:2)
Re: (Score:2)
Blah blah blah fucking blah. The simple fact is that it's not hard to get an unlocked phone. Moto, for example. Your whole assertion was that it's difficult. It isn't. Give over.
you are gonna sit here with a straight face and try to argue companies like Samsung, LG, and a billion smaller corps are gonna say "We don't need profits for the next few years, if Google doesn't do as we say we'll make our OWN OS with blackjack and hookers!" really? Ask Sailfish how that worked out for them,
It didn't work out because Android was available under acceptable terms. That may only have been because there was another OS waiting in the wings as a threat, but so what? If so, it worked.
Re: (Score:2)
Re: (Score:1, Insightful)
If
Re: (Score:1)
What? Who banned it? They are making laws agaisnt it because of all the pollution it casues. Are you paying to remove all the CO2 and whatever noxious fumes your combustion engine forces into the atmosphere. Even if it doesn't cause cimate change, you are adding crap to the atmosphere.\
Re:x86 (Score:5, Insightful)
Basically this externality is the problem. Gas is artificially cheaper because people only pay part of the cost now and hand off the rest of the cost to others later in the form of pollution. Even if global warming did not exist air pollution is a major health problem. It is not right that someone can just spew that stuff into the air and everyone else has to pay for it.
Re: (Score:1)
Re: (Score:2)
And electric is hardly better, all you're doing is moving where the spewing into the environment is happening. Rather than the car's tail pipe, its the smoke stack at the coal/oil burning power plant, the destruction of natural environments and industrial pollution that comes with mining the raw materials and the manufacture of "renewable" energy sources.
Firstly, even then it's easier to deal with the pollution in bulk at source. Secondly, electric can be produced other ways without any change at the user end. You can't decide to run your car on different fuels from one day to the next.
Re: (Score:2)
Decoupling is really important. Moving the pollution does help a lot of people since they directly breathe in far less of it. Large power plants are also more efficient than car engines are and it is easier to capture a higher percentage of waste products at a point source than from all the car engines.
Decoupling also has the advantage that the problem is easier to clean up. If we have gas cars and the fusion reactor from MIT works we still have a huge pollution problem from gas cars. If we have electric ca
Re: (Score:2)
Your arguments were old, tired, and wrong literally decades ago.
Try to keep up if you don't want to be wrong and boring.
Re: (Score:1)
Re: (Score:2)
That is a problem that needs to be solved in california but lets be honest even without electric cars california has to solve this problem.
They'll need about 3-4X more electricity, to be ex (Score:2)
To be more specific, if you want to use electricity for everything (cars, heating, etc), the US needs about 3X as much electricity as it currently has. That is, the electricity usage goes up by about 3X. California is already short, so figure they need about 4X in order to power everything and not have rolling blackouts.
Re: (Score:1)
Re: x86 (Score:2)
We make laws because you people would *literally* mass-genocide the entire planet for a few short profit gains that serve no purpose but to "Make number go brrrr!" on your imaginary money accounts.
I know somebody who managed only *one* genocide attempt... How does it feel, being literally worse than Hitler?
Re: (Score:1)
This is straight up communism.
It is quite staggering to see how many Americans have no fucking clue what "communism" means.
Re: (Score:3)
RISCV is going to be about as popular as Transmeta was. If It hasn't happened yet it's not going to. Plenty of embedded stuff is still perfectly happy running on PowerPC, MIPS, and even SPARC cores. All of those are thoroughly tested and vetted with decades of results.
Re: (Score:2)
Re: (Score:2)
> come back in 2030
OK - the rest of us will take performance and energy-efficiency boosts for the next ten years.
Re: (Score:2)
hahaha, "why bother when the rosy view in my crystal ball says it's not needed."
The answer is reality, pal. x86 is king now, and might be 10 years from now. ARM or RISC V might not be able to keep up with what is coming in x86 roadmap.
An internal combustion engine could make pure water as exhaust in 2030...
Re: (Score:1)
An internal combustion engine could make pure water as exhaust in 2030...
Sure, if it only uses hydrogen as fuel and oxygen as oxidizer and runs cool enough to avoid forming nitrates. However, if the engine runs on gasoline, the presence of carbon in the fuel means you'll have more outputs than water.
Re: (Score:2)
there are carbon capture and nitrate absorber techs being developed, hydrogen isn't the only possible way
Re: (Score:2)
ICEs burning HC make soot, and at some point the soot gets to be too fine to successfully trap in a filter. When you burn off large soot in a filter (like a DPF) you get out CO2 and finer soot that you can't trap, so DPFs just mean finer and more dangerous soot, not elimination thereof.
There's no effective way to get ICEs to stop emitting soot short of massive filters that take up more space in a car than batteries do in an EV, because they have to be very fine and thus they need very large surface area in
Re: (Score:2)
Your arguments are dated. There are other ways than a perforated "filter" to remove soot, such as passing exhaust through a solution. Internal combustion fuel dwarfs the feeble energy density of batteries so much, a couple orders of magnitude, that electric vehicles may never win.
Re: (Score:2)
There are other ways than a perforated "filter" to remove soot, such as passing exhaust through a solution.
There's a lot of exhaust to pass through your solution. How big is the trailer in which you're going to do your soot removal?
Internal combustion fuel dwarfs the feeble energy density of batteries so much, a couple orders of magnitude, that electric vehicles may never win.
EVs have already "won", in that people want to buy them, and once they've driven one they don't want to go back. ICEs are just on borrowed time. EVs continue to increase in both range and charge rate (as measured in units of range over time, and also in C rate of cells) towards the point that any range deficit is irrelevant. ICEs or perhaps fuel cells (which may or may not run on HC f
Re: (Score:2)
You mean a small percentage of people in the USA have bought them, they're a bit too pricey for the average joe and there are not sufficient charging stations. Electric cars haven't won anything here.
Re: (Score:2)
You mean a small percentage of people in the USA have bought them, they're a bit too pricey for the average joe and there are not sufficient charging stations.
So, just like cars themselves, originally? Forgetting the lessons of history means getting caught flat-footed by the future.
Re: (Score:2)
aren't you funny, saying everything is fine because it's like 1910 for electric car refueling. hilarous. news for you, the economy depends on cars and timely refueling, we can't have tens of millions of people waiting 8-12 hours so they can continue their journey.
Re: (Score:3)
Whether x86 is on its way out or not, the installed base is absolutely enormous. So even if no other x86 were ever sold, it is still worth making improvements to the software. And it would be hard to convince me it will go to 0 sales in 10 years - don't underestimate the inertia of a large installed software/hardware base (I am currently working on some software that works only on XP because the company depends upon hardware that has no drivers that work for later versions of Windows... it will be phased ou
Re: (Score:2)
x86 is on its ride out
x86 is long gone, except as a compatibility mode in processors implementing the amd64 instruction set.
to be replaced by ARM or RiSC V.
Absolutely not. SOME amd64 servers will be replaced with ARM servers, but only ones which are strictly I/O bound. RISC-V is still in the early phases...
If you donÃ(TM)t believe me come back in 2030
...and it's utterly unlikely to be dominating in a mere decade.
That sounds like a stretch. (Score:1)
has the possibility of helping Intel/AMD CPU performance especially in areas like context switching that had been hurt badly by Spectre/Meltdown and other CPU vulnerability mitigations largely on the Intel side
And here's a new battery research paper that promises 3x the storage...
Re: (Score:2)
has the possibility of helping Intel/AMD CPU performance especially in areas like context switching that had been hurt badly by Spectre/Meltdown and other CPU vulnerability mitigations largely on the Intel side
And here's a new battery research paper that promises 3x the storage...
It's also bullshit to conflate AMD and CPU while conflating SPECTRE and MELTDOWN, because AMD is not vulnerable to MELTDOWN, only SPECTRE.
WTF is FSGSBASE (Score:5, Informative)
... which just leaves the question: what actually is FSGSBASE?
FS and GS are segment registers, that (in Linux and Windows) point to an area of memory. This area is different per-thread, so when you switch threads, FS and GS need to be loaded with new values.
This new code lets that happen more efficiently, in a way that I don't quite follow, but I think it has to do with not having to change access level from user mode to kernel mode before you execute the instruction.
https://lwn.net/Articles/76935... [lwn.net]
Re:WTF is FSGSBASE (Score:4, Informative)
Re:WTF is FSGSBASE (Score:5, Informative)
Re: (Score:2)
It better be, as it needs to be checked all the time, instead of one syscall in that one weird application that needs a memory chroot.
Re:WTF is FSGSBASE (Score:5, Informative)
That delay is largely due to TLB flushing, etc. I.e., in terms of lost cycles- the faster your machine is, the more expensive that cost is.
On a 5Ghz machine, for example, the "cost" of a context switch is about 11,000 wasted cycles. On a modern superscalar machine, that generally means a lot more than 11,000 times an instruction could have been executed, were the core not stalled waiting for the caches to flush.
Context switches are *very* expensive.
Re: (Score:2)
Generally, the context switch alone costs about 2.2uS.
That delay is largely due to TLB flushing, etc. I.e., in terms of lost cycles- the faster your machine is, the more expensive that cost is.
On a 5Ghz machine, for example, the "cost" of a context switch is about 11,000 wasted cycles. On a modern superscalar machine, that generally means a lot more than 11,000 times an instruction could have been executed, were the core not stalled waiting for the caches to flush.
Context switches are *very* expensive.
But having to check that condition on every interrupt and scheduled context switch, also easily adds up to tens of thousands of checks.
And i am pretty sure there are techniques to avoid flushing the TLB when doing simple system calls that continues with the same process. As long as it isn't blocking, which would be much more expensive.
Re: (Score:2)
Ah, right. it used to be cheaper, but the spectre workaround forces the kernel to flush more to work around Intel bugs.
Re: (Score:2)
FSGSBASE mitigates quite a bit of that by removing MSR access requirement from the context switch code, so it's faster on both Intel and AMD CPUs, with or without Spectre and Meltdown mitigations.
Re: (Score:2)
But having to check that condition on every interrupt and scheduled context switch, also easily adds up to tens of thousands of checks.
Unless it's doing 10s of thousands of checks in between every instance where a userspace process would want to set its FS base, then your scenario isn't realistic.
And it's not, because TLS is set via FS, and it's highly unlikely that you'll have 10s of thousands of syscalls executed in between every time a thread tries to setup a new TLS, or some JIT wants to use its FS for internal purposes.
There's a reason this change is happening. The math has already been done. FSGSBASE is superior in performance, e
iouring bug fixes (Score:1)
I could be wrong but I think there are some important iouring fixes that are eagerly expected among the non-blocking IO frameworks/libraries.
In Case Anyone Is Wondering... (Score:5, Informative)
I came up with this post [lwn.net], captured in the Linux Weekly News archive, which gives a slightly more detailed look at what this patch actually delivers.
Then there's this page [kernel.org], over at Kernel.org, which goes in to a little bit more detail about the use of the code in managing address spaces and segmentation within the kernel. I'm not even remotely close to a kernel developer, but a close read of this material suggest - to me at least - that this code is a more elegant way of using software to deliver the address space protection that the Meltdown and Spectre vulnerabilities revealed were not working as intended in the physical hardware of Intel and AMD processors.
It's these improvements to segmentation and address space management that have helped to restore some of the performance that was lost when it became necessary to write software fixes to cover for the CPU design flaws being exploited by Meltdown and Spectre.
This is probably a bit unfair of me... but in light of the couple of recent
Re:In Case Anyone Is Wondering... (Score:5, Informative)
I feel obliged to point out that these performance improvements were implemented (as far as we know) in Linux ahead of any proprietary OS.
No.
FSGSBASE has been supported in Windows since 8.1
It's lagging support in Linux has been due to a rather public spat between Intel engineers and the x86 maintainer.
Biggest gains for PostgreSQL so I bet it is MS SQL (Score:1)
"one of Microsoft's Linux kernel engineers" (Score:3)
There's a line that nobody would have believed a decade ago.
I checked: Hell officially froze over. They're all ice skating whenever the pigs aren't swarming. I'm sorry. Microsoft Pigs that is!
Is it time to split core kernel from drivers? (Score:2)
The kernel package is now huge and takes a huge amount of time to compile. I can't help thinking that perhaps the core kernel should be put into its own package so that if there's a change in the core it can easily be downloaded and built without having to rebuild all the driver code along with it. Yes, this will make matching up compatible driver packages with kernel core an issue but perhaps its something that should be looked in to.
Re:Is it time to split core kernel from drivers? (Score:4, Informative)
The kernel is modular.
Distributions ship what they need, people build what they want.
If you want to tack on out-of-tree modules to your currently running kernel, there's DKMS.
Symbol table fingerprinting is a thing to ensure compatibility.
Ya, we'll look into it though.
Re: (Score:3)
Part of the appeal of Linux is that it comes with all those drivers, and saves people from the driver hell that they experience with Windows. Having to track down drivers for all the hardware separately is a PITA.
Re: (Score:2)
Whatever package it is in is certainly installed by default, for the exact reason you specified- but still, the core is shipped separately.
Re: (Score:3)
It's a non-issue anyway.
People compiling their own kernel are presumably only compiling drivers they need, so it won't affect them except for having to download the drivers... once. If they are upgrading to each new kernel version they can download a patch instead of the tarball.
Everyone else who gets the drivers installed on their system only loses some disk space which they can almost certainly afford on a modern computer. A fairly well-featured Linux distribution install (not just a kernel) can fit in le
Re: (Score:2)
Re: (Score:2)
driver hell with windows?
tried debian. It wouldn't boot with my usb kb&mouse connected. A wasd code v2b and a corsair harpoon.
from the past couple experiences with linux i'm almost vomiting to say it, but windows is a better operating system. The gui is of course terrible, ghastly, awful, but i haven't had a crash for years.
ever since my first experience with linux back with redhat 5.2 (i think?) there were very, very few times where i tried a distro and went "fuck yeah that's the stuff"... and the last
Re: (Score:2)
However- I don't know what the fuck your point is, because you can't compile the kernel without a scheduler (though it is pluggable) but you can most certainly compile it without any sound card drivers.
Your beef seems to be that your distribution includes sound card drivers in your lib-modules-extra-`uname -r`?
How fucking big do they need to write "extra" to get your attention?
I'd skip the crayon and practice on writing at all, because I have a feeling it's not the only thing yo
Re: (Score:2)
"However- I don't know what the fuck your point is"
There's a surprise. You've already proved you're as dumb as a rock, no need to emphasise it.
"because you can't compile the kernel without a scheduler"
Yes correct. However its clear you've never compiled or updated a kernel from source in your life. Stick to apt-get or yum mate.
Re: (Score:2)
Hi, I'm scotty2/damnoregonian.
You have no idea what the fuck you're talking about, or who the fuck you're talking to.
I've been writing kernel mode code for almost 20 years.
I have published CVEs, have written code that patches the kernel at run-time, and have written modules that have to run in kernels to which I didn't have the source to.
You're a nothing to me, dude. A little wanker who asks for my autograph
Re: (Score:2)
Wow, arn't you the hero. I've been building kernels and hacking kernel code since linux 1.1 when ygdrassil came on floppy disks so shove that up your arse. Also sort out your attitude, you sound like a boasting snotty teenager.
Re: (Score:2)
Wow, arn't you the hero.
Nope. Just in another fucking universe compared to you in knowledge of the topic at hand.
Also sort out your attitude, you sound like a boasting snotty teenager.
No, I sound like someone who just put a bitch in his place after he claimed I didn't know shit, when he was actually the ignorant party.
Justice has been done. Educate yourself so that you don't step in this particular pile again with someone else in the future.
It's probably best to just not pretend like you know shit that you don't.
Re: (Score:2)
A "bitch"? Wow, you're street init! Like a said, a snotty probably pasty faced nerd still acting like a teenager and living with his mum. Pity you can't understand the concept of split packages , but hey, you're too busy acting school playground tough. LOL :)
Re: (Score:2)
I'm on the right half of the Dunning-Kruger curve. You probably were somewhere down in the middle at one point, but the middle has gone and elevated to match the left side of the curve.
You shit stains acting authoritative about shit you know nothing about is going to be the death of us all.
Re: (Score:2)
Keep going sonny :)
Take that RISC! (Score:2)
We're still putting band-aids around our segment register architecture.