LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Perez-Gonzalez, Inaky" <inaky.perez-gonzalez@intel.com>
To: "Arjan van de Ven" <arjan@infradead.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: RE: RFC/patch: down_timeout_interruptible()
Date: Sun, 25 Feb 2007 22:37:40 -0800	[thread overview]
Message-ID: <C72DEB015BA7724783363DE1AF6B0F98016FF09B@orsmsx417.amr.corp.intel.com> (raw)
In-Reply-To: <1172385954.3265.14.camel@laptopd505.fenrus.org>

>From: Arjan van de Ven [mailto:arjan@infradead.org]
>
>> I gave it a quick try (must admit, not too tested) and it seems that
>> the setting of TIF_SIGPENDING without really having a signal queued
>> is not having easily visible ugly consequences.
>
>what happens if you get a signal around the time the timeout fires?

Depends of what around means.

+	result = down_interruptible(sem);
+	del_timer(&dit_timer);
+	if (result < 0 && data.result < 0)
+		result = data.result;

This piece of code will catch the 'timeout arrived right before a 
signal' case. 'data.result' is set by the timeout handler, so it 
doesn't interfere.

Now, if the timeout arrives right after a signal was delivered
but before the thread returns from down_interruptible, then it
will also look like a timeout (as that code in the if statement
will kick in) -- to some extent, it is 'right' theoretically, as
it didn't get the sem before the time expired. TIF_SIGPENDING is 
still set, so the signal is not lost (unless I miss something else
about the signal delivery engine).

The last case, if the timeout arrives after the signal and after
down_interruptible returns, nothing in theory. There is a window
where the timer could still execute before it is deleted and it
would look like a timeout [which theoretically could be right too].
Maybe the result < 0 && data.result < 0 check should be done 
before del_timer(). 

Suggestions? 

-- Inaky

      reply	other threads:[~2007-02-26  6:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-23  1:54 Iñaky Pérez-González
2007-02-25  6:45 ` Arjan van de Ven
2007-02-26  6:37   ` Perez-Gonzalez, Inaky [this message]

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=C72DEB015BA7724783363DE1AF6B0F98016FF09B@orsmsx417.amr.corp.intel.com \
    --to=inaky.perez-gonzalez@intel.com \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='RE: RFC/patch: down_timeout_interruptible()' \
    /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

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).