Skip to content

Commit 6efcb7e

Browse files
[spyre] Update memlock ulimit for sentient group based on card count
Multi-card Spyre containers can eventually exhaust locked memory, causing the containers to exit unexpectedly. Update the memlock configuration to scale based on the number of Spyre cards present in the system. This sets the memlock limit to the maximum value containers may consume, preventing exits due to locked memory exhaustion. The memlimit value was determined experimentally using: memlimit = (number_of_spyre_cards) * (128GB + 16MB) Signed-off-by: Sahithi Ravindranath <Sahithi.Ravindranath@ibm.com>
1 parent 306b17a commit 6efcb7e

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

  • servicereportpkg/validate/plugins

servicereportpkg/validate/plugins/spyre.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,21 @@ def __init__(self):
3030
self.name = Spyre.__name__
3131
self.description = Spyre.__doc__
3232

33+
"""
34+
This helper function identifies spyre cards among the existing pci cards
35+
and gets the number of spyre cards available in the system.
36+
37+
Args:
38+
None
39+
40+
Returns:
41+
int: number of spyre cards in the system.
42+
"""
3343
@classmethod
34-
def is_spyre_card_exists(cls):
35-
"""Return True if spyre exists in the system otherwise False"""
44+
def get_number_of_spyre_cards(cls):
45+
"""Returns number of spyre cards in the device"""
3646

47+
number_of_cards = 0
3748
context = pyudev.Context()
3849
# IBM vendor ID
3950
spyre_vendor_ids = ["0x1014"]
@@ -49,15 +60,15 @@ def is_spyre_card_exists(cls):
4960
if device_id not in spyre_device_ids:
5061
continue
5162

52-
return True
63+
number_of_cards += 1
5364

54-
return False
65+
return number_of_cards
5566

5667
@classmethod
5768
def is_applicable(cls):
5869
"""Returns True if plugin is applicable otherwise False"""
5970

60-
return Spyre.is_spyre_card_exists()
71+
return (Spyre.get_number_of_spyre_cards())>0
6172

6273
def check_driver_config(self):
6374
"""VFIO Driver configuration"""
@@ -185,7 +196,8 @@ def validate_mem_limit_config(self, conf_check,
185196
def check_memlock_conf(self):
186197
"""User memlock configuration"""
187198

188-
memlimit = 134217728
199+
num_cards = Spyre.get_number_of_spyre_cards()
200+
memlimit = num_cards * 134234112
189201
vfio_mem_conf = [f"@sentient - memlock {memlimit}"]
190202
config_file = "/etc/security/limits.d/memlock.conf"
191203

0 commit comments

Comments
 (0)