From: Maxim Levitsky <maximlevitsky@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-pm@lists.linux-foundation.org, netdev@vger.kernel.org
Subject: QUESTION: How to fix race between .suspend routine and watchdog timer
Date: Thu, 25 Oct 2007 06:12:44 +0200 [thread overview]
Message-ID: <200710250612.44296.maximlevitsky@gmail.com> (raw)
Hi,
Recently, trying to fix saa7134 suspend/resume problems I found that there
is a race between IRQ handler and .suspend , and that I cant let driver access the device
while its in D3 since it can lock up some systems.
Now I am looking to fix those issues in two drivers that have my .suspend/.resume routines.
the saa7134 capture chip and dmfe, the davicom network driver.
Looking through the dmfe code, I noticed yet another possible race.
A race between the .suspend, and a timer that serves both as a watchdog, and link state detector.
Again I need to prevent it from running during the suspend/resume, but how?
I can use del_timer in .suspend, and mod_timer in .resume, but that doesn't protect against
race with already running timer.
I can use del_timer_sync, but it states that it is useless if timer re-enables itself, and I agree with that.
In dmfe case the timer does re-enable itself.
I can put checks in the timer for ->insuspend, and don't re enable it if set,
but that opens a new can of worms with memory barriers, etc...
So please tell me how properly to do that.
By the way, this problem, together with synchronize_irq it very generic, since most drivers
have and irq handler, and a timeout timer.
Best regards,
Maxim Levitsky
next reply other threads:[~2007-10-25 4:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-25 4:12 Maxim Levitsky [this message]
2007-10-25 17:02 ` [linux-pm] QUESTION: How to fix race between .suspend routine and watchdog timer Alan Stern
2007-10-26 11:48 ` Maxim Levitsky
2007-10-27 19:17 ` Alan Stern
2007-10-27 19:19 ` Maxim Levitsky
2007-10-27 22:24 ` Alan Stern
2007-10-28 19:19 ` Maxim Levitsky
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=200710250612.44296.maximlevitsky@gmail.com \
--to=maximlevitsky@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=netdev@vger.kernel.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 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).