mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-10 10:05:19 +07:00
![]() The memory barrier is not enough to protect queuing works into a destroyed cq kthread. Just imagine the following situation: CPU1 CPU2 rvt_cq_enter() worker = cq->rdi->worker; rvt_cq_exit() rdi->worker = NULL; smp_wmb(); kthread_flush_worker(worker); kthread_stop(worker->task); kfree(worker); // nothing queued yet => // nothing flushed and // happily stopped and freed if (likely(worker)) { // true => read before CPU2 acted cq->notify = RVT_CQ_NONE; cq->triggered++; kthread_queue_work(worker, &cq->comptask); BANG: worker has been flushed/stopped/freed in the meantime. This patch solves this by protecting the critical sections by rdi->n_cqs_lock. It seems that this lock is not much contended and looks reasonable for this purpose. One catch is that rvt_cq_enter() might be called from IRQ context. Therefore we must always take the lock with IRQs disabled to avoid a possible deadlock. Signed-off-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Doug Ledford <dledford@redhat.com> |
||
---|---|---|
.. | ||
ah.c | ||
ah.h | ||
cq.c | ||
cq.h | ||
dma.c | ||
dma.h | ||
Kconfig | ||
mad.c | ||
mad.h | ||
Makefile | ||
mcast.c | ||
mcast.h | ||
mmap.c | ||
mmap.h | ||
mr.c | ||
mr.h | ||
pd.c | ||
pd.h | ||
qp.c | ||
qp.h | ||
srq.c | ||
srq.h | ||
trace_mr.h | ||
trace_qp.h | ||
trace_rvt.h | ||
trace_tx.h | ||
trace.c | ||
trace.h | ||
vt.c | ||
vt.h |