* bug in Real-Time Preemption
@ 2005-06-09 13:45 Milan Svoboda
2005-06-09 21:28 ` Esben Nielsen
0 siblings, 1 reply; 8+ messages in thread
From: Milan Svoboda @ 2005-06-09 13:45 UTC (permalink / raw)
To: linux-kernel
Hello all,
I have a test program which creates one thread with SCHED_RR and priority 50. This
thread creates another thread witch SCHED_RR and priority 10 and then waits some time
until it exits. Thread with priority of 10 only counts, it should be a cpu-hog and calls sched_yield.
Problem is that the parent thread (with priority 50) sleeps as long as the thread with priority 10 is
runnig when runnig on realtime-preempt-2.6.12-rc6-V0.7.48-01 with full preemption enabled.
I tested this program on 2.4.21-xxx and on 2.6.12-rc6 with realtime-preempt-2.6.12-rc6-V0.7.48-01 with RT preemption
disabled and results were as expected - parent thread sleeps shorter time then counting thread so program is
terminated before counting thread could finished it's work.
#include <pthread.h>
#include <unistd.h>
#include <sys/time.h>
void* thread(void *thread) {
int i;
while (i < 10000) {
sched_yield();
i++;
}
}
void* thread_main(void *arg) {
pthread_attr_t attr;
pthread_t p;
struct sched_param sch;
struct timeval tv1, tv2;
unsigned int dif;
pthread_attr_init(&attr);
pthread_attr_setschedpolicy(&attr, SCHED_RR);
sch.sched_priority = 10;
pthread_attr_setschedparam(&attr, &sch);
pthread_create(&p, &attr, thread, NULL);
pthread_attr_destroy(&attr);
gettimeofday(&tv1, NULL);
usleep(10000);
gettimeofday(&tv2, NULL);
dif = (tv2.tv_sec - tv1.tv_sec) * 1000000 + tv2.tv_usec - tv1.tv_usec;
printf("Dif: %d\n", dif);
exit(0);
}
int main(int argc, char** argv) {
pthread_attr_t attr;
pthread_t p;
struct sched_param sch;
pthread_attr_init(&attr);
pthread_attr_setschedpolicy(&attr, SCHED_RR);
sch.sched_priority = 50;
pthread_attr_setschedparam(&attr, &sch);
pthread_create(&p, &attr, thread_main, NULL);
pthread_attr_destroy(&attr);
while (1) {
sleep(500);
}
return 0;
}
Follows important parts from .config:
.config with RT preemption disabled
#
# General setup
#
CONFIG_LOCALVERSION=""
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_BSD_PROCESS_ACCT=y
# CONFIG_BSD_PROCESS_ACCT_V3 is not set
CONFIG_SYSCTL=y
# CONFIG_AUDIT is not set
CONFIG_HOTPLUG=y
CONFIG_KOBJECT_UEVENT=y
# CONFIG_IKCONFIG is not set
# CONFIG_EMBEDDED is not set
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
# CONFIG_KALLSYMS_EXTRA_PASS is not set
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y
CONFIG_SHMEM=y
CONFIG_CC_ALIGN_FUNCTIONS=0
CONFIG_CC_ALIGN_LABELS=0
CONFIG_CC_ALIGN_LOOPS=0
CONFIG_CC_ALIGN_JUMPS=0
# CONFIG_TINY_SHMEM is not set
CONFIG_BASE_SMALL=0
#
# Loadable module support
#
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
CONFIG_OBSOLETE_MODPARM=y
CONFIG_MODVERSIONS=y
# CONFIG_MODULE_SRCVERSION_ALL is not set
CONFIG_KMOD=y
#
# Processor type and features
#
CONFIG_X86_PC=y
# CONFIG_X86_ELAN is not set
# CONFIG_X86_VOYAGER is not set
# CONFIG_X86_NUMAQ is not set
# CONFIG_X86_SUMMIT is not set
# CONFIG_X86_BIGSMP is not set
# CONFIG_X86_VISWS is not set
# CONFIG_X86_GENERICARCH is not set
# CONFIG_X86_ES7000 is not set
# CONFIG_M386 is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
# CONFIG_M586MMX is not set
CONFIG_M686=y
# CONFIG_MPENTIUMII is not set
# CONFIG_MPENTIUMIII is not set
# CONFIG_MPENTIUMM is not set
# CONFIG_MPENTIUM4 is not set
# CONFIG_MK6 is not set
# CONFIG_MK7 is not set
# CONFIG_MK8 is not set
# CONFIG_MCRUSOE is not set
# CONFIG_MEFFICEON is not set
# CONFIG_MWINCHIPC6 is not set
# CONFIG_MWINCHIP2 is not set
# CONFIG_MWINCHIP3D is not set
# CONFIG_MGEODEGX1 is not set
# CONFIG_MCYRIXIII is not set
# CONFIG_MVIAC3_2 is not set
CONFIG_X86_GENERIC=y
CONFIG_X86_CMPXCHG=y
CONFIG_X86_XADD=y
CONFIG_X86_L1_CACHE_SHIFT=7
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_X86_PPRO_FENCE=y
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_BSWAP=y
CONFIG_X86_POPAD_OK=y
CONFIG_X86_GOOD_APIC=y
CONFIG_X86_INTEL_USERCOPY=y
CONFIG_X86_USE_PPRO_CHECKSUM=y
CONFIG_HPET_TIMER=y
CONFIG_HPET_EMULATE_RTC=y
# CONFIG_SMP is not set
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT_DESKTOP is not set
# CONFIG_PREEMPT_RT is not set
# CONFIG_PREEMPT_SOFTIRQS is not set
# CONFIG_PREEMPT_HARDIRQS is not set
# CONFIG_PREEMPT_BKL is not set
CONFIG_ASM_SEMAPHORES=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_X86_UP_APIC=y
CONFIG_X86_UP_IOAPIC=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
CONFIG_X86_TSC=y
CONFIG_X86_MCE=y
# CONFIG_X86_MCE_NONFATAL is not set
# CONFIG_X86_MCE_P4THERMAL is not set
# CONFIG_TOSHIBA is not set
# CONFIG_I8K is not set
# CONFIG_X86_REBOOTFIXUPS is not set
# CONFIG_MICROCODE is not set
# CONFIG_X86_MSR is not set
CONFIG_X86_CPUID=m
#
# Profiling support
#
CONFIG_PROFILING=y
CONFIG_OPROFILE=y
#
# Kernel hacking
#
CONFIG_PRINTK_TIME=y
CONFIG_DEBUG_KERNEL=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_LOG_BUF_SHIFT=15
CONFIG_SCHEDSTATS=y
# CONFIG_DEBUG_SLAB is not set
# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
CONFIG_WAKEUP_TIMING=y
CONFIG_CRITICAL_IRQSOFF_TIMING=y
CONFIG_CRITICAL_TIMING=y
CONFIG_LATENCY_TIMING=y
CONFIG_LATENCY_TRACE=y
CONFIG_MCOUNT=y
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_BUGVERBOSE=y
# CONFIG_DEBUG_INFO is not set
# CONFIG_DEBUG_FS is not set
CONFIG_FRAME_POINTER=y
CONFIG_EARLY_PRINTK=y
CONFIG_DEBUG_STACKOVERFLOW=y
CONFIG_KPROBES=y
CONFIG_DEBUG_STACK_USAGE=y
# CONFIG_DEBUG_PAGEALLOC is not set
# CONFIG_4KSTACKS is not set
CONFIG_X86_FIND_SMP_CONFIG=y
CONFIG_X86_MPPARSE=y
.config with RT preemption enabled
#
# General setup
#
CONFIG_LOCALVERSION=""
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_BSD_PROCESS_ACCT=y
# CONFIG_BSD_PROCESS_ACCT_V3 is not set
CONFIG_SYSCTL=y
# CONFIG_AUDIT is not set
CONFIG_HOTPLUG=y
CONFIG_KOBJECT_UEVENT=y
# CONFIG_IKCONFIG is not set
# CONFIG_EMBEDDED is not set
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
# CONFIG_KALLSYMS_EXTRA_PASS is not set
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y
CONFIG_SHMEM=y
CONFIG_CC_ALIGN_FUNCTIONS=0
CONFIG_CC_ALIGN_LABELS=0
CONFIG_CC_ALIGN_LOOPS=0
CONFIG_CC_ALIGN_JUMPS=0
# CONFIG_TINY_SHMEM is not set
CONFIG_BASE_SMALL=0
#
# Loadable module support
#
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
CONFIG_OBSOLETE_MODPARM=y
CONFIG_MODVERSIONS=y
# CONFIG_MODULE_SRCVERSION_ALL is not set
CONFIG_KMOD=y
#
# Processor type and features
#
CONFIG_X86_PC=y
# CONFIG_X86_ELAN is not set
# CONFIG_X86_VOYAGER is not set
# CONFIG_X86_NUMAQ is not set
# CONFIG_X86_SUMMIT is not set
# CONFIG_X86_BIGSMP is not set
# CONFIG_X86_VISWS is not set
# CONFIG_X86_GENERICARCH is not set
# CONFIG_X86_ES7000 is not set
# CONFIG_M386 is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
# CONFIG_M586MMX is not set
CONFIG_M686=y
# CONFIG_MPENTIUMII is not set
# CONFIG_MPENTIUMIII is not set
# CONFIG_MPENTIUMM is not set
# CONFIG_MPENTIUM4 is not set
# CONFIG_MK6 is not set
# CONFIG_MK7 is not set
# CONFIG_MK8 is not set
# CONFIG_MCRUSOE is not set
# CONFIG_MEFFICEON is not set
# CONFIG_MWINCHIPC6 is not set
# CONFIG_MWINCHIP2 is not set
# CONFIG_MWINCHIP3D is not set
# CONFIG_MGEODEGX1 is not set
# CONFIG_MCYRIXIII is not set
# CONFIG_MVIAC3_2 is not set
CONFIG_X86_GENERIC=y
CONFIG_X86_CMPXCHG=y
CONFIG_X86_XADD=y
CONFIG_X86_L1_CACHE_SHIFT=7
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_X86_PPRO_FENCE=y
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_BSWAP=y
CONFIG_X86_POPAD_OK=y
CONFIG_X86_GOOD_APIC=y
CONFIG_X86_INTEL_USERCOPY=y
CONFIG_X86_USE_PPRO_CHECKSUM=y
CONFIG_HPET_TIMER=y
CONFIG_HPET_EMULATE_RTC=y
# CONFIG_SMP is not set
# CONFIG_PREEMPT_NONE is not set
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT_DESKTOP is not set
CONFIG_PREEMPT_RT=y
CONFIG_PREEMPT=y
CONFIG_PREEMPT_SOFTIRQS=y
CONFIG_PREEMPT_HARDIRQS=y
CONFIG_PREEMPT_RCU=y
CONFIG_PREEMPT_BKL=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_ASM_SEMAPHORES=y
CONFIG_X86_UP_APIC=y
CONFIG_X86_UP_IOAPIC=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
CONFIG_X86_TSC=y
CONFIG_X86_MCE=y
# CONFIG_X86_MCE_NONFATAL is not set
# CONFIG_X86_MCE_P4THERMAL is not set
# CONFIG_TOSHIBA is not set
# CONFIG_I8K is not set
# CONFIG_X86_REBOOTFIXUPS is not set
# CONFIG_MICROCODE is not set
# CONFIG_X86_MSR is not set
CONFIG_X86_CPUID=m
#
# Profiling support
#
CONFIG_PROFILING=y
CONFIG_OPROFILE=y
#
# Kernel hacking
#
CONFIG_PRINTK_TIME=y
CONFIG_DEBUG_KERNEL=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_LOG_BUF_SHIFT=15
CONFIG_SCHEDSTATS=y
# CONFIG_DEBUG_SLAB is not set
CONFIG_DEBUG_PREEMPT=y
CONFIG_WAKEUP_TIMING=y
CONFIG_PREEMPT_TRACE=y
CONFIG_CRITICAL_PREEMPT_TIMING=y
CONFIG_CRITICAL_IRQSOFF_TIMING=y
CONFIG_CRITICAL_TIMING=y
CONFIG_LATENCY_TIMING=y
CONFIG_LATENCY_TRACE=y
CONFIG_MCOUNT=y
CONFIG_RT_DEADLOCK_DETECT=y
CONFIG_DEBUG_RT_LOCKING_MODE=y
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_BUGVERBOSE=y
# CONFIG_DEBUG_INFO is not set
# CONFIG_DEBUG_FS is not set
CONFIG_FRAME_POINTER=y
CONFIG_EARLY_PRINTK=y
CONFIG_DEBUG_STACKOVERFLOW=y
CONFIG_KPROBES=y
CONFIG_DEBUG_STACK_USAGE=y
# CONFIG_DEBUG_PAGEALLOC is not set
CONFIG_X86_MPPARSE=y
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: bug in Real-Time Preemption
2005-06-09 13:45 Milan Svoboda
@ 2005-06-09 21:28 ` Esben Nielsen
0 siblings, 0 replies; 8+ messages in thread
From: Esben Nielsen @ 2005-06-09 21:28 UTC (permalink / raw)
To: Milan Svoboda; +Cc: linux-kernel
I tried to your program: I couldn't make it fail under PREEMPT_RT. No
matter what the termination value for the while loop in the priority 10
thread I put in the priority 50 thread printed the same "Dif:".
I also put in a global variable, thread_done, which I set in the priority
10 thread after the loop and printed it out along with "Dif:". It was not
set. I also tried to add exit(1) at the end of the priority 10 thread...
I see no odd behaviour.
Esben
On Thu, 9 Jun 2005, Milan Svoboda wrote:
> Hello all,
>
> I have a test program which creates one thread with SCHED_RR and priority 50. This
> thread creates another thread witch SCHED_RR and priority 10 and then waits some time
> until it exits. Thread with priority of 10 only counts, it should be a cpu-hog and calls sched_yield.
>
> Problem is that the parent thread (with priority 50) sleeps as long as the thread with priority 10 is
> runnig when runnig on realtime-preempt-2.6.12-rc6-V0.7.48-01 with full preemption enabled.
>
> I tested this program on 2.4.21-xxx and on 2.6.12-rc6 with realtime-preempt-2.6.12-rc6-V0.7.48-01 with RT preemption
> disabled and results were as expected - parent thread sleeps shorter time then counting thread so program is
> terminated before counting thread could finished it's work.
>
> #include <pthread.h>
> #include <unistd.h>
> #include <sys/time.h>
>
> void* thread(void *thread) {
> int i;
>
> while (i < 10000) {
> sched_yield();
> i++;
> }
> }
>
> void* thread_main(void *arg) {
> pthread_attr_t attr;
> pthread_t p;
> struct sched_param sch;
> struct timeval tv1, tv2;
> unsigned int dif;
>
> pthread_attr_init(&attr);
> pthread_attr_setschedpolicy(&attr, SCHED_RR);
>
> sch.sched_priority = 10;
> pthread_attr_setschedparam(&attr, &sch);
> pthread_create(&p, &attr, thread, NULL);
> pthread_attr_destroy(&attr);
>
> gettimeofday(&tv1, NULL);
> usleep(10000);
> gettimeofday(&tv2, NULL);
>
> dif = (tv2.tv_sec - tv1.tv_sec) * 1000000 + tv2.tv_usec - tv1.tv_usec;
> printf("Dif: %d\n", dif);
>
> exit(0);
> }
>
> int main(int argc, char** argv) {
> pthread_attr_t attr;
> pthread_t p;
> struct sched_param sch;
>
> pthread_attr_init(&attr);
> pthread_attr_setschedpolicy(&attr, SCHED_RR);
>
> sch.sched_priority = 50;
> pthread_attr_setschedparam(&attr, &sch);
> pthread_create(&p, &attr, thread_main, NULL);
> pthread_attr_destroy(&attr);
>
> while (1) {
> sleep(500);
> }
>
> return 0;
> }
>
> Follows important parts from .config:
>
> .config with RT preemption disabled
>
> #
> # General setup
> #
> CONFIG_LOCALVERSION=""
> CONFIG_SWAP=y
> CONFIG_SYSVIPC=y
> CONFIG_POSIX_MQUEUE=y
> CONFIG_BSD_PROCESS_ACCT=y
> # CONFIG_BSD_PROCESS_ACCT_V3 is not set
> CONFIG_SYSCTL=y
> # CONFIG_AUDIT is not set
> CONFIG_HOTPLUG=y
> CONFIG_KOBJECT_UEVENT=y
> # CONFIG_IKCONFIG is not set
> # CONFIG_EMBEDDED is not set
> CONFIG_KALLSYMS=y
> CONFIG_KALLSYMS_ALL=y
> # CONFIG_KALLSYMS_EXTRA_PASS is not set
> CONFIG_PRINTK=y
> CONFIG_BUG=y
> CONFIG_BASE_FULL=y
> CONFIG_FUTEX=y
> CONFIG_EPOLL=y
> CONFIG_SHMEM=y
> CONFIG_CC_ALIGN_FUNCTIONS=0
> CONFIG_CC_ALIGN_LABELS=0
> CONFIG_CC_ALIGN_LOOPS=0
> CONFIG_CC_ALIGN_JUMPS=0
> # CONFIG_TINY_SHMEM is not set
> CONFIG_BASE_SMALL=0
>
> #
> # Loadable module support
> #
> CONFIG_MODULES=y
> CONFIG_MODULE_UNLOAD=y
> CONFIG_MODULE_FORCE_UNLOAD=y
> CONFIG_OBSOLETE_MODPARM=y
> CONFIG_MODVERSIONS=y
> # CONFIG_MODULE_SRCVERSION_ALL is not set
> CONFIG_KMOD=y
>
> #
> # Processor type and features
> #
> CONFIG_X86_PC=y
> # CONFIG_X86_ELAN is not set
> # CONFIG_X86_VOYAGER is not set
> # CONFIG_X86_NUMAQ is not set
> # CONFIG_X86_SUMMIT is not set
> # CONFIG_X86_BIGSMP is not set
> # CONFIG_X86_VISWS is not set
> # CONFIG_X86_GENERICARCH is not set
> # CONFIG_X86_ES7000 is not set
> # CONFIG_M386 is not set
> # CONFIG_M486 is not set
> # CONFIG_M586 is not set
> # CONFIG_M586TSC is not set
> # CONFIG_M586MMX is not set
> CONFIG_M686=y
> # CONFIG_MPENTIUMII is not set
> # CONFIG_MPENTIUMIII is not set
> # CONFIG_MPENTIUMM is not set
> # CONFIG_MPENTIUM4 is not set
> # CONFIG_MK6 is not set
> # CONFIG_MK7 is not set
> # CONFIG_MK8 is not set
> # CONFIG_MCRUSOE is not set
> # CONFIG_MEFFICEON is not set
> # CONFIG_MWINCHIPC6 is not set
> # CONFIG_MWINCHIP2 is not set
> # CONFIG_MWINCHIP3D is not set
> # CONFIG_MGEODEGX1 is not set
> # CONFIG_MCYRIXIII is not set
> # CONFIG_MVIAC3_2 is not set
> CONFIG_X86_GENERIC=y
> CONFIG_X86_CMPXCHG=y
> CONFIG_X86_XADD=y
> CONFIG_X86_L1_CACHE_SHIFT=7
> CONFIG_GENERIC_CALIBRATE_DELAY=y
> CONFIG_X86_PPRO_FENCE=y
> CONFIG_X86_WP_WORKS_OK=y
> CONFIG_X86_INVLPG=y
> CONFIG_X86_BSWAP=y
> CONFIG_X86_POPAD_OK=y
> CONFIG_X86_GOOD_APIC=y
> CONFIG_X86_INTEL_USERCOPY=y
> CONFIG_X86_USE_PPRO_CHECKSUM=y
> CONFIG_HPET_TIMER=y
> CONFIG_HPET_EMULATE_RTC=y
> # CONFIG_SMP is not set
> CONFIG_PREEMPT_NONE=y
> # CONFIG_PREEMPT_VOLUNTARY is not set
> # CONFIG_PREEMPT_DESKTOP is not set
> # CONFIG_PREEMPT_RT is not set
> # CONFIG_PREEMPT_SOFTIRQS is not set
> # CONFIG_PREEMPT_HARDIRQS is not set
> # CONFIG_PREEMPT_BKL is not set
> CONFIG_ASM_SEMAPHORES=y
> CONFIG_RWSEM_XCHGADD_ALGORITHM=y
> CONFIG_X86_UP_APIC=y
> CONFIG_X86_UP_IOAPIC=y
> CONFIG_X86_LOCAL_APIC=y
> CONFIG_X86_IO_APIC=y
> CONFIG_X86_TSC=y
> CONFIG_X86_MCE=y
> # CONFIG_X86_MCE_NONFATAL is not set
> # CONFIG_X86_MCE_P4THERMAL is not set
> # CONFIG_TOSHIBA is not set
> # CONFIG_I8K is not set
> # CONFIG_X86_REBOOTFIXUPS is not set
> # CONFIG_MICROCODE is not set
> # CONFIG_X86_MSR is not set
> CONFIG_X86_CPUID=m
>
> #
> # Profiling support
> #
> CONFIG_PROFILING=y
> CONFIG_OPROFILE=y
>
> #
> # Kernel hacking
> #
> CONFIG_PRINTK_TIME=y
> CONFIG_DEBUG_KERNEL=y
> CONFIG_MAGIC_SYSRQ=y
> CONFIG_LOG_BUF_SHIFT=15
> CONFIG_SCHEDSTATS=y
> # CONFIG_DEBUG_SLAB is not set
> # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
> CONFIG_WAKEUP_TIMING=y
> CONFIG_CRITICAL_IRQSOFF_TIMING=y
> CONFIG_CRITICAL_TIMING=y
> CONFIG_LATENCY_TIMING=y
> CONFIG_LATENCY_TRACE=y
> CONFIG_MCOUNT=y
> # CONFIG_DEBUG_KOBJECT is not set
> CONFIG_DEBUG_BUGVERBOSE=y
> # CONFIG_DEBUG_INFO is not set
> # CONFIG_DEBUG_FS is not set
> CONFIG_FRAME_POINTER=y
> CONFIG_EARLY_PRINTK=y
> CONFIG_DEBUG_STACKOVERFLOW=y
> CONFIG_KPROBES=y
> CONFIG_DEBUG_STACK_USAGE=y
> # CONFIG_DEBUG_PAGEALLOC is not set
> # CONFIG_4KSTACKS is not set
> CONFIG_X86_FIND_SMP_CONFIG=y
> CONFIG_X86_MPPARSE=y
>
> .config with RT preemption enabled
> #
> # General setup
> #
> CONFIG_LOCALVERSION=""
> CONFIG_SWAP=y
> CONFIG_SYSVIPC=y
> CONFIG_POSIX_MQUEUE=y
> CONFIG_BSD_PROCESS_ACCT=y
> # CONFIG_BSD_PROCESS_ACCT_V3 is not set
> CONFIG_SYSCTL=y
> # CONFIG_AUDIT is not set
> CONFIG_HOTPLUG=y
> CONFIG_KOBJECT_UEVENT=y
> # CONFIG_IKCONFIG is not set
> # CONFIG_EMBEDDED is not set
> CONFIG_KALLSYMS=y
> CONFIG_KALLSYMS_ALL=y
> # CONFIG_KALLSYMS_EXTRA_PASS is not set
> CONFIG_PRINTK=y
> CONFIG_BUG=y
> CONFIG_BASE_FULL=y
> CONFIG_FUTEX=y
> CONFIG_EPOLL=y
> CONFIG_SHMEM=y
> CONFIG_CC_ALIGN_FUNCTIONS=0
> CONFIG_CC_ALIGN_LABELS=0
> CONFIG_CC_ALIGN_LOOPS=0
> CONFIG_CC_ALIGN_JUMPS=0
> # CONFIG_TINY_SHMEM is not set
> CONFIG_BASE_SMALL=0
>
> #
> # Loadable module support
> #
> CONFIG_MODULES=y
> CONFIG_MODULE_UNLOAD=y
> CONFIG_MODULE_FORCE_UNLOAD=y
> CONFIG_OBSOLETE_MODPARM=y
> CONFIG_MODVERSIONS=y
> # CONFIG_MODULE_SRCVERSION_ALL is not set
> CONFIG_KMOD=y
>
> #
> # Processor type and features
> #
> CONFIG_X86_PC=y
> # CONFIG_X86_ELAN is not set
> # CONFIG_X86_VOYAGER is not set
> # CONFIG_X86_NUMAQ is not set
> # CONFIG_X86_SUMMIT is not set
> # CONFIG_X86_BIGSMP is not set
> # CONFIG_X86_VISWS is not set
> # CONFIG_X86_GENERICARCH is not set
> # CONFIG_X86_ES7000 is not set
> # CONFIG_M386 is not set
> # CONFIG_M486 is not set
> # CONFIG_M586 is not set
> # CONFIG_M586TSC is not set
> # CONFIG_M586MMX is not set
> CONFIG_M686=y
> # CONFIG_MPENTIUMII is not set
> # CONFIG_MPENTIUMIII is not set
> # CONFIG_MPENTIUMM is not set
> # CONFIG_MPENTIUM4 is not set
> # CONFIG_MK6 is not set
> # CONFIG_MK7 is not set
> # CONFIG_MK8 is not set
> # CONFIG_MCRUSOE is not set
> # CONFIG_MEFFICEON is not set
> # CONFIG_MWINCHIPC6 is not set
> # CONFIG_MWINCHIP2 is not set
> # CONFIG_MWINCHIP3D is not set
> # CONFIG_MGEODEGX1 is not set
> # CONFIG_MCYRIXIII is not set
> # CONFIG_MVIAC3_2 is not set
> CONFIG_X86_GENERIC=y
> CONFIG_X86_CMPXCHG=y
> CONFIG_X86_XADD=y
> CONFIG_X86_L1_CACHE_SHIFT=7
> CONFIG_GENERIC_CALIBRATE_DELAY=y
> CONFIG_X86_PPRO_FENCE=y
> CONFIG_X86_WP_WORKS_OK=y
> CONFIG_X86_INVLPG=y
> CONFIG_X86_BSWAP=y
> CONFIG_X86_POPAD_OK=y
> CONFIG_X86_GOOD_APIC=y
> CONFIG_X86_INTEL_USERCOPY=y
> CONFIG_X86_USE_PPRO_CHECKSUM=y
> CONFIG_HPET_TIMER=y
> CONFIG_HPET_EMULATE_RTC=y
> # CONFIG_SMP is not set
> # CONFIG_PREEMPT_NONE is not set
> # CONFIG_PREEMPT_VOLUNTARY is not set
> # CONFIG_PREEMPT_DESKTOP is not set
> CONFIG_PREEMPT_RT=y
> CONFIG_PREEMPT=y
> CONFIG_PREEMPT_SOFTIRQS=y
> CONFIG_PREEMPT_HARDIRQS=y
> CONFIG_PREEMPT_RCU=y
> CONFIG_PREEMPT_BKL=y
> CONFIG_RWSEM_GENERIC_SPINLOCK=y
> CONFIG_ASM_SEMAPHORES=y
> CONFIG_X86_UP_APIC=y
> CONFIG_X86_UP_IOAPIC=y
> CONFIG_X86_LOCAL_APIC=y
> CONFIG_X86_IO_APIC=y
> CONFIG_X86_TSC=y
> CONFIG_X86_MCE=y
> # CONFIG_X86_MCE_NONFATAL is not set
> # CONFIG_X86_MCE_P4THERMAL is not set
> # CONFIG_TOSHIBA is not set
> # CONFIG_I8K is not set
> # CONFIG_X86_REBOOTFIXUPS is not set
> # CONFIG_MICROCODE is not set
> # CONFIG_X86_MSR is not set
> CONFIG_X86_CPUID=m
>
> #
> # Profiling support
> #
> CONFIG_PROFILING=y
> CONFIG_OPROFILE=y
>
> #
> # Kernel hacking
> #
> CONFIG_PRINTK_TIME=y
> CONFIG_DEBUG_KERNEL=y
> CONFIG_MAGIC_SYSRQ=y
> CONFIG_LOG_BUF_SHIFT=15
> CONFIG_SCHEDSTATS=y
> # CONFIG_DEBUG_SLAB is not set
> CONFIG_DEBUG_PREEMPT=y
> CONFIG_WAKEUP_TIMING=y
> CONFIG_PREEMPT_TRACE=y
> CONFIG_CRITICAL_PREEMPT_TIMING=y
> CONFIG_CRITICAL_IRQSOFF_TIMING=y
> CONFIG_CRITICAL_TIMING=y
> CONFIG_LATENCY_TIMING=y
> CONFIG_LATENCY_TRACE=y
> CONFIG_MCOUNT=y
> CONFIG_RT_DEADLOCK_DETECT=y
> CONFIG_DEBUG_RT_LOCKING_MODE=y
> # CONFIG_DEBUG_KOBJECT is not set
> CONFIG_DEBUG_BUGVERBOSE=y
> # CONFIG_DEBUG_INFO is not set
> # CONFIG_DEBUG_FS is not set
> CONFIG_FRAME_POINTER=y
> CONFIG_EARLY_PRINTK=y
> CONFIG_DEBUG_STACKOVERFLOW=y
> CONFIG_KPROBES=y
> CONFIG_DEBUG_STACK_USAGE=y
> # CONFIG_DEBUG_PAGEALLOC is not set
> CONFIG_X86_MPPARSE=y
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: bug in Real-Time Preemption
@ 2005-06-10 7:18 Milan Svoboda
2005-06-10 7:46 ` Esben Nielsen
2005-06-10 7:52 ` Michal Schmidt
0 siblings, 2 replies; 8+ messages in thread
From: Milan Svoboda @ 2005-06-10 7:18 UTC (permalink / raw)
To: linux-kernel; +Cc: simlo
> I tried to your program: I couldn't make it fail under PREEMPT_RT. No
> matter what the termination value for the while loop in the priority 10
> thread I put in the priority 50 thread printed the same "Dif:".
> I also put in a global variable, thread_done, which I set in the priority
> 10 thread after the loop and printed it out along with "Dif:". It was not
> set. I also tried to add exit(1) at the end of the priority 10 thread...
>
> I see no odd behaviour.
>
> Esben
>
Look at my results:
I added a flag too.
under non RT preempt:
(these results are expected)
./a.out
Flag: 0, Dif:11714
./a.out
Flag: 0, Dif:11678
under full RT preempt:
./a.out
Flag: 1, Dif:582536
./a.out
Flag: 1, Dif:579791
This shows that thread with bigger priority was
blocked by the thread with lower priority!
Please, try it again with 'while (1) {' (or some
much bigger number) instead of original 'while (i < 10000) {'.
Thanks,
Milan
> On Thu, 9 Jun 2005, Milan Svoboda wrote:
>
> > Hello all,
> >
> > I have a test program which creates one thread with SCHED_RR and
> priority 50. This
> > thread creates another thread witch SCHED_RR and priority 10 and then
> waits some time
> > until it exits. Thread with priority of 10 only counts, it should be a
> cpu-hog and calls sched_yield.
> >
> > Problem is that the parent thread (with priority 50) sleeps as long as
> the thread with priority 10 is
> > runnig when runnig on realtime-preempt-2.6.12-rc6-V0.7.48-01 with full
> preemption enabled.
> >
> > I tested this program on 2.4.21-xxx and on 2.6.12-rc6 with
> realtime-preempt-2.6.12-rc6-V0.7.48-01 with RT preemption
> > disabled and results were as expected - parent thread sleeps shorter
> time then counting thread so program is
> > terminated before counting thread could finished it's work.
> >
> > #include <pthread.h>
> > #include <unistd.h>
> > #include <sys/time.h>
> >
> > void* thread(void *thread) {
> > int i;
> >
> > while (i < 10000) {
> > sched_yield();
> > i++;
> > }
> > }
> >
> > void* thread_main(void *arg) {
> > pthread_attr_t attr;
> > pthread_t p;
> > struct sched_param sch;
> > struct timeval tv1, tv2;
> > unsigned int dif;
> >
> > pthread_attr_init(&attr);
> > pthread_attr_setschedpolicy(&attr, SCHED_RR);
> >
> > sch.sched_priority = 10;
> > pthread_attr_setschedparam(&attr, &sch);
> > pthread_create(&p, &attr, thread, NULL);
> > pthread_attr_destroy(&attr);
> >
> > gettimeofday(&tv1, NULL);
> > usleep(10000);
> > gettimeofday(&tv2, NULL);
> >
> > dif = (tv2.tv_sec - tv1.tv_sec) * 1000000 + tv2.tv_usec - tv1.tv_usec;
> > printf("Dif: %d\n", dif);
> >
> > exit(0);
> > }
> >
> > int main(int argc, char** argv) {
> > pthread_attr_t attr;
> > pthread_t p;
> > struct sched_param sch;
> >
> > pthread_attr_init(&attr);
> > pthread_attr_setschedpolicy(&attr, SCHED_RR);
> >
> > sch.sched_priority = 50;
> > pthread_attr_setschedparam(&attr, &sch);
> > pthread_create(&p, &attr, thread_main, NULL);
> > pthread_attr_destroy(&attr);
> >
> > while (1) {
> > sleep(500);
> > }
> >
> > return 0;
> > }
> >
> > Follows important parts from .config:
> >
> > .config with RT preemption disabled
> >
> > #
> > # General setup
> > #
> > CONFIG_LOCALVERSION=""
> > CONFIG_SWAP=y
> > CONFIG_SYSVIPC=y
> > CONFIG_POSIX_MQUEUE=y
> > CONFIG_BSD_PROCESS_ACCT=y
> > # CONFIG_BSD_PROCESS_ACCT_V3 is not set
> > CONFIG_SYSCTL=y
> > # CONFIG_AUDIT is not set
> > CONFIG_HOTPLUG=y
> > CONFIG_KOBJECT_UEVENT=y
> > # CONFIG_IKCONFIG is not set
> > # CONFIG_EMBEDDED is not set
> > CONFIG_KALLSYMS=y
> > CONFIG_KALLSYMS_ALL=y
> > # CONFIG_KALLSYMS_EXTRA_PASS is not set
> > CONFIG_PRINTK=y
> > CONFIG_BUG=y
> > CONFIG_BASE_FULL=y
> > CONFIG_FUTEX=y
> > CONFIG_EPOLL=y
> > CONFIG_SHMEM=y
> > CONFIG_CC_ALIGN_FUNCTIONS=0
> > CONFIG_CC_ALIGN_LABELS=0
> > CONFIG_CC_ALIGN_LOOPS=0
> > CONFIG_CC_ALIGN_JUMPS=0
> > # CONFIG_TINY_SHMEM is not set
> > CONFIG_BASE_SMALL=0
> >
> > #
> > # Loadable module support
> > #
> > CONFIG_MODULES=y
> > CONFIG_MODULE_UNLOAD=y
> > CONFIG_MODULE_FORCE_UNLOAD=y
> > CONFIG_OBSOLETE_MODPARM=y
> > CONFIG_MODVERSIONS=y
> > # CONFIG_MODULE_SRCVERSION_ALL is not set
> > CONFIG_KMOD=y
> >
> > #
> > # Processor type and features
> > #
> > CONFIG_X86_PC=y
> > # CONFIG_X86_ELAN is not set
> > # CONFIG_X86_VOYAGER is not set
> > # CONFIG_X86_NUMAQ is not set
> > # CONFIG_X86_SUMMIT is not set
> > # CONFIG_X86_BIGSMP is not set
> > # CONFIG_X86_VISWS is not set
> > # CONFIG_X86_GENERICARCH is not set
> > # CONFIG_X86_ES7000 is not set
> > # CONFIG_M386 is not set
> > # CONFIG_M486 is not set
> > # CONFIG_M586 is not set
> > # CONFIG_M586TSC is not set
> > # CONFIG_M586MMX is not set
> > CONFIG_M686=y
> > # CONFIG_MPENTIUMII is not set
> > # CONFIG_MPENTIUMIII is not set
> > # CONFIG_MPENTIUMM is not set
> > # CONFIG_MPENTIUM4 is not set
> > # CONFIG_MK6 is not set
> > # CONFIG_MK7 is not set
> > # CONFIG_MK8 is not set
> > # CONFIG_MCRUSOE is not set
> > # CONFIG_MEFFICEON is not set
> > # CONFIG_MWINCHIPC6 is not set
> > # CONFIG_MWINCHIP2 is not set
> > # CONFIG_MWINCHIP3D is not set
> > # CONFIG_MGEODEGX1 is not set
> > # CONFIG_MCYRIXIII is not set
> > # CONFIG_MVIAC3_2 is not set
> > CONFIG_X86_GENERIC=y
> > CONFIG_X86_CMPXCHG=y
> > CONFIG_X86_XADD=y
> > CONFIG_X86_L1_CACHE_SHIFT=7
> > CONFIG_GENERIC_CALIBRATE_DELAY=y
> > CONFIG_X86_PPRO_FENCE=y
> > CONFIG_X86_WP_WORKS_OK=y
> > CONFIG_X86_INVLPG=y
> > CONFIG_X86_BSWAP=y
> > CONFIG_X86_POPAD_OK=y
> > CONFIG_X86_GOOD_APIC=y
> > CONFIG_X86_INTEL_USERCOPY=y
> > CONFIG_X86_USE_PPRO_CHECKSUM=y
> > CONFIG_HPET_TIMER=y
> > CONFIG_HPET_EMULATE_RTC=y
> > # CONFIG_SMP is not set
> > CONFIG_PREEMPT_NONE=y
> > # CONFIG_PREEMPT_VOLUNTARY is not set
> > # CONFIG_PREEMPT_DESKTOP is not set
> > # CONFIG_PREEMPT_RT is not set
> > # CONFIG_PREEMPT_SOFTIRQS is not set
> > # CONFIG_PREEMPT_HARDIRQS is not set
> > # CONFIG_PREEMPT_BKL is not set
> > CONFIG_ASM_SEMAPHORES=y
> > CONFIG_RWSEM_XCHGADD_ALGORITHM=y
> > CONFIG_X86_UP_APIC=y
> > CONFIG_X86_UP_IOAPIC=y
> > CONFIG_X86_LOCAL_APIC=y
> > CONFIG_X86_IO_APIC=y
> > CONFIG_X86_TSC=y
> > CONFIG_X86_MCE=y
> > # CONFIG_X86_MCE_NONFATAL is not set
> > # CONFIG_X86_MCE_P4THERMAL is not set
> > # CONFIG_TOSHIBA is not set
> > # CONFIG_I8K is not set
> > # CONFIG_X86_REBOOTFIXUPS is not set
> > # CONFIG_MICROCODE is not set
> > # CONFIG_X86_MSR is not set
> > CONFIG_X86_CPUID=m
> >
> > #
> > # Profiling support
> > #
> > CONFIG_PROFILING=y
> > CONFIG_OPROFILE=y
> >
> > #
> > # Kernel hacking
> > #
> > CONFIG_PRINTK_TIME=y
> > CONFIG_DEBUG_KERNEL=y
> > CONFIG_MAGIC_SYSRQ=y
> > CONFIG_LOG_BUF_SHIFT=15
> > CONFIG_SCHEDSTATS=y
> > # CONFIG_DEBUG_SLAB is not set
> > # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
> > CONFIG_WAKEUP_TIMING=y
> > CONFIG_CRITICAL_IRQSOFF_TIMING=y
> > CONFIG_CRITICAL_TIMING=y
> > CONFIG_LATENCY_TIMING=y
> > CONFIG_LATENCY_TRACE=y
> > CONFIG_MCOUNT=y
> > # CONFIG_DEBUG_KOBJECT is not set
> > CONFIG_DEBUG_BUGVERBOSE=y
> > # CONFIG_DEBUG_INFO is not set
> > # CONFIG_DEBUG_FS is not set
> > CONFIG_FRAME_POINTER=y
> > CONFIG_EARLY_PRINTK=y
> > CONFIG_DEBUG_STACKOVERFLOW=y
> > CONFIG_KPROBES=y
> > CONFIG_DEBUG_STACK_USAGE=y
> > # CONFIG_DEBUG_PAGEALLOC is not set
> > # CONFIG_4KSTACKS is not set
> > CONFIG_X86_FIND_SMP_CONFIG=y
> > CONFIG_X86_MPPARSE=y
> >
> > .config with RT preemption enabled
> > #
> > # General setup
> > #
> > CONFIG_LOCALVERSION=""
> > CONFIG_SWAP=y
> > CONFIG_SYSVIPC=y
> > CONFIG_POSIX_MQUEUE=y
> > CONFIG_BSD_PROCESS_ACCT=y
> > # CONFIG_BSD_PROCESS_ACCT_V3 is not set
> > CONFIG_SYSCTL=y
> > # CONFIG_AUDIT is not set
> > CONFIG_HOTPLUG=y
> > CONFIG_KOBJECT_UEVENT=y
> > # CONFIG_IKCONFIG is not set
> > # CONFIG_EMBEDDED is not set
> > CONFIG_KALLSYMS=y
> > CONFIG_KALLSYMS_ALL=y
> > # CONFIG_KALLSYMS_EXTRA_PASS is not set
> > CONFIG_PRINTK=y
> > CONFIG_BUG=y
> > CONFIG_BASE_FULL=y
> > CONFIG_FUTEX=y
> > CONFIG_EPOLL=y
> > CONFIG_SHMEM=y
> > CONFIG_CC_ALIGN_FUNCTIONS=0
> > CONFIG_CC_ALIGN_LABELS=0
> > CONFIG_CC_ALIGN_LOOPS=0
> > CONFIG_CC_ALIGN_JUMPS=0
> > # CONFIG_TINY_SHMEM is not set
> > CONFIG_BASE_SMALL=0
> >
> > #
> > # Loadable module support
> > #
> > CONFIG_MODULES=y
> > CONFIG_MODULE_UNLOAD=y
> > CONFIG_MODULE_FORCE_UNLOAD=y
> > CONFIG_OBSOLETE_MODPARM=y
> > CONFIG_MODVERSIONS=y
> > # CONFIG_MODULE_SRCVERSION_ALL is not set
> > CONFIG_KMOD=y
> >
> > #
> > # Processor type and features
> > #
> > CONFIG_X86_PC=y
> > # CONFIG_X86_ELAN is not set
> > # CONFIG_X86_VOYAGER is not set
> > # CONFIG_X86_NUMAQ is not set
> > # CONFIG_X86_SUMMIT is not set
> > # CONFIG_X86_BIGSMP is not set
> > # CONFIG_X86_VISWS is not set
> > # CONFIG_X86_GENERICARCH is not set
> > # CONFIG_X86_ES7000 is not set
> > # CONFIG_M386 is not set
> > # CONFIG_M486 is not set
> > # CONFIG_M586 is not set
> > # CONFIG_M586TSC is not set
> > # CONFIG_M586MMX is not set
> > CONFIG_M686=y
> > # CONFIG_MPENTIUMII is not set
> > # CONFIG_MPENTIUMIII is not set
> > # CONFIG_MPENTIUMM is not set
> > # CONFIG_MPENTIUM4 is not set
> > # CONFIG_MK6 is not set
> > # CONFIG_MK7 is not set
> > # CONFIG_MK8 is not set
> > # CONFIG_MCRUSOE is not set
> > # CONFIG_MEFFICEON is not set
> > # CONFIG_MWINCHIPC6 is not set
> > # CONFIG_MWINCHIP2 is not set
> > # CONFIG_MWINCHIP3D is not set
> > # CONFIG_MGEODEGX1 is not set
> > # CONFIG_MCYRIXIII is not set
> > # CONFIG_MVIAC3_2 is not set
> > CONFIG_X86_GENERIC=y
> > CONFIG_X86_CMPXCHG=y
> > CONFIG_X86_XADD=y
> > CONFIG_X86_L1_CACHE_SHIFT=7
> > CONFIG_GENERIC_CALIBRATE_DELAY=y
> > CONFIG_X86_PPRO_FENCE=y
> > CONFIG_X86_WP_WORKS_OK=y
> > CONFIG_X86_INVLPG=y
> > CONFIG_X86_BSWAP=y
> > CONFIG_X86_POPAD_OK=y
> > CONFIG_X86_GOOD_APIC=y
> > CONFIG_X86_INTEL_USERCOPY=y
> > CONFIG_X86_USE_PPRO_CHECKSUM=y
> > CONFIG_HPET_TIMER=y
> > CONFIG_HPET_EMULATE_RTC=y
> > # CONFIG_SMP is not set
> > # CONFIG_PREEMPT_NONE is not set
> > # CONFIG_PREEMPT_VOLUNTARY is not set
> > # CONFIG_PREEMPT_DESKTOP is not set
> > CONFIG_PREEMPT_RT=y
> > CONFIG_PREEMPT=y
> > CONFIG_PREEMPT_SOFTIRQS=y
> > CONFIG_PREEMPT_HARDIRQS=y
> > CONFIG_PREEMPT_RCU=y
> > CONFIG_PREEMPT_BKL=y
> > CONFIG_RWSEM_GENERIC_SPINLOCK=y
> > CONFIG_ASM_SEMAPHORES=y
> > CONFIG_X86_UP_APIC=y
> > CONFIG_X86_UP_IOAPIC=y
> > CONFIG_X86_LOCAL_APIC=y
> > CONFIG_X86_IO_APIC=y
> > CONFIG_X86_TSC=y
> > CONFIG_X86_MCE=y
> > # CONFIG_X86_MCE_NONFATAL is not set
> > # CONFIG_X86_MCE_P4THERMAL is not set
> > # CONFIG_TOSHIBA is not set
> > # CONFIG_I8K is not set
> > # CONFIG_X86_REBOOTFIXUPS is not set
> > # CONFIG_MICROCODE is not set
> > # CONFIG_X86_MSR is not set
> > CONFIG_X86_CPUID=m
> >
> > #
> > # Profiling support
> > #
> > CONFIG_PROFILING=y
> > CONFIG_OPROFILE=y
> >
> > #
> > # Kernel hacking
> > #
> > CONFIG_PRINTK_TIME=y
> > CONFIG_DEBUG_KERNEL=y
> > CONFIG_MAGIC_SYSRQ=y
> > CONFIG_LOG_BUF_SHIFT=15
> > CONFIG_SCHEDSTATS=y
> > # CONFIG_DEBUG_SLAB is not set
> > CONFIG_DEBUG_PREEMPT=y
> > CONFIG_WAKEUP_TIMING=y
> > CONFIG_PREEMPT_TRACE=y
> > CONFIG_CRITICAL_PREEMPT_TIMING=y
> > CONFIG_CRITICAL_IRQSOFF_TIMING=y
> > CONFIG_CRITICAL_TIMING=y
> > CONFIG_LATENCY_TIMING=y
> > CONFIG_LATENCY_TRACE=y
> > CONFIG_MCOUNT=y
> > CONFIG_RT_DEADLOCK_DETECT=y
> > CONFIG_DEBUG_RT_LOCKING_MODE=y
> > # CONFIG_DEBUG_KOBJECT is not set
> > CONFIG_DEBUG_BUGVERBOSE=y
> > # CONFIG_DEBUG_INFO is not set
> > # CONFIG_DEBUG_FS is not set
> > CONFIG_FRAME_POINTER=y
> > CONFIG_EARLY_PRINTK=y
> > CONFIG_DEBUG_STACKOVERFLOW=y
> > CONFIG_KPROBES=y
> > CONFIG_DEBUG_STACK_USAGE=y
> > # CONFIG_DEBUG_PAGEALLOC is not set
> > CONFIG_X86_MPPARSE=y
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel"
> in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/
> >
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: bug in Real-Time Preemption
@ 2005-06-10 7:45 Milan Svoboda
0 siblings, 0 replies; 8+ messages in thread
From: Milan Svoboda @ 2005-06-10 7:45 UTC (permalink / raw)
To: simlo; +Cc: linux-kernel
> Please, try it again with 'while (1) {' (or some
> much bigger number) instead of original 'while (i < 10000) {'.
Ignore this sentence please.
Milan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: bug in Real-Time Preemption
2005-06-10 7:18 Milan Svoboda
@ 2005-06-10 7:46 ` Esben Nielsen
2005-06-10 7:52 ` Michal Schmidt
1 sibling, 0 replies; 8+ messages in thread
From: Esben Nielsen @ 2005-06-10 7:46 UTC (permalink / raw)
To: Milan Svoboda; +Cc: linux-kernel
On Fri, 10 Jun 2005, Milan Svoboda wrote:
> > I tried to your program: I couldn't make it fail under PREEMPT_RT. No
> > matter what the termination value for the while loop in the priority 10
> > thread I put in the priority 50 thread printed the same "Dif:".
> > I also put in a global variable, thread_done, which I set in the priority
> > 10 thread after the loop and printed it out along with "Dif:". It was not
> > set. I also tried to add exit(1) at the end of the priority 10 thread...
> >
> > I see no odd behaviour.
> >
> > Esben
> >
>
> Look at my results:
>
> I added a flag too.
>
> under non RT preempt:
> (these results are expected)
>
> ./a.out
> Flag: 0, Dif:11714
> ./a.out
> Flag: 0, Dif:11678
>
(Flag:0 means the counting thread haven't finished, right?)
This is what I see on PREEMPT_RT 2.6.12-rc6-V0.7.48-04.
> under full RT preempt:
> ./a.out
> Flag: 1, Dif:582536
> ./a.out
> Flag: 1, Dif:579791
>
> This shows that thread with bigger priority was
> blocked by the thread with lower priority!
>
Yes. Odd. Tried on V0.7.48-04 ?
Esben
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: bug in Real-Time Preemption
@ 2005-06-10 7:47 Milan Svoboda
0 siblings, 0 replies; 8+ messages in thread
From: Milan Svoboda @ 2005-06-10 7:47 UTC (permalink / raw)
To: simlo; +Cc: linux-kernel
> Please, try it again with 'while (1) {' (or some
> much bigger number) instead of original 'while (i < 10000) {'.
Ignore this sentence please.
It's good to know that it works and it's only my
local problem. Althrought I totally don't know where to
find.
Milan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: bug in Real-Time Preemption
2005-06-10 7:18 Milan Svoboda
2005-06-10 7:46 ` Esben Nielsen
@ 2005-06-10 7:52 ` Michal Schmidt
1 sibling, 0 replies; 8+ messages in thread
From: Michal Schmidt @ 2005-06-10 7:52 UTC (permalink / raw)
To: Milan Svoboda; +Cc: linux-kernel, simlo
[-- Attachment #1: Type: text/plain, Size: 397 bytes --]
Milan Svoboda wrote:
> under non RT preempt:
> (these results are expected)
>
> ./a.out
> Flag: 0, Dif:11714
> ./a.out
> Flag: 0, Dif:11678
>
> under full RT preempt:
> ./a.out
> Flag: 1, Dif:582536
> ./a.out
> Flag: 1, Dif:579791
>
> This shows that thread with bigger priority was
> blocked by the thread with lower priority!
Can you retry with RT-V0.7.48-05 and this patch applied?
Michal
[-- Attachment #2: rt-fix-delayed-preemption-lags2.diff --]
[-- Type: text/plain, Size: 867 bytes --]
diff -Nurp -X linux-RT/Documentation/dontdiff linux-RT/kernel/sched.c linux-RT.mich/kernel/sched.c
--- linux-RT/kernel/sched.c 2005-06-09 23:09:43.000000000 +0200
+++ linux-RT.mich/kernel/sched.c 2005-06-09 23:29:20.000000000 +0200
@@ -1190,18 +1190,14 @@ out_activate:
* this cpu. Delayed preemption is guaranteed to happen upon
* return to userspace.
*/
- if (cpu != this_cpu) {
+ if (!sync || cpu != this_cpu) {
activate_task(p, rq, cpu == this_cpu);
if (TASK_PREEMPTS_CURR(p, rq))
resched_task(rq->curr);
} else {
__activate_task(p, rq);
- if (TASK_PREEMPTS_CURR(p, rq)) {
- if (sync)
- set_tsk_need_resched_delayed(rq->curr);
- else
- resched_task(rq->curr);
- }
+ if (TASK_PREEMPTS_CURR(p, rq))
+ set_tsk_need_resched_delayed(rq->curr);
}
trace_start_sched_wakeup(p, rq);
if (rq->curr && p && rq && _need_resched())
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: bug in Real-Time Preemption
@ 2005-06-10 9:50 Milan Svoboda
0 siblings, 0 replies; 8+ messages in thread
From: Milan Svoboda @ 2005-06-10 9:50 UTC (permalink / raw)
To: xschmi00; +Cc: linux-kernel
> Milan Svoboda wrote:
> > under non RT preempt:
> > (these results are expected)
> > > ./a.out
> > Flag: 0, Dif:11714
> > ./a.out
> > Flag: 0, Dif:11678
> > > under full RT preempt:
> > ./a.out
> > Flag: 1, Dif:582536
> > ./a.out
> > Flag: 1, Dif:579791
> > > This shows that thread with bigger priority was
> > blocked by the thread with lower priority!
>
> Can you retry with RT-V0.7.48-05 and this patch applied?
>
> Michal
>
I didn't help. Results are the same.
./a.out
Flag: 1, Dif: 598910
uname -a
Linux 2.6.12-rc6-RT-V0.7.48-05 #4 Fri Jun 10 11:26:38 CEST 2005 i686 i686 i386 GNU/Linux
BTW: I cannot compile this version with RT disabled:
-rc6-RT-V0.7.48-05
CC lib/radix-tree.o
CC lib/rbtree.o
CC lib/rwsem.o
lib/rwsem.c: In function `__rwsem_do_wake':
lib/rwsem.c:57: warning: implicit declaration of function `rwsem_atomic_update'
lib/rwsem.c:57: error: `RWSEM_ACTIVE_BIAS' undeclared (first use in this function)
lib/rwsem.c:57: error: (Each undeclared identifier is reported only once
lib/rwsem.c:57: error: for each function it appears in.)
lib/rwsem.c:59: error: `RWSEM_ACTIVE_MASK' undeclared (first use in this function)
lib/rwsem.c:62: error: structure has no member named `wait_list'
lib/rwsem.c:85: error: structure has no member named `wait_list'
lib/rwsem.c:99: error: structure has no member named `wait_list'
lib/rwsem.c:108: error: `RWSEM_WAITING_BIAS' undeclared (first use in this function)
lib/rwsem.c:113: warning: implicit declaration of function `rwsem_atomic_add'
lib/rwsem.c:115: error: structure has no member named `wait_list'
lib/rwsem.c:126: error: structure has no member named `wait_list'
lib/rwsem.c:127: error: structure has no member named `wait_list'
lib/rwsem.c: In function `rwsem_down_failed_common':
lib/rwsem.c:153: error: structure has no member named `wait_lock'
lib/rwsem.c:153: warning: type defaults to `int' in declaration of `type name'
lib/rwsem.c:153: error: structure has no member named `wait_lock'
lib/rwsem.c:153: error: structure has no member named `wait_lock'
lib/rwsem.c:153: warning: type defaults to `int' in declaration of `type name'
lib/rwsem.c:153: error: structure has no member named `wait_lock'
lib/rwsem.c:157: error: structure has no member named `wait_list'
lib/rwsem.c:163: error: `RWSEM_ACTIVE_MASK' undeclared (first use in this function)
lib/rwsem.c:166: error: structure has no member named `wait_lock'
lib/rwsem.c:166: warning: type defaults to `int' in declaration of `type name'
lib/rwsem.c:166: error: structure has no member named `wait_lock'
lib/rwsem.c:166: error: structure has no member named `wait_lock'
lib/rwsem.c:166: warning: type defaults to `int' in declaration of `type name'
lib/rwsem.c:166: error: structure has no member named `wait_lock'
lib/rwsem.c: In function `rwsem_down_read_failed':
lib/rwsem.c:193: error: `RWSEM_WAITING_BIAS' undeclared (first use in this function)
lib/rwsem.c:193: error: `RWSEM_ACTIVE_BIAS' undeclared (first use in this function)
lib/rwsem.c: In function `rwsem_down_write_failed':
lib/rwsem.c:210: error: `RWSEM_ACTIVE_BIAS' undeclared (first use in this function)
lib/rwsem.c: In function `rwsem_wake':
lib/rwsem.c:226: error: structure has no member named `wait_lock'
lib/rwsem.c:226: warning: type defaults to `int' in declaration of `type name'
lib/rwsem.c:226: error: structure has no member named `wait_lock'
lib/rwsem.c:226: error: structure has no member named `wait_lock'
lib/rwsem.c:226: warning: type defaults to `int' in declaration of `type name'
lib/rwsem.c:226: error: structure has no member named `wait_lock'
lib/rwsem.c:229: error: structure has no member named `wait_list'
lib/rwsem.c:232: error: structure has no member named `wait_lock'
lib/rwsem.c:232: warning: type defaults to `int' in declaration of `type name'
lib/rwsem.c:232: error: structure has no member named `wait_lock'
lib/rwsem.c:232: error: structure has no member named `wait_lock'
lib/rwsem.c:232: warning: type defaults to `int' in declaration of `type name'
lib/rwsem.c:232: error: structure has no member named `wait_lock'
lib/rwsem.c: In function `rwsem_downgrade_wake':
lib/rwsem.c:250: error: structure has no member named `wait_lock'
lib/rwsem.c:250: warning: type defaults to `int' in declaration of `type name'
lib/rwsem.c:250: error: structure has no member named `wait_lock'
lib/rwsem.c:250: error: structure has no member named `wait_lock'
lib/rwsem.c:250: warning: type defaults to `int' in declaration of `type name'
lib/rwsem.c:250: error: structure has no member named `wait_lock'
lib/rwsem.c:253: error: structure has no member named `wait_list'
lib/rwsem.c:256: error: structure has no member named `wait_lock'
lib/rwsem.c:256: warning: type defaults to `int' in declaration of `type name'
lib/rwsem.c:256: error: structure has no member named `wait_lock'
lib/rwsem.c:256: error: structure has no member named `wait_lock'
lib/rwsem.c:256: warning: type defaults to `int' in declaration of `type name'
lib/rwsem.c:256: error: structure has no member named `wait_lock'
make[1]: *** [lib/rwsem.o] Error 1
Relevant .config:
#
# Processor type and features
#
CONFIG_X86_PC=y
# CONFIG_X86_ELAN is not set
# CONFIG_X86_VOYAGER is not set
# CONFIG_X86_NUMAQ is not set
# CONFIG_X86_SUMMIT is not set
# CONFIG_X86_BIGSMP is not set
# CONFIG_X86_VISWS is not set
# CONFIG_X86_GENERICARCH is not set
# CONFIG_X86_ES7000 is not set
# CONFIG_M386 is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
# CONFIG_M586MMX is not set
CONFIG_M686=y
# CONFIG_MPENTIUMII is not set
# CONFIG_MPENTIUMIII is not set
# CONFIG_MPENTIUMM is not set
# CONFIG_MPENTIUM4 is not set
# CONFIG_MK6 is not set
# CONFIG_MK7 is not set
# CONFIG_MK8 is not set
# CONFIG_MCRUSOE is not set
# CONFIG_MEFFICEON is not set
# CONFIG_MWINCHIPC6 is not set
# CONFIG_MWINCHIP2 is not set
# CONFIG_MWINCHIP3D is not set
# CONFIG_MGEODEGX1 is not set
# CONFIG_MCYRIXIII is not set
# CONFIG_MVIAC3_2 is not set
CONFIG_X86_GENERIC=y
CONFIG_X86_CMPXCHG=y
CONFIG_X86_XADD=y
CONFIG_X86_L1_CACHE_SHIFT=7
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_X86_PPRO_FENCE=y
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_BSWAP=y
CONFIG_X86_POPAD_OK=y
CONFIG_X86_GOOD_APIC=y
CONFIG_X86_INTEL_USERCOPY=y
CONFIG_X86_USE_PPRO_CHECKSUM=y
CONFIG_HPET_TIMER=y
CONFIG_HPET_EMULATE_RTC=y
# CONFIG_SMP is not set
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT_DESKTOP is not set
# CONFIG_PREEMPT_RT is not set
# CONFIG_PREEMPT_SOFTIRQS is not set
# CONFIG_PREEMPT_HARDIRQS is not set
# CONFIG_PREEMPT_BKL is not set
CONFIG_ASM_SEMAPHORES=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_X86_UP_APIC=y
CONFIG_X86_UP_IOAPIC=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
CONFIG_X86_TSC=y
CONFIG_X86_MCE=y
# CONFIG_X86_MCE_NONFATAL is not set
# CONFIG_X86_MCE_P4THERMAL is not set
# CONFIG_TOSHIBA is not set
# CONFIG_I8K is not set
# CONFIG_X86_REBOOTFIXUPS is not set
# CONFIG_MICROCODE is not set
# CONFIG_X86_MSR is not set
CONFIG_X86_CPUID=m
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-06-10 9:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-10 7:45 bug in Real-Time Preemption Milan Svoboda
-- strict thread matches above, loose matches on Subject: below --
2005-06-10 9:50 Milan Svoboda
2005-06-10 7:47 Milan Svoboda
2005-06-10 7:18 Milan Svoboda
2005-06-10 7:46 ` Esben Nielsen
2005-06-10 7:52 ` Michal Schmidt
2005-06-09 13:45 Milan Svoboda
2005-06-09 21:28 ` Esben Nielsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox