UB
Universal Blueβ€’3mo ago
68x

Testing USB4 and Mainline kernel

I am creating this help thread so @antheas can help me step through setting up EndavourOS w/ the mainline kernel. This is to test my USB4 Egpu and LeGo's sleep/wake failures.
104 Replies
antheas
antheasβ€’3mo ago
you have endeavor os? how many logical cores do you have?
68x
68xOPβ€’3mo ago
I just got it installed nad booting into I got the Z1E should be 8 Cores/16 Threads
antheas
antheasβ€’3mo ago
wget https://git.kernel.org/torvalds/t/linux-6.12-rc4.tar.gz and extract it somewhere
68x
68xOPβ€’3mo ago
I got the archvie downloaded and extracted Want me to run a make -j 8?
antheas
antheasβ€’3mo ago
no first, plug in everything you will want to use second make localmodconfig then make random choices make pacman-pkg -j 16 then finally this which will spit the kernel sudo pacman -U linux-upstream and if you have dkms linux-headers-upstream thats it should take around 5-10min
68x
68xOPβ€’3mo ago
got it
antheas
antheasβ€’3mo ago
also reconfigure grub to see linux-upstream so you can boot it (i dont have the command with me for that)
68x
68xOPβ€’3mo ago
I'll figure out the arch bits I have to step out for a bit, let me get back to you in a couple of hours πŸ˜…
antheas
antheasβ€’3mo ago
i will be asleep in 4 hours
68x
68xOPβ€’3mo ago
Got it, let me get the build going BTW my USB4 enclosure should be connected, right?
antheas
antheasβ€’3mo ago
before running localmodconfig after that it doesnt matter otherwise anything needed to run it wont be built
68x
68xOPβ€’3mo ago
It looks like the thunderbolt/usb authorization is not popping up 😦
antheas
antheasβ€’3mo ago
you might need to install a package connect it first, make it crash then, connect it again and reboot run localmodconfig and compile the kernel
68x
68xOPβ€’3mo ago
got it I just needed the plasma-thunderbolt aur package, let me get the build going now I don't the upstream package exists for the 6.12 rc4 kernel
antheas
antheasβ€’3mo ago
the way i told you is faster there is no prebuilt 6.12 rc4 building the full arch config take 45min
68x
68xOPβ€’3mo ago
I mean this is what I am getting when I run make pacman-pkg -j 16:
[kprinssu@kishor-legion linux-6.12-rc4]$ make pacman-pkg -j 16
UPD include/config/kernel.release
BUILDDIR="/home/kprinssu/Desktop/linux-6.12-rc4/pacman" \
CARCH="x86_64" \
KBUILD_MAKEFLAGS="rR -j16 --jobserver-auth=fifo:/tmp/GMfifo3270 --no-print-directory" \
KBUILD_REVISION="1" \
makepkg
==> Making package: linux-upstream 6.12.0_rc4-1 (Mon 21 Oct 2024 11:44:14 AM)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Missing dependencies:
-> bc
==> ERROR: Could not resolve all dependencies.
make[2]: *** [scripts/Makefile.package:150: pacman-pkg] Error 8
make[1]: *** [/home/kprinssu/Desktop/linux-6.12-rc4/Makefile:1557: pacman-pkg] Error 2
make: *** [Makefile:224: __sub-make] Error 2
[kprinssu@kishor-legion linux-6.12-rc4]$ make pacman-pkg -j 16
UPD include/config/kernel.release
BUILDDIR="/home/kprinssu/Desktop/linux-6.12-rc4/pacman" \
CARCH="x86_64" \
KBUILD_MAKEFLAGS="rR -j16 --jobserver-auth=fifo:/tmp/GMfifo3270 --no-print-directory" \
KBUILD_REVISION="1" \
makepkg
==> Making package: linux-upstream 6.12.0_rc4-1 (Mon 21 Oct 2024 11:44:14 AM)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Missing dependencies:
-> bc
==> ERROR: Could not resolve all dependencies.
make[2]: *** [scripts/Makefile.package:150: pacman-pkg] Error 8
make[1]: *** [/home/kprinssu/Desktop/linux-6.12-rc4/Makefile:1557: pacman-pkg] Error 2
make: *** [Makefile:224: __sub-make] Error 2
I am an idiot, let me look at the missing depednency πŸ˜…
antheas
antheasβ€’3mo ago
yeah depenencies is the one thing i cant help with did it once and was over with
68x
68xOPβ€’3mo ago
All good, it's going after a installing bc This is going to take a while so see you in an hour or so lol
antheas
antheasβ€’3mo ago
i told you it takes 5-10 min if you do localmodconfig
68x
68xOPβ€’3mo ago
(I have to head back to work 😦 )
antheas
antheasβ€’3mo ago
in my OXP X1 making a config for the Ally X it takes 2-4min after doing a build or something i think
68x
68xOPβ€’3mo ago
Gotcha, I'll wait for the build to finish BTW the localmodconfig took < 1 min on my device
antheas
antheasβ€’3mo ago
that just makes a config
68x
68xOPβ€’3mo ago
So sudo pacman -U linux-upstream will install the built package
antheas
antheasβ€’3mo ago
yea uname -r to check after you reboot well you need the filename full filename for it just press tab
68x
68xOPβ€’3mo ago
πŸ‘ I'll be back in an hour or so, need to head back to work πŸ˜… @antheas It got built lol Do you know doing sudo pacman -U linux-upstream says that the package is not found
antheas
antheasβ€’3mo ago
i told you full file name it has a bunch of stuff after upstream hit tab
68x
68xOPβ€’3mo ago
Gotcha, sorry I am bouncing three computers I got the 6.12 kernel booted but it's stuck at looking for non-existent drivers 😦
68x
68xOPβ€’3mo ago
No description
antheas
antheasβ€’3mo ago
something something localmodconfig will only capture what was in your system if you want to wait an hour for the full kernel
68x
68xOPβ€’3mo ago
Got it, it's probably my thunderbolt encolsure's external SSD
antheas
antheasβ€’3mo ago
rm .config
68x
68xOPβ€’3mo ago
I'll re-configure and build again without the SSD installed
antheas
antheasβ€’3mo ago
zcat /proc/config.gz > .config or yea do that unplug the ssd seems like its fstab the build will take 45m if you run the commands i sent
68x
68xOPβ€’3mo ago
Ugh got it, I'll run the longer build, hold on I got the big kernel built @antheas The sleep/wake works just fine on the latest 6.12 rc4 kernel Multiple times in a row
antheas
antheasβ€’3mo ago
ok jump on bazzite unstable then, with a fresh kernel that fixes my issue and check out if it sleeps there too
68x
68xOPβ€’3mo ago
will do, I need another few mins to switch over to there
antheas
antheasβ€’3mo ago
then if it does not work send mario this and kindly ask what patches are missing
68x
68xOPβ€’3mo ago
I will I'll continue to play around with the 6.12 kernel few more times Ny sample size of 4-5 sleep/wake cycles is a bit small πŸ˜… I also have no luck with Bazzite unstable 😦 It seems to not wake successfully
antheas
antheasβ€’3mo ago
Did you try endeavor os stock kernel? And uname -r it?
68x
68xOPβ€’3mo ago
It was running 6.12 rc4 when on Endeavour when it was working Do you want me to run the stock 6.11 kernel?
antheas
antheasβ€’3mo ago
Use the Linux package Uname -r should say 6.11.4
68x
68xOPβ€’3mo ago
Will do, let me get a Google Sheet doc going to write out the test cases here
antheas
antheasβ€’3mo ago
If it doesn't work we're cookrd
68x
68xOPβ€’3mo ago
πŸ˜… @antheas The package should be linux-mainline?
antheas
antheasβ€’3mo ago
Just Linux If it does work we're cooked I mean If it doesn't it's Mario's problem
68x
68xOPβ€’3mo ago
Got it My egpu and sleep/wake works on the default 6.11.4-arch2-1 kernel πŸ˜…
antheas
antheasβ€’3mo ago
Rip Was it ever broken? In endeavor
68x
68xOPβ€’3mo ago
I think I never tested the 6.11 kernel on Endeavour
antheas
antheasβ€’3mo ago
What's the stock one
68x
68xOPβ€’3mo ago
Stock would be the 6.11 kernel no?
antheas
antheasβ€’3mo ago
You never tested the built in kernel?
68x
68xOPβ€’3mo ago
*The built-in kernel is 6.11.4-arch2-1, this works
antheas
antheasβ€’3mo ago
So everything works in endeavoros? Did you find a broken kernel there?
68x
68xOPβ€’3mo ago
No, not thus far, everything works it looks like Bazzite has a breaking change 😦
antheas
antheasβ€’3mo ago
Did you sleep bazzite in kde or gamemode?
68x
68xOPβ€’3mo ago
It's flaky in gamemode/gamescope, let me re-test on KDE
antheas
antheasβ€’3mo ago
I thought you did kde
68x
68xOPβ€’3mo ago
I am unsure now, let me re-test this a few more times
antheas
antheasβ€’3mo ago
Does bazzite work rn? In kde
68x
68xOPβ€’3mo ago
I am hopping b/w work and Discord, let me follow up in 5 mins It works on stable, but it freezes after a few times Few times being, where I repeatedly and consecutively sleep/wake the device. It failed on the 3rd try
antheas
antheasβ€’3mo ago
Try unstable also That's kind of expected if you don't wait at least 10 seconds You will probably find endeavoros is the same
68x
68xOPβ€’3mo ago
Yep, I noticed that too
antheas
antheasβ€’3mo ago
So we're back at the question of whether it ever worked
68x
68xOPβ€’3mo ago
At least we figured out the test cases, let me go through it out all, this will take a bit
antheas
antheasβ€’3mo ago
You can't run gamescope in endeavoros and even if you can you're probably cooked Because it won't work Unless you wanna play with cachyos too Although there everything is lto fancy compiled And everything is broken It's probably gamescope tbh
68x
68xOPβ€’3mo ago
I don't want to spend more time going down the rabbit hole πŸ˜… It looks like so
antheas
antheasβ€’3mo ago
Tell Mario KDE works in bazzite too and to tell you how to get a log And get one from unstable I'll try to make some vanilla kernels
68x
68xOPβ€’3mo ago
I am noticing the freezes on Bazzite stable build 😦
antheas
antheasβ€’3mo ago
Well stable is an ancient kernel Go to unstable it's better for now, other than the selinux issues Classic fedora transition
68x
68xOPβ€’3mo ago
Will do I am able to reproduce the hard lock on unstable with the 6.11 kernel 😦
antheas
antheasβ€’3mo ago
On kde
68x
68xOPβ€’3mo ago
Yeah, I also waited 10s and repeated and reproduced across two boots
antheas
antheasβ€’3mo ago
And on endeavor it's rock solid?
68x
68xOPβ€’3mo ago
Let me re-test on Endeavour to be more certain I am able to reproduce the hard lock on Endeavour w/ 6.11 I am also able to reproduce this on 6.12 rc4 too What changed was I disabled the screen lock on sleep/wake πŸ˜…
antheas
antheasβ€’3mo ago
I don't understand why that helped
68x
68xOPβ€’3mo ago
Me neither πŸ˜… I'll boot into Endeavour and attempt another round of testing errr it's consisntently working now, I am going to say user error It's hard to pin this down without logs @antheas any chance I can just buy and donate to you a thunderbolt gpu enclosure?
antheas
antheasβ€’3mo ago
with what gpu lmao i dont have space for it its not user error its inconsistent you need logs to debug it
68x
68xOPβ€’3mo ago
I'll reach out to Mario then
antheas
antheasβ€’3mo ago
tell him gamescope is completely busted and 6.11, 6.12, and bazzite 6.11 are equally semi-busted
68x
68xOPβ€’3mo ago
anything particular than busted? Honestly, I was hoping if you could supply your own GPU πŸ˜…
antheas
antheasβ€’3mo ago
pray oxp gets interested and sends something but for now lets fix these handhelds
68x
68xOPβ€’3mo ago
GitLab
Hard lock with External GPU on sleep/wake cycle (#3706) Β· Issues Β· ...
Brief summary of the problem: My current device is a Lenovo Legion Go with an external GPU (egpu) connected over USB...
68x
68xOPβ€’3mo ago
I got some logs πŸ”₯
68x
68xOPβ€’3mo ago
No description
antheas
antheasβ€’3mo ago
nice
68x
68xOPβ€’3mo ago
It looks like the device is inaccessible The GPU is probably disconnected while the driver is being unloaded. It’s probably a race condition?
antheas
antheasβ€’3mo ago
seems like a series of errors i know nothing about
68x
68xOPβ€’3mo ago
I’ll ask Mario upstream, thanks for the troubleshooting help
antheas
antheasβ€’3mo ago
well since you tagged me im part of that conversation anyway oh you have the fancy oxp gpu thats nice
68x
68xOPβ€’3mo ago
Yeah, I just got it a few weeks back
antheas
antheasβ€’3mo ago
oxp makes nice devices x1 is better than the legion go, except its controllers its controllers are kinda sad
68x
68xOPβ€’3mo ago
I really wanted the X1 mini but it's like $1500-1800 CAD πŸ˜…
antheas
antheasβ€’3mo ago
x1 mini i think has the screen of the legion go or very similar the big screen is the nice one
68x
68xOPβ€’2mo ago
yeah and it has connector for a proper detachable keyboard I am waiting for the new Strix point APUs It looks like I found an upstream kernel bug @antheas Is there an way for an end user like me to raise awareness on the Linux kernel bugzilla?
antheas
antheasβ€’2mo ago
Do you know a kernel version where it works?
68x
68xOPβ€’2d ago
None as far as I can tell, I can roll some older kernels to troubleshoot (e.g. 6.5 to 6.8) I also tried the eGPU on another device and I ran into the same error 😦 BTW it's an issue with the USB/TB kernel modules @antheas I figured out a workaround for the crashes I have to disable power management on the TB/USB4 ports
/usr/bin/echo on | /usr/bin/tee /sys/bus/pci/devices/0000\:00\:07.0/power/control && /usr/bin/echo on | /usr/bin/tee /sys/bus/pci/devices/0000\:00\:07.1/power/contro
/usr/bin/echo on | /usr/bin/tee /sys/bus/pci/devices/0000\:00\:07.0/power/control && /usr/bin/echo on | /usr/bin/tee /sys/bus/pci/devices/0000\:00\:07.1/power/contro
A quick systemd unit file:
[Unit]
Description=Disable Power Management for Thunderbolt/USB4 Ports
Wants=network.target
After=network.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c '/usr/bin/echo on | /usr/bin/tee /sys/bus/pci/devices/0000\:00\:07.0/power/control && /usr/bin/echo on | /usr/bin/tee /sys/bus/pci/devices/0000\:00\:07.1/power/control'
User=root
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
[Unit]
Description=Disable Power Management for Thunderbolt/USB4 Ports
Wants=network.target
After=network.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c '/usr/bin/echo on | /usr/bin/tee /sys/bus/pci/devices/0000\:00\:07.0/power/control && /usr/bin/echo on | /usr/bin/tee /sys/bus/pci/devices/0000\:00\:07.1/power/control'
User=root
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
Disconnecting the cable does cause the system to crash as before but it’s much more stable @antheas I had to just unbind all my devices before suspend and it works really well
[Unit]
Description=Unbind USB4 device on sleep/suspend
Before=sleep.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c 'echo "0000:2f:00.1" > /sys/bus/pci/drivers/snd_hda_intel/unbind; \
echo "0000:2f:00.0" > /sys/bus/pci/drivers/amdgpu/unbind; \
echo "0000:30:00.0" > /sys/bus/pci/drivers/xhci_hci/unbind; \
echo "0000:2e:00.0" > /sys/bus/pci/drivers/pcieport/unbind; \
echo "0000:2d:00.0" > /sys/bus/pci/drivers/pcieport/unbind; \
echo "0000:2c:04.0" > /sys/bus/pci/drivers/pcieport/unbind; \
echo "0000:2c:02.0" > /sys/bus/pci/drivers/pcieport/unbind; \
echo "0000:2c:01.0" > /sys/bus/pci/drivers/pcieport/unbind; \
echo "0000:2b:00.0" > /sys/bus/pci/drivers/pcieport/unbind'

[Install]
WantedBy=sleep.target
[Unit]
Description=Unbind USB4 device on sleep/suspend
Before=sleep.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c 'echo "0000:2f:00.1" > /sys/bus/pci/drivers/snd_hda_intel/unbind; \
echo "0000:2f:00.0" > /sys/bus/pci/drivers/amdgpu/unbind; \
echo "0000:30:00.0" > /sys/bus/pci/drivers/xhci_hci/unbind; \
echo "0000:2e:00.0" > /sys/bus/pci/drivers/pcieport/unbind; \
echo "0000:2d:00.0" > /sys/bus/pci/drivers/pcieport/unbind; \
echo "0000:2c:04.0" > /sys/bus/pci/drivers/pcieport/unbind; \
echo "0000:2c:02.0" > /sys/bus/pci/drivers/pcieport/unbind; \
echo "0000:2c:01.0" > /sys/bus/pci/drivers/pcieport/unbind; \
echo "0000:2b:00.0" > /sys/bus/pci/drivers/pcieport/unbind'

[Install]
WantedBy=sleep.target
It's set up for my specific laptop and device I'll try writing a script to unload all devices on the TB pcie tunnel
antheas
antheasβ€’2d ago
What do you meAn by really well
68x
68xOPβ€’2d ago
It works 100% of the time, I booted up my spare laptop with a Intel TB4 port What the above unit file does is forces the driver to unbind from all the devices on the TB tree In my case, I ran lspci -tv to get the tree view and unbinded the loaded modules from lspci -vv Test scenario: I am running Arch 6.12 and 6.13 rc3 and it doesn't crash anymore Devices are re-enumerated upon sleep too So the eGPU comes back from wake/resume Running lspci -tv:
# lspci -tvv
-[0000:00]-+-00.0 Intel Corporation 11th Gen Core Processor Host Bridge/DRAM Registers
+-02.0 Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics]
+-04.0 Intel Corporation TigerLake-LP Dynamic Tuning Processor Participant
+-07.0-[01-2a]--
+-07.1-[2b-54]----00.0-[2c-54]--+-01.0-[2d-2f]----00.0-[2e-2f]----00.0-[2f]--+-00.0 Advanced Micro Devices, Inc. [AMD/ATI] Navi 33 [Radeon RX 7600/7600 XT/7600M XT/7600S/7700S / PRO W7600]
| | \-00.1 Advanced Micro Devices, Inc. [AMD/ATI] Navi 31 HDMI/DP Audio
| +-02.0-[30]----00.0 Intel Corporation JHL7440 Thunderbolt 3 USB Controller [Titan Ridge DD 2018]
| \-04.0-[31-54]--
+-0a.0 Intel Corporation Tigerlake Telemetry Aggregator Driver
+-0d.0 Intel Corporation Tiger Lake-LP Thunderbolt 4 USB Controller
+-0d.2 Intel Corporation Tiger Lake-LP Thunderbolt 4 NHI #0
+-0e.0 Intel Corporation Volume Management Device NVMe RAID Controller
+-14.0 Intel Corporation Tiger Lake-LP USB 3.2 Gen 2x1 xHCI Host Controller
+-14.2 Intel Corporation Tiger Lake-LP Shared SRAM
+-15.0 Intel Corporation Tiger Lake-LP Serial IO I2C Controller #0
+-16.0 Intel Corporation Tiger Lake-LP Management Engine Interface
+-1c.0-[55]----00.0 Intel Corporation Wi-Fi 7(802.11be) AX1775*/AX1790*/BE20*/BE401/BE1750* 2x2
+-1d.0-[56]----00.0 Samsung Electronics Co Ltd NVMe SSD Controller 980 (DRAM-less)
+-1f.0 Intel Corporation Tiger Lake-LP LPC Controller
+-1f.3 Intel Corporation Tiger Lake-LP Smart Sound Technology Audio Controller
+-1f.4 Intel Corporation Tiger Lake-LP SMBus Controller
\-1f.5 Intel Corporation Tiger Lake-LP SPI Controller

