yashsingh1/xdaforums huggingface dataset:
[G Tablet Android Development] rcgabriel:
Cool, that's a reasonable idea for an interim fix.

I built my own kernel with the default config, but with CPU idle PM support disabled (i.e. only change from Viewsonic stock is CONFIG_CPU_IDLE=n) and I'm running it now.

I wanted to isolate a single change or set of changes so if it fixes the problem, we know as best as possible where to look for issues.

So far so good, only clean wakeups here, and we'll see if that fixes the problem (I need to let 'er sleep for a bit). Also want to see how severe the impact on power usage is so we can help Roebeet, Rothnic and Gojimi figure out what config they should be using for default kernels in the major ROMs.

EDIT: Well, so far so good. We'll see how it goes after another 12 hours or so.

Okay, nevermind that. Let it sleep for an hour or so, woke it up, and the lag is back. Verified CPU frequency is stuck at 216000 again. Verified the running kernel is indeed the one I rebuilt this morning with CONFIG_CPU_IDLE off. So I can safely conclude that disabling CONFIG_CPU_IDLE doesn't solve the problem. :( I also checked the dmesg output, and again I see the error -11s and error -16s. Could try disabling CPU_FREQ entirely, as you also suggested clemsyn. That's just locking the CPU outright at full speed. Maybe I'll try that tomorrow, have to do real work now for the rest of the day. :(
[G Tablet Android Development] clemsyn:
Thanks for letting me know. Do you think we might have early suspend wake lock issues too?
[G Tablet Android Development] clemsyn:
wrong post
[G Tablet Android Development] thebadfrog:
No. I installed the kernel over my existing install (backed up first:)). The lag is one big pain so I'll keep testing kernels to help find the issue. My tab lags on almost every wake up. I'm gonna see if I can install only the 3389 update and market without the enhancement pack.
[G Tablet Android Development] anlog:
On stock build 3389 I was able to recreate the slowdown by doing an "echo 216000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"

It clocked the CPU down to 216MHz and everything was slow as hell. I left it overnight like that, and this morning I was able to clock it back up to 1GHz by setting the scaling min and max files back to 1000000. The tab restored to full speed.

So, I don't know if this newer VS kernel in 3389 let's you restore speed when it gets stuck or not. I'm going to wait for the slowdown to appear on it's own and try. I know for a fact that the slowdown is not related to the tegra performance drivers.
[G Tablet Android Development] rob_z11:
Were you able to do this without rebooting and running the script? I am stuck at 216000, and I ran the script without any success. I suppose I need the kernel from this thread?
[G Tablet Android Development] vsc:
A quick question. Does everyone with this slowdown program also have a sdcard installed?
[G Tablet Android Development] rob_z11:
I don't have one installed, but still suffering from bad wake-up bug.
[G Tablet Android Development] anlog:
No I'm using the 2nd gen kernel from Viewsonic, the one that is included in TnT Lite 3.0 and above, as well as vegan b4 (I believe). Vegan b3 uses the old kernel. I'm currently running the stock TnT from Viewsonic (latest build 3389) with root and CW v08.

We know the 1st gen kernel gets stuck at 216MHz. The question is, will the 2nd gen kernel let you manually pull out of 216MHz after it freaks out and goes there on it's own. I was able to manually clock it to 216MHz, verify that everything was slow (screen transitions, quadrant, etc), and then it let me clock it back to 1GHz after letting it sit all night.

We need to verify if the 2nd gen kernel suffers from the same problem. It's not an issue of the CPU itself breaking when it hits 216MHz, because I was able to clock it there and back up.
[G Tablet Android Development] clemsyn:
Just tried building a kernel with no CPU freq to lock speed but it won't build.
[G Tablet Android Development] Butch1326:
While we're throwing out ideas...

