From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: [patch 6/10] s390: pfault interrupt race.
Date: Mon, 29 Aug 2005 19:55:42 +0200 [thread overview]
Message-ID: <20050829175542.GF6796@localhost.localdomain> (raw)
[patch 6/10] s390: pfault interrupt race.
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
There is a race in pfault_interrupt. That function gets called two times
for each pfault notification. Once with a subcode of 0 to indicate that
a real page is not available and once with a subcode of 0x80 to indicate
that the page is present again. Since the two external interrupts can be
delivered on two different cpus the order in which the two calls are made
is unpredictable. It is possible that the subcode 0x80 interrupt is
completed before the subcode 0x00 interrupt has done the wake_up() call.
To avoid calling wake_up() on an already removed task structure proper
task structure reference counting is needed. Increase the reference
counter in the subcode 0x00 interrupt before setting pfault_wait to zero
and return the reference after the wake_up call.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
diffstat:
arch/s390/mm/fault.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletion(-)
diff -urpN linux-2.6/arch/s390/mm/fault.c linux-2.6-patched/arch/s390/mm/fault.c
--- linux-2.6/arch/s390/mm/fault.c 2005-08-29 01:41:01.000000000 +0200
+++ linux-2.6-patched/arch/s390/mm/fault.c 2005-08-29 19:18:09.000000000 +0200
@@ -563,12 +563,14 @@ pfault_interrupt(struct pt_regs *regs, _
* interrupt. pfault_wait is valid. Set pfault_wait
* back to zero and wake up the process. This can
* safely be done because the task is still sleeping
- * and can't procude new pfaults. */
+ * and can't produce new pfaults. */
tsk->thread.pfault_wait = 0;
wake_up_process(tsk);
+ put_task_struct(tsk);
}
} else {
/* signal bit not set -> a real page is missing. */
+ get_task_struct(tsk);
set_task_state(tsk, TASK_UNINTERRUPTIBLE);
if (xchg(&tsk->thread.pfault_wait, 1) != 0) {
/* Completion interrupt was faster than the initial
@@ -578,6 +580,7 @@ pfault_interrupt(struct pt_regs *regs, _
* mode and can't produce new pfaults. */
tsk->thread.pfault_wait = 0;
set_task_state(tsk, TASK_RUNNING);
+ put_task_struct(tsk);
} else
set_tsk_need_resched(tsk);
}
reply other threads:[~2005-08-29 17:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20050829175542.GF6796@localhost.localdomain \
--to=schwidefsky@de.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®