Contribute
Register

kernel_task always using above 100% CPU!

Status
Not open for further replies.
If you think ACPIBatteryManager.kext is causing some issue (a hang internally with it?), you will need to add some debugging code to it in order to find the problem.
I'm not ruling anything out completely, but I don't see what else it could be. I'm not sure how I'd go about editing the code, either. Are there any alternatives to ACPIBatteryManager I could try so I can be completey sure that it's the problem? Perhaps there's something wrong with my ACPI battery methods? Perhaps the polling?
 
If you think ACPIBatteryManager.kext is causing some issue (a hang internally with it?), you will need to add some debugging code to it in order to find the problem.
I've tried replacing FakeSMC and its plugins with VirtualSMC, which includes its own battery management kext. I get the same results, so I suspect the problem is with my ACPI config. Updated PR files attached.
 

Attachments

  • debug_11441.zip
    2.6 MB · Views: 48
I've tried replacing FakeSMC and its plugins with VirtualSMC, which includes its own battery management kext. I get the same results, so I suspect the problem is with my ACPI config. Updated PR files attached.

See ACPI patching guide:
 
See ACPI patching guide:
I think I'll try working with my ACPI files from scratch. Would you recommend using:
Code:
iasl -dl DSDT.aml SSDT*.aml
For the disassembly, without the -da modify or refs.txt, since I have a Kabylake (Refresh) CPU?
 
See ACPI patching guide:
So I went ahead and rejigged my ACPI files. I've applied minimal patching to my DSDT.
I created new PR files and what stands out is that my kernel_log.txt is FULL of the following:
Code:
2019-02-12 05:24:56.594227+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.594583+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.594991+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.595298+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.595650+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.595984+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.596354+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.596704+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.597083+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.597474+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.597885+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.598279+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.598685+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.599077+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.599464+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.599898+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.600274+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.600652+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.601021+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.601399+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.601793+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.602144+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.602503+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.602858+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.603208+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.603528+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.603882+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.604197+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.604531+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.604862+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.605186+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.605469+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.605847+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.606136+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.606459+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.606822+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.607115+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.607420+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.607723+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.608042+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.608368+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.608651+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.608956+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
2019-02-12 05:24:56.609282+0000 0x221      Default     0x0                  93     5    loginwindow: [com.apple.loginwindow.logging:Standard] clamshellStateChanged | Clamshell state changed: closed=0, shouldSleepWhenClosed=2
This appears every couple of thousandths of a second for fully five minutes. I'm guessing this is where the problem lies. Any ideas how I should proceed?
Many thanks!
Updated PR files included.
 

Attachments

  • debug_12457.zip
    7 MB · Views: 78
See ACPI patching guide:
Any thoughts on whether that extra from my kernel log represents the cause of the issue? If so, does anyone have any idea how to limit the polling of the 'clamshell'? None of this appears in the kernel log if no battery management kext is loaded. Thank you!
 
Can anyone see anything wrong with my battery methods? (See below) I still can't figure out what's wrong.

