xxxzc / xps15-9570-macos

macOS Monterey/Ventura on XPS15-9570 with OpenCore
193 stars 27 forks source link

kernel_task high CPU usage while trackpad is used #29

Closed tiger511 closed 4 years ago

tiger511 commented 4 years ago

Whenever i touch the track,kernel_task cpu usage jumps from 2% to 35+% and stays there as long as im touching the trackpad.I'm using GPIO interrrupt mode.Here is my logs of i2c:

Timestamp (process)[PID] 2020-03-23 23:50:57.215399+0600 localhost kernel[0]: (kernel) VoodooI2CPCIController::pci8086,a368 Starting I2C controller 2020-03-23 23:50:57.215408+0600 localhost kernel[0]: (kernel) VoodooI2CPCIController::pci8086,a369 Starting I2C controller 2020-03-23 23:50:57.215607+0600 localhost kernel[0]: (kernel) VoodooI2CPCIController::pci8086,a369 Set PCI power state D0 2020-03-23 23:50:57.215846+0600 localhost kernel[0]: (kernel) VoodooI2CPCIController::pci8086,a369 Publishing nub 2020-03-23 23:50:57.216088+0600 localhost kernel[0]: (kernel) VoodooI2CControllerDriver::pci8086,a369 Probing controller 2020-03-23 23:50:57.216198+0600 localhost kernel[0]: (kernel) VoodooI2CControllerDriver::pci8086,a369 Found valid Synopsys component, continuing with initialisation 2020-03-23 23:50:57.223265+0600 localhost kernel[0]: (kernel) VoodooI2CControllerDriver::pci8086,a369 Got bus configuration values 2020-03-23 23:50:57.226298+0600 localhost kernel[0]: (kernel) VoodooI2CPCIController::pci8086,a368 Set PCI power state D0 2020-03-23 23:50:57.227228+0600 localhost kernel[0]: (kernel) VoodooI2CPCIController::pci8086,a368 Publishing nub 2020-03-23 23:50:57.228335+0600 localhost kernel[0]: (kernel) VoodooI2CControllerDriver::pci8086,a368 Probing controller 2020-03-23 23:50:57.232307+0600 localhost kernel[0]: (kernel) VoodooI2CControllerDriver::pci8086,a369 Publishing device nubs 2020-03-23 23:50:57.232534+0600 localhost kernel[0]: (kernel) VoodooI2CControllerDriver::pci8086,a369 Found I2C device: SYNA2393 2020-03-23 23:50:57.237661+0600 localhost kernel[0]: (kernel) VoodooI2CDeviceNub::Got GPIO Controller! VoodooGPIOCannonLakeH 2020-03-23 23:50:57.259132+0600 localhost kernel[0]: (kernel) VoodooI2CControllerDriver::pci8086,a368 Found valid Synopsys component, continuing with initialisation 2020-03-23 23:50:57.266564+0600 localhost kernel[0]: (kernel) VoodooI2CControllerDriver::pci8086,a368 Got bus configuration values 2020-03-23 23:50:57.266640+0600 localhost kernel[0]: (kernel) VoodooI2CControllerDriver::pci8086,a368 Publishing device nubs 2020-03-23 23:51:13.244866+0600 localhost kernel[0]: (kernel) VoodooI2CPrecisionTouchpadHIDEventDriver::setProperties USBMouseStopsTrackpad = 0

Screen Shot 2020-03-24 at 12 06 02 AM

Is it cause by Voodooi2c bug or it's a bug with our patches? i've opened up a bug in Voodooi2c too: https://github.com/alexandred/VoodooI2C/issues/259

tiger511 commented 4 years ago

NOTE: i've disabled touchscreen with your SSDT-TPDX and From BIOS too.

JackyWWX commented 4 years ago

me to,this problem maybe cannot be solved at the moment?

tiger511 commented 4 years ago

@xxxzc why are we using Voodooi2c instead of VoodooPS2Trackpad? Maybe moving to VoodooPS2Trackpad will solve this cpu usage issue.This issue persists in XPS 9550 too as far as i remember.

tctien342 commented 4 years ago

@tiger511 disable GPIO and using polling mode with this kext:

tiger511 commented 4 years ago

@tctien342 disabling GPIO will result in high kernel_task usage all the time even on idle.

dvdblg commented 4 years ago

@tiger511 disable GPIO and using polling mode with this kext:

Thanks! I am now getting around 3% kernel_task usage at idle and between 10-15% when using the touchpad. What I've done to get these results is:

@tiger511 I suggest to try these.

Side note: VoodooI2C is receiving many updates lately fixing lot of things so maybe we can expect a new release soon fixing this issue and letting us use GPIO mode while not having high kernel_task cpu usage.

