Showing posts with label Technical. Show all posts
Showing posts with label Technical. Show all posts

June 27, 2012

Sharing - Leap Second Bug in RedHat

The UTC time standard, which is widely used for international timekeeping on computer systems, uses the international standard definition of the second, based on atomic clocks. However, the duration
of one mean solar day is slightly longer than 86,400 seconds (a UTC day). The purpose of a leap second is to compensate for this drift, by scheduling days with 86401 or 86399 international standard seconds.
Because the Earth's rotation speed varies in response to natural events, UTC leap seconds are irregularly spaced and unpredictable. The last leap second occured at 23:59:59 UTC on 31 December 2008. Leap seconds occur based on UTC time, and therefore are timezone independent and occur around the world at the same moment, regardless of local time.

By default in modern kernels every 1/1000th of a second (1ms) the kernel can make new process scheduling decisions. This 1ms interval is called a kernel "tick".

* How the event is triggered *
  1. The system inherits a leap second flag from an upstream NTP server with knowledge of the upcoming leap second. (This occurs on the day of the leap second event and cannot be unset.)
  2. At 23:59:59 UTC on the leap second day, the kernel sees the leap second flag and causes 23:59:59 UTC to occur twice
  3. In order to process the leap second event a lock is acquired to access the current time
  4. While processing the leap second the kernel issues a printk to notify the user that the leap second has occurred
  5. The printk triggers klogd to wake up so that it can process the new kernel message
  6. klogd attempts to acquire a lock to access the current kernel time.

If step 3 happens on the same core and during the same tick as step 6 then a deadlock occurs (on xtime_lock).

* Likelihood of Occurrence *

It's exceptionally unlikely that the triggering events would happen as required to cause a hang. It is
extremely difficult to trigger this issue during reproduction attempts, even when those reproduction attempts included artificially introducing high printk loads to attempt to trigger the hang.

* Workarounds *

Updating to kernel version kernel-2.6.9-89.EL (RHEL4) or kernel-2.6.18-164.el5 in RHEL5, or any later RHEL kernel is the most reliable method to avoid any impact from this bug. The bug has been
patched in these kernel versions. If your environment includes systems with a kernel version //lower//
than the those patched kernels and you remain concerned even with the low probability of encountering this issue, there are several workarounds available to further mitigate the risk of encountering this bug.

  1. Manually adjust the system time so that 2012-06-30 T23:59:59 UTC never occurs.
  2. Disable NTP clients on the affected system at least a full day ahead of the leap second so that the leap second flag is never inherited.
Then, re-enable NTP on those systems after the leap second has occured. It's important to insure that the tzdata package installed on the system has not been updated to include the 2012-06-30 leap second, as the
system can inherit the leap second flag from the tzdata file as well, even if NTP is disabled.

February 13, 2012

Boosting UniFi

The fact that a lot of people suffered from bad Unifi speed was REAL. It happens to me.

For the past few days, I was feeling like everything was getting really slow. Some might experience slowness in both ways (download and upload) but I think it's quite weird that my upload speed was okay (constantly from 4-5 MBPS) but my download speed went down to not more than 200 kbps, and the slowest recorded was 15kbps, even slower than the PSTN dial up speed.

It used to be at least 1MBPS, when sometimes it goes up to 2 or 3 and 4 but never reached 5 MBPS.

I reported the problem to TM and I only got not less than 15 report numbers for the past 24 hours. Just the report numbers. Nothing more than that. What a service??

Talked to a few friends and Wan suggested that might be due to the router problem. I was just trying my luck and decided to look for the router.

Searched thoroughly on the NET and found out a site, http://unifi.athena.my, which list out all the compatible routers to be working with the current UniFi setup.

So today I went to LowYat Plaza (the heaven on earth for geeks & nerds like me) and looked around for the router. I was stopped at a shop and told that they have a wide range of routers. I checked the site and found out a router with 300 MBPS N WiFi. Priced at RM79, it's a TP-LINK TL-WR841ND.

Headed home after a nice dinner at the al-Rawsha. Popped the router from the box and connect it to one of my laptop while the other one to look for the ways to configure it on the Net.

Downloaded the firmware after so many failing attempts due to the failing UniFi connection, immediately I load it into the router and reboot, configured everything and VOILA! The Internet seems to be improving!


Did the test and it was showing figures around 7-8 MBPS this time. That means the original router provided by TM was faulty from the beginning! Lucky I had a faulty device. I'm not only getting a cheaper replacement (TM's default router will cost you RM150), I'm also getting a better connection now!

I just had my UniFi installed for slightly more than a month. How do you explain that?

UniFi does not sucks. It's the people there. Providing people with faulty items and faulty services, as even the Customer Service failed!

* Please let me know if you are interested and would like to know more how this can be done. It's actually all over the Internet but if you're so lazy, just let me know I can do it for you.

February 2, 2011

Perfecting my Hackintosh Build

