All of lore.kernel.org
 help / color / mirror / Atom feed
From: Darcy Watkins <dwatkins@tranzeo.com>
To: linuxppc-embedded <linuxppc-embedded@ozlabs.org>
Subject: Possible init bug in ibm_newemac/core.c
Date: Fri, 15 Aug 2008 10:03:05 -0700	[thread overview]
Message-ID: <1218819785.3465.190.camel@localhost> (raw)

Hello,

In function...

static int __devinit emac_probe(struct of_device *ofdev,
				const struct of_device_id *match)


... in 

   drivers/net/ibm_newemac/core.c

... there is a chunk of code as follows (The // DLW - BUG ... comment is
mine)  ...

	/* Find PHY if any */
	// DLW - BUG - This uses an uninitialized spinlock (potential badness).
	err = emac_init_phy(dev);
	if (err != 0)
		goto err_detach_tah;

	/* Fill in the driver function table */
	ndev->open = &emac_open;
	if (dev->tah_dev)
		ndev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
	ndev->tx_timeout = &emac_tx_timeout;
	ndev->watchdog_timeo = 5 * HZ;
	ndev->stop = &emac_close;
	ndev->get_stats = &emac_stats;
	ndev->set_multicast_list = &emac_set_multicast_list;
	ndev->do_ioctl = &emac_ioctl;
	if (emac_phy_supports_gige(dev->phy_mode)) {
		ndev->hard_start_xmit = &emac_start_xmit_sg;
		ndev->change_mtu = &emac_change_mtu;
		dev->commac.ops = &emac_commac_sg_ops;
	} else {
		ndev->hard_start_xmit = &emac_start_xmit;
	}
	SET_ETHTOOL_OPS(ndev, &emac_ethtool_ops);

	netif_carrier_off(ndev);
	netif_stop_queue(ndev);

	err = register_netdev(ndev);
	if (err) {
		printk(KERN_ERR "%s: failed to register net device (%d)!\n",
		       np->full_name, err);
		goto err_detach_tah;
	}

init_emac_phy() uses a spinlock that isn't initialized until
register_netdev() is invoked.  I tried moving the init_emac_phy() to be
after the register_netdev().  The fix appeared to work on one board
variant (with two Ethernet ports) but kernel panics during boot on
another board variant (with one Etherent port and less memory).

So I have reverted my lame hack attempt and am reporting this so that an
expert can check into it.

The bug normally goes unnoticed until you turn on spinlock and/or
rtmutex debuggging in the kernel config - then the debugging magic
checks will catch it during boot.

This is based on kernel 2.6.25.8-rt7 and then upgraded to be
2.6.25.13-rt7 using incremental patches - running on an AMCC PPC405EP
but I think you could reproduce it using 2.6.25.8-rt7 (or possibly other
kernel versions).


-- 


Regards,

Darcy

--------------
Darcy L. Watkins - Senior Software Developer
Tranzeo Wireless Technologies, Inc.
19273 Fraser Way, Pitt Meadows, BC, Canada V3Y 2V4
T:604-460-6002 ext:410
http://www.tranzeo.com

             reply	other threads:[~2008-08-15 17:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-15 17:03 Darcy Watkins [this message]
2008-08-15 17:48 ` Possible init bug in ibm_newemac/core.c Benjamin Krill
2008-08-15 20:00   ` Darcy Watkins
2008-08-15 20:38     ` Darcy Watkins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1218819785.3465.190.camel@localhost \
    --to=dwatkins@tranzeo.com \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.