tiger511 commented 4 years ago

@xxxzc I'm trying out VoodooPS2Trackpad,I'm unable to make it work.Although touching trackpad lights up keyboard,but in settings track is "not found".Do i need additional ACPI patch to make it work? I've removed Voodooi2c*


xxxzc: I remove the log.

xxxzc commented 4 years ago

@tiger511

Is it cause by Voodooi2c bug or it's a bug with our patches?

documentation says "that interrupts mode leads to high CPU usage then it is likely you have a system with a buggy implementation of GPIO."

I've tried a lot of GPIO pin numbers, but nothing works.

why are we using Voodooi2c instead of VoodooPS2Trackpad?

Because our trackpad is I2C device. VoodooPS2Trackpad use PS/2 bus to transfer touch data that leads to less smooth and inaccurate touch gestures.

You need to add VoodoInput if you want to use VoodooPS2Trackpad

tiger511 commented 4 years ago

documentation says "that interrupts mode leads to high CPU usage then it is likely you have a system with a buggy implementation of GPIO."

I don't think its a buggy implenmentation of hardware.I think its a buggy handling of Voodooi2c.I've opened up a bug report on voodooi2c repo.

You need to add VoodoInput if you want to use VoodooPS2Trackpad

Do i need additional ACPI/rename patches to make it work?

tiger511 commented 4 years ago

I've tried a lot of GPIO pin numbers, but nothing works.

@xxxzc I've add debugged the VoodooGPIO and found the following: VoodooGPIO) VoodooGPIOCannonLakeH::Got hardware pin for GPIO pin 28

So for this system,pin is 28 (decimal).But im unable to put it in SSDT ,i'm not good at it.

tiger511 commented 4 years ago
Screen Shot 2020-03-27 at 3 02 09 AM
dvdblg commented 4 years ago

I managed to get kernel_task at ~11% cpu usage even when I have fingers on the touchpad by using this SSDT-TPDX.aml.zip.

I got the original .aml file from this repo from an older commit and changed these lines in it:

     // Pin list
     0x001B     # was 0x0000
CreateWordField (SBFG, 0x1B, INT1)    # was 0x17

The only problem I have is that it's at ~11% even when not touching it, but I'm getting better battery life anyway so for now I'll keep these settings.

@tiger511 have you got any better results?

tiger511 commented 4 years ago

@OrionDB5 The problem is NOT in DSDT/BIOS.Modifying DSDT is not gonna help.The problem is the VoodooGPIO driver that is not being able to mask GPIO pin properly and gettin flooded by interrupts.I've modified the driver source code and i bought it down to 15% CPU usage while in use.1-2% while not in use.I am still working on it.Seems like it's been ported from Linux to mac by @coolstar

dvdblg commented 4 years ago

Seems like you got great results, good job! Can you please share your modifications?

tiger511 commented 4 years ago

Sure i will.I'm currently testing it's stability.Can you make sure you have the same touchpad device as mine "SYNA2393".Because my modifications are hard coded currently.

dvdblg commented 4 years ago

Yes, I have the same one. I would be glad to help you test it, if you need other testers of course. Also, I don't have the touchscreen panel (I don't know if it means anything)

tiger511 commented 4 years ago

@OrionDB5 Try this. Voodooi2c-XPS9570.zip

dvdblg commented 4 years ago

@OrionDB5 Try this. Voodooi2c-XPS9570.zip

I'm using it right now. At idle I get ~1% CPU usage and it jumps between 15-20% when using the touchpad. Also one thing I have notice is that the touchpad is a little "jumpy", or at least feels like it is.

I should add I'm using VoodooInput (because I was using latest VoodooI2C compiled from source) too. Should I disable it?

tiger511 commented 4 years ago

You do NOT need any additional Voodoo*.Just use the kexts i provided.It might be a little jumpy because it polls at 1ms interval when touchpad in use.This is negligible and i barely notice anything though.this is a temporary workaround.

Can you test following with my setup and others: Put a finger on the touchpad and keep it for around 20second and see how high the kernel_task goes.With my mod it doesn't get past 20%.But with stock voodooi2c it goes to 40%

dvdblg commented 4 years ago

Can you test following with my setup and others: Put a finger on the touchpad and keep it for around 20second and see how high the kernel_task goes.With my mod it doesn't get past 20%.But with stock voodooi2c it goes to 40%

Even without rebooting (so VoodooInput is still loaded, I have already disabled it for the next reboot) it doesn't go past 20% for me as well, and I was getting 35+% with stock too

tiger511 commented 4 years ago

See if this fixes your mouse jittery problem.My eyes are not that sensitive,so i can't really tell any difference.

