Re: [PATCH] synchronize_irq needs a barrier

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Maxim Levitsky
Date: Friday, October 19, 2007 - 7:02 pm

On Thursday 18 October 2007 03:25:42 Benjamin Herrenschmidt wrote:

Hi,

I have read this thread and I concluded few things:

1) It is impossible to know that the card won't send more interrupts:
Even if I do a read from the device, the IRQ can be pending in the bus/APIC
It is even possible (and likely) that the IRQ line will be shared, thus the 
handler can be called by non-relevant device.

2) the synchronize_irq(); in .suspend is useless:
an IRQ can happen immediately after this synchronize_irq();
and interrupt even the .suspend()
(At least theoretically)


Thus I now understand that .suspend() should do:

	saa_writel(SAA7134_IRQ1, 0);
	saa_writel(SAA7134_IRQ2, 0);
	saa_writel(SAA7134_MAIN_CTRL, 0);

	dev->insuspend = 1;
	smp_wmb();

	/* at that point the _request to disable card's IRQs was issued, we don't know 
	   that there will be no irqs anymore.
	   the smp_mb(); guaranties that the IRQ handler will bail out in that case. */
	
	/* .......*/

	pci_save_state(pci_dev);
	pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state));
	return 0;

and the interrupt handler:

	smp_rmb();
	if (dev->insuspend)
		goto out;

Am I right?
	Best regards,
		Maxim Levitsky
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Wed Oct 17, 6:25 pm)
Re: [PATCH] synchronize_irq needs a barrier, Andrew Morton, (Wed Oct 17, 6:45 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Wed Oct 17, 6:55 pm)
Re: [PATCH] synchronize_irq needs a barrier, Linus Torvalds, (Wed Oct 17, 7:12 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Wed Oct 17, 7:40 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Wed Oct 17, 7:57 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 7:35 am)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 7:56 am)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 2:35 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 3:05 pm)
Re: [PATCH] synchronize_irq needs a barrier, Linus Torvalds, (Thu Oct 18, 3:52 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 4:17 pm)
Re: [PATCH] synchronize_irq needs a barrier, Linus Torvalds, (Thu Oct 18, 4:39 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 4:52 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 7:32 pm)
Re: [PATCH] synchronize_irq needs a barrier, Nick Piggin, (Thu Oct 18, 7:52 pm)
Re: [PATCH] synchronize_irq needs a barrier, Linus Torvalds, (Thu Oct 18, 7:55 pm)
Re: [PATCH] synchronize_irq needs a barrier, Linus Torvalds, (Thu Oct 18, 8:26 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 8:28 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 9:11 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 9:20 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 9:26 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 9:29 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 9:35 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 9:48 pm)
Re: [PATCH] synchronize_irq needs a barrier, Nick Piggin, (Thu Oct 18, 9:49 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 9:58 pm)
[NET]: Fix possible dev_deactivate race condition, Herbert Xu, (Thu Oct 18, 10:36 pm)
Re: [NET]: Fix possible dev_deactivate race condition, David Miller, (Thu Oct 18, 10:38 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 10:53 pm)
Re: [NET]: Fix possible dev_deactivate race condition, Peter Zijlstra, (Fri Oct 19, 12:35 am)
Re: [PATCH] synchronize_irq needs a barrier, Maxim Levitsky, (Fri Oct 19, 7:02 pm)
Re: [PATCH] synchronize_irq needs a barrier, Linus Torvalds, (Fri Oct 19, 7:25 pm)
Re: [PATCH] synchronize_irq needs a barrier, Maxim Levitsky, (Fri Oct 19, 8:10 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Fri Oct 19, 8:37 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 8:56 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 9:04 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 9:06 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 9:09 pm)
Re: [PATCH] synchronize_irq needs a barrier, Maxim Levitsky, (Fri Oct 19, 9:24 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 10:04 pm)
Re: [PATCH] synchronize_irq needs a barrier, Maxim Levitsky, (Fri Oct 19, 10:36 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 10:46 pm)
Re: [PATCH] synchronize_irq needs a barrier, Maxim Levitsky, (Fri Oct 19, 11:06 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 11:13 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Sun Oct 21, 2:10 pm)
[IRQ]: Fix synchronize_irq races with IRQ handler, Herbert Xu, (Mon Oct 22, 8:26 pm)