Problem with atomicity of TIF for parisc ?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line
Now I'm wondering if our thread-problems may be due the fact that we do not disable interrupts while testing the
TIF_XXvalues inarch/parisc/kernel/entry.S, e.g.:
Do you have a testcase? I'm still seeing the occasional thread test fail in the GCC testsuite fail. These are usually timeouts. I'm not seeing hung processes leading to a kernel crash anymore ;)
I also see output from a test truncated occasionally when a test generates a lot of output.
Quoted 11 lines
intr_return:
/* NOTE: Need to enable interrupts incase we schedule. */
ssmPSW_SM_I, %r0
<....>intr_check_resched:/* check for reschedule */ mfctl %cr30,%r1 LDREG TI_FLAGS(%r1),%r19 /* sched.h: TIF_NEED_RESCHED */ bb,<,n %r19,31-TIF_NEED_RESCHED,intr_do_resched /* forward */Is the coding correct, or do we need to disable interrupts when checking
TIF_NEED_RESCHED?
The bb test clearly isn't atomic...
Is disabling interrupts sufficient on a SMP system?
Dave
Signature · 2 lines
J. David Anglin [email protected] National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 3 lines · John David Anglin
Is disabling interrupts sufficient on a SMP system?
No. :/
Hi Dave,
Quoted 3 lines · John David Anglin
Quoted 1 line
Now I'm wondering if our thread-problems may be due the fact that we do not disable interrupts while testing the
TIF_XXvalues inarch/parisc/kernel/entry.S, e.g.:Do you have a testcase?
Randolph pointed me once to the thread_test2.c testprogram in parisc's 'userspace' CVS repository. Source is attached, but I haven't tested it since a few weeks...
Quoted 3 lines
I'm still seeing the occasional thread test
fail in the GCC testsuite fail. These are usually timeouts. I'm not seeing hung processes leading to a kernel crash anymore ;)
Me neither.
Helge
/* gcc -Wall -O2 -o thread_test2 thread_test2.c -lpthread */ #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/wait.h>
pthread_cond_t started, terminated;pthread_mutex_t started_lock, terminated_lock;pthread_t thread;
static void *threadfunc(void *data)
{
int *count = (int *)data;
pid_t pid;
int status;
printf("Thread %d started\n", *count);
pthread_cond_signal(&started);
pid = fork();
switch (pid) {
case 0: /* Child */
printf("Process %d started\n", *count);
sleep(1);
exit(10);
break;
case -1: /* Error */
perror("fork");
return NULL;
}
printf("Waiting on pid %d\n", pid);
pid = waitpid(-1, &status, 0);
if (pid < 0) {
perror("waitpid");
return NULL;
}
printf("Thread %d terminated (%d)\n", *count, WEXITSTATUS(status));
pthread_cond_signal(&terminated);
pthread_exit(NULL);
return 0;
}int main(int argc, char **argv)
{
int count, ret;
for (count = 1; ; count++) {
ret = pthread_cond_init(&started, NULL);
if (ret) {
perror("pthread_cond_init(started)");
break;
}
ret = pthread_mutex_init(&started_lock, NULL);
if (ret) {
perror("pthread_mutex_init(started_lock)");
break;
}
ret = pthread_cond_init(&terminated, NULL);
if (ret) {
perror("pthread_cond_init(terminated)");
break;
}
ret = pthread_mutex_init(&terminated_lock, NULL);
if (ret) {
perror("pthread_mutex_init(terminated_lock)");
break;
}
ret = pthread_create(&thread, NULL, threadfunc, &count);
if (ret) {
perror("pthread_create");
break;
}
pthread_mutex_lock(&started_lock);
do {
ret = pthread_cond_wait(&started, &started_lock);
} while (ret != 0);
pthread_mutex_unlock(&started_lock);
pthread_mutex_destroy(&started_lock);
pthread_cond_destroy(&started);
pthread_mutex_lock(&terminated_lock);
do {
ret = pthread_cond_wait(&terminated, &terminated_lock);
} while (ret != 0);
pthread_mutex_unlock(&terminated_lock);
pthread_mutex_destroy(&terminated_lock);
pthread_cond_destroy(&terminated);
}
return 0;
}_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Kyle McMartin
Quoted 3 lines · John David Anglin
Is disabling interrupts sufficient on a SMP system?
No. :/
Hi Kyle,
Independend of the fact if irq-disabling is enough on SMP or not. The question still remains: May this be one of the reasons we see the hangs ?
Helge
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux