From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Nuno Monteiro <nuno@itsari.org>
Cc: linux-kernel@vger.kernel.org, marcelo.tosatti@cyclades.com,
David Howells <dhowells@redhat.com>
Subject: Re: [2.4] build error with latest BK
Date: Wed, 16 Jun 2004 12:38:25 +1000 [thread overview]
Message-ID: <40CFB2A1.8070104@yahoo.com.au> (raw)
In-Reply-To: <20040615164848.GA8276@hobbes.itsari.int>
[-- Attachment #1: Type: text/plain, Size: 484 bytes --]
Nuno Monteiro wrote:
>
> Hi all,
>
>
> Just pulled latest bk of 2.4 and it appears to be broken. The recent
> rwsem race fixes seem to be the culprit (see
> http://linux.bkbits.net:8080/linux-2.4/cset@40cee86dCLGhZc1lEOWZV6K7FysQlw?nav=index.html|
> ChangeSet@-1d). Reversing it fixes the problem.
>
Sorry, that was stupid of me.
Does the attached patch look acceptable? In particular, should
task_lock be used in this manner? (ie. to guarantee the task doesn't
go away).
[-- Attachment #2: rwsem24-fix.patch --]
[-- Type: text/x-patch, Size: 2547 bytes --]
--- linux-2.4/lib/rwsem.c.orig 2004-06-16 12:26:52.000000000 +1000
+++ linux-2.4/lib/rwsem.c 2004-06-16 12:33:28.000000000 +1000
@@ -61,10 +61,10 @@ static inline struct rw_semaphore *__rws
list_del(&waiter->list);
tsk = waiter->task;
- mb();
+ task_lock(tsk); /* task_lock is an implicit memory barrier */
waiter->task = NULL;
wake_up_process(tsk);
- put_task_struct(tsk);
+ task_unlock(tsk);
goto out;
/* grant an infinite number of read locks to the readers at the front of the queue
@@ -93,10 +93,10 @@ static inline struct rw_semaphore *__rws
waiter = list_entry(next,struct rwsem_waiter,list);
next = waiter->list.next;
tsk = waiter->task;
- mb();
+ task_lock(tsk);
waiter->task = NULL;
wake_up_process(tsk);
- put_task_struct(tsk);
+ task_unlock(tsk);
}
sem->wait_list.next = next;
@@ -128,7 +128,6 @@ static inline struct rw_semaphore *rwsem
/* set up my own style of waitqueue */
spin_lock(&sem->wait_lock);
waiter->task = tsk;
- get_task_struct(tsk);
list_add_tail(&waiter->list,&sem->wait_list);
--- linux-2.4/lib/rwsem-spinlock.c.orig 2004-06-16 12:33:40.000000000 +1000
+++ linux-2.4/lib/rwsem-spinlock.c 2004-06-16 12:34:39.000000000 +1000
@@ -66,10 +66,10 @@ static inline struct rw_semaphore *__rws
sem->activity = -1;
list_del(&waiter->list);
tsk = waiter->task;
- mb();
+ task_lock(tsk); /* implicit memory barrier */
waiter->task = NULL;
wake_up_process(tsk);
- put_task_struct(tsk);
+ task_unlock(tsk);
goto out;
}
@@ -78,10 +78,10 @@ static inline struct rw_semaphore *__rws
do {
list_del(&waiter->list);
tsk = waiter->task;
- mb();
+ task_lock(tsk);
waiter->task = NULL;
wake_up_process(tsk);
- put_task_struct(tsk);
+ task_unlock(tsk);
woken++;
if (list_empty(&sem->wait_list))
break;
@@ -108,10 +108,10 @@ static inline struct rw_semaphore *__rws
list_del(&waiter->list);
tsk = waiter->task;
- mb();
+ task_lock(tsk);
waiter->task = NULL;
wake_up_process(tsk);
- put_task_struct(tsk);
+ task_unlock(tsk);
return sem;
}
@@ -140,7 +140,6 @@ void __down_read(struct rw_semaphore *se
/* set up my own style of waitqueue */
waiter.task = tsk;
waiter.flags = RWSEM_WAITING_FOR_READ;
- get_task_struct(tsk);
list_add_tail(&waiter.list,&sem->wait_list);
@@ -209,7 +208,6 @@ void __down_write(struct rw_semaphore *s
/* set up my own style of waitqueue */
waiter.task = tsk;
waiter.flags = RWSEM_WAITING_FOR_WRITE;
- get_task_struct(tsk);
list_add_tail(&waiter.list,&sem->wait_list);
next prev parent reply other threads:[~2004-06-16 2:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-15 16:48 [2.4] build error with latest BK Nuno Monteiro
2004-06-16 2:38 ` Nick Piggin [this message]
2004-06-16 8:20 ` David Howells
2004-06-16 8:43 ` Nick Piggin
2004-06-16 9:01 ` Mikael Pettersson
2004-06-16 9:04 ` Nick Piggin
2004-06-16 13:40 ` Nuno Monteiro
2004-06-16 13:57 ` Marcelo Tosatti
2004-06-16 15:07 ` [2.4] build error with latest BK [fixed patch] Nuno Monteiro
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=40CFB2A1.8070104@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
--cc=nuno@itsari.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