I'm still puzzled why myself, Roebeet, and others have not seen the slowdown/lag issue, which tells me it's either application or configuration (sorry, I'm just putting on my IT hat...)

I'm trying to think outside the box.

Any thought on the gtab's partition configuration. It shouldn't really matter, but stranger things have happened.

I partition my gtab 2048/256, but I know many have setup the gtab partition as 2048/0. Maybe there's a pattern here.

BTW - I do use a microSD card (16GB Class 4)
[G Tablet Android Development] clemsyn:
Updated the kernel to better support Overclocking Widget. I'll test it for a few hours and see how it goes. Anyone willing to try it out, here it is. Make sure you use Overclocking Widget and save settings. Settings seems to stick when I do a cat /sys/..... on terminal. Lowest setting I set at 528 and highest at 1000.
[G Tablet Android Development] rob_z11:
How did you get the cpu off to higher then 216000 without rebooting?

I am running beta4 rom.
[G Tablet Android Development] Neoprimal:
I haven't done any partitioning whatsoever.

I have seen the slowdown both with the actual sd card (I will more than likely always refer to the internal storage as internal storage) installed and not installed so I don't think it's related.

I have tried turning wifi off before I let it sit and fall asleep as well as made it so wifi turns off when the screen does. I have also tried it with wifi set to never go off (though somehow it inherently does - something I think relating to the power management built into the tegra).

This was my upgrade path:

Stock 3053 when I purchased it. Did the update to 3899 as soon as it popped as an OTA. Installed GApps. Decided to try the V2 enh. pack so I flashed that on. The pad seemed to break somewhere along the line because recently it started becoming unresponsive to touch and I couldn't run the Terminal Emu. to have someone help me troubleshoot so I got fed up and did a full wipe and am back to 3389 and now it works perfectly (in terms of the touch issues). Haven't had time to see the slowdown yet but I suspect it will be back.

If you're not seeing the slowdown at all, might I suggest letting your tablet drain to 20% and then having it sleep....not manually, just let it do it's thing. I know that people have argued that it has 0 correlation because they are seeing it at 100% 80%, etc. so it seems random but if you're NOT seeing it, then do try this as maybe it will help spur it on somehow.

Maybe something hardwired into 2.2 isn't doing great with the tegra core, period.

I'm sure between the devs here it'll get figured out.
[G Tablet Android Development] thebadfrog:
Downloading and testing. Gonna change my name to "thebadguineapig" soon.:D
[G Tablet Android Development] anlog:
There is definitive proof that it isn't an app or config issue. Roebeet and rothnic reboot too often to notice it. I've gone as long as 24 hours before the issue appeared. I can also recreate the slowdown on demand, so without a doubt it is a kernel issue.
[G Tablet Android Development] anlog:
I did an echo 216000 to the scaling_max_freq file to drop the cpu to 216mhz. Confirmed that everything was super slow. Left it like that overnight then set both the scaling_min_freq and scaling_max_freq files to 1000000 and the cpu ramped back up to full speed.

I started the whole process after a fresh boot before the cpu had an opportunity to clock down to 216mhz on its own. Still have to test if it will let me clock higher once it drops on its own.

All of this was done with rooted stock 3389 with no gapps or performance pack tegra drivers.
[G Tablet Android Development] clemsyn:
Make sure you do a fresh install after installing the kernel. So far eeverything is ok with the new kernel + overclockwidget. No lags yet.
[G Tablet Android Development] thebadfrog:
Maybe I'm going brain dead here but wouldn't doing a fresh install after installing the kernel overwrite the kernel that I just installed?

I did install it on my original setup and I haven't had a lag from wake yet. I'm also able to get the info from both cpu's.
[G Tablet Android Development] clemsyn:
What I do is replace the boot.img in the ROM and flash the ROM. Anyways, weird thing happened, looks like I got stuck at 216 but the overclockwidget wasn't running coz when I clicked the overclock widget, it ask for su permission again.
[G Tablet Android Development] thebadfrog:
And yes I should have thought of that but I'm trying to fix my laptop and I'm distracted. (windows trashed my dual boot again...arrgggghhh). I set the min and max thru terminal.
[G Tablet Android Development] jimcpl:
Hi,

Sorry to jump in here, but I've been following this subject almost from the beginning, a little after 3389 came out, but it seems to me that we're dealing with too many variables? Assuming, for the moment, that the slowdown is due to something in the kernel, even then, it seems like different people are working with different kernels,

In the beginning, I had the impression that all the VS versions had same kernel, but now there is mention of 1st Gen, 2nd Gen, etc., in addition to the user-built kernels. If that's the case, it's not surprising that different people are getting different test results?

Maybe 1 thing that might help is to give the kernels names, so when we talk about them, everybody means the same thing?

Anyway, again, sorry for jumping in....

Jim
[G Tablet Android Development] thebadfrog:
@clemsyn

I have not had any lag from wake issues yet. I installed your latest kernel right on top of the same system I have been using for a couple days. I have a script to check the cpuinfo and generally they are in the 500k range on wake and scale up to 1000000 quickly.

I did install a backup from before I installed the your previous kernel so they both have been installed onto the same system. If I get time later I am going to do a fresh install with update 3389 and rothnics performance pack.
[G Tablet Android Development] anlog:
Are both of your CPUs online?
[G Tablet Android Development] anlog:
Ok so I finally had the slowdown occur. I am still booted into the same session where I successfully clocked down to 216MHz, verified that everything was really slow, left the tab overnight sleeping, and clocked back up to 1GHz in the morning. I left both the min and max scaling files at 1000000, and on around the 5th resume from sleep (a few hours later) it's clocked back to 216MHz and stuck.

Both the scaling files were still at 1000000. I tried setting them both to 216000, then back to 1000000 to "trick" the system, but it's still stuck at 216MHz.

This is with stock 3389, no tegra drivers. Only root and CW. So it appears all builds are affected.

I captured a dmesg if anyone wants to see it...

@jimcpl: I know it seems confusing when we talk about multiple kernels. It's actually not that complicated. When I refer to "1st gen" I mean the kernel that shipped with the original device software and all official updates up to the one before 3316. This includes all custom roms up to TnT Lite v2.4 and Vegan beta 3. With Viewsonic build 3316 and later, a newer kernel was included by Viewsonic with the releases. TnT Lite v3.0+ and Vegan beta 4+ use this newer "2nd gen" kernel. I'm not referring to any of the custom kernels floating around. Those don't have names yet...
[G Tablet Android Development] thebadfrog:
Both cpu's were online and the I just got the lag again...wake this thing up probably 50 times and no problem and just picked it up after it sat for about 30 minutes and the lag is back and I can't force it out of it.
[G Tablet Android Development] jimcpl:
Hi,

No problem. Fyi, I'm still on stock 3053, no updated drivers, so "1st Gen" I guess, and haven't seen this lag problem. I've run Quadrant occasionally.

I kind of held out on taking the OTAs, waiting for the 12/24 one (3389), but when I started seeing posts about this lag problem, decided to wait to see what happens.

Jim
[G Tablet Android Development] anlog:
I've gone as long as 24 hours before the lag appeared, so if you are turning your tab off or rebooting daily, you may not actually see it. It definitely affects every version/rom out there.
[G Tablet Android Development] anlog:
Came across this patch. Not sure if it will help us...

http://www.gossamer-threads.com/lists/linux/kernel/1311903
[G Tablet Android Development] clemsyn:
Looks like the only speed supported by Overclock widget is 1000000. I'll just set my min and max speed at that setting and see how it goes. BTW, any where and how to add this?
[G Tablet Android Development] eclps:
That posted patch looks promising. Being a kernel patch you'll have to apply with the patches from viewsonic and create a new kernel. Look and see if anyone has posted anything about getting the viewsonic patches working. Not home for the holidays so I have no access to my dev environment; not much help really.
[G Tablet Android Development] clemsyn:
Just got a lag too..hmm...Would try disabling LP2 and see how it goes.
[G Tablet Android Development] thebadfrog:
Could this be why all the tegra 2 tabs keep getting delayed? Maybe this is a flaw in the chipset.
[G Tablet Android Development] vsc:
Actually have you looked at the sources (e.g. ap2rm_power_dfs.c)? I can't believe the complexity of the algorithms used for dynamic clock and voltage. It is no wonder there are issues. They even have process corners rolled into this stuff, perhaps on a device-by-device basis.

Note that I'm half asleep but code in NvRmPrivAp20DttPolicyUpdate has me concerned related to setting s_CpuThrottleMaxKHz based upon NvRmPrivModuleVscaleGetMV. Please tell me that the core voltage wasn't accidentally left at a low value after a failed suspend...
[G Tablet Android Development] clemsyn:
OK, here is a kernel with LP2 disabled. Seems to be more responsive and snappier to use. Basically this prevents "Tegra CPU turn off policy" on sleep and suspend but might use more battery
[G Tablet Android Development] jimcpl:
You all should Google "Colin cross tegra" :). Between that and general stuff about tegra, it seems like there's a lot of focus on power, possibly at the expense of performance?

