From: "Rafał Miłecki" <zajec5@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
DRI <dri-devel@lists.sourceforge.net>
Subject: Re: [PATCH][RFC] time: add wait_interruptible_timeout macro to sleep (w. timeout) until wake_up
Date: Fri, 26 Feb 2010 11:38:59 +0100 [thread overview]
Message-ID: <b170af451002260238p29c7db97nd50154bf7288ef42@mail.gmail.com> (raw)
In-Reply-To: <1266761422-2921-1-git-send-email-zajec5@gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 3626 bytes --]
Forwarding to ppl I could often notice in git log time.h
---------- WiadomoÅÄ przekazana dalej ----------From: RafaÅ MiÅecki <zajec5@gmail.com>Date: 21 lutego 2010 15:10Subject: [PATCH][RFC] time: add wait_interruptible_timeout macro tosleep (w. timeout) until wake_upTo: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,dri-devel@lists.sourceforge.netCC: RafaÅ MiÅecki <zajec5@gmail.com>
Signed-off-by: RafaÅ MiÅecki <zajec5@gmail.com>---We try to implement some PM in radeon KMS and we need to sync with VLBANK forreclocking engine/memory. The easiest and cleanest way seems to be sleeping intimer handler just before reclocking. Then our IRQ handler calls wake_up and wecontinue reclocking.
As you see our sleeping is condition-less, we just wait for waking up queue.
We hope this waking will happen from IRQ handler, but for less-happy case wealso use some timeout (this will probably cause some single corruption, butwe can live with it).
Following macro is soemthing that seems to work fine for us, but insteadintroducing this to radeon KMS only, I'd like to propose adding this to wholewait.h. Do you this it's something we should place there? Can someone take thispatch for me? Or maybe you find this rather useless and we should keep thismarco locally?---Â include/linux/wait.h | Â 25 +++++++++++++++++++++++++Â 1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/include/linux/wait.h b/include/linux/wait.hindex a48e16b..998475b 100644--- a/include/linux/wait.h+++ b/include/linux/wait.h@@ -332,6 +332,31 @@ do { Â Â Â Â Â Â Â Â Â Â Â Â \Â Â Â Â __ret; Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \Â })
+/**+ * wait_interruptible_timeout - sleep until a waitqueue is woken up+ * @wq: the waitqueue to wait on+ * @timeout: timeout, in jiffies+ *+ * The process is put to sleep (TASK_INTERRUPTIBLE) until the waitqueue+ * @wq is woken up. It can be done manually with wake_up or will happen+ * if timeout elapses.+ *+ * The function returns 0 if the @timeout elapsed, remaining jiffies+ * if workqueue was waken up earlier.+ */+#define wait_interruptible_timeout(wq, timeout)     \+({                                   \+    long __ret = timeout;                      \+                                    \+    DEFINE_WAIT(__wait);                       \+    prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE);        \+    if (!signal_pending(current))                  \+        __ret = schedule_timeout(__ret);             \+    finish_wait(&wq, &__wait);                    \+                                    \+    __ret;                              \+})+ #define __wait_event_interruptible_exclusive(wq, condition, ret)    \ do {                                  \    DEFINE_WAIT(__wait);                       \--1.6.4.2ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next prev parent reply other threads:[~2010-02-26 10:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-21 14:10 Rafał Miłecki
2010-02-21 15:01 ` Thomas Hellstrom
2010-02-21 15:50 ` Rafał Miłecki
2010-02-24 22:33 ` Rafał Miłecki
2010-02-26 10:38 ` Rafał Miłecki [this message]
2010-02-26 11:55 ` Thomas Gleixner
2010-02-26 12:16 ` Rafał Miłecki
2010-02-26 16:14 ` Andrew Morton
2010-02-26 17:33 ` Rafał Miłecki
2010-02-26 19:01 ` Ville Syrjälä
2010-02-27 9:33 ` Rafał Miłecki
2010-03-01 16:37 ` Michel Dänzer
2010-03-02 20:32 ` Rafał Miłecki
2010-02-27 1:04 ` Linus Torvalds
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=b170af451002260238p29c7db97nd50154bf7288ef42@mail.gmail.com \
--to=zajec5@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dri-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®