PI mutex support on ARM
hi !
Is about the PI Mutex issue on ARM some work going on?
Or does someone have an information for me how to implement this for a armv4 correct ?
thanks
fred
Quoted 1 line · Manfred Gruber
Is about the PI Mutex issue on ARM some work going on?
work best sentences when formed properly they're.
Quoted 2 lines
Or does someone have an information for me how to implement this for a armv4 correct ?
The futexes are something I've no interest in at the moment since I'm not running EABI or even TLS based environments. People who are get the privilege of solving the problems found there in.
Hello Manfred,
At http://www.spinics.net/lists/arm-kernel/msg42349.html you can find a patch that will probably work. Due to the lack of proper atomic instructions on the ARM-v4 core this patch is likely to be the best possible solution.
Kind Regards,
Remy
2007/8/20, Manfred Gruber <[email protected]>:
Quoted 10 lines
hi !
Is about the PI Mutex issue on ARM some work going on?
Or does someone have an information for me how to implement this for a armv4 correct ?thanks
fred
Hi Remy !
thanks a lot, i will test it on a ARM-v4 with 2.6.23-rc2-rt2 and 2.6.21.5-rt20.
I have a application which makes a lot of pthread_mutex_lock/unlock between rt and non-rt tasks with PI. So i will look what happens.
thanks
fred
Am Monday 20 August 2007 schrieben Sie:
Quoted 10 lines
Hello Manfred,
At http://www.spinics.net/lists/arm-kernel/msg42349.html you can find a patch that will probably work. Due to the lack of proper atomic instructions on the ARM-v4 core this patch is likely to be the best possible solution.
Kind Regards,
Remy
hi !
I have now run 2.6.23-rc4-rt1 on my arm920t with the pi_stress test programm from http://people.redhat.com/williams/tests
My question if I run the pi_stress, my watchdog triggers, if watchdog is disabled i get this:
Admin threads running on processor: 0 Test threads running on processor: 0 Starting PI Stress Test
Number of thread groups: 10
Number of inversions per group: infinite Test threads using scheduler policy: SCHED_FIFO
Admin thread priority: 4
10 groups of 3 threads will be created
High thread priority: 3
Med thread priority: 2
Low thread priority: 1Press Control-C to stop test Current Inversions: 15551
Keyboard Interrupt!
Stopping test
Total inversion performed: 15570
Test Duration: 0 days, 0 hours, 0 minutes, 14 seconds
Is this the correct behaviour ? Or does it show a problem ?
thanks, regards
fred
Am Tuesday 21 August 2007 schrieben Sie:
Quoted 27 lines
Hi Remy !
thanks a lot, i will test it on a ARM-v4 with 2.6.23-rc2-rt2 and 2.6.21.5-rt20.
I have a application which makes a lot of pthread_mutex_lock/unlock between rt and non-rt tasks with PI. So i will look what happens.
thanks
fredAm Monday 20 August 2007 schrieben Sie:
Quoted 10 lines
Hello Manfred,
At http://www.spinics.net/lists/arm-kernel/msg42349.html you can find a patch that will probably work. Due to the lack of proper atomic instructions on the ARM-v4 core this patch is likely to be the best possible solution.
Kind Regards,
Remy
-
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello Manfred,
Quoted 3 lines
My question if I run the
pi_stress, my watchdog triggers, if watchdog is disabled i get this:
Is this the correct behaviour ? Or does it show a problem ?
Depends on the priority of your watchdog-feeder thread. If it is not running in RT mode, with a priority higher than used in the pi-stress test, then yes it is normal that the watchdog kicks in. pi-stress takes 100% CPU-load, and leaves no room for non-RT processes.
The output you get seems normal to me...
Remy
2007/9/4, Manfred Gruber <[email protected]>:
Quoted 61 lines
hi !
I have now run 2.6.23-rc4-rt1 on my arm920t with the
pi_stresstest programm from http://people.redhat.com/williams/testsMy question if I run the
pi_stress, my watchdog triggers, if watchdog is disabled i get this:Admin threads running on processor: 0 Test threads running on processor: 0 Starting PI Stress Test
Number of thread groups: 10
Number of inversions per group: infinite Test threads using scheduler policy:SCHED_FIFO
Admin thread priority: 4
10 groups of 3 threads will be createdHigh thread priority: 3 Med thread priority: 2 Low thread priority: 1Press Control-C to stop test Current Inversions: 15551
Keyboard Interrupt!Stopping test
Total inversion performed: 15570
Test Duration: 0 days, 0 hours, 0 minutes, 14 secondsIs this the correct behaviour ? Or does it show a problem ?
thanks, regards
fredAm Tuesday 21 August 2007 schrieben Sie:
Quoted 27 lines
Hi Remy !
thanks a lot, i will test it on a ARM-v4 with 2.6.23-rc2-rt2 and 2.6.21.5-rt20.
I have a application which makes a lot of pthread_mutex_lock/unlock between rt and non-rt tasks with PI. So i will look what happens.
thanks
fredAm Monday 20 August 2007 schrieben Sie:
Quoted 10 lines
Hello Manfred,
At http://www.spinics.net/lists/arm-kernel/msg42349.html you can find a patch that will probably work. Due to the lack of proper atomic instructions on the ARM-v4 core this patch is likely to be the best possible solution.
Kind Regards,
Remy
-
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
hi Remy !
Am Wednesday 05 September 2007 schrieben Sie:
Quoted 6 lines
Hello Manfred,
Quoted 3 lines
My question if I run the
pi_stress, my watchdog triggers, if watchdog is disabled i get this:
Is this the correct behaviour ? Or does it show a problem ?
Quoted 6 lines
Depends on the priority of your watchdog-feeder thread. If it is not running in RT mode, with a priority higher than used in the pi-stress test, then yes it is normal that the watchdog kicks in. pi-stress takes 100% CPU-load, and leaves no room for non-RT processes.
The output you get seems normal to me...
Ok, thanks.
The only difference between you patch and now 2.6.23-rc4-rt1 is that now a raw_ spinlock is used. So i think when using your patch on 2.6.21.5-rt20, because a customer has this kernel running, i have there also to use a raw_spinlock ?
thanks,
regards manfred
Hello Manfred,
Quoted 4 lines
The only difference between you patch and now 2.6.23-rc4-rt1 is that now a
raw_spinlock is used. So i think when using your patch on 2.6.21.5-rt20, because a customer has this kernel running, i have there also to use araw_spinlock?
The same patch applies to older kernels. Besides, I use this patch for a while now on 2.6.21 and 2.6.22, but with an interrupt lock instead of a spinlock. A raw_spinlock is better because it is safe in SMP also, so Ingo has the proper implementation in his patch, which you should follow. (Probably this is technically the best possible solution, given the limited amount of atomic-instructions on ARM-v4/v5)
So, A normal (non-raw) spinlock should NOT be used here, because that does would be converted to a rt-mutex, which is preemptible. If this code is preemptible, it could be preempted by another user space thread which could, in theory, modify the same piece of memory, and thus causing a race condition.
Notice that there have been raised questions about the interrupt lock while accessing user space memory in this code, it is considered as not-safe.
AFAIK the only situation where it is not-safe, is the case where the memory is not available in RAM, but e.g. somewhere in a swap space. If the memory has to be paged in, probably interrupts are needed. In my system things like this will never happen...
Maybe Ingo, Thomas or someone else can acknowledge (or trash) my opinion here?
Kind Regards,
Remy Bohmer
--
Quoted 5 lines · Remy Bohmer
So, A normal (non-raw) spinlock should NOT be used here, because that does would be converted to a rt-mutex, which is preemptible. If this code is preemptible, it could be preempted by another user space thread which could, in theory, modify the same piece of memory, and thus causing a race condition.
Are you talking about this code?
+ spin_lock(&futex_atomic_lock);
+
+ __asm__ __volatile__( "@futex_atomic_cmpxchg_inatomic \n"
+ "1: ldrt %0, [%3] \n" + " teq %0, %1 \n" + "2: streqt %2, [%3] \n" + "3: \n" + " .section __ex_table, \"a\" \n" + " .align 3 \n" + " .long 1b, 4f, 2b, 4f \n" + " .previous \n" + " .section .fixup,\"ax\" \n" + "4: mov %0, %4 \n" + " b 3b \n" + " .previous"
+ : "=&r" (val)
+ : "r" (oldval), "r" (newval), "r" (uaddr), "Ir" (-EFAULT)
+ : "cc");
+
+ spin_unlock(&futex_atomic_lock);
I don't quite remember ARM (been a few years since working with it), but this looks like the standard "load store-conditional", or is it simply a read/test/write? (I don't have a ARM book handy at the moment).
But I would ask, what would touch that memory without first taking the futex_atomic_lock? So I don't understand your issue of being preempted.
Quoted 8 lines
Notice that there have been raised questions about the interrupt lock while accessing user space memory in this code, it is considered as not-safe.
AFAIK the only situation where it is not-safe, is the case where the memory is not available in RAM, but e.g. somewhere in a swap space. If the memory has to be paged in, probably interrupts are needed. In my system things like this will never happen...
That's nice, but other systems might have that happen ;-)
But mainly, yes, the area can be swapped out, _or_ it may not have been allocated yet. Areas like the BSS section where variables are initialized to zero may not have memory allocated to them until something actually writes to it.
-- Steve
Hello Steven,
Thanks for your explanation, here are my answers:
Quoted 7 lines
Quoted 5 lines
So, A normal (non-raw) spinlock should NOT be used here, because that does would be converted to a rt-mutex, which is preemptible. If this code is preemptible, it could be preempted by another user space thread which could, in theory, modify the same piece of memory, and thus causing a race condition.
Are you talking about this code?
Yes!
Quoted 22 lines
(quoted diff) +20
-0+ spin_lock(&futex_atomic_lock); + + __asm__ __volatile__( "@futex_atomic_cmpxchg_inatomic \n" + "1: ldrt %0, [%3] \n" + " teq %0, %1 \n" + "2: streqt %2, [%3] \n" + "3: \n" + " .section __ex_table, \"a\" \n" + " .align 3 \n" + " .long 1b, 4f, 2b, 4f \n" + " .previous \n" + " .section .fixup,\"ax\" \n" + "4: mov %0, %4 \n" + " b 3b \n" + " .previous" + : "=&r" (val) + : "r" (oldval), "r" (newval), "r" (uaddr), "Ir" (-EFAULT) + : "cc"); + + spin_unlock(&futex_atomic_lock);
Quoted 3 lines
I don't quite remember ARM (been a few years since working with it), but this looks like the standard "load store-conditional", or is it simply a read/test/write? (I don't have a ARM book handy at the moment).
it is a read/test/write, or in other words a cmpxchg().
Quoted 3 lines
But I would ask, what would touch that memory without first taking the
futex_atomic_lock? So I don't understand your issue of being preempted.
AFAIK, it is user space memory, allocated in the context of a user space process.
If this memory location is modified outside this 'protected' section, like for example in some codepath in glibc also (e.g. futex slowpath implementation), then this implementation could be dangerous with a normal spinlock/rt-mutex.
Quoted 10 lines
Quoted 8 lines
Notice that there have been raised questions about the interrupt lock while accessing user space memory in this code, it is considered as not-safe.
AFAIK the only situation where it is not-safe, is the case where the memory is not available in RAM, but e.g. somewhere in a swap space. If the memory has to be paged in, probably interrupts are needed. In my system things like this will never happen...That's nice, but other systems might have that happen ;-)
And that is exactly the reason, why I have questions with this implementation...
Kind Regards,
Remy