This is a fix for an issue we hit on specific NIC tracked in
https://bugzilla.redhat.com/show_bug.cgi?id=1484059
In this case the mlx4_core driver lists all available MSI interrupts
under /sys/class/$dev/device/msi_irqs, this covers interrupts for both
mlx4_en (network part) and mlx4_ib (storage part) even if any of these is
not loaded yet. The IRQs are propagated to /proc/irq/ directory once
they're loaded.
To fix this the availability of the interrupt id is first checked in
/proc/irq/ directory and modified only if present.
v2: I moved the /proc/irq listing out of the loop so that the command is
run just once and reused when checking the presence of specific IRQ
number
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/RecipeCommon/IRQ.py | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/lnst/RecipeCommon/IRQ.py b/lnst/RecipeCommon/IRQ.py
index 88d673b..f61f23c 100644
--- a/lnst/RecipeCommon/IRQ.py
+++ b/lnst/RecipeCommon/IRQ.py
@@ -11,6 +11,7 @@ __author__ = """
jtluka(a)redhat.com (Jan Tluka)
"""
+import re
'''
Pins all device IRQs to specified cpu on machine.
@@ -33,9 +34,22 @@ def pin_dev_irqs(machine, device, cpu):
res = pi.get_result()
intrs = res["res_data"]["stdout"]
+ # save all /proc/irq/ entries
+ cmd = machine.run("ls -1 /proc/irq/ 2>/dev/null || true")
+ res = cmd.get_result()
+ proc_irq = res["res_data"]["stdout"]
+
for intr in intrs.split('\n'):
try:
int(intr)
except:
continue
- machine.config("/proc/irq/%s/smp_affinity_list" % intr.strip(), cpu)
+
+ # some drivers list all _available_ MSI interrupts under msi_irqs
+ # even for driver parts that are not loaded (in case of converged
+ # network adapters) and these interrupts are not visible under
+ # /proc/irq and make LNST report failure so we need to check if the
+ # interrupt is available first
+
+ if re.search("^%s$" % intr.strip(), proc_irq, re.MULTILINE) is not None:
+ machine.config("/proc/irq/%s/smp_affinity_list" % intr.strip(), cpu)
--
2.14.4
On Tue, Oct 02, 2018 at 03:06:40PM +0000, Petr Machata wrote:
> Pool #8 was recently introduced to mlxsw to support MC-aware regime of
> the switch. Pool 8 is configured differently from the other pools, with
> infinite size, and statically-determined quotas. Tweak the sharedbuffer
> test to handle this case.
>
> Signed-off-by: Petr Machata <petrm(a)mellanox.com>
> ---
> recipes/switchdev/sharedbuffer.py | 26 ++++++++++++++++++++------
> 1 file changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/recipes/switchdev/sharedbuffer.py b/recipes/switchdev/sharedbuffer.py
> index 28a6f44..4393770 100644
> --- a/recipes/switchdev/sharedbuffer.py
> +++ b/recipes/switchdev/sharedbuffer.py
> @@ -13,6 +13,9 @@ from TestLib import TestLib
> from time import sleep
> import random
>
> +CELL_SIZE = 288 # Least common multiple of cell sizes of Spectrum and
> + # Spectrum-2, which are, respectively, 96 and 144.
> +
> class RandomValuePicker:
> def __init__(self, pools):
> self._pools = {"ingress": [], "egress": []}
> @@ -27,9 +30,11 @@ class RandomValuePicker:
> # support static threshold only for now
> return "static"
>
> - def _get_th(self):
> - # support dynamic threshold only for now
> - return random.randint(3,16)
> + def _get_th(self, pool):
> + th = random.randint(3,16)
> + if pool == 8: # Pool 8 has static quotas.
> + th *= CELL_SIZE
> + return th
>
> def _get_pool(self, direction):
> arr = self._pools[direction]
> @@ -40,14 +45,17 @@ class RandomValuePicker:
> return (self._get_size(), self._get_thtype())
> if isinstance(objid, TcBind):
> pool = self._get_pool(objid["type"])
> - th = self._get_th()
> + th = self._get_th(pool)
> return (pool, th)
> if isinstance(objid, PortPool):
> - return (self._get_th(),)
> + return (self._get_th(objid["pool"]),)
>
> class RecordValuePickerException(Exception):
> pass
>
> +class SkipTest(Exception):
> + pass
> +
> class RecordValuePicker:
> def __init__(self, objlist):
> self._recs = []
> @@ -55,6 +63,9 @@ class RecordValuePicker:
> self._recs.append({"objid": item, "value": item.var_tuple()})
>
> def get_value(self, objid):
> + if isinstance(objid, Pool) and objid["pool"] == 8:
> + # Pool 8 is reported with infinite size, which can't be reset.
> + raise SkipTest()
> for rec in self._recs:
> if rec["objid"].weak_eq(objid):
> return rec["value"]
> @@ -124,7 +135,10 @@ def get_pools(sw, dlname, direction=None):
> def do_check_pools(tl, sw, dlname, pools, vp):
> for pool in pools:
> pre_pools = get_pools(sw, dlname)
> - (size, thtype) = vp.get_value(pool)
> + try:
> + (size, thtype) = vp.get_value(pool)
> + except SkipTest:
> + continue
> pool.dl_set(sw, dlname, size, thtype)
> post_pools = get_pools(sw, dlname)
> pool = post_pools.get_by(pool)
> --
> 2.4.11
> _______________________________________________
> LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
> To unsubscribe send an email to lnst-developers-leave(a)lists.fedorahosted.org
> Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedoraho…
"8" seems like a weird magic number constant. Does it make sense to use
it in the context of an upstream repository where we want to track
generic recipes?
If it does I'm ok with pushing this.
-Ondrej
This is a fix for an issue we hit on specific NIC tracked in
https://bugzilla.redhat.com/show_bug.cgi?id=1484059
In this case the mlx4_core driver lists all available MSI interrupts
under /sys/class/$dev/device/msi_irqs, this covers interrupts for both
mlx4_en (network part) and mlx4_ib (storage part) even if any of these is
not loaded yet. The IRQs are propagated to /proc/irq/ directory once
they're loaded.
To fix this the availability of the interrupt id is first checked in
/proc/irq/ directory and modified only if present.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/RecipeCommon/IRQ.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lnst/RecipeCommon/IRQ.py b/lnst/RecipeCommon/IRQ.py
index 88d673b..6b3a2e0 100644
--- a/lnst/RecipeCommon/IRQ.py
+++ b/lnst/RecipeCommon/IRQ.py
@@ -38,4 +38,13 @@ def pin_dev_irqs(machine, device, cpu):
int(intr)
except:
continue
- machine.config("/proc/irq/%s/smp_affinity_list" % intr.strip(), cpu)
+
+ # some drivers list all _available_ MSI interrupts under msi_irqs
+ # even for driver parts that are not loaded (in case of converged
+ # network adapters) and these interrupts are not visible under
+ # /proc/irq and make LNST report failure so we need to check if the
+ # interrupt is available first
+ list_intr = machine.run("ls -d /proc/irq/%s 2>/dev/null || true" % intr.strip())
+ res = list_intr.get_result()
+ if res["res_data"]["stdout"]:
+ machine.config("/proc/irq/%s/smp_affinity_list" % intr.strip(), cpu)
--
2.14.4