On 22.01.2013 04:29, Jacky Lam wrote: > I have a kernel driver needed to do a indirect register access > to a hardware interface. In past, I use spinlock to protect > those code. After turning on PREEMPT_RT, the driver doesn't > work anymore. I'm not an expert but AFAIK the spinlock still does the protection, it just can be preempted. If your driver does not work, there is either a timing issue as well (i.e. you have time constraints that are not met when the spinlock is preempted) or there is a bug that is triggered by the preemption (such as unprotected access in the code that preempts your spinlock). > I know spinlock is now preemptible, but how can I protect a "really" > critical section in PREEMPT_RT? If it is a bad design, could give me > some tutorial/readings on how to modify my driver? https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO says Critical sections protected by i.e. spinlock_t and rwlock_t are now preemptible. The creation of non-preemptible sections (in kernel) is still possible with raw_spinlock_t (same APIs like spinlock_t) However, try to identify the real culprit first. -- Stano -- To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html