Skip to contentSkip to conversation

HPET regression in 2.6.26 versus 2.6.25

DISCUSSION David Witbrodt 1 participant 1 message Aug 8, 2008

lore
Share & tools
lore
#0 lore raw

OK, suffering from insomnia this morning, I added printk()'s to net/ipv4/af_inet.c in order to find the code where the freeze happens. One of 2 loops was the culprit:

===== BEGIN CODE =======================
#ifdef CONFIG_IP_MULTICAST
if (inet_add_protocol(&igmp_protocol, IPPROTO_IGMP) < 0)
printk(KERN_CRIT "inet_init: Cannot add IGMP protocol\n");
#endif

    /* Register the socket-side information for inet_create. */
    for (r = &inetsw[0]; r < &inetsw[SOCK_MAX]; ++r)
        INIT_LIST_HEAD(r);

    for (q = inetsw_array; q < &inetsw_array[INETSW_ARRAY_LEN]; ++q)
        inet_register_protosw(q);
  
    /*
     *    Set the ARP module up
     */

===== END CODE =======================

Feeling better, I tried to get a few hours of sleep before I had to go to work.

Knowing where to focus more attention, I restored the original version of af_inet.c from the git tree with

git show HEAD:net/ivp4/af_inet.c

and then made the following changes to discover which loop was the problem:

===== BEGIN DIFF ========================
#ifdef CONFIG_IP_MULTICAST
if (inet_add_protocol(&igmp_protocol, IPPROTO_IGMP) < 0)
printk(KERN_CRIT "inet_init: Cannot add IGMP protocol\n");
#endif

+     printk("           First loop:\n");
+     printk("             SOCK_MAX = %d\n", SOCK_MAX);
+     int dwindex=0;
      /* Register the socket-side information for inet_create. */
      for (r = &inetsw[0]; r < &inetsw[SOCK_MAX]; ++r)
+       {
+         printk("             initializing:  &inetsw[%d] = %p\n", dwindex, r);
          INIT_LIST_HEAD(r);

+ ++dwindex;
+ }

+     printk("           Second loop:\n");
+     printk("             INETSW_ARRAY_LEN = %d\n", INETSW_ARRAY_LEN);
+     printk("             Initial q = %p\n", inetsw_array);
+     printk("             Final   q = %p\n", &inetsw_array[INETSW_ARRAY_LEN]);
+     dwindex=0;
      for (q = inetsw_array; q < &inetsw_array[INETSW_ARRAY_LEN]; ++q)
+       {
+         printk("             initializing:  &q[%d]\n", dwindex);
          inet_register_protosw(q);

+ ++dwindex;
+ }

      /*
       *    Set the ARP module up
       */

===== END DIFF ========================

I then built the kernel, installed it, and rebooted. The following output was observed:

===== BEGIN OUTPUT ========================
...
NET: Registered protocol family 2

           First loop:
             SOCK_MAX = 11
             initializing:  &initsw[0] = ffffffff809c8460
             initializing:  &initsw[1] = ffffffff809c8470
             initializing:  &initsw[2] = ffffffff809c8480
             initializing:  &initsw[3] = ffffffff809c8490
             initializing:  &initsw[4] = ffffffff809c84a0
             initializing:  &initsw[5] = ffffffff809c84b0
             initializing:  &initsw[6] = ffffffff809c84c0
             initializing:  &initsw[7] = ffffffff809c84d0
             initializing:  &initsw[8] = ffffffff809c84e0
             initializing:  &initsw[9] = ffffffff809c84f0
             initializing:  &initsw[10] = ffffffff809c8500
           Second loop:
             INETSW_ARRAY_LEN = 3
             Initial q = ffffffff806f8a20
             Final   q = ffffffff806f8a60
             initializing:  &q[0]

===== END OUTPUT ========================

This is where my kernels (2.6.26* and 2.6.27*) are freezing, in the call of inet_register_protosw().

As I find time, I will keep trying to dig deeper. Hopefully one of you on the LKML has an idea of what's wrong, because even though I am familiar with C and C++ I have no background at all with Linux kernel code itself.

Dave W.