What I mean is hardly anybody here is complaining that their battery is not lasting long enough, so it seems that they got that part (reducing power) right...

Jim
[G Tablet Android Development] anlog:
My gut instinct tells me that the EASIEST fix is going to be disabling all forms of power management entirely. Let's force the CPU to run at full speed at all times, which will probably drop our battery life around 25%. My battery lasts a hell of a long time, so I'm cool with this as the initial fix.

Once we at least have working tabs that don't slow down, then we should start digging into the power management logic to see if we can loosen it up. My gut instinct ALSO tells me that it's not necessarily the logic that's flawed, but a failed suspend/resume that is causing the tab to remain in "idle" or "low power" mode. There has to be a way to get it out of that.

One of my tabs is currently stuck at 216MHz, and I don't plan on rebooting it till I figure out why it's stuck. If there is some way to "sighup" a process/module/driver/etc or something to get back out of lower power mode, I'm hoping to find it.
[G Tablet Android Development] gotwillk:
what does LP2 mean and how do i apply this kernel?
[G Tablet Android Development] blackwidow1234:
The following seems to have helped me; will report back if I encounter a failure:

1. Reboot

2. echo 1 > /sys/devices/system/cpu/cpu1/online

3. echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

Apparently, CPU1 gets powered off and on as needed, unless you explicitly turn it on (according to the tegradeveloper site).
[G Tablet Android Development] clemsyn:
Extract boot.Img file and replace the boot.img in the ROM (currently using vegan v4) . Then flash the Rom containing the new boot.Img