Code:
Device (BAT0)
        {
            Name (_HID, EisaId ("PNP0C0A"))  // _HID: Hardware ID
            Name (_UID, Zero)  // _UID: Unique ID
            Name (_PCL, Package (0x01)  // _PCL: Power Consumer List
            {
                _SB
            })
            Name (BFCC, Zero)
            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                If (^^PCI0.LPCB.EC.ECOK)
                {
                    If (^^PCI0.LPCB.EC.BAT0)
                    {
                        Return (0x1F)
                    }
                    Else
                    {
                        Return (0x0F)
                    }
                }
                Else
                {
                    Return (0x0F)
                }
            }

            Name (PBIF, Package (0x0D)
            {
                One,
                0xFFFFFFFF,
                0xFFFFFFFF,
                One,
                0x39D0,
                Zero,
                Zero,
                0x40,
                0x40,
                "BAT",
                "0001",
                "LION",
                "Notebook"
            })
            Method (IVBI, 0, NotSerialized)
            {
                Store (0xFFFFFFFF, Index (PBIF, One))
                Store (0xFFFFFFFF, Index (PBIF, 0x02))
                Store (0xFFFFFFFF, Index (PBIF, 0x04))
                Store (" ", Index (PBIF, 0x09))
                Store (" ", Index (PBIF, 0x0A))
                Store (" ", Index (PBIF, 0x0B))
                Store (" ", Index (PBIF, 0x0C))
                Store (Zero, BFCC)
            }

            Method (UPBI, 0, NotSerialized)
            {
                If (^^PCI0.LPCB.EC.BAT0)
                {
                    And (^^PCI0.LPCB.EC.BDC0, 0xFFFF, Local0)
                    Store (Local0, Index (PBIF, One))
                    And (^^PCI0.LPCB.EC.BFC0, 0xFFFF, Local0)
                    Store (Local0, Index (PBIF, 0x02))
                    Store (Local0, BFCC)
                    And (^^PCI0.LPCB.EC.BDV0, 0xFFFF, Local0)
                    Store (Local0, Index (PBIF, 0x04))
                    And (^^PCI0.LPCB.EC.BCW0, 0xFFFF, Local0)
                    Store (Local0, Index (PBIF, 0x05))
                    And (^^PCI0.LPCB.EC.BCL0, 0xFFFF, Local0)
                    Store (Local0, Index (PBIF, 0x06))
                    Store ("BAT", Index (PBIF, 0x09))
                    Store ("0001", Index (PBIF, 0x0A))
                    Store ("LION", Index (PBIF, 0x0B))
                    Store ("Notebook", Index (PBIF, 0x0C))
                }
                Else
                {
                    IVBI ()
                }
            }

            Method (_BIF, 0, NotSerialized)  // _BIF: Battery Information
            {
                If (^^PCI0.LPCB.EC.ECOK)
                {
                    UPBI ()
                }
                Else
                {
                    IVBI ()
                }

                Return (PBIF)
            }

            Name (PBST, Package (0x04)
            {
                Zero,
                0xFFFFFFFF,
                0xFFFFFFFF,
                0x3D90
            })
            Method (IVBS, 0, NotSerialized)
            {
                Store (Zero, Index (PBST, Zero))
                Store (0xFFFFFFFF, Index (PBST, One))
                Store (0xFFFFFFFF, Index (PBST, 0x02))
                Store (0x2710, Index (PBST, 0x03))
            }

            Method (UPBS, 0, NotSerialized)
            {
                If (^^PCI0.LPCB.EC.BAT0)
                {
                    Store (Zero, Local0)
                    Store (Zero, Local1)
                    If (^^AC.ACFG)
                    {
                        If (LEqual (And (^^PCI0.LPCB.EC.BST0, 0x02), 0x02))
                        {
                            Or (Local0, 0x02, Local0)
                            And (^^PCI0.LPCB.EC.BPR0, 0xFFFF, Local1)
                        }
                    }
                    Else
                    {
                        Or (Local0, One, Local0)
                        And (^^PCI0.LPCB.EC.BPR0, 0xFFFF, Local1)
                    }

                    And (Local1, 0x8000, Local7)
                    If (LEqual (Local7, 0x8000))
                    {
                        XOr (Local1, 0xFFFF, Local1)
                    }

                    And (^^PCI0.LPCB.EC.BRC0, 0xFFFF, Local2)
                    And (^^PCI0.LPCB.EC.BPV0, 0xFFFF, Local3)
                    Store (Local0, Index (PBST, Zero))
                    Store (Local1, Index (PBST, One))
                    Store (Local2, Index (PBST, 0x02))
                    Store (Local3, Index (PBST, 0x03))
                    If (LNotEqual (BFCC, ^^PCI0.LPCB.EC.BFC0))
                    {
                        Notify (BAT0, 0x81)
                    }
                }
                Else
                {
                    IVBS ()
                }
            }

            Method (_BST, 0, NotSerialized)  // _BST: Battery Status
            {
                If (^^PCI0.LPCB.EC.ECOK)
                {
                    UPBS ()
                }
                Else
                {
                    IVBS ()
                }

                Return (PBST)
            }
        }
 
Can anyone see anything wrong with my battery methods? (See below) I still can't figure out what's wrong.

