@@ -222,7 +222,7 @@ def test_no_args(self, capsys):
222
222
223
223
xrd-vrouter checks
224
224
-----------------------
225
- Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size
225
+ Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size, Real-time Group Scheduling
226
226
227
227
==================================================================
228
228
XR platforms supported: xrd-control-plane, xrd-vrouter
@@ -371,7 +371,7 @@ def test_extra_check_docker(self, capsys):
371
371
372
372
xrd-vrouter checks
373
373
-----------------------
374
- Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size
374
+ Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size, Real-time Group Scheduling
375
375
376
376
==============================
377
377
Extra checks
@@ -408,7 +408,7 @@ def test_extra_check_xr_compose(self, capsys):
408
408
409
409
xrd-vrouter checks
410
410
-----------------------
411
- Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size
411
+ Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size, Real-time Group Scheduling
412
412
413
413
==============================
414
414
Extra checks
@@ -447,7 +447,7 @@ def test_all_extra_checks(self, capsys):
447
447
448
448
xrd-vrouter checks
449
449
-----------------------
450
- Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size
450
+ Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size, Real-time Group Scheduling
451
451
452
452
==============================
453
453
Extra checks
@@ -510,7 +510,7 @@ def test_no_plats_supported(self, capsys):
510
510
511
511
xrd-vrouter checks
512
512
-----------------------
513
- Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size
513
+ Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size, Real-time Group Scheduling
514
514
515
515
==================================================================
516
516
!! Host NOT set up correctly for any XR platforms !!
@@ -539,7 +539,7 @@ def test_one_plat_supported(self, capsys):
539
539
540
540
xrd-vrouter checks
541
541
-----------------------
542
- Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size
542
+ Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size, Real-time Group Scheduling
543
543
544
544
==================================================================
545
545
XR platforms supported: xrd-control-plane
@@ -569,7 +569,7 @@ def test_extra_check_not_supported(self, capsys):
569
569
570
570
xrd-vrouter checks
571
571
-----------------------
572
- Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size
572
+ Checks: CPU extensions, RAM, Hugepages, Interface kernel driver, IOMMU, Shared memory pages max size, Real-time Group Scheduling
573
573
574
574
==============================
575
575
Extra checks
@@ -1436,6 +1436,130 @@ def test_both_enabled(self, capsys):
1436
1436
assert not success
1437
1437
1438
1438
1439
+ class TestRealtimeGroupSched (_CheckTestBase ):
1440
+ """Tests for Real-time Group Scheduling disabled check"""
1441
+
1442
+ check_group = "xrd-vrouter"
1443
+ check_name = "Real-time Group Scheduling"
1444
+ files = ["/proc/sys/kernel/sched_rt_runtime_us" ]
1445
+
1446
+ def test_v1_disabled_in_kernel_config (self , capsys ):
1447
+ """Test the v1 case where disabled in kernel config"""
1448
+ with mock .patch (
1449
+ "host_check._get_cgroup_version" , return_value = 1
1450
+ ), mock .patch ("os.path.exists" , return_value = False ):
1451
+ success , output = self .perform_check (capsys , read_effects = None )
1452
+ assert (
1453
+ output
1454
+ == "PASS -- Real-time Group Scheduling (disabled in kernel config)\n "
1455
+ )
1456
+ assert success
1457
+
1458
+ def test_v1_disabled_at_runtime (self , capsys ):
1459
+ """Test the v1 case where disabled at runtime"""
1460
+ with mock .patch (
1461
+ "host_check._get_cgroup_version" , return_value = 1
1462
+ ), mock .patch ("os.path.exists" , return_value = True ):
1463
+ success , output = self .perform_check (capsys , read_effects = "-1" )
1464
+ assert (
1465
+ output
1466
+ == "PASS -- Real-time Group Scheduling (disabled at runtime)\n "
1467
+ )
1468
+ assert success
1469
+
1470
+ def test_v1_read_error (self , capsys ):
1471
+ """Test the limit being too low."""
1472
+ with mock .patch (
1473
+ "host_check._get_cgroup_version" , return_value = 1
1474
+ ), mock .patch ("os.path.exists" , return_value = True ):
1475
+ success , output = self .perform_check (
1476
+ capsys , read_effects = Exception
1477
+ )
1478
+ assert output == textwrap .dedent (
1479
+ """\
1480
+ WARN -- Real-time Group Scheduling
1481
+ Failed to read /proc/sys/kernel/sched_rt_runtime_us, unable to check if
1482
+ real-time group scheduling is disabled.
1483
+ Running with real-time group scheduling enabled is not supported.
1484
+ If real-time group scheduling (RT_GROUP_SCHED) is configured in the kernel,
1485
+ it is required that this feature is disabled at runtime by adding
1486
+ 'kernel.sched_rt_runtime_us=-1' to /etc/sysctl.conf or in a dedicated conf
1487
+ file under /etc/sysctl.d/.
1488
+ For a temporary fix, run:
1489
+ sysctl -w kernel.sched_rt_runtime_us=-1
1490
+ """
1491
+ )
1492
+ assert not success
1493
+
1494
+ def test_v1_failure_enabled_at_runtime (self , capsys ):
1495
+ """Test the check fails in the v1 case where enabled at runtime"""
1496
+ with mock .patch (
1497
+ "host_check._get_cgroup_version" , return_value = 1
1498
+ ), mock .patch ("os.path.exists" , return_value = True ):
1499
+ success , output = self .perform_check (capsys , read_effects = "950000" )
1500
+ assert output == textwrap .dedent (
1501
+ """\
1502
+ FAIL -- Real-time Group Scheduling
1503
+ The kernel parameter kernel.sched_rt_runtime_us is set to 950000
1504
+ but must be disabled by setting it to '-1'.
1505
+ Running with real-time group scheduling enabled is not supported.
1506
+ If real-time group scheduling (RT_GROUP_SCHED) is configured in the kernel,
1507
+ it is required that this feature is disabled at runtime by adding
1508
+ 'kernel.sched_rt_runtime_us=-1' to /etc/sysctl.conf or in a dedicated conf
1509
+ file under /etc/sysctl.d/.
1510
+ For a temporary fix, run:
1511
+ sysctl -w kernel.sched_rt_runtime_us=-1
1512
+ """
1513
+ )
1514
+ assert not success
1515
+
1516
+ def test_v2_disabled_in_kernel_config (self , capsys ):
1517
+ """Test the v2 case where disabled in kernel config"""
1518
+ with mock .patch (
1519
+ "host_check._get_cgroup_version" , return_value = 2
1520
+ ), mock .patch ("os.path.exists" , return_value = False ):
1521
+ success , output = self .perform_check (capsys , read_effects = None )
1522
+ assert (
1523
+ output
1524
+ == "PASS -- Real-time Group Scheduling (disabled in kernel config)\n "
1525
+ )
1526
+ assert success
1527
+
1528
+ def test_v2_disabled_at_runtime (self , capsys ):
1529
+ """Test the v2 case where disabled at runtime"""
1530
+ with mock .patch (
1531
+ "host_check._get_cgroup_version" , return_value = 2
1532
+ ), mock .patch ("os.path.exists" , return_value = True ):
1533
+ success , output = self .perform_check (capsys , read_effects = "-1" )
1534
+ assert (
1535
+ output
1536
+ == "PASS -- Real-time Group Scheduling (disabled at runtime)\n "
1537
+ )
1538
+ assert success
1539
+
1540
+ def test_v2_failure_enabled_at_runtime (self , capsys ):
1541
+ """Test the check fails in the v2 case where enabled at runtime"""
1542
+ with mock .patch (
1543
+ "host_check._get_cgroup_version" , return_value = 2
1544
+ ), mock .patch ("os.path.exists" , return_value = True ):
1545
+ success , output = self .perform_check (capsys , read_effects = "950000" )
1546
+ assert output == textwrap .dedent (
1547
+ """\
1548
+ FAIL -- Real-time Group Scheduling
1549
+ The kernel parameter kernel.sched_rt_runtime_us is set to 950000
1550
+ but must be disabled by setting it to '-1'.
1551
+ Running with real-time group scheduling enabled is not supported.
1552
+ If real-time group scheduling (RT_GROUP_SCHED) is configured in the kernel,
1553
+ it is required that this feature is disabled at runtime by adding
1554
+ 'kernel.sched_rt_runtime_us=-1' to /etc/sysctl.conf or in a dedicated conf
1555
+ file under /etc/sysctl.d/.
1556
+ For a temporary fix, run:
1557
+ sysctl -w kernel.sched_rt_runtime_us=-1
1558
+ """
1559
+ )
1560
+ assert not success
1561
+
1562
+
1439
1563
class TestSocketParameters (_CheckTestBase ):
1440
1564
"""Tests for Socket Kernel Parameters check."""
1441
1565
0 commit comments