linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pcie: xilinx: kernel hang - ISR readl()
@ 2020-01-07 16:15 Muni Sekhar
  2020-01-08 14:33 ` Muni Sekhar
  2020-01-08 20:15 ` Bjorn Helgaas
  0 siblings, 2 replies; 16+ messages in thread
From: Muni Sekhar @ 2020-01-07 16:15 UTC (permalink / raw)
  To: linux-pci; +Cc: linux-kernel

Hi,

I have module with Xilinx FPGA. It implements UART(s), SPI(s),
parallel I/O and interfaces them to the Host CPU via PCI Express bus.
I see that my system freezes without capturing the crash dump for
certain tests. I debugged this issue and it was tracked down to the
below mentioned interrupt handler code.


In ISR, first reads the Interrupt Status register using ‘readl()’ as
given below.
    status = readl(ctrl->reg + INT_STATUS);


And then clears the pending interrupts using ‘writel()’ as given blow.
        writel(status, ctrl->reg + INT_STATUS);


I've noticed a kernel hang if INT_STATUS register read again after
clearing the pending interrupts.

Can someone clarify me why the kernel hangs without crash dump incase
if I read the INT_STATUS register using readl() after clearing the
pending bits?

Can readl() block?


Snippet of the ISR code is given blow:

https://pastebin.com/WdnZJZF5



static irqreturn_t pcie_isr(int irq, void *dev_id)

{

        struct test_device *ctrl = data;

        u32 status;

…



        status = readl(ctrl->reg + INT_STATUS);

        /*

         * Check to see if it was our interrupt

         */

        if (!(status & 0x000C))

                return IRQ_NONE;



        /* Clear the interrupt */

        writel(status, ctrl->reg + INT_STATUS);



        if (status & 0x0004) {

                /*

                 * Tx interrupt pending.

                 */

                 ....

       }



        if (status & 0x0008) {

                /* Rx interrupt Pending */

                /* The system freezes if I read again the INT_STATUS
register as given below */

                status = readl(ctrl->reg + INT_STATUS);

                ....

        }

..

        return IRQ_HANDLED;
}



-- 
Thanks,
Sekhar

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

end of thread, other threads:[~2020-02-04 15:33 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07 16:15 pcie: xilinx: kernel hang - ISR readl() Muni Sekhar
2020-01-08 14:33 ` Muni Sekhar
2020-01-08 20:15 ` Bjorn Helgaas
2020-01-09  3:17   ` Muni Sekhar
2020-01-09  4:35     ` Bjorn Helgaas
2020-01-09  4:50       ` Muni Sekhar
2020-01-18  1:46       ` Muni Sekhar
2020-01-28 17:40         ` Bjorn Helgaas
2020-01-30 16:07       ` Muni Sekhar
2020-01-30 19:00         ` Bjorn Helgaas
2020-01-31 11:33           ` David Laight
2020-01-31 16:34           ` Muni Sekhar
2020-01-31 20:46             ` Bjorn Helgaas
2020-02-01  3:14               ` Muni Sekhar
2020-02-01 18:29                 ` Bjorn Helgaas
2020-02-04 15:33                   ` Muni Sekhar

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).