From patchwork Tue Mar 31 18:45:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 25434 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id C1594DDDF6 for ; Wed, 1 Apr 2009 05:46:10 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763506AbZCaSqG (ORCPT ); Tue, 31 Mar 2009 14:46:06 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1763512AbZCaSqE (ORCPT ); Tue, 31 Mar 2009 14:46:04 -0400 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.123]:37578 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763496AbZCaSp7 (ORCPT ); Tue, 31 Mar 2009 14:45:59 -0400 Received: from larrylap ([69.76.240.125]) by hrndva-omta02.mail.rr.com with SMTP id <20090331184555.FLD3231.hrndva-omta02.mail.rr.com@larrylap>; Tue, 31 Mar 2009 18:45:55 +0000 Date: Tue, 31 Mar 2009 13:45:49 -0500 From: Larry Finger To: jgarzik@pobox.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, oliver@neukum.org Subject: [PATCH 1/2 V2] kaweth: Fix locking to be SMP-safe Message-ID: <49d264dd.YwbXLw18YaD1tQqD%Larry.Finger@lwfinger.net> User-Agent: Heirloom mailx 12.2 01/07/07 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On an SMP system, the following message is printed. The patch below gets fixes the problem. --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ================================= [ INFO: inconsistent lock state ] 2.6.29-Linus-05093-gc31f403 #57 --------------------------------- inconsistent {hardirq-on-W} -> {in-hardirq-W} usage. bash/4105 [HC1[1]:SC0[0]:HE0:SE1] takes: (&kaweth->device_lock){+...}, at: [] kaweth_usb_receive+0x77/0x1af [kaw eth] {hardirq-on-W} state was registered at: [] __lock_acquire+0x753/0x1685 [] lock_acquire+0x55/0x71 [] _spin_lock+0x31/0x3d [] kaweth_start_xmit+0x2b/0x1e1 [kaweth] [] dev_hard_start_xmit+0x22e/0x2ad [] __qdisc_run+0xf2/0x203 [] dev_queue_xmit+0x263/0x39b [] packet_sendmsg_spkt+0x1c4/0x20a [af_packet] [] sock_sendmsg+0xe4/0xfd [] sys_sendto+0xe4/0x10c [] system_call_fastpath+0x16/0x1b [] 0xffffffffffffffff irq event stamp: 1280 hardirqs last enabled at (1279): [] _spin_unlock_irqrestore+0x44/0x4c hardirqs last disabled at (1280): [] save_args+0x67/0x70 softirqs last enabled at (660): [] __do_softirq+0x14d/0x15d softirqs last disabled at (651): [] call_softirq+0x1c/0x28 Signed-off-by: Larry Finger --- Jeff, As the listed authors of this driver have not touched it in several years, I have taken the liberty of sending it to you as networking drivers maintainer. I hope this is OK. Larry --- Index: wireless-testing/drivers/net/usb/kaweth.c =================================================================== --- wireless-testing.orig/drivers/net/usb/kaweth.c +++ wireless-testing/drivers/net/usb/kaweth.c @@ -36,7 +36,6 @@ * Run test procedures * Fix bugs from previous two steps * Snoop other OSs for any tricks we're not doing - * SMP locking * Reduce arbitrary timeouts * Smart multicast support * Temporary MAC change support @@ -796,7 +799,7 @@ static int kaweth_start_xmit(struct sk_b int res; - spin_lock(&kaweth->device_lock); + spin_lock_irq(&kaweth->device_lock); kaweth_async_set_rx_mode(kaweth); netif_stop_queue(net); @@ -814,7 +817,7 @@ static int kaweth_start_xmit(struct sk_b if (!copied_skb) { kaweth->stats.tx_errors++; netif_start_queue(net); - spin_unlock(&kaweth->device_lock); + spin_unlock_irq(&kaweth->device_lock); return 0; } } @@ -848,7 +851,7 @@ skip: net->trans_start = jiffies; } - spin_unlock(&kaweth->device_lock); + spin_unlock_irq(&kaweth->device_lock); return 0; }