Code:
Device (BAT0)
        {
            Name (_HID, EisaId ("PNP0C0A"))  // _HID: Hardware ID
            Name (_UID, Zero)  // _UID: Unique ID
            Name (_PCL, Package (0x01)  // _PCL: Power Consumer List
            {
                _SB
            })
            Name (BFCC, Zero)
            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                If (^^PCI0.LPCB.EC.ECOK)
                {
                    If (^^PCI0.LPCB.EC.BAT0)
                    {
                        Return (0x1F)
                    }
                    Else
                    {
                        Return (0x0F)
                    }
                }
                Else
                {
                    Return (0x0F)
                }
            }

            Name (PBIF, Package (0x0D)
            {
                One,
                0xFFFFFFFF,
                0xFFFFFFFF,
                One,
                0x39D0,
                Zero,
                Zero,
                0x40,
                0x40,
                "BAT",
                "0001",
                "LION",
                "Notebook"
            })
            Method (IVBI, 0, NotSerialized)
            {
                Store (0xFFFFFFFF, Index (PBIF, One))
                Store (0xFFFFFFFF, Index (PBIF, 0x02))
                Store (0xFFFFFFFF, Index (PBIF, 0x04))
                Store (" ", Index (PBIF, 0x09))
                Store (" ", Index (PBIF, 0x0A))
                Store (" ", Index (PBIF, 0x0B))
                Store (" ", Index (PBIF, 0x0C))
                Store (Zero, BFCC)
            }

            Method (UPBI, 0, NotSerialized)
            {
                If (^^PCI0.LPCB.EC.BAT0)
                {
                    And (^^PCI0.LPCB.EC.BDC0, 0xFFFF, Local0)
                    Store (Local0, Index (PBIF, One))
                    And (^^PCI0.LPCB.EC.BFC0, 0xFFFF, Local0)
                    Store (Local0, Index (PBIF, 0x02))
                    Store (Local0, BFCC)
                    And (^^PCI0.LPCB.EC.BDV0, 0xFFFF, Local0)
                    Store (Local0, Index (PBIF, 0x04))
                    And (^^PCI0.LPCB.EC.BCW0, 0xFFFF, Local0)
                    Store (Local0, Index (PBIF, 0x05))
                    And (^^PCI0.LPCB.EC.BCL0, 0xFFFF, Local0)
                    Store (Local0, Index (PBIF, 0x06))
                    Store ("BAT", Index (PBIF, 0x09))
                    Store ("0001", Index (PBIF, 0x0A))
                    Store ("LION", Index (PBIF, 0x0B))
                    Store ("Notebook", Index (PBIF, 0x0C))
                }
                Else
                {
                    IVBI ()
                }
            }

            Method (_BIF, 0, NotSerialized)  // _BIF: Battery Information
            {
                If (^^PCI0.LPCB.EC.ECOK)
                {
                    UPBI ()
                }
                Else
                {
                    IVBI ()
                }

                Return (PBIF)
            }

            Name (PBST, Package (0x04)
            {
                Zero,
                0xFFFFFFFF,
                0xFFFFFFFF,
                0x3D90
            })
            Method (IVBS, 0, NotSerialized)
            {
                Store (Zero, Index (PBST, Zero))
                Store (0xFFFFFFFF, Index (PBST, One))
                Store (0xFFFFFFFF, Index (PBST, 0x02))
                Store (0x2710, Index (PBST, 0x03))
            }

            Method (UPBS, 0, NotSerialized)
            {
                If (^^PCI0.LPCB.EC.BAT0)
                {
                    Store (Zero, Local0)
                    Store (Zero, Local1)
                    If (^^AC.ACFG)
                    {
                        If (LEqual (And (^^PCI0.LPCB.EC.BST0, 0x02), 0x02))
                        {
                            Or (Local0, 0x02, Local0)
                            And (^^PCI0.LPCB.EC.BPR0, 0xFFFF, Local1)
                        }
                    }
                    Else
                    {
                        Or (Local0, One, Local0)
                        And (^^PCI0.LPCB.EC.BPR0, 0xFFFF, Local1)
                    }

                    And (Local1, 0x8000, Local7)
                    If (LEqual (Local7, 0x8000))
                    {
                        XOr (Local1, 0xFFFF, Local1)
                    }

                    And (^^PCI0.LPCB.EC.BRC0, 0xFFFF, Local2)
                    And (^^PCI0.LPCB.EC.BPV0, 0xFFFF, Local3)
                    Store (Local0, Index (PBST, Zero))
                    Store (Local1, Index (PBST, One))
                    Store (Local2, Index (PBST, 0x02))
                    Store (Local3, Index (PBST, 0x03))
                    If (LNotEqual (BFCC, ^^PCI0.LPCB.EC.BFC0))
                    {
                        Notify (BAT0, 0x81)
                    }
                }
                Else
                {
                    IVBS ()
                }
            }

            Method (_BST, 0, NotSerialized)  // _BST: Battery Status
            {
                If (^^PCI0.LPCB.EC.ECOK)
                {
                    UPBS ()
                }
                Else
                {
                    IVBS ()
                }

                Return (PBST)
            }
        }
apparently, if you use VirtualSMC and it's battery kext, you don't need to use a DSDT patch

i have tested this and seems to work fine on my Asus
 
apparently, if you use VirtualSMC and it's battery kext, you don't need to use a DSDT patch

i have tested this and seems to work fine on my Asus

Against all logic, I re-instated the VirtualSMC battery kext and the problem seems to have solved itself. Unless some other change I've made
 
Against all logic, I re-instated the VirtualSMC battery kext and the problem seems to have solved itself. Unless some other change I've made
nice! :)
 
Status
Not open for further replies.
Back
Top