From 963cd6f9b0a13aa570cdf831eac05acc3398a3ec Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 17 May 2013 09:58:43 +0200 Subject: [PATCH 02/18] smp: don't warn about csd->flags having CSD_FLAG_LOCK cleared for !wait blk-mq reuses the request potentially immediately, since the most cache hot is always given out first. This means that rq->csd could be reused between csd->func() being called and csd_unlock() being called. This isn't a problem, since we never use wait == 1 for the smp call function. Add CSD_FLAG_WAIT to be able to tell the difference, retaining the warning for other cases. Signed-off-by: Jens Axboe --- kernel/smp.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/kernel/smp.c b/kernel/smp.c index 7a59be2..fe54f52 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -18,6 +18,7 @@ #ifdef CONFIG_USE_GENERIC_SMP_HELPERS enum { CSD_FLAG_LOCK = 0x01, + CSD_FLAG_WAIT = 0x02, }; struct call_function_data { @@ -121,7 +122,7 @@ static void csd_lock(struct call_single_data *data) static void csd_unlock(struct call_single_data *data) { - WARN_ON(!(data->flags & CSD_FLAG_LOCK)); + WARN_ON((data->flags & CSD_FLAG_WAIT) && !(data->flags & CSD_FLAG_LOCK)); /* * ensure we're all done before releasing data: @@ -143,6 +144,9 @@ void generic_exec_single(int cpu, struct call_single_data *data, int wait) unsigned long flags; int ipi; + if (wait) + data->flags |= CSD_FLAG_WAIT; + raw_spin_lock_irqsave(&dst->lock, flags); ipi = list_empty(&dst->list); list_add_tail(&data->list, &dst->list); -- 1.7.4.4