linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Muni Sekhar <munisekharrms@gmail.com>
To: linux-pci@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: pcie: xilinx: kernel hang - ISR readl()
Date: Tue, 7 Jan 2020 21:45:13 +0530	[thread overview]
Message-ID: <CAHhAz+ijBTp55gZYAejWthnvdmR_qyQJpVV4r1gyQ-Kud6t9qg@mail.gmail.com> (raw)

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

             reply	other threads:[~2020-01-07 16:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 16:15 Muni Sekhar [this message]
2020-01-08 14:33 ` pcie: xilinx: kernel hang - ISR readl() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHhAz+ijBTp55gZYAejWthnvdmR_qyQJpVV4r1gyQ-Kud6t9qg@mail.gmail.com \
    --to=munisekharrms@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).