there are two critical problems with spinlock in gpu driver:
1. spin_unlock is missing when pte_offset_map_lock return invalid pte pointer,
this will cause dead lock in stress case.
2. pte_unmap is missing in spinlock debug build, this will cause kernel panic,
which can be reproduced when enable CONFIG_DEBUG_SPINLOCK in kernel build.
Date: May 02, 2017
Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
)
{
#ifndef CONFIG_DEBUG_SPINLOCK
- spinlock_t *lock;
+ spinlock_t *lock = NULL;
#endif
gctUINTPTR_T logical = (gctUINTPTR_T)Logical;
pgd_t *pgd;
if (!pte)
{
+#ifndef CONFIG_DEBUG_SPINLOCK
+ if (lock)
+ {
+ spin_unlock(lock);
+ }
+#else
+ spin_unlock(¤t->mm->page_table_lock);
+#endif
return gcvSTATUS_NOT_FOUND;
}
#ifndef CONFIG_DEBUG_SPINLOCK
pte_unmap_unlock(pte, lock);
#else
+ pte_unmap(pte);
spin_unlock(¤t->mm->page_table_lock);
#endif
return gcvSTATUS_NOT_FOUND;
#ifndef CONFIG_DEBUG_SPINLOCK
pte_unmap_unlock(pte, lock);
#else
+ pte_unmap(pte);
spin_unlock(¤t->mm->page_table_lock);
#endif