linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* blk-softirq vs smp_call_function_single_async()
@ 2020-06-08 11:58 Peter Zijlstra
  2020-06-08 15:45 ` Christoph Hellwig
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Zijlstra @ 2020-06-08 11:58 UTC (permalink / raw)
  To: Jens Axboe; +Cc: frederic, linux-kernel, linux-block

Hi Jens,

I've been going through smp_call_function_single_async() users and
stumbled upon blk-softirq.c, which has:

static int raise_blk_irq(int cpu, struct request *rq)
{
	if (cpu_online(cpu)) {
		call_single_data_t *data = &rq->csd;

		data->func = trigger_softirq;
		data->info = rq;
		data->flags = 0;

		smp_call_function_single_async(cpu, data);
		return 0;
	}

	return 1;
}

What, if anything, guarantees rq->csd is not already in use at that
time?

The purpose of that CSD is to make the BLOCK_SOFTIRQ go, but there's
plenty of other ways to tickle that, afaict. So if that races vs someone
else, and that completes whatever was needed, then can't we get to
raise_blk_irq() again, even though the csd is still enqueued?

Worse; it has: data->flags = 0; so our early exit will not happen, even
when it should.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-06-09 13:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08 11:58 blk-softirq vs smp_call_function_single_async() Peter Zijlstra
2020-06-08 15:45 ` Christoph Hellwig
2020-06-08 15:58   ` Peter Zijlstra
2020-06-08 16:33     ` Christoph Hellwig
2020-06-08 16:40       ` Peter Zijlstra
2020-06-08 16:42         ` Christoph Hellwig
2020-06-09 13:38           ` Peter Zijlstra
2020-06-08 21:34         ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).