UPDATE

The kernel is very promising. No lags at the moment. Just turned it back on after 5 horse of sleep and still no lag. Will continue testing :) crossing my fingers :)
[G Tablet Android Development] rcgabriel:
vsc, I think you may be onto something with that.

Also, see this patch from October (after our kernel branch date) related to resetting voltage and clock frequency stuff after exiting the LP1 state...:

http://nv-tegra.nvidia.com/gitweb/?...ff;h=24026696dcd728be545c07fcd3b4bd7e1483c553

I just merged that patch into the base kernel code. Will try this out. :)

Edit:

So far so good with this kernel build... I'm really beating on it here, suspend/resuming like a monster, multi-pressing the power button and so on and no lagging out. Gone through a bunch of cycles. Going to give it a longer time now to see if things screw up. BTW, it's quite possible that clemsyn's solution will work too. I'm not totally clear if LP0 or LP2 is the problem, but I do think one of these suspend states interacting with a driver is the source of the issue.

The more I think about it, the more plausible I think this is the issue. Another kernel driver aborts suspend, causing the voltage to fail to get properly reset, low voltage prevents setting frequency back to maxfreq.

Also, some informative reading about the different suspend modes of the Tegra 2 processor (LP0, LP1, LP2):

http://kerneltrap.org/mailarchive/linux-kernel/2010/12/5/4655084

Read that and you'll appreciate how complex the damn suspend resume code has to be to support all that logic. It's a bit mindblowing. And now it's kinda obvious why there are some bugs in this stuff.

Will post back in a few hours and if this kernel still looks good, I'll throw it up here.

Edit 2: I've attached the build of the patched kernel. It is the tegra-10.8.2 base, plus stock Viewsonic kernel patchset plus the above mentioned voltage reset patch, so no other changes to config or code. I just threw the zImage file into a zip for now, so you'll have to roll your own boot.img file if you want to try it out. More at the end of the day today if this keeps working...

Edit 3: Attaching Vegan beta4 kernel patch update.zip (called "veganb4-kernel-patch.zip"). If you are running Vegan beta 4 and have lots of lag-on-wake issues, you can give this a try - just download to SD Card and flash from Clockwork mod over your existing Vegan beta 4 installation.

It only reflashes your boot.img. Don't do this unless you know what you're doing, know how to recover a screwed up G Tablet, have a recent clockwork backup, etc. :)

Edit 4: Patch updated - the new patch fixes the SD card app install issues.
[G Tablet Android Development] rushless:
You folks are on the right path. I bet the farm that the kernel is the evil-doer here as far as lag. Though recovering from sleep mode seems the most common trigger, the lag can happen while awake as well.

Why is there not a core kernel shipped with the chipset (by Nvidia) rather than a layered mess made by the OEM? Unless the mess is from Nvidia...
[G Tablet Android Development] clemsyn:
I've been more gentle with the power button though..If I push the power button and get no response, I wait about 5-10 seconds before I press it again. I just have a feeling that pressing the power button again and again (especially when you don't get a response the first time) will bring the bug back. I'll try it once I pass the 12 hrs of testing though.

