
Ionen wrote:I really have few ideas of what may be happening here, my best "guess" was that dev-qt/* may have been enabling some broken feature when -march=native is passed for these cpus (could try building dev-qt/* without -march at all) -- but if binpkgs are used then it sounded doubtful.
It's instead possible that it detects a feature at runtime regardless and only use it then, and only affect this specific hardware for some reason. If we knew which it could potentially be disabled but well. Not to say this is necessarily the right route or that the issue is really in dev-qt/*.
I'd suggest building qtbase without intrinsics support to see if it helps, but upstream Qt has made this impossible for amd64/x86 a few versions ago and just gives an error if disable the feature.

Incredible, I can't believe it!Ionen wrote:I really have few ideas of what may be happening here, my best "guess" was that dev-qt/* may have been enabling some broken feature when -march=native is passed for these cpus (could try building dev-qt/* without -march at all) -- but if binpkgs are used then it sounded doubtful.
It's instead possible that it detects a feature at runtime regardless and only use it then, and only affect this specific hardware for some reason. If we knew which it could potentially be disabled but well. Not to say this is necessarily the right route or that the issue is really in dev-qt/*.
I'd suggest building qtbase without intrinsics support to see if it helps (Edit: aka this disables runtime detection+usage of AVX and such), but upstream Qt has made this impossible for amd64/x86 a few versions ago and just gives an error if disable the feature.

Hu wrote:I wonder if the affected users have AVX support in hardware, but have it blocked by one of the software mitigations (probably for GDS (see linux.git:Documentation/admin-guide/hw-vuln/gather_data_sampling.rst)), and Qt isn't properly handling the case that the feature is in the CPU, but cannot be used. When -march is omitted, Qt then does not include the buggy AVX support at all, and works. This is all speculation on my part. I have not reviewed how Qt changes with the presence/absence of -march.
If that is the case, then we can simply test it:Hu wrote:I wonder if the affected users have AVX support in hardware, but have it blocked by one of the software mitigations [...] and Qt isn't properly handling the case that the feature is in the CPU, but cannot be used. When -march is omitted, Qt then does not include the buggy AVX support at all, and works. This is all speculation on my part. I have not reviewed how Qt changes with the presence/absence of -march.
Code: Select all
cat /sys/devices/system/cpu/vulnerabilities/gather_data_samplingFrom this file:Hu wrote:[...] (see linux.git:Documentation/admin-guide/hw-vuln/gather_data_sampling.rst)),[...]
The mitigation can be disabled by setting "gather_data_sampling=off" or "mitigations=off" on the kernel command line.
...
If used, these options will disable AVX use by turning off XSAVE YMM support. However, the processor will still enumerate AVX support. Userspace that does not follow proper AVX enumeration to check both AVX *and* XSAVE YMM support will break.

This is what I see:pietinger wrote:If that is the case, then we can simply test it:Hu wrote:I wonder if the affected users have AVX support in hardware, but have it blocked by one of the software mitigations [...] and Qt isn't properly handling the case that the feature is in the CPU, but cannot be used. When -march is omitted, Qt then does not include the buggy AVX support at all, and works. This is all speculation on my part. I have not reviewed how Qt changes with the presence/absence of -march.
1. Checking current setting with:(Maybe it will gives: "Mitigation: AVX disabled, no microcode")Code: Select all
cat /sys/devices/system/cpu/vulnerabilities/gather_data_sampling
2a. Compile everything with march=native and set the kernel command line parameter: gather_data_sampling=off
( 2b. Ceck again with cat /sys/devices/system/cpu/vulnerabilities/gather_data_sampling )
... any segfaults now ?
From this file:Hu wrote:[...] (see linux.git:Documentation/admin-guide/hw-vuln/gather_data_sampling.rst)),[...]The mitigation can be disabled by setting "gather_data_sampling=off" or "mitigations=off" on the kernel command line.
...
If used, these options will disable AVX use by turning off XSAVE YMM support. However, the processor will still enumerate AVX support. Userspace that does not follow proper AVX enumeration to check both AVX *and* XSAVE YMM support will break.

Thanks. It seems like the -23.08.* versions have already been removed for my version of the tree; I don't see ebuilds for them anymore. I can deal with not having them for a little while if I have to.proteusx wrote:I have none of the kaccount-* installed.
Spectacle: I have masked: >=kde-apps/spectacle-24.05.2. Version 23.08.5 works fine.
But I prefer the old ksnap which is a lot better. Still works
Same for gwenview: masked >=kde-apps/gwenview-24.08.1 and use version 28.08.0-r1
Also watch out media-libs/kimageannotator and media-libs/kcolorpicker I had to mask the latest versions.
Just to clarify where I am with this, asturm, I have gentoobinhost configured, but I don't recall ever having actually used it to install anything. - I always build from source. gcc appears to already detect bdver4 as native, which is slightly at odds with the document you linked saying the correct setting is bdver1. Should I interpret the 1 and 4 on the end as something like revision numbers, or is there likely to be a significant difference there, do you think? A quick Google doesn't seem to turn up any answers about the differences, but I'll keep looking.asturm wrote:@localtoast: Before you do that, I would still rather recommend
1) to upgrade to KF-6.6.0 and Plasma 6.1.5, just because they are available in ~arch now
2) switch your away from CFLAGS="-march=native -mtune=native" to the generic settings used by gentoobinhost which you appear to be using, and rebuild the Qt packages.
[...]
If you do not use the Gentoo hosted binary packages, checkout this document to choose the right setting for your AMD FX-9800: https://wiki.gentoo.org/wiki/Safe_CFLAGS#FX-XXXX
I was going to say I'd take a swing at KF-6.6, but it looks like another solution has possibly presented itself...GCC x86 Options wrote:‘bdver1’
CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
[...]
‘bdver4’
AMD Family 15h core based CPUs with x86-64 instruction set support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
Just so I'm sure I understand: tranquilcool, you built dev-qt/qtbase and nothing else with no -march and -mtune flags at all, or with like -march=generic? Did you still do -O2, or did you also turn off optimization? Did you mess with any CPU_FLAGS_X86 settings?tranquilcool wrote:Incredible, I can't believe it!
I compiled qtbase without any -march and everything just works. I can launch plasma6 apps etc.
Now I am compiling kwin and plasma-workspace, of course with -march-native, (I started deleting 'em to go back to plasma5) before you
suggested a no -march qtbase compilation).
I think everything is just going to work.
I'll report back.
I am very grateful.
Thank you!
Exactly the same for me.tranquilcool wrote:This is what I see:
cat /sys/devices/system/cpu/vulnerabilities/gather_data_sampling
Not affected


I'm gonna try this when I finish using the machine for work.tranquilcool wrote:Built qtbase with no march and non mtune. I never use mtune. And that was it.
I confirm, it works.
Thanks everybody.

According to GCC, my native arch is bdver4. I checked it using the gcc one-liner at the top of the page asturm linked me to upthread, so I presume it's correct. I assume tranquilcool's is too but I don't think I've seen him explicitly state it anywhere.Ionen wrote:Does the baseline -march=x86-64-v3 work fine, rather than none at all? Be good to know if issue is limited to -march=bdver4
Also, I know tranquilcool's -march=native is bdver4 but what about yours localtoast to be sure? To be simple, can emerge app-misc/resolve-march-native and run the "resolve-march-native" command to see.
Does raise the question as to why this is happening, bug in qt? bug in gcc? I don't intend to dig into that myself (esp. given can't test/reproduce, with my cpu -march=bdver4 just causes qtbase to fail to build), but I could potentially do a ebuild workaround that swaps to x86-64-v3 when bdver4 is detected so other people don't run into this.
Code: Select all
portage 9481 133 0.1 52552 17448 pts/5 R 19:01 0:00 /usr/libexec/gcc/x86_64-pc-linux-gnu/13/cc1plus -quiet -D_GNU_SOURCE -D HAVE_pollts /var/tmp/portage/dev-qt/qtbase-6.7.2-r4/work/qtbase-everywhere-src-6.7.2_build/CMakeFiles/CMakeScratch/TryCompile-dWnoqm/src.cxx -quiet -dumpdir CMakeFiles/cmTC_90abe.dir/ -dumpbase src.cxx.cxx -dumpbase-ext .cxx -mtune=generic -march=x86-64 -O2 -std=gnu++17 -fPIE -fcf-protection -o -Code: Select all
~ $ sudo grep O2 /var/tmp/portage/dev-qt/qtbase-6.7.2-r4/temp/build.log
-DCMAKE_C_FLAGS=-O2 -pipe
-DCMAKE_CXX_FLAGS=-O2 -pipe
C -O2 -pipe
C++ -O2 -pipeCode: Select all
[[ ${PN} == qtbase ]] && tc-is-gcc &&
[[ $($(tc-getCXX) -S -fverbose-asm ${CXXFLAGS} ${CPPFLAGS} \
-x c++ -o - - <<<'' || die) == *-march=bdver4* ]]
Give me a day or so, I will try to launch plasma with the qtbase version I've built omitting march, then when (if) that works, I'll rebuild qtbase specifically with x86-64-v3 and see what happens.Ionen wrote:If can confirm that -march=x86-64-v3 works too by rebuilding qtbase again and not just none, I already prepared a dirty workaround that I could push to qt6-build.eclass' _qt6-build_sanitize_cpu_flags, aka will sanitize if this is true:Commit at https://termbin.com/u6vx if someone actually want to try it, albeit I already tested the logic and I don't see why it wouldn't work, question is more whether x86-64-v3 is fine or not. If it's not, I'd suspect something broken or quirky on these cpus rather than a potential bug in qtbase or gcc, given -v3 is common and not broken for anyone that I'm aware of (some binary distros also provide -v3 packages (we do!), albeit -v1-2 are far more common).Code: Select all
[[ ${PN} == qtbase ]] && tc-is-gcc && [[ $($(tc-getCXX) -S -fverbose-asm ${CXXFLAGS} ${CPPFLAGS} \ -x c++ -o - - <<<'' || die) == *-march=bdver4* ]]

I built dev-qt/qtbase with this:Ionen wrote:If can confirm that -march=x86-64-v3 works too by rebuilding qtbase again and not just none, I already prepared a dirty workaround that I could push to qt6-build.eclass' _qt6-build_sanitize_cpu_flags, aka will sanitize if this is true:Commit at https://termbin.com/u6vx if someone actually want to try it, albeit I already tested the logic and I don't see why it wouldn't work, question is more whether x86-64-v3 is fine or not. If it's not, I'd suspect something broken or quirky on these cpus rather than a potential bug in qtbase or gcc, given -v3 is common and not broken for anyone that I'm aware of (some binary distros also provide -v3 packages (we do!), albeit -v1-2 are far more common).Code: Select all
[[ ${PN} == qtbase ]] && tc-is-gcc && [[ $($(tc-getCXX) -S -fverbose-asm ${CXXFLAGS} ${CPPFLAGS} \ -x c++ -o - - <<<'' || die) == *-march=bdver4* ]]
I see, that's too bad. Does x86-64-v2 fare any better? Maybe something up with AVX.tranquilcool wrote:I built dev-qt/qtbase with this:
-march=x86-64-v3
as you suggested, I can
confirm that it doesn’t work
It only works with no -march at all.

Ionen wrote:I see, that's too bad. Does x86-64-v2 fare any better? Maybe something up with AVX.tranquilcool wrote:I built dev-qt/qtbase with this:
-march=x86-64-v3
as you suggested, I can
confirm that it doesn’t work
It only works with no -march at all.
Either way that makes working around it difficult now, I have no real way to tell if the hardware is affected, at best =bdver4 is now more of a "guess" that it may be affected. In theory even the x86-64-v3 binary packages may be affected now (despite being fine for everyone else).
Perhaps not all bdver4 are affected too, so replacing bdver4 may be wrong for most users.
May need to keep the local-only package.env workaround, unsure if will do anything about this in the ebuild unless someone figures out the right fix.

Thanks for trying this. I'll also rebuild qtbase with -v2 later on, at least then I'll have some arch optimization. First, though, I have to bask in having a working DE for a couple of hours at least.tranquilcool wrote: Compiling dev-qt/qtbase with -march=x86-64-v2 works.
I use package.env to compile qtbase with the above.
So far in the forum only three, including me, have this problem. I see it the same way as you.
If only 3 are complaing so far it could only mean that for most people bdver4 doesn't give any problem.
If I recall correctly, somewhere amongst all of the rebuilds and troubleshooting, I did emerge qtbase with USE="test" and -march=native. It didn't report any failures at build time as far as I know; the build didn't fail, and I didn't see any errors.Ionen wrote:I have the growing suspicion that it may be a cpu bug if x86-64-v3 fails and -v2 works (when it *should* support v3 just fine). May only cause problems when specific conditions are met (much like the infamous znver1 bug which cause build failures only on specific packages and otherwise works just fine). With =native/bdver4 I thought it was something more specific that triggered a bug somewhere, but -v3 is commonly used.
So there may not be anything to fix in any of qtbase/gcc/kde/plasma, albeit I guess some rather unlikely UB somewhere is not entirely impossible.
If it is a cpu issue, not impossible that it can be mitigated by a firmware/microcode update though. Not that znver1 had much luck there.
On another note, it may be interesting to try emerging qtbase with FEATURES=test and see if anything fails when using x86-64-v3 (also check if everything passes with x86-64-v2), that could provide hints for smaller reproducer at least. If everything passes with either, could be interesting to know qtbase is not entirely broken too... maybe only with the specific usage that some software do.
Edit: I do assume some things do work right, otherwise its tools that use qtcore libraries would be broken and other packages fail to build, maybe it's only the qtgui components
USE=test does not run tests, it only builds them.localtoast wrote:If I recall correctly, somewhere amongst all of the rebuilds and troubleshooting, I did emerge qtbase with USE="test" and -march=native. It didn't report any failures at build time as far as I know; the build didn't fail, and I didn't see any errors..

Oh. I thought it would run them at build time, before building.Ionen wrote:USE=test does not run tests, it only builds them.localtoast wrote:If I recall correctly, somewhere amongst all of the rebuilds and troubleshooting, I did emerge qtbase with USE="test" and -march=native. It didn't report any failures at build time as far as I know; the build didn't fail, and I didn't see any errors..
FEATURES=test is what makes portage run tests (after building, before installing, aborts on failure), and when that's set portage will automatically enable USE=test so tests get built or extra dependencies (like test runners) get pulled where needed. On its own USE=test is just wasteful.localtoast wrote:Oh. I thought it would run them at build time, before building.Ionen wrote:USE=test does not run tests, it only builds them.localtoast wrote:If I recall correctly, somewhere amongst all of the rebuilds and troubleshooting, I did emerge qtbase with USE="test" and -march=native. It didn't report any failures at build time as far as I know; the build didn't fail, and I didn't see any errors..

