From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Larmour To: Xavier Wang Cc: ecos-discuss@sources.redhat.com Subject: Re: [ECOS] nested interrupts Date: Thu, 18 Jan 2001 22:35:00 -0000 Message-id: <3A67E00D.89DD5CAF@redhat.com> References: <003b01c0811f$196395e0$6f2314ac@realtek.com.tw> <002f01c0814d$d618fa80$6f2314ac@realtek.com.tw> <00e101c081d2$c124bee0$6f2314ac@realtek.com.tw> X-SW-Source: 2001-01/msg00332.html Xavier Wang wrote: [snip] > Which step above does indeed make the kernel state safe to be called by DSRs? > > For example, an interrupt occurred while a thread is running in scheduler's critical > section. It's not safe to manipulate scheduler's data in ISR obviously, but it seems > also not safe to access scheduler's data in DSR since the interrupted thread still > doesn't finish its job to make the data consistent. Am I wrong here? DSRs are not called if the scheduler was already locked *before* the interrupt. So the running thread just gets restored in the return from the interrupt. It is the process of unlocking the scheduler, and specifically the scheduler lock transitioning from the 1 to 0 state that causes DSRs to run. The sequence of events you cited is a simplification. For detail at this level (after all, why do you need to know how - just know it is safe), Use The Source Luke. DSRs are called from Cyg_Scheduler::unlock_inner() in kernel/VERSION/src/sched/sched.cxx. Jifl -- Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062 Un cheval, pas du glue. Pas du cheval, beaucoup du glue. || Opinions==mine