* [net-next-2.6 PATCH] ixgbe: only process one ixgbe_watchdog_task at a time.
@ 2010-01-23 10:17 Jeff Kirsher
2010-01-23 10:19 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Kirsher @ 2010-01-23 10:17 UTC (permalink / raw)
To: davem; +Cc: netdev, gospo, John Fastabend, Jeff Kirsher
From: John Fastabend <john.r.fastabend@intel.com>
Processing multiple ixgbe_watchdog_task calls may cause
the link_up variable and IXGBE_FLAG_NEED_LINK_UPDATE flag
to be set incorrectly. In the worse case this is causing
the netif_carrier_off to be called inappropriately which
results in an interface that can't be brought up.
Although schedule_work() will only schedule the task if
it is not already on the work queue the WORK_STRUCT_PENDING
bits are cleared just before calling the work function.
This allows WORK_STRUCT_PENDING to be cleared, the work
function to start and meanwhile schedule another task.
This patch moves the IN_IXGBE_WATCHDOG_TASK flag into the
adapter state and uses test_and_set_bit/clear_bit operations
to guarentee this works as expected.
This bug is actualized by changing DCB settings or doing
extended cable pull tests.
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ixgbe/ixgbe.h | 20 ++++++++++----------
drivers/net/ixgbe/ixgbe_main.c | 5 +++--
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index e3909d3..cd6ed64 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -341,15 +341,14 @@ struct ixgbe_adapter {
#define IXGBE_FLAG_VMDQ_ENABLED (u32)(1 << 19)
#define IXGBE_FLAG_FAN_FAIL_CAPABLE (u32)(1 << 20)
#define IXGBE_FLAG_NEED_LINK_UPDATE (u32)(1 << 22)
-#define IXGBE_FLAG_IN_WATCHDOG_TASK (u32)(1 << 23)
-#define IXGBE_FLAG_IN_SFP_LINK_TASK (u32)(1 << 24)
-#define IXGBE_FLAG_IN_SFP_MOD_TASK (u32)(1 << 25)
-#define IXGBE_FLAG_FDIR_HASH_CAPABLE (u32)(1 << 26)
-#define IXGBE_FLAG_FDIR_PERFECT_CAPABLE (u32)(1 << 27)
-#define IXGBE_FLAG_FCOE_CAPABLE (u32)(1 << 28)
-#define IXGBE_FLAG_FCOE_ENABLED (u32)(1 << 29)
-#define IXGBE_FLAG_SRIOV_CAPABLE (u32)(1 << 30)
-#define IXGBE_FLAG_SRIOV_ENABLED (u32)(1 << 31)
+#define IXGBE_FLAG_IN_SFP_LINK_TASK (u32)(1 << 23)
+#define IXGBE_FLAG_IN_SFP_MOD_TASK (u32)(1 << 24)
+#define IXGBE_FLAG_FDIR_HASH_CAPABLE (u32)(1 << 25)
+#define IXGBE_FLAG_FDIR_PERFECT_CAPABLE (u32)(1 << 26)
+#define IXGBE_FLAG_FCOE_CAPABLE (u32)(1 << 27)
+#define IXGBE_FLAG_FCOE_ENABLED (u32)(1 << 28)
+#define IXGBE_FLAG_SRIOV_CAPABLE (u32)(1 << 29)
+#define IXGBE_FLAG_SRIOV_ENABLED (u32)(1 << 30)
u32 flags2;
#define IXGBE_FLAG2_RSC_CAPABLE (u32)(1)
@@ -411,7 +410,8 @@ enum ixbge_state_t {
__IXGBE_RESETTING,
__IXGBE_DOWN,
__IXGBE_FDIR_INIT_DONE,
- __IXGBE_SFP_MODULE_NOT_FOUND
+ __IXGBE_SFP_MODULE_NOT_FOUND,
+ __IXGBE_IN_WATCHDOG_TASK
};
enum ixgbe_boards {
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 8d206f7..cbc62db 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -5013,7 +5013,8 @@ static void ixgbe_watchdog_task(struct work_struct *work)
struct ixgbe_ring *tx_ring;
int some_tx_pending = 0;
- adapter->flags |= IXGBE_FLAG_IN_WATCHDOG_TASK;
+ while (test_and_set_bit(__IXGBE_IN_WATCHDOG_TASK, &adapter->state))
+ msleep(1);
if (adapter->flags & IXGBE_FLAG_NEED_LINK_UPDATE) {
hw->mac.ops.check_link(hw, &link_speed, &link_up, false);
@@ -5102,7 +5103,7 @@ static void ixgbe_watchdog_task(struct work_struct *work)
}
ixgbe_update_stats(adapter);
- adapter->flags &= ~IXGBE_FLAG_IN_WATCHDOG_TASK;
+ clear_bit(__IXGBE_IN_WATCHDOG_TASK, &adapter->state);
}
static int ixgbe_tso(struct ixgbe_adapter *adapter,
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [net-next-2.6 PATCH] ixgbe: only process one ixgbe_watchdog_task at a time.
2010-01-23 10:17 [net-next-2.6 PATCH] ixgbe: only process one ixgbe_watchdog_task at a time Jeff Kirsher
@ 2010-01-23 10:19 ` David Miller
2010-01-25 6:24 ` John Fastabend
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2010-01-23 10:19 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, john.r.fastabend
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Sat, 23 Jan 2010 02:17:31 -0800
> diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
> index 8d206f7..cbc62db 100644
> --- a/drivers/net/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ixgbe/ixgbe_main.c
> @@ -5013,7 +5013,8 @@ static void ixgbe_watchdog_task(struct work_struct *work)
> struct ixgbe_ring *tx_ring;
> int some_tx_pending = 0;
>
> - adapter->flags |= IXGBE_FLAG_IN_WATCHDOG_TASK;
> + while (test_and_set_bit(__IXGBE_IN_WATCHDOG_TASK, &adapter->state))
> + msleep(1);
>
I think using a mutex() would better serve you here.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [net-next-2.6 PATCH] ixgbe: only process one ixgbe_watchdog_task at a time.
2010-01-23 10:19 ` David Miller
@ 2010-01-25 6:24 ` John Fastabend
0 siblings, 0 replies; 3+ messages in thread
From: John Fastabend @ 2010-01-25 6:24 UTC (permalink / raw)
To: David Miller; +Cc: Kirsher, Jeffrey T, netdev@vger.kernel.org, gospo@redhat.com
David Miller wrote:
> From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Date: Sat, 23 Jan 2010 02:17:31 -0800
>
>
>> diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
>> index 8d206f7..cbc62db 100644
>> --- a/drivers/net/ixgbe/ixgbe_main.c
>> +++ b/drivers/net/ixgbe/ixgbe_main.c
>> @@ -5013,7 +5013,8 @@ static void ixgbe_watchdog_task(struct work_struct *work)
>> struct ixgbe_ring *tx_ring;
>> int some_tx_pending = 0;
>>
>> - adapter->flags |= IXGBE_FLAG_IN_WATCHDOG_TASK;
>> + while (test_and_set_bit(__IXGBE_IN_WATCHDOG_TASK, &adapter->state))
>> + msleep(1);
>>
>>
>
> I think using a mutex() would better serve you here.
>
I'll make this change and resubmit. Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-25 6:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-23 10:17 [net-next-2.6 PATCH] ixgbe: only process one ixgbe_watchdog_task at a time Jeff Kirsher
2010-01-23 10:19 ` David Miller
2010-01-25 6:24 ` John Fastabend
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).