[G Tablet Android Development] rcgabriel:
I have an idea for the lag on wake issue that seems endemic to the new kernel in the current TNTLite 3.x, Vegan beta 4 and stock 3389 ROMs.

I think I've confirmed this isn't an issue with Calendar, at least not in Vegan beta4, because I disabled everything Calendar related in AutoStarts and it was still happening all the time.

I've been poking around, reading about CPU governors, and exploring the /sys filesystem.

What I've found is that the default kernel seems to have only two governor settings - performance and powersave, the former of which pegs the CPU at maxfrequency and the latter pegs the CPU at minfrequency. The ondemand governor that my Nexus One uses and that a lot of Android devices use seems to be disabled here, perhaps because it doesn't play nice with Tegra2, perhaps because they just couldn't be bothered.

I believe what's happening is that when the G Tablet is asleep for a longer period of time, the governor gets set to powersave mode. When the G Tablet wakes up it's presumably supposed to be set back to performance mode. Apparently that isn't happening all the time.

My proposal to confirm this is to try to get the lag condition to happen again, then to issue the following commands from the terminal window and see if the issue resolves itself:

sudo echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
sudo echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

It's also possible that since the governor is getting truly stuck in the powersave mode, this won't successfully "unstick" it. But it's worth trying - if we can confirm that this is what's happening, I suspect we can hack our way to a proper fix, especially now that we have the kernel source as of about an hour ago. :)

Going to try sleeping my tablet for a while, see if this gets me anywhere... will update...

EDIT: this doesn't fix the issue once it happens. But I can confirm that when it's lagging which just happened after an hour's sleep, that cpuinfo_cur_freq file shows 216000 (even though I had minfreq set in OC Widget to 528000, hmm). So it's obviously getting stuck at that very, very slow clock setting.

Also, I was at 85% battery when this happened, so it's not only at low battery readings that this occurs, at least on beta4 of Vegan.

This all confirms to me that I am on the right track, this is absolutely an issue with the governor.

-----------------------------------------------------------------------------------------------

EDIT: Adding this summary of the thread below.

Update.zip files with alternate kernels for users of Vegan b4 and TNTLite 3.1.x ROMs (see these posts):

For Vegan beta4:

http://xdaforums.com/showpost.php?p=10138407&postcount=112

For TNTLite (vsc build)

http://xdaforums.com/showpost.php?p=10170515&postcount=206

Information for kernel developers:

We identified two patches to fix the lag-on-wake issue. These patches are:

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

http://nv-tegra.nvidia.com/gitweb/?...it;h=01a0b8146665a17dd063b4b8e2fe80e5bd795c22

The first of these appears to be the critical one, the latter to handle some possible corner case issues.

Additionally, there is an issue with the kernel config that affected apps trying to install to the SD card. We fixed that using a subset of the patch here:

http://nv-tegra.nvidia.com/gitweb/?...it;h=555d0c0e5b9a86b5e291216d59406709b34480d6

Specifically, my subset patch is posted at this location: http://xdaforums.com/showpost.php?p=10168177&postcount=5

Synopsis of what we learned:

Under certain conditions (LP1 suspend?), when the Tegra 2 was in a suspend state and a driver returned an error on wake-up, there is a step in the resume process where the voltage was supposed to be reset to the CPU, and that step was getting skipped. When the voltage was stuck low, the CPU would get stuck at minimum frequency, 216MHz and couldn't be pushed back to 1GHz or any other setting by the governor. There was a patch from NVidia that fixed this behavior, from a newer branch of the Tegra 2 source code than what Viewsonic used. We integrated this patch and found that indeed, it resolved the problem.