# lspci -tvv
-[0000:00]-+-00.0 Intel Corporation 11th Gen Core Processor Host Bridge/DRAM Registers
+-02.0 Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics]
+-04.0 Intel Corporation TigerLake-LP Dynamic Tuning Processor Participant
+-07.0-[01-2a]--
+-07.1-[2b-54]----00.0-[2c-54]--+-01.0-[2d-2f]----00.0-[2e-2f]----00.0-[2f]--+-00.0 Advanced Micro Devices, Inc. [AMD/ATI] Navi 33 [Radeon RX 7600/7600 XT/7600M XT/7600S/7700S / PRO W7600]
| | \-00.1 Advanced Micro Devices, Inc. [AMD/ATI] Navi 31 HDMI/DP Audio
| +-02.0-[30]----00.0 Intel Corporation JHL7440 Thunderbolt 3 USB Controller [Titan Ridge DD 2018]
| \-04.0-[31-54]--
+-0a.0 Intel Corporation Tigerlake Telemetry Aggregator Driver
+-0d.0 Intel Corporation Tiger Lake-LP Thunderbolt 4 USB Controller
+-0d.2 Intel Corporation Tiger Lake-LP Thunderbolt 4 NHI #0
+-0e.0 Intel Corporation Volume Management Device NVMe RAID Controller
+-14.0 Intel Corporation Tiger Lake-LP USB 3.2 Gen 2x1 xHCI Host Controller
+-14.2 Intel Corporation Tiger Lake-LP Shared SRAM
+-15.0 Intel Corporation Tiger Lake-LP Serial IO I2C Controller #0
+-16.0 Intel Corporation Tiger Lake-LP Management Engine Interface
+-1c.0-[55]----00.0 Intel Corporation Wi-Fi 7(802.11be) AX1775*/AX1790*/BE20*/BE401/BE1750* 2x2
+-1d.0-[56]----00.0 Samsung Electronics Co Ltd NVMe SSD Controller 980 (DRAM-less)
+-1f.0 Intel Corporation Tiger Lake-LP LPC Controller
+-1f.3 Intel Corporation Tiger Lake-LP Smart Sound Technology Audio Controller
+-1f.4 Intel Corporation Tiger Lake-LP SMBus Controller
\-1f.5 Intel Corporation Tiger Lake-LP SPI Controller

68x
68xOPβ€’2d ago
Running lspci -vv
68x
68xOPβ€’2d ago
So what I did was unbind the child nodes from the tree view and unbounded the nodes from there Basically, the respective driver's can't crash if they are not binded What do you think? I can write a quick Python script to generalize this πŸ™‚
antheas
antheasβ€’2d ago
Do they load correctly after is the question And also if you unbjnd you lose the game
68x
68xOPβ€’6h ago
Do they load correctly after is the question
They do
And also if you unbjnd you lose the game
Yeah 😦 I say this is a lot better than a hard lock. I would much rather save and exit my game before suspend than it hard lock I honestly cannot think of any better way and my use case is connected to egpu, play for a bit, then stop I'll give it ago with my new Onexfly later It's working well on the Onexfly too @antheas
antheas
antheasβ€’6h ago
good to hear also good news for you, oxp wants to look into eGPU but first, holidays
Want results from more Discord servers?
Add your server