I have just upgraded my Snow Leopard to from 10.6.0 to 10.6.6 successfully yesterday. It begins with the upgrade for iTunes. I was holding the Mac OS update due to the fact that I will lose all my sound settings.

As expected, after upgrading to 10.6.6, I lost my sound. My Hackintosh is muted.

The reason why I'm scared to upgrade is due to the fact that I might have lost the sound kext for my hackintosh. I have also forgotten what sound card that I'm using. Thanks to my previous post of the Hackintosh which stated my Sound Card was actually ALC 1200. I thought it was ALC888 or ALC889.

The main resource for ALC 1200 is at http://www.insanelymac.com/forum/index.php?showtopic=161430. There are 2 kind of fix provided in the page. Last time I did use the fix without having to edit DSDT from this page as well. As I didn't understand a thing in DSDT, I opted for HDAEnabler and no DSDT editing as I didn't know anything about DSDT.

All this while I didn't understand DSDT editing at all. All the guide over the Internet did not properly state what exactly needs to be done after compiling the DSDT. It was quite simple actually. Heck to those saying that DSDT editing is hard and confusing. Reading it that way made me think that it's hard.

It was known that by using the HDAEnabler, once the OS is upgraded, you will have to do the sound all over again. So this time, I'm opting for the DSDT editing. I have a few things to fix as well; eg. CMOS reset problem.

Actually DSDT editing is easy. After compiling, what do you really need to do is just to compy it to root folder and restart. As easy as that :)

DSDT Editing:

