All of lore.kernel.org
 help / color / mirror / Atom feed
* pci_check_and_set_intx_mask(dev, true)
@ 2021-10-28  3:23 Amol
  2021-10-28  3:29 ` Amol
  0 siblings, 1 reply; 3+ messages in thread
From: Amol @ 2021-10-28  3:23 UTC (permalink / raw)
  To: linux-pci

Hello,

If pci_check_and_set_intx_mask is called with the intention of masking,
and if there indeed is an IRQ pending, then the comparison
"mask != irq_pending" evaluates to false: the 'mask' variable is 1, and
'irq_pending' is 0x80, in that case.

This state causes the function to return without masking, contrary to the
behaviour expected of it as given by a comment:

"Check if the device dev has its INTx line asserted, mask it and return true
in that case. False is returned if no interrupt was pending."

My vfio/pcipassthrough setup sees INTx line asserted as the VM is being
shutdown, but the line is not masked; the host kernel panics saying
"nobody cared" - there's no handler.

Is the inconsistency with the pci intx masking really a problem, or just a
misunderstanding on my part?

Thanks,
Amol

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

* Re: pci_check_and_set_intx_mask(dev, true)
  2021-10-28  3:23 pci_check_and_set_intx_mask(dev, true) Amol
@ 2021-10-28  3:29 ` Amol
  2021-10-28  3:55   ` Amol
  0 siblings, 1 reply; 3+ messages in thread
From: Amol @ 2021-10-28  3:29 UTC (permalink / raw)
  To: linux-pci

On 28/10/2021, Amol <suratiamol@gmail.com> wrote:
> Hello,
>
> If pci_check_and_set_intx_mask is called with the intention of masking,
> and if there indeed is an IRQ pending, then the comparison
> "mask != irq_pending" evaluates to false: the 'mask' variable is 1, and

Correction: Evaluates to true. Causes the function to return without masking.

> 'irq_pending' is 0x80, in that case.
>
> This state causes the function to return without masking, contrary to the
> behaviour expected of it as given by a comment:
>
> "Check if the device dev has its INTx line asserted, mask it and return
> true
> in that case. False is returned if no interrupt was pending."
>
> My vfio/pcipassthrough setup sees INTx line asserted as the VM is being
> shutdown, but the line is not masked; the host kernel panics saying
> "nobody cared" - there's no handler.
>
> Is the inconsistency with the pci intx masking really a problem, or just a
> misunderstanding on my part?
>
> Thanks,
> Amol
>

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

* Re: pci_check_and_set_intx_mask(dev, true)
  2021-10-28  3:29 ` Amol
@ 2021-10-28  3:55   ` Amol
  0 siblings, 0 replies; 3+ messages in thread
From: Amol @ 2021-10-28  3:55 UTC (permalink / raw)
  To: linux-pci

On 28/10/2021, Amol <suratiamol@gmail.com> wrote:
> On 28/10/2021, Amol <suratiamol@gmail.com> wrote:
>> Hello,
>>
>> If pci_check_and_set_intx_mask is called with the intention of masking,
>> and if there indeed is an IRQ pending, then the comparison
>> "mask != irq_pending" evaluates to false: the 'mask' variable is 1, and
>
> Correction: Evaluates to true. Causes the function to return without
> masking.
>
>> 'irq_pending' is 0x80, in that case.
>>
>> This state causes the function to return without masking, contrary to the
>> behaviour expected of it as given by a comment:
>>
>> "Check if the device dev has its INTx line asserted, mask it and return
>> true
>> in that case. False is returned if no interrupt was pending."
>>
>> My vfio/pcipassthrough setup sees INTx line asserted as the VM is being
>> shutdown, but the line is not masked; the host kernel panics saying
>> "nobody cared" - there's no handler.
>>
>> Is the inconsistency with the pci intx masking really a problem, or just
>> a
>> misunderstanding on my part?

It is indeed a misunderstanding on my part. I missed the fact that the
datatype involved here is _Bool; the compiler must be emitting extra
instructions to convert non-zero values to 1.

Apologies for the spam.

>>
>> Thanks,
>> Amol
>>
>

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

end of thread, other threads:[~2021-10-28  3:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28  3:23 pci_check_and_set_intx_mask(dev, true) Amol
2021-10-28  3:29 ` Amol
2021-10-28  3:55   ` Amol

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.