Voodooi2c-XPS9570_2.zip

dvdblg commented 4 years ago

image This is a screenshot I took after keeping a finger on the touchpad for more than 30 seconds! While the touchpad is not in use it is still around 1% cpu usage. And yes, it fixes the jittery problem too. You did some magic right there!

What was causing the issue?

tiger511 commented 4 years ago

Test this.In my test it is better than the last version.But it's still not perfect Voodooi2c-XPS-9570-3.zip

dvdblg commented 4 years ago

image While keeping a finger on the touchpad (20+ seconds) the cpu usage is between 10-12%. While not in use still around 1%. So for me it's slightly better than the last version

romancin commented 4 years ago

Test this.In my test it is better than the last version.But it's still not perfect Voodooi2c-XPS-9570-3.zip

Awesome work! Thank you very much!

dvdblg commented 4 years ago

Hey @tiger511, are you still working on the kext? If not could you publish the changes you have made or maybe make a pull request on the kext's repo?

tiger511 commented 4 years ago

@OrionDB5 yes im still working on this. Latest master doesn't work for me for some reason. I've edited on version 2.3. I wanted to submit PR , but since i can't edit master,i didn't do it yet.Does the master work for you?

tiger511 commented 4 years ago

Also can you give this kext a try and see if it's any better: https://github.com/alexandred/VoodooI2C/issues/259#issuecomment-609705423

dvdblg commented 4 years ago

@OrionDB5 yes im still working on this. Latest master doesn't work for me for some reason. I've edited on version 2.3. I wanted to submit PR , but since i can't edit master,i didn't do it yet.Does the master work for you?

Yes it works for me, do you have VoodooInput in VoodooI2C.kext/Plugins? The new build depends on VoodooInput but you have to build it yourself if you want to compile VoodooI2C.

Also can you give this kext a try and see if it's any better: alexandred/VoodooI2C#259 (comment)

I didn't try the kext @tctien342 provided in the comment but I tried to implement the changes he explained here in the newest upstream build. It was jumpy and while it had low cpu usage on idle (1-2%), it has much higher cpu usage than yours while finger is on the touchpad

tiger511 commented 4 years ago

Yes it works for me, do you have VoodooInput in VoodooI2C.kext/Plugins? The new build depends on VoodooInput but you have to build it yourself if you want to compile VoodooI2C.

So i have to compile VoodooI2C from source.Then compile VoodooInput from its source and put it into VoodooI2C/plugin folder?

dvdblg commented 4 years ago

So i have to compile VoodooI2C from source.Then compile VoodooInput from its source and put it into VoodooI2C/plugin folder?

You should compile VoodooInput first. You also need VoodooInput's source code in the Dependencies directory to build VoodooI2C, reference.

tiger511 commented 4 years ago

@OrionDB5 i just followed the doc and got this errror: ` BUILD SUCCEEDED

-> Installing compiled SDK... ERROR: Failed to find the built SDK! ERROR: Failed to bootstrap SDK with code 1!`

More details here: https://gitter.im/alexandred/VoodooI2CDev

dvdblg commented 4 years ago

@tiger511 Strange, I tried to start clean and compile again from source but now is giving me the same error as you. I can't point my finger to what I did differently from yesterday

dvdblg commented 4 years ago

@tiger511 If you still haven't managed to solve the issue behind those errors, I found out the solution. You have to run the command you can find here

tiger511 commented 4 years ago

@OrionDB5 why do i need macos 10.12 SDK ? 🤔

dvdblg commented 4 years ago

@tiger511 honestly I was wondering the same, but that fixed my issue

tiger511 commented 4 years ago

VoodooI2C 2.4.2 Released with supposed kernel_task fix.But my touchpad stopped working altogther with this release.Did that work for you all?

Anyway I've added fix by @Goshin and fixed some other minor memory leak issues.Try this if vesion 2.4.2 does not work for you: I2C_2.4.2_Fix.zip

It has touchscreen disabled by Info.plist.

tiger511 commented 4 years ago

@OrionDB5 @xxxzc

dvdblg commented 4 years ago

Hey @tiger511 sorry for the late response, I've tried your kext and I've no issues with it. Also, performance is great. I'haven't tried the "stock" 2.4.2 version though.

RodriMora commented 4 years ago

Test this.In my test it is better than the last version.But it's still not perfect Voodooi2c-XPS-9570-3.zip

this is the one currently working for me.

2.4.1 vanilla doesn't work. Nor does 2.4.2 fix of tiger511 from 2 post above

tiger511 commented 4 years ago

@RodriMora Please use the following kext.It contains all the latest fixes. I2C-2.4.2-Fix2.zip

