Search code examples
linuxlogginglinux-kernelembedded-linuxspi

how to manage or resolve log of SPI interrupt in embedded linux


My SOC with embedded linux OS communicate with another chip by SPI protocol, when I monitor the /var/log/kern.log file I see these messages that is written in this file with a high speed and rate(And this event causes a sharp decrease in the free memory of the system) :

2022-11-09T15:28:38.827661+00:00 mcu-v1 kernel: [  513.748802] fsl_spi e0007000.spi: 
fsl_spi_irq: events 300
2022-11-09T15:28:38.827758+00:00 mcu-v1 kernel: [  513.748855] fsl_spi e0007000.spi: 
fsl_spi_irq: events 300
2022-11-09T15:28:38.838743+00:00 mcu-v1 kernel: [  513.759301] fsl_spi e0007000.spi: 
fsl_spi_irq: events 300
2022-11-09T15:28:38.838843+00:00 mcu-v1 kernel: [  513.759347] fsl_spi e0007000.spi: 
fsl_spi_irq: events 300
2022-11-09T15:28:38.838885+00:00 mcu-v1 kernel: [  513.759418] fsl_spi e0007000.spi: 
fsl_spi_irq: events 300
2022-11-09T15:28:38.838921+00:00 mcu-v1 kernel: [  513.759457] fsl_spi e0007000.spi: 
fsl_spi_irq: events 300
2022-11-09T15:28:38.850540+00:00 mcu-v1 kernel: [  513.769821] fsl_spi e0007000.spi: 
fsl_spi_irq: events 300
2022-11-09T15:28:38.850703+00:00 mcu-v1 kernel: [  513.769862] fsl_spi e0007000.spi: 
fsl_spi_irq: events 300
2022-11-09T15:28:38.850753+00:00 mcu-v1 kernel: [  513.769960] fsl_spi e0007000.spi: 
fsl_spi_irq: events 300
2022-11-09T15:28:38.850788+00:00 mcu-v1 kernel: [  513.770003] fsl_spi e0007000.spi: 
fsl_spi_irq: events 300

I set the log_level in kernel command line with 2 to ignore this messages(To prevent memory consumption )! But the message is still being written ! I read the kernel source(v 4.14) But I did not understand!

What does this message indicate? And how to solve this problem ?


Solution

  • What does this message indicate?

    The message seems to be for debugging, a notice that this ISR handled an event. In drivers/spi/spi-fsl-spi.c:

    static irqreturn_t fsl_spi_irq(s32 irq, void *context_data)
    {
        ...
    
        /* Get interrupt events(tx/rx) */
        events = mpc8xxx_spi_read_reg(&reg_base->event);
        if (events)
            ret = IRQ_HANDLED;
    
        dev_dbg(mspi->dev, "%s: events %x\n", __func__, events);    <== msg generator
        ...
        return ret;
    }
    

    a debug console message is generated unconditionally every time the ISR is executed.

    And how to solve this problem?

    The messages do not indicate any "problem" that needs resolution. Every SPI interrupt handled will generate the message. Yes, it's a bit noisy.

    For the problem of excessive messages, check your kernel configuration.
    Is CONFIG_SPI_DEBUG enabled? If so, then disable it, and rebuild the kernel.