linux/drivers/soc
Sebastian Andrzej Siewior f84754dbc5 soc/fsl/qbman: Add an argument to signal if NAPI processing is required.
dpaa_eth_napi_schedule() and caam_qi_napi_schedule() schedule NAPI if
invoked from:

 - Hard interrupt context
 - Any context which is not serving soft interrupts

Any context which is not serving soft interrupts includes hard interrupts
so the in_irq() check is redundant. caam_qi_napi_schedule() has a comment
about this:

        /*
         * In case of threaded ISR, for RT kernels in_irq() does not return
         * appropriate value, so use in_serving_softirq to distinguish between
         * softirq and irq contexts.
         */
         if (in_irq() || !in_serving_softirq())

This has nothing to do with RT. Even on a non RT kernel force threaded
interrupts run obviously in thread context and therefore in_irq() returns
false when invoked from the handler.

The extension of the in_irq() check with !in_serving_softirq() was there
when the drivers were added, but in the out of tree FSL BSP the original
condition was in_irq() which got extended due to failures on RT.

The usage of in_xxx() in drivers is phased out and Linus clearly requested
that code which changes behaviour depending on context should either be
separated or the context be conveyed in an argument passed by the caller,
which usually knows the context. Right he is, the above construct is
clearly showing why.

The following callchains have been analyzed to end up in
dpaa_eth_napi_schedule():

qman_p_poll_dqrr()
  __poll_portal_fast()
    fq->cb.dqrr()
       dpaa_eth_napi_schedule()

portal_isr()
  __poll_portal_fast()
    fq->cb.dqrr()
       dpaa_eth_napi_schedule()

Both need to schedule NAPI.
The crypto part has another code path leading up to this:
  kill_fq()
     empty_retired_fq()
       qman_p_poll_dqrr()
         __poll_portal_fast()
            fq->cb.dqrr()
               dpaa_eth_napi_schedule()

kill_fq() is called from task context and ends up scheduling NAPI, but
that's pointless and an unintended side effect of the !in_serving_softirq()
check.

The code path:
  caam_qi_poll() -> qman_p_poll_dqrr()

is invoked from NAPI and I *assume* from crypto's NAPI device and not
from qbman's NAPI device. I *guess* it is okay to skip scheduling NAPI
(because this is what happens now) but could be changed if it is wrong
due to `budget' handling.

Add an argument to __poll_portal_fast() which is true if NAPI needs to be
scheduled. This requires propagating the value to the caller including
`qman_cb_dqrr' typedef which is used by the dpaa and the crypto driver.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
Cc: Herbert XS <herbert@gondor.apana.org.au>
Cc: Li Yang <leoyang.li@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
Tested-by: Camelia Groza <camelia.groza@nxp.com>
2020-11-03 17:41:03 -08:00
..
actions soc: actions: include header to fix missing prototype 2020-09-22 12:45:16 +05:30
amlogic soc: amlogic: pm-domains: use always-on flag 2020-09-24 09:50:01 -07:00
aspeed treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
atmel drivers: soc: atmel: move sam9x60 under its own config flag 2019-12-10 00:44:53 +01:00
bcm soc: bcm: brcmstb: biuctrl: Change RAC data line prefetching after 4 consecutive lines 2020-09-06 12:43:02 -07:00
dove
fsl soc/fsl/qbman: Add an argument to signal if NAPI processing is required. 2020-11-03 17:41:03 -08:00
gemini
imx soc: imx: gpcv2: Use dev_err_probe() to simplify error handling 2020-08-22 20:57:57 +08:00
ixp4xx
kendryte riscv: K210: Add a built-in device tree 2020-05-18 11:38:06 -07:00
lantiq soc: lantiq: convert to devm_platform_ioremap_resource 2020-01-10 11:44:52 -08:00
mediatek soc: mediatek: cmdq: add clear option in cmdq_pkt_wfe api 2020-09-25 17:27:39 +02:00
qcom ARM: SoC-related driver updates 2020-10-24 10:39:22 -07:00
renesas soc: renesas: r8a779a0-sysc: Add r8a779a0 support 2020-09-16 08:57:31 +02:00
rockchip PM: AVS: rockchip-io: Move the driver to the rockchip specific drivers 2020-10-16 18:23:15 +02:00
samsung ARM: SoC platform updates 2020-10-24 10:33:08 -07:00
sifive soc: sifive: l2 cache: Mark l2_get_priv_group as static 2020-05-28 15:57:49 -07:00
sunxi soc: sunxi: sram: remove unneeded semicolon 2020-09-11 17:02:39 +02:00
tegra ARM: Devicetree updates 2020-10-24 10:44:18 -07:00
ti ARM: SoC-related driver updates 2020-10-24 10:39:22 -07:00
ux500 soc: ux500: Use custom soc attribute group instead of device_create_file 2020-07-06 09:48:06 +01:00
versatile soc: integrator: Drop pointless static qualifier in integrator_soc_init() 2020-08-20 08:57:05 +02:00
xilinx soc: xilinx: Fix error code in zynqmp_pm_probe() 2020-06-18 10:07:17 +02:00
zte
Kconfig riscv: Add Kendryte K210 SoC support 2020-04-03 10:49:52 -07:00
Makefile RISC-V Patches for the 5.7 Merge Window, Part 1 2020-04-09 10:51:30 -07:00