The easiest way to do DSDT editing is by using DSDTSE, which can be downloaded from http://www.osx86.es/FArchivos/FDSDTSE.zip.
  1. Extract and install DSDTSE package
  2. Once installed, browse through "/" folder and double click on dsdt.aml. A new window will be opened with an extract from the DSDT file. 
  3. HDEF fix
  4. insert this code to dsdt file
  5. Device (HDEF)
                {
                    Name (_ADR, 0x001B0000)
                    Method (_DSM, 4, NotSerialized)
                    {
                        Store (Package (0x0A)
                            {
                                "built-in",
                                Buffer (One)
                                {
                                    0x01
                                },

                                "codec-id",
                                Buffer (0x04)
                                {
                                    0x88, 0x08, 0xEC, 0x10
                                },

                                "layout-id",
                                Buffer (0x04)
                                {
                                    0x0C, 0x00, 0x00, 0x00
                                },

                                "device-type",
                                Buffer (0x11)
                                {
                                    "Realtek ALC1200"
                                },

                                "PinConfigurations",
                                Buffer (One)
                                {
                                }
                            }, Local0)
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }
                }
  6. Some board may have DTGP error while compiling. Please insert this code at the beginning of the file after the first {
  7. Method (DTGP, 5, NotSerialized)
        {
            If (LEqual (Arg0, Buffer (0x10)
                    {
                        /* 0000 */    0xC6, 0xB7, 0xB5, 0xA0, 0x18, 0x13, 0x1C, 0x44,
                        /* 0008 */    0xB0, 0xC9, 0xFE, 0x69, 0x5E, 0xAF, 0x94, 0x9B
                    }))
            {
                If (LEqual (Arg1, One))
                {
                    If (LEqual (Arg2, Zero))
                    {
                        Store (Buffer (One)
                            {
                                0x03
                            }, Arg4)
                        Return (One)
                    }

                    If (LEqual (Arg2, One))
                    {
                        Return (One)
                    }
                }
            }

            Store (Buffer (One)
                {
                    0x00
                }, Arg4)
            Return (Zero)
        }
  8. To fix my CMOS reset, I used this fix. The one in bold Red value was 4 before. So I changed it to 2.
  9.                 Device (RTC)
                    {
                        Name (_HID, EisaId ("PNP0B00"))
                        Name (ATT0, ResourceTemplate ()
                        {
                            IO (Decode16,
                                0x0070,             // Range Minimum
                                0x0070,             // Range Maximum
                                0x00,               // Alignment
                                0x02,               // Length
                                )
                        })
  10. I keep recompiling after every fix to ensure no error in the codes. After all this fixes, the compile successful with a warning. It was the _WAK warning which was fixed using this code at the end of _WAK paragraph.
  11. Method (_WAK, 1, NotSerialized)
        {       
            ............................
            Return (Package (0x02)
            {
                Zero,
                Zero
            })
        }
  12. Then my compile was successful without error and warning at all.
  13. Backup the old dsdt.aml in "/" folder and replace with the one you just compile. Normally after compiling, DSDTSE will open a new finder window with direction to the compiled DSDT.aml
AppleHDA fix:
    I downloaded the AppleHDA fix with DSDT patch file from http://www.insanelymac.com/forum/index.php?act=attach&type=post&id=80281. You mus register before you are able to download this file. Extract this file and install.

    Final thing to do is, RESTART. After restart, I have no more CMOS reset and the most important thing is, I got my sound back!

    October 1, 2010

    IPHONE4 & and battery tips

    Finally, Iphone 4 is in Malaysia. I was among the earliest to obtain it from Digi. The reason why I got it from Digi is because it's earlier and cheaper (in terms of phone price and monthly fees). Use 1GB and the rest is still free even though it's slow.

    There are a few obvious issues I myself found on my very own Iphone4.
    • It fell off from my car to the road surface, and dented, and the so called Helicopter like glass-plasticky material as claimed are not that strong either. From 2 feet above, and fell, and dented, is not supposed to be the case here. Anyway, all function are still working very fine. NO doubts, except for the last thing I'm gonna mention at the end of this article.
    • Call drops. 
    • Battery is draining furiously fast with all the options turned on. Below are tips to prolong it
    1. Turn off location service
    2. Turn off push notification
    3. Fetch new data manually, instead of push
    4. Turn off push email
    5. Reduce email accounts to be auto-checked
    6. Minimize playing games/3rd party apps
    7. Turn off Wifi. Turn it on only when necessary
    8. Turn off Bluetooth
    9. Offline or use airplain mode where the provider signal is low or totally null
    10. Use dimmer brightness
    11. Turn EQ off for Ipod or set EG to flat
    12. Disable using 3G.
    Today, I found a bizarre thing about Iphone4. I called my home landline of which connected to a fax machine. After few rings the call were not picked up, it gets connected to the fax machine. After that, the phone Mic fails. For any calls I made or received, the other side were not able to hear my voice, even though I can still hear them.

    I switched on and off, and turn on flight mode and off it back, sometimes it works and sometimes it doesn't. I resync my Iphone and made a call to my wife and it works again, but I'm worried of the inconsistency.

    So far, it works great and as u know, this is the thing of which I'm not gonna really use it for calls, it's more probably a small computer for me to get connected to the world, anywhere I want, but having the core function not working as supposed gives me some sort of headache right now. *blegh*

    June 2, 2010

    Retail Snow Leopard on my desktop

    Finally, after buying the Snow Leopard installation CD for quite sometimes (I think I bought it last year), only now that I managed to get it installed to a PC and get it fully running. Tried with so many methods, then I decided to buy an almost compatible to Apple setup CPU.

    The spec of the newly bought PC is as below:

  • Intel Quad Core 8300 2.5GHz Processor


  • Gigabyte GA EP43-UD3L motherboard bought from Lowyat


  • MSI n9500 GT 1GB PCIe Display Card


  • 8GB RAM


  • 1 TB HDD
  • I first tried the Kakewalk Installation method which is pretty easy to be done but I have to choose the GA EP45-UD3L method instead as it doesn't have any support for EP43-UD3L, so that was the closest I can pick. The installation was easy, except that the display card didn't work Out Of the Box (OOB), of which I have to use lookup for the nvflash utility, setup a bootable Dos USB flash and run the nvflash to get the ROM file. The using the OSx86 tools to inject the EFI string using the NVCAP string obtained from the nvflash utility.

    Unluckily, my sound card is not as advertised in the website, which is reported to be using the ALC 888 codec. Mine was using the ALC1200. Using Kakewalk installation method, it was kind of messing up with my HDA kexts and installing the Kext for ALC1200 downloaded from the Internet was not a success.

    Then I tried using the Snow Boot Loader installation Method. Good thing was:

  • Display work OOB. Even though I have to change the resolution, it goes blank blue and I restarted. It goes well after that.


  • ALC 1200 was installed with success. It works like a charm!
  • But I'm not pretty sure whether it is running in 64 bit or otherwise. I will have to check.

    Will put a snapshot in the next post. Cheers :)

    May 12, 2009

    Polystyrene may cause cancer?

    A recent study shows that polystyrene, the material that has been for so long, used to pack our food contains elements that is cancerous to our body.

    If this is true, why don't these researchs been extended and told to everyone in this world. Polystyrene is one hell solution for a cheap food packaging solution.

    I came across an article, a few days back and looking at the statistic of cancer cases all around the world, specifically all around myself, is intriguingly terrifying. Day by day, more people will die of cancer. It seems like there's no solution for this widespread disease.

    This, has may become the cause of all this while, cancer. My mom once said that, last time, there was not as much cancer cases as we heard today, as during the time of our ancestors, nobody got cancer at all.

    Polystyrene was introduced as the solution for food packaging, not so long ago. And since then, nobody would thought that it is cancerous.

    It is time for you to make a positive move from using the polystyrene packs to something else.

    Nothing is safe now. Be careful.

    Sponsor Links

    Free Iphone?
    Or Free Ipad?
    Learn how to get free gadgets

    Want to make money from Iphone/Ipad apps?
    Affiliate yourself with apps developer to make money

    Search Optimize your website
    and win free gadget?
    SEO Marketing