kernel_task CPU usage is fixed mostly.So i'm closing this out.

romancin commented 4 years ago

@RodriMora Please use the following kext.It contains all the latest fixes. I2C-2.4.2-Fix2.zip

kernel_task CPU usage is fixed mostly.So i'm closing this out.

Sorry @tiger511, this doesn't work for me neither, only Voodooi2c-XPS-9570-3.zip works for me. I have regenerated kernelcache. Is there anything more I can try to see if it can work? Thank you.

RodriMora commented 4 years ago

@RodriMora Please use the following kext.It contains all the latest fixes. I2C-2.4.2-Fix2.zip kernel_task CPU usage is fixed mostly.So i'm closing this out.

Sorry @tiger511, this doesn't work for me neither, only Voodooi2c-XPS-9570-3.zip works for me. I have regenerated kernelcache. Is there anything more I can try to see if it can work? Thank you.

same thing. It doens't work as in the touchpad doens't move. Kernel_task seems ok though

romancin commented 4 years ago

@RodriMora Please use the following kext.It contains all the latest fixes. I2C-2.4.2-Fix2.zip kernel_task CPU usage is fixed mostly.So i'm closing this out.

Sorry @tiger511, this doesn't work for me neither, only Voodooi2c-XPS-9570-3.zip works for me. I have regenerated kernelcache. Is there anything more I can try to see if it can work? Thank you.

same thing. It doens't work as in the touchpad doens't move. Kernel_task seems ok though

Did found the answer myself, i wasn't including VodooInput in config.plist

Working flawlessly now.

romancin commented 4 years ago

@RodriMora Please use the following kext.It contains all the latest fixes. I2C-2.4.2-Fix2.zip

kernel_task CPU usage is fixed mostly.So i'm closing this out.

Multitouch gestures like launch launchpad or notification center stopped working with this version. Am I alone with this problem?

mesh17 commented 4 years ago

@RodriMora Please use the following kext.It contains all the latest fixes. I2C-2.4.2-Fix2.zip kernel_task CPU usage is fixed mostly.So i'm closing this out.

Multitouch gestures like launch launchpad or notification center stopped working with this version. Am I alone with this problem?

I had the same issue with this ver. , I just replaced the VoodooInput from the official Voodooi2c and everything is working again !! try it.

tiger511 commented 4 years ago

@RodriMora Please use the following kext.It contains all the latest fixes. I2C-2.4.2-Fix2.zip kernel_task CPU usage is fixed mostly.So i'm closing this out.

Multitouch gestures like launch launchpad or notification center stopped working with this version. Am I alone with this problem?

Are you using Force Touch in trackpad settings?There is a bug related to that.Try tunring that off.

@RodriMora @romancin @swapnilxd Try this:

Archive.zip

Also use the latest EFI.

RodriMora commented 4 years ago

@RodriMora Please use the following kext.It contains all the latest fixes. I2C-2.4.2-Fix2.zip kernel_task CPU usage is fixed mostly.So i'm closing this out.

Multitouch gestures like launch launchpad or notification center stopped working with this version. Am I alone with this problem?

Are you using Force Touch in trackpad settings?There is a bug related to that.Try tunring that off.

@RodriMora @romancin @swapnilxd Try this:

Archive.zip

Also use the latest EFI.

the latest release is not up to date with OC 0.5.8 right? I have to grab the individual files from the

romancin commented 4 years ago

@RodriMora Please use the following kext.It contains all the latest fixes. I2C-2.4.2-Fix2.zip kernel_task CPU usage is fixed mostly.So i'm closing this out.

Multitouch gestures like launch launchpad or notification center stopped working with this version. Am I alone with this problem?

Are you using Force Touch in trackpad settings?There is a bug related to that.Try tunring that off.

@RodriMora @romancin @swapnilxd Try this:

Archive.zip

Also use the latest EFI.

Better, but not perfect with this version. Launchpad (3 fingers) started working, but notification center (2 fingers from the right) doesn't work yet. Thank you! :)

tiger511 commented 4 years ago

@RodriMora Please use the following kext.It contains all the latest fixes. I2C-2.4.2-Fix2.zip kernel_task CPU usage is fixed mostly.So i'm closing this out.

Multitouch gestures like launch launchpad or notification center stopped working with this version. Am I alone with this problem?

Are you using Force Touch in trackpad settings?There is a bug related to that.Try tunring that off. @RodriMora @romancin @swapnilxd Try this: Archive.zip Also use the latest EFI.

Better, but not perfect with this version. Launchpad (3 fingers) started working, but notification center (2 fingers from the right) doesn't work yet. Thank you! :)

I see.does the latest VoodooInput work for you?