All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] genirq: Only call irq_ack if implemented by chip
@ 2015-04-14 10:29 Adrian-Ken Rueegsegger
  2015-04-14 18:00 ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian-Ken Rueegsegger @ 2015-04-14 10:29 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, Adrian-Ken Rueegsegger

Restore the check if an IRQ chip implements the irq_ack function prior
to its invocation. Commit 22a49163e90d ("genirq: Provide compat handling
for chip->ack()") removed the check from handle_edge_irq while keeping
the check in other call paths.

Signed-off-by: Adrian-Ken Rueegsegger <ken@codelabs.ch>
---
 kernel/irq/chip.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index eb9a4ea..3889b02 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -586,7 +586,8 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
 	kstat_incr_irqs_this_cpu(irq, desc);
 
 	/* Start handling the irq */
-	desc->irq_data.chip->irq_ack(&desc->irq_data);
+	if (desc->irq_data.chip->irq_ack)
+		desc->irq_data.chip->irq_ack(&desc->irq_data);
 
 	do {
 		if (unlikely(!desc->action)) {
-- 
1.7.10.4


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

* Re: [PATCH] genirq: Only call irq_ack if implemented by chip
  2015-04-14 10:29 [PATCH] genirq: Only call irq_ack if implemented by chip Adrian-Ken Rueegsegger
@ 2015-04-14 18:00 ` Thomas Gleixner
  2015-04-15  9:40   ` Adrian-Ken Rueegsegger
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2015-04-14 18:00 UTC (permalink / raw)
  To: Adrian-Ken Rueegsegger; +Cc: linux-kernel

On Tue, 14 Apr 2015, Adrian-Ken Rueegsegger wrote:
> Restore the check if an IRQ chip implements the irq_ack function prior
> to its invocation. Commit 22a49163e90d ("genirq: Provide compat handling
> for chip->ack()") removed the check from handle_edge_irq while keeping
> the check in other call paths.

How's an edge triggered interrupt without ack supposed to work?

You are missing to describe which problem you solve.

Thanks,

	tglx
 
> Signed-off-by: Adrian-Ken Rueegsegger <ken@codelabs.ch>
> ---
>  kernel/irq/chip.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
> index eb9a4ea..3889b02 100644
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -586,7 +586,8 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
>  	kstat_incr_irqs_this_cpu(irq, desc);
>  
>  	/* Start handling the irq */
> -	desc->irq_data.chip->irq_ack(&desc->irq_data);
> +	if (desc->irq_data.chip->irq_ack)
> +		desc->irq_data.chip->irq_ack(&desc->irq_data);
>  
>  	do {
>  		if (unlikely(!desc->action)) {
> -- 
> 1.7.10.4
> 
> 

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

* Re: [PATCH] genirq: Only call irq_ack if implemented by chip
  2015-04-14 18:00 ` Thomas Gleixner
@ 2015-04-15  9:40   ` Adrian-Ken Rueegsegger
  2015-04-21 12:20     ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian-Ken Rueegsegger @ 2015-04-15  9:40 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel

Hi,

On 04/14/2015 08:00 PM, Thomas Gleixner wrote:
> On Tue, 14 Apr 2015, Adrian-Ken Rueegsegger wrote:
>> Restore the check if an IRQ chip implements the irq_ack function prior
>> to its invocation. Commit 22a49163e90d ("genirq: Provide compat handling
>> for chip->ack()") removed the check from handle_edge_irq while keeping
>> the check in other call paths.
> 
> How's an edge triggered interrupt without ack supposed to work?
> 
> You are missing to describe which problem you solve.

I am running Linux as a VM on top of the Muen Separation Kernel (SK)
[1], where we have implemented PCI device passthrough using VT-d. In
this case the hardware interrupt is handled by the SK/hypervisor and
injected to Linux.

To support PCI MSI(-X), we register our own platform-specific MSI
operations (x86_msi.setup_msi_irqs, etc) and implement an irq_chip that
simply provides the irq_mask and irq_unmask operations (by reusing the
"regular" mask_msi_irq/unmask_msi_irq).

After encountering a null pointer dereference due to the irq_chip not
providing an irq_ack operation, I examined the commit that changed the
source of the irq_ack call, noticing that only the check in
handle_edge_irq was dropped while the other call sites were kept. As the
commit message did not provide me with additional information for that
particular fragment of the change, I (prematurely) concluded that it was
not intentional.

If it is a prerequisite for IRQ chips to provide the irq_ack operation
when used in conjunction with handle_edge_irq, then please ignore my
patch. In that case, I will adjust our chip implementation
accordingly.

Thanks for your time,
Adrian

[1] - http://muen.codelabs.ch/

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

* Re: [PATCH] genirq: Only call irq_ack if implemented by chip
  2015-04-15  9:40   ` Adrian-Ken Rueegsegger
@ 2015-04-21 12:20     ` Thomas Gleixner
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2015-04-21 12:20 UTC (permalink / raw)
  To: Adrian-Ken Rueegsegger; +Cc: linux-kernel

On Wed, 15 Apr 2015, Adrian-Ken Rueegsegger wrote:
> To support PCI MSI(-X), we register our own platform-specific MSI
> operations (x86_msi.setup_msi_irqs, etc) and implement an irq_chip that
> simply provides the irq_mask and irq_unmask operations (by reusing the
> "regular" mask_msi_irq/unmask_msi_irq).

But why are you using the edge flow handler then? 

> After encountering a null pointer dereference due to the irq_chip not
> providing an irq_ack operation, I examined the commit that changed the
> source of the irq_ack call, noticing that only the check in
> handle_edge_irq was dropped while the other call sites were kept. As the
> commit message did not provide me with additional information for that
> particular fragment of the change, I (prematurely) concluded that it was
> not intentional.
> 
> If it is a prerequisite for IRQ chips to provide the irq_ack operation
> when used in conjunction with handle_edge_irq, then please ignore my
> patch. In that case, I will adjust our chip implementation
> accordingly.

Yes, it is more or less. And I really want to avoid the extra
conditional in the handler hotpath.

Thanks,

	

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

end of thread, other threads:[~2015-04-21 12:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-14 10:29 [PATCH] genirq: Only call irq_ack if implemented by chip Adrian-Ken Rueegsegger
2015-04-14 18:00 ` Thomas Gleixner
2015-04-15  9:40   ` Adrian-Ken Rueegsegger
2015-04-21 12:20     ` Thomas Gleixner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.