BTW, this is excellent find. I was looking up the code and looks like a better support for suspend and resume on tegra by nvidia. I still have no issues with LP2 disabled but I might have to try this out.
[G Tablet Android Development] vsc:
The stuff we are looking at right now is from Nvidia. I don't think anyone else could have come up with it given the complexity and apparent required knowledge of the Tegra2 architecture.

On kernel.org you will find a very different set of codes with respect to Nvidia's git repository, including changes from at least one person at Motorola.... The complexity is way less. In fact I spent a lot of time yesterday poking my way through that code assuming it was the same as Nvidia's repository. I really didn't see a problem with it.

Then I broke down, loaded up the kernel and was surprised to see everything was different. It wasn't until late last night that I found what I cited. I hope it as simple as applying one patch to solve the problem.
[G Tablet Android Development] thebadfrog:
I'm gonna replace the boot.img in tnt lite 3 and do a fresh install. Lag = :mad: :)
[G Tablet Android Development] cyclisto:
I'm on day 2 of no lag after experiencing it after every sleep on 2.4, 3.0 and 3.1. What I did yesterday is repartition the SD card in cwm to 2048/0. I did not restore any data, but i did reinstall all the previous apps from market. I did not reinstall 3.1.1 after the repartition:

from laggy 3.1.1 - boot into cwm - mount system and data - clear all caches - repartition SD - reboot - market fix with titanium backup - reinstall apps from market
[G Tablet Android Development] jerdog:
EDIT: I have only been able to look at a ZPad kernel from Malata's 1222 firmware with CIFS kernel which is the same source as Rothnic's hack)....

Forgive me if this has already been mentioned, but is anyone trying SetCPU? I am coming from the HTC Evo and haven't bought my GTablet just yet.... I saw this same type of thing when I set my min speed to below 384mhz and it would struggle to come out of sleep - sometimes never doing it. Once I set my min at 384mhz the sleep lag went away. I can't imagine that the Tegra can't utilize other governors...

I was also looking through some config files for the kernel (this one the ZPad), and saw these 2 lines - not sure if it makes a difference - but they aren't in the kernel config files I have seen:

My Evo kernel doesn't have the above....

The above is set to 5 on my Evo's kernel config....

The above isn't set on my Evo's kernel config....

The above is from the zpad config.... only Performance is enabled....

The above is from netarchy's 4.2.2 kernel.... notice he's enabled the default governor to be conservative, and then enabled Performance, Powersave, Ondemand, Interactive, Smartass (his implementation)
[G Tablet Android Development] anlog:
Testing this out on vegan b4 as we speak. I'm showing 2.6.32.9-0001-gce20c7f-dirty #2 as the kernel build. Is this correct?

UPDATE 1:

Just pushed the hell out of the power button about 50 times in a row trying to break cpufreq. So far I am still at full speed!
[G Tablet Android Development] rcgabriel:
Hey anlog, that looks like the signature from my kernel build, yup, my G Tab currently showing the same thing. Been running it all morning so far, slept it for intervals of up to an hour at a time, no issues. Previously with Vegan beta 4's stock kernel, I was getting lag-on-wake about 50%-75% of the time I was waking after more than a 10 minute sleep.
[G Tablet Android Development] vsc:
Attached is a similar build with patch applied, packaged for TnTLite 3.1. Only the kernel is updated. It boots, but is not tested in any real sense. Thus do you backups, etc...

Edit: I haven't broken it yet, but time will tell.

Edit2: Attachement removed.
[G Tablet Android Development] Mrbobrowitz:
As all of the other kernel replacements I have tried, this breaks Angry Birds along with installs from market and a slew of other apps. I believe this to be with something being messed up with sdcard reading. Please try to iron this issue out or these kernels will end up going nowhere.

-MrBobrowitz
[G Tablet Android Development] rcgabriel:
Nice, thanks vsc. Your idea seems to have led to the underlying issue and the right solution to this problem.

And clemsyn, disabling LP2 probably does resolve the issue too.

Hopefully this means we now will have a stable enough baseline kernel build to use with the current ROMs. Not perfect, but fixes the worst issue. Should tide us over until pershoot gets his kernel stabilized with all the latest patches rolled up into it.
[G Tablet Android Development] anlog:
rcgabriel your kernel has major issues..

Market is jacked (won't show all apps), and Angry Birds won't install.