Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: inside-secure - irq balance

Balance the irqs of the inside secure driver over all
available cpus.
Currently all interrupts are handled by the first CPU.

From my testing with IPSec AES-GCM 256
on my MCbin with 4 Cores I get a 50% speed increase:

Before the patch: 99.73 Kpps
With the patch: 151.25 Kpps

Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Sven Auhagen and committed by
Herbert Xu
c6720415 6914dd53

+14 -2
+11 -2
drivers/crypto/inside-secure/safexcel.c
··· 1135 1135 1136 1136 static int safexcel_request_ring_irq(void *pdev, int irqid, 1137 1137 int is_pci_dev, 1138 + int ring_id, 1138 1139 irq_handler_t handler, 1139 1140 irq_handler_t threaded_handler, 1140 1141 struct safexcel_ring_irq_data *ring_irq_priv) 1141 1142 { 1142 - int ret, irq; 1143 + int ret, irq, cpu; 1143 1144 struct device *dev; 1144 1145 1145 1146 if (IS_ENABLED(CONFIG_PCI) && is_pci_dev) { ··· 1177 1176 dev_err(dev, "unable to request IRQ %d\n", irq); 1178 1177 return ret; 1179 1178 } 1179 + 1180 + /* Set affinity */ 1181 + cpu = cpumask_local_spread(ring_id, NUMA_NO_NODE); 1182 + irq_set_affinity_hint(irq, get_cpu_mask(cpu)); 1180 1183 1181 1184 return irq; 1182 1185 } ··· 1616 1611 irq = safexcel_request_ring_irq(pdev, 1617 1612 EIP197_IRQ_NUMBER(i, is_pci_dev), 1618 1613 is_pci_dev, 1614 + i, 1619 1615 safexcel_irq_ring, 1620 1616 safexcel_irq_ring_thread, 1621 1617 ring_irq); ··· 1625 1619 return irq; 1626 1620 } 1627 1621 1622 + priv->ring[i].irq = irq; 1628 1623 priv->ring[i].work_data.priv = priv; 1629 1624 priv->ring[i].work_data.ring = i; 1630 1625 INIT_WORK(&priv->ring[i].work_data.work, ··· 1763 1756 clk_disable_unprepare(priv->reg_clk); 1764 1757 clk_disable_unprepare(priv->clk); 1765 1758 1766 - for (i = 0; i < priv->config.rings; i++) 1759 + for (i = 0; i < priv->config.rings; i++) { 1760 + irq_set_affinity_hint(priv->ring[i].irq, NULL); 1767 1761 destroy_workqueue(priv->ring[i].workqueue); 1762 + } 1768 1763 1769 1764 return 0; 1770 1765 }
+3
drivers/crypto/inside-secure/safexcel.h
··· 707 707 */ 708 708 struct crypto_async_request *req; 709 709 struct crypto_async_request *backlog; 710 + 711 + /* irq of this ring */ 712 + int irq; 710 713 }; 711 714 712 715 /* EIP integration context flags */