News for hackers. Stuff that matters.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by Ristovski on Tuesday October 04, 2022 @10:02AM (#33080528)
An interesting comment made in the Phoronix forums:

> My theory is that fixing the Spectre V2 vulnerability on a hardware level would lead to fundamental architecture changes that AMD is not willing to make, because it may add so much more complexity to the architecture or it may just be too unconvenient. They probably realized that optimizing the code paths that the Linux kernel utilizes on the default mitigations mode is faster, simpler and it may involve less deeper changes, while still being secure.

> As far as I know, pretty much every CPU architecture that implements speculative execution is vulnerable to some version of Spectre, so note that this is not a fundametal flaw of AMD64.

Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by galaxyLogic on Friday October 07, 2022 @07:42PM (#33128340)
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by dundarious on Friday October 07, 2022 @08:02PM (#33128473)
That's the Spectre V2 from the OP title. What's the point this link is meant to convey?
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by aliqot on Friday October 07, 2022 @08:19PM (#33128574)
Probably that they had a feeling they wanted to refute it somehow but figured an article would be more authoritative, except the one they picked was picked by the headline rather than content.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by dundarious on Saturday October 08, 2022 @12:10PM (#33133492)
Yes, it certainly seems that way.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by ajross on Friday October 07, 2022 @08:11PM (#33128525)
That seems like a disaster brewing. The whole spectre family of vulnerabilities is a side effect of CPUs keeping state around to optimize things and leaking that data between privilege levels.

I mean, in the humorous extreme: imagine if some enterprising group at AMD got together and realized they could "optimize" all that retpoline code by making the RET instruction aware of the branch prediction cache!

"Fundamental architecture changes" are, in fact, what is actually required here.

Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by Sirened on Friday October 07, 2022 @08:31PM (#33128673)
I am terrified to think what AMD's predictor structure is if it's easier for them to do _this_ than it is to simply add privilege tags to their predictors. I don't personally buy this explanation anyways; trying to optimize retpolines in hardware would be an absolute pain in the ass and require an insane amount of synchronization with the backend since retpolines always trash the RAS.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by sounds on Friday October 07, 2022 @10:22PM (#33129277)
I would guess it's probably physics. Specifically the complexity of the signal path routing for the predictor core must be pretty heavily optimized, and probably are where AMD (and Intel) have invested heavily in advanced design software - their secret sauce - to push the chip right to the edge of what semiconductor physics can achieve.

The branch predictor is one of the most highly optimized pieces of the CPU core. Lots of discussion has been had about how the arm architecture's frontend is simpler, so for example Apple's chips have way more execution units. Intel and AMD's latest designs have also expanded the number of execution units, but the frontend instruction decode and dispatch is the "serial" part of the process, reading the incoming instruction stream. And the x86 instruction set is hard to decode, with a lot of variation in the number of bytes per instruction. So for the instruction decoder to even know there's a branch coming up is a "hard problem," and then it predicts which way the branch will go.

Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by tadfisher on Friday October 07, 2022 @10:04PM (#33129181)
Occam's Razor would suggest a Linux bug.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by iforgotpassword on Saturday October 08, 2022 @04:21AM (#33130702)
Or maybe if we want to keep in the realm of AMD doing something on purpose here, maybe they can detect that the kernel is run with mitigations and then just let the CPU do all the unsafe speculation, while without the mitigations, they disable a lot of the speculative stuff which is somehow even slower than the former case.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by Sesse__ on Saturday October 08, 2022 @05:12AM (#33130907)
Occam's Razor would suggest that Phoronix' benchmarks are broken.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by Havoc on Friday October 07, 2022 @08:06PM (#33128490)
Interesting. When i first heard this I assumed it’s bad benchmarking but photonics saying same suggest otherwise
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by simlevesque on Friday October 07, 2022 @09:12PM (#33128905)
It seems logical that if Zen 4 is immune to Spectre, the mitigations are a waste and therefore slow the CPU.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by pdpi on Friday October 07, 2022 @09:39PM (#33129042)
Except that that's the opposite of what's going on. The CPU performs better with the "wasted" mitigations turned on.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by MBCook on Friday October 07, 2022 @11:06PM (#33129460)
“As for why the Ryzen 7000 series performance is actually slower if disabling the Spectre V2 mitigations, that's likely something only AMD can effectively answer but presumably…”

Just ask!

Seriously. You can ask AMD. Maybe they won’t tell you, but they might. It might be really good info. Why not ask someone who is really knowledgeable about this stuff like a kernel developer who works on x86-64 or worked on the mitigations?

This is what I never understand about Phoronix. People link to them all the time but they run a bunch of benchmarks and then end on “there you go”. I’d like investigation into why. You won’t always get an answer but you should try.

Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by theow7384iri on Saturday October 08, 2022 @12:50AM (#33129852)
I don't think Phoronix has time and budget for that. It is a single man, a few scripts and heavy automation. Sometimes he founds bugs and reports it, but there is no time to follow such rabbit hole!
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by getcrunk on Saturday October 08, 2022 @01:26AM (#33129998)
if anything, industry should reach out to him imo. he has a lot of mind share in the IT community
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by p-e-w on Saturday October 08, 2022 @01:35AM (#33130036)
> Seriously. You can ask AMD. Maybe they won’t tell you, but they might.

Seriously? By far the most likely outcome is that they don't even bother responding.

That's how corporations operate in 2022. If you're a journalist from the Washington Post, you might get a three-line statement from a spokesperson. Everyone else gets a canned reply from a bot, or nothing at all.

I don't blame Michael for not even bothering to try. Phoronix is the only game in town for much of the topics it covers. The fact that it exists at all, and is effectively run by a single person, is nothing short of amazing.

Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by worthless-trash on Saturday October 08, 2022 @02:29AM (#33130269)
> That's how corporations operate in 2022. If you're a journalist from the Washington Post, you might get a three-line statement from a spokesperson. Everyone else gets a canned reply from a bot, or nothing at all.

This is not true, I write to AMD security team for spectre/meltdown/CPU flaws and get reasonable responses. Intel security team is also quite good. The usual wait time is 3-4 days.

Admittedly I do write from my work address.

Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by p-e-w on Saturday October 08, 2022 @02:40AM (#33130310)
That's great, but I suspect the address you write from indeed plays a big part here. Direct responses from engineers of that caliber within a matter of days is most certainly not standard.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by throwawaybutwhy on Sunday October 09, 2022 @05:18AM (#33139326)
Probably somewhere in A.A. County.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by stingraycharles on Saturday October 08, 2022 @03:32AM (#33130522)
What’s your work, out of curiosity? I suppose security researcher?
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by worthless-trash on Tuesday October 11, 2022 @09:03PM (#33171411)
Red Hat Kernel security team.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by inglor on Saturday October 08, 2022 @05:14AM (#33130910)
I answer engineers from other companies all the time but never answer journalists. Engineers give a vibe of “cares about what you do and wants to collaborate”.

Talking to journalists is like talking to the police - as an engineer you don’t understand the situation well enough and you need to involve an (expensive) professional to navigate it.

The question going through my head when I get journalist emails is “can I ignore this and save the hours of work with legal/pr?”.

Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by spookie on Saturday October 08, 2022 @07:50AM (#33131543)
True that
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by marcosdumay on Saturday October 08, 2022 @12:17PM (#33133546)
On most places only the PR team is even allowed to talk to journalists. Exactly because that "is like talking to the police" issue.

It's a very sensible and correct policy.

Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by worthless-trash on Tuesday October 11, 2022 @09:02PM (#33171404)
Thats a good point, I had never thought of that.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by TheRealPomax on Saturday October 08, 2022 @02:44AM (#33130327)
> By far the most likely outcome is that they don't even bother responding

So, "likely" the same outcome as when you don't ask, except unlike when you don't ask, there is a different outcome when you do ask? Sounds like you just made the argument in favour of always asking questions.

Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by Blikkentrekker on Saturday October 08, 2022 @07:45AM (#33131521)
Under the assumption that time is not valuable. Writing such an email is still an investment of time.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by albertopv on Saturday October 08, 2022 @01:50AM (#33130115)
Phoronix is a one man show literally doing everything: hw managemen, tests, articles, news reports, forum admin, premium users management...
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by hericium on Saturday October 08, 2022 @05:07AM (#33130893)
> Just ask! Seriously. You can ask AMD.

But it's Phoronix - short reprints, not well-done benchmarks, 1-3 paragraphs long "articles" and backlink spam on forums, wikis and wherever possible. They may ask AMD but that will be another "article" and another wave of spam.

Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by woliveirajr on Saturday October 08, 2022 @06:36AM (#33131216)
Remembers me about the 'supercow powers" question at StackOverflow (unixStackExchange): everybody just guessing, I dared to ask Jason Gunthorpe and he didn't answer me... he made post about it:

https://web.archive.org/web/20190322061230/https://plus.goog...

Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by stevefan1999 on Saturday October 08, 2022 @02:13AM (#33130208)
meh, maybe they just flush TLB every time in hardware level if you disabled the mitigations, ane disabled the hardware flush if the software side can handle it
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by bmacho on Saturday October 08, 2022 @07:23AM (#33131415)
So mitigations = off when they do flush, and mitigations = on when they use previous data and weird shenanigans?
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by Cloudef on Saturday October 08, 2022 @08:38AM (#33131799)
Yeah it seems like hw migtation is slower than software
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by staticassertion on Saturday October 08, 2022 @03:29PM (#33135246)
This is basically my guess. In the event of no mitigations you have to pessimistically flush TLB. In the case of mitigations the flush only has to happen in specific instances, which PCID significantly helps with but requires cooperation from both hardware and software.

So maybe even something like "if PCID is not set, flush the cache" vs "if PCID changes, flush the cache".

I think that would certainly account for this, and they could have improved the performance with PCID by increasing the PCID cache size.

Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by ZiiS on Saturday October 08, 2022 @04:36AM (#33130757)
This is basically just saying: the super clever AMD designers and Linux kernel developers have optimised for the setting they recomend and most people use. An insecure setting they recomend against isn't yet well optimised on brand new hardware.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by staticassertion on Saturday October 08, 2022 @03:28PM (#33135239)
Yes, the interesting question is how they did this.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by sylware on Saturday October 08, 2022 @06:13AM (#33131150)
this smells really bad... as it does not make a lot of sense, the devil hides in the details.
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by amelius on Saturday October 08, 2022 @07:38AM (#33131497)
Perhaps their Spectre path has benchmark detection :)
Re:AMD Ryzen 7000 Series performs better with Spectre V2 Mit... by staticassertion on Saturday October 08, 2022 @09:59AM (#33132315)
Interesting. I wonder if the kpti path leveraging PCID has 'tipped' into a performance improvement? Maybe a larger PCID cache on the CPUs and optimized codepaths for specter-usage?