doc:appunti:linux:sa:ksoftirqd
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:linux:sa:ksoftirqd [2024/11/08 14:59] – [Web References] niccolo | doc:appunti:linux:sa:ksoftirqd [2024/11/08 17:22] (current) – [ksoftirqd process utilizes 100% of a CPU] niccolo | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| < | < | ||
| - | ps uax | grep ksoftir | + | ps uax | grep ksoftirqd |
| root 14 0.0 0.0 0 0 ? S Nov07 0:00 [ksoftirqd/ | root 14 0.0 0.0 0 0 ? S Nov07 0:00 [ksoftirqd/ | ||
| root 21 1.4 0.0 0 0 ? S Nov07 21:43 [ksoftirqd/ | root 21 1.4 0.0 0 0 ? S Nov07 21:43 [ksoftirqd/ | ||
| Line 45: | Line 45: | ||
| Dove **f** un valore esadecimale che rappresenta una bitmask dei core CPU; tale IRQ può essere quindi servita da uno qualunque dei core. | Dove **f** un valore esadecimale che rappresenta una bitmask dei core CPU; tale IRQ può essere quindi servita da uno qualunque dei core. | ||
| + | |||
| + | Dall' | ||
| + | |||
| + | < | ||
| + | ifconfig net0 | ||
| + | net0: flags=4163< | ||
| + | inet 192.168.1.254 | ||
| + | inet6 fe80:: | ||
| + | ether 00: | ||
| + | RX packets 3943557 | ||
| + | RX errors 0 dropped 107001 | ||
| + | TX packets 2410528 | ||
| + | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
| + | </ | ||
| + | |||
| + | ===== softnet_stat ===== | ||
| + | |||
| + | Grazie al contenuto di **/ | ||
| + | |||
| + | - Total number of processed packets (processed). | ||
| + | - Times ksoftirq ran out of quota (dropped). | ||
| + | - Times net_rx_action was rescheduled. | ||
| + | - Number of times processed all lists before quota. | ||
| + | - Number of times did not process all lists due to quota. | ||
| + | - Number of times net_rx_action was rescheduled for GRO (Generic Receive Offload) cells. | ||
| + | - Number of times GRO cells were processed. | ||
| + | |||
| + | Per vedere la tabella in formato decimale invece che esadecimale si può ricorrere al comando: | ||
| + | |||
| + | < | ||
| + | awk '{for (i=1; i<=NF; i++) printf strtonum(" | ||
| + | </ | ||
| + | |||
| + | ===== netdev_max_backlog ===== | ||
| + | |||
| + | Se il numero nella **seconda colonna** cresce costantemente (frame persi a causa di una coda backlog piena), è possibile incrementare la dimensione del buffer. Il valore corrente si vede con: | ||
| + | |||
| + | < | ||
| + | sysctl net.core.netdev_max_backlog | ||
| + | net.core.netdev_max_backlog = 1000 | ||
| + | </ | ||
| + | |||
| + | Quindi si può creare un file **/ | ||
| + | |||
| + | < | ||
| + | net.core.netdev_max_backlog = 2000 | ||
| + | </ | ||
| + | |||
| + | e renderlo esecutivo con: | ||
| + | |||
| + | < | ||
| + | sysctl -p / | ||
| + | </ | ||
| + | |||
| + | ===== netdev_budget ===== | ||
| + | |||
| + | Anche la **terza colonna** di **/ | ||
| + | |||
| + | Il budget assegnato è dato dai parametri **netdev_budget** e **netdev_budget_usecs** che sono consultabili con i comandi: | ||
| + | |||
| + | < | ||
| + | sysctl net.core.netdev_budget | ||
| + | net.core.netdev_budget = 300 | ||
| + | |||
| + | sysctl net.core.netdev_budget_usecs | ||
| + | net.core.netdev_budget_usecs = 8000 | ||
| + | </ | ||
| + | |||
| + | In questo caso softirqd ha, per ogni ciclo di polling, 8000 microsecondi di tempo massimo per processare fino a 300 messaggi dalla scheda di rete. Possiamo aumentarli creando un file **/ | ||
| + | |||
| + | < | ||
| + | net.core.netdev_budget = 600 | ||
| + | net.core.netdev_budget_usecs = 24000 | ||
| + | </ | ||
| + | |||
| + | ed eseguendo | ||
| + | |||
| + | < | ||
| + | sysctl -p / | ||
| + | </ | ||
| + | |||
| + | ===== Shorewall (netfilter) logging ===== | ||
| + | |||
| + | Purtroppo nel nostro caso **non si sono ottenuti risultati incrementando il budget** per la softirq. L'host in questione è un firewall GNU/Linux con due schede di rete, il problema era associato all' | ||
| + | |||
| + | < | ||
| + | iptables -S | wc -l | ||
| + | 157 | ||
| + | </ | ||
| + | |||
| + | Il problema si manifestava in condizioni di portscan intensi, intorno ai 3 pacchetti/ | ||
| + | |||
| + | Avendo **eliminato il logging dei pacchetti dropped** il problema pare risolto. | ||
| ===== Web References ===== | ===== Web References ===== | ||
| - | * **[[https:// | + | * **[[https:// |
| * **[[https:// | * **[[https:// | ||
| + | * **[[https:// | ||
| + | * **[[https:// | ||
doc/appunti/linux/sa/ksoftirqd.1731074372.txt.gz · Last modified: by niccolo
