Skip to content

Conversation

@ben-grande
Copy link

For: QubesOS/qubes-issues#1512
For: QubesOS/qubes-issues#10027


Bad resolution because of VNC:

hi

It starts the value as 0 but doesn't save it if the feature is not set yet. Yes, there is no way to remove the feature, but value 0 is equal to a deleted feature in this case, as it does not the behavior of preload-dispvm-max being set or not.

<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Memory threshold that is deducted from the calculation of system's available memory. Useful to prevent memory exhaustion.</property>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @adw, could you help me make this clear in case it is not? Could you understand on the first reading?

The calculation is simple:

PRELOAD_MEM = DVM_TEMPLTE.MEM_PROP
USEFUL_MEM = CURRENT_AVAIL_MEM - THRESHOLD
IF USEFUL_MEM > PRELOAD_MEM:
    PRELOAD

But I think it would become more confusing if I were to into the details on the text.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong Andrew ;) @andrewdavidwong

Maybe this could be something like "Memory reserved for preloaded disposables"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, that's not it - maybe something like 'Minimum free memory that has to be available for preloading to start"? In any case, this feels like something we as devs should calculate smartly, not leave it to the user to decide...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, wrong Andrew, sorry...

Minimum free memory that has to be available for preloading to start

It is not that. It is a threshold (static), that value is deducted from the current available memory in the system (volatile), to calculate on runtime if a preload can be created.

Consider this:

  • system maximum memory: 16GB
  • system available memory : 2GB
  • threshold memory: 1500 MiB
  • result: 2GB - 1500MiB = ~500MiB

This would allow one qube that has memory property of 400 MiB to be preloaded.


About calculating smartly, I sure would like for this to be set automatically via GUI but customizable via CLI (some OpenQA runs are capped to 8GB of RAM, so I'd not set the threshold or set it to 0). The GUI then, would not modify the value if the feature is already set via CLI. This works as long as the calculating algorithm doesn't change, cause then, we'd have no way to updated it without overriding user's choice.

If you see the commit history, there was a time that I was defaulting to 1000MiB, but I thought it was too arbitrary.

I have a 32GB system, xl info total_memory reports 32404 MB.

>>> def MB_to_MiB(size):
...    return size * 1000**2 / 1024**2

>>> total_memory_MB = 32404
>>> total_memory_MiB = MB_to_MiB(total_memory_MB)
>>> value = int(total_memory_MiB * 0.05)
>>> value
1545
>>> min(max(value, 1000), 6000)  # 1000 <= value <= 6000

For comparison:

total mem reserved mem
8GB 1000MiB*
16GB 1000MiB
24GB 1158MiB
32GB 1545MiB
64GB 3090MiB
96GB 4635MiB
128GB 6000MiB

* disabled for openqa

Is this 5% enough or too much? Depends on each user's workflow. On a 16GB system, I notice significant slowdowns on the system when there is less than one 1GB of free memory, so I think 5% should be enough.

@marmarek had some problems with starting out of memory by the preload qube attempting to start at the same time as the normal disposable qube, a delay of some seconds was added to that to check the memory again, but a threshold seems best to prevent the memory starvation case.

But I am not sure if this number should be decided by the total memory of the system, because I don't think GUIVM can do xl info total_memory.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about: "The amount of free system memory that will never be used for preloading disposables. Ensures preloaded disposables do not consume all available memory."

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about: "The amount of free system memory that will never be used for preloading disposables. Ensures preloaded disposables do not consume all available memory."

That is very good.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because GUI domain doesn't now the system's total memory, the installer will set via Salt on dom0 the threshold feature based on the total memory of the system. This way, there is no need to duplicate the logic here.

@marmarek
Copy link
Member

marmarek commented Aug 4, 2025

pylint complains (and not because of core-admin-client PR not merged yet)

@qubesos-bot
Copy link

qubesos-bot commented Aug 4, 2025

OpenQA test summary

Complete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2025080809-4.3&flavor=pull-requests

Test run included the following:

New failures, excluding unstable

Compared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2025061004-4.3&flavor=update

  • system_tests_dispvm

    • TC_20_DispVM_debian-12-xfce: test_019_preload_refresh (error + timed out)
      qubes.exc.QubesVMShutdownTimeoutError: Domain shutdown timed out: '...
  • system_tests_audio

  • system_tests_qwt_win10@hw13

    • windows_clipboard_and_filecopy: unnamed test (unknown)
    • windows_clipboard_and_filecopy: Failed (test died)
      # Test died: no candidate needle with tag(s) 'file-copy-prompt' mat...
  • system_tests_qwt_win10_seamless@hw13

    • windows_clipboard_and_filecopy: unnamed test (unknown)
    • windows_clipboard_and_filecopy: Failed (test died)
      # Test died: no candidate needle with tag(s) 'windows-Edge-address-...
  • system_tests_qwt_win11@hw13

    • windows_install: wait_serial (wait serial expected)
      # wait_serial expected: qr/qDqV_-\d+-/...

    • windows_install: Failed (test died + timed out)
      # Test died: command 'script -e -c 'bash -x /usr/bin/qvm-create-win...

  • system_tests_dispvm_perf@hw7

    • TC_00_DispVMPerf_whonix-workstation-17: test_003_dispvm_gui_concurrent (failure)
      AssertionError: '/usr/lib/qubes/tests/dispvm_perf.py --dvm=test-ins...
  • system_tests_basic_vm_qrexec_gui@hw7

    • startup: unnamed test (unknown)
    • startup: Failed (test died)
      # Test died: no candidate needle with tag(s) 'nm-applet' matched...
  • system_tests_guivm_gpu_gui_interactive@hw13

    • guivm_startup: wait_serial (wait serial expected)
      # wait_serial expected: qr/lEcbc-\d+-/...

    • guivm_startup: Failed (test died + timed out)
      # Test died: command '! qvm-check sys-whonix || time qvm-start sys-...

Failed tests

15 failures
  • system_tests_dispvm

    • TC_20_DispVM_debian-12-xfce: test_019_preload_refresh (error + timed out)
      qubes.exc.QubesVMShutdownTimeoutError: Domain shutdown timed out: '...
  • system_tests_audio

  • system_tests_qwt_win10@hw13

    • windows_clipboard_and_filecopy: unnamed test (unknown)
    • windows_clipboard_and_filecopy: Failed (test died)
      # Test died: no candidate needle with tag(s) 'file-copy-prompt' mat...
  • system_tests_qwt_win10_seamless@hw13

    • windows_clipboard_and_filecopy: unnamed test (unknown)
    • windows_clipboard_and_filecopy: Failed (test died)
      # Test died: no candidate needle with tag(s) 'windows-Edge-address-...
  • system_tests_qwt_win11@hw13

    • windows_install: wait_serial (wait serial expected)
      # wait_serial expected: qr/qDqV_-\d+-/...

    • windows_install: Failed (test died + timed out)
      # Test died: command 'script -e -c 'bash -x /usr/bin/qvm-create-win...

  • system_tests_dispvm_perf@hw7

    • TC_00_DispVMPerf_whonix-workstation-17: test_003_dispvm_gui_concurrent (failure)
      AssertionError: '/usr/lib/qubes/tests/dispvm_perf.py --dvm=test-ins...
  • system_tests_basic_vm_qrexec_gui@hw7

    • startup: unnamed test (unknown)
    • startup: Failed (test died)
      # Test died: no candidate needle with tag(s) 'nm-applet' matched...
  • system_tests_kde_gui_interactive

    • gui_keyboard_layout: wait_serial (wait serial expected)
      # wait_serial expected: "echo -e '[Layout]\nLayoutList=us,de' | sud...

    • gui_keyboard_layout: Failed (test died)
      # Test died: command 'test "$(cd ~user;ls e1*)" = "$(qvm-run -p wor...

  • system_tests_guivm_gpu_gui_interactive@hw13

    • guivm_startup: wait_serial (wait serial expected)
      # wait_serial expected: qr/lEcbc-\d+-/...

    • guivm_startup: Failed (test died + timed out)
      # Test died: command '! qvm-check sys-whonix || time qvm-start sys-...

Fixed failures

Compared to: https://openqa.qubes-os.org/tests/142375#dependencies

11 fixed

Unstable tests

Performance Tests

Performance degradation:

3 performance degradations
  • debian-12-xfce_exec-data-simplex: 72.58 🔺 ( previous job: 65.51, degradation: 110.79%)
  • debian-12-xfce_exec-data-duplex-root: 82.13 🔺 ( previous job: 70.01, degradation: 117.32%)
  • whonix-workstation-17_exec-data-duplex-root: 108.22 🔺 ( previous job: 86.00, degradation: 125.83%)

Remaining performance tests:

130 tests
  • debian-12-xfce_exec: 7.94 🟢 ( previous job: 8.63, improvement: 91.99%)
  • debian-12-xfce_exec-root: 27.65 🟢 ( previous job: 29.44, improvement: 93.93%)
  • debian-12-xfce_socket: 8.46 🟢 ( previous job: 8.50, improvement: 99.51%)
  • debian-12-xfce_socket-root: 8.62 🔺 ( previous job: 8.31, degradation: 103.64%)
  • debian-12-xfce_exec-data-duplex: 69.64 🟢 ( previous job: 73.55, improvement: 94.69%)
  • debian-12-xfce_socket-data-duplex: 144.00 🟢 ( previous job: 161.35, improvement: 89.24%)
  • fedora-42-xfce_exec: 9.10
  • fedora-42-xfce_exec-root: 58.20
  • fedora-42-xfce_socket: 8.75
  • fedora-42-xfce_socket-root: 8.48
  • fedora-42-xfce_exec-data-simplex: 60.85
  • fedora-42-xfce_exec-data-duplex: 74.87
  • fedora-42-xfce_exec-data-duplex-root: 102.84
  • fedora-42-xfce_socket-data-duplex: 157.36
  • whonix-gateway-17_exec: 6.12 🟢 ( previous job: 7.34, improvement: 83.32%)
  • whonix-gateway-17_exec-root: 41.46 🔺 ( previous job: 39.57, degradation: 104.76%)
  • whonix-gateway-17_socket: 7.88 🔺 ( previous job: 7.85, degradation: 100.31%)
  • whonix-gateway-17_socket-root: 7.36 🟢 ( previous job: 7.89, improvement: 93.27%)
  • whonix-gateway-17_exec-data-simplex: 78.75 🔺 ( previous job: 77.76, degradation: 101.26%)
  • whonix-gateway-17_exec-data-duplex: 79.16 🔺 ( previous job: 78.39, degradation: 100.98%)
  • whonix-gateway-17_exec-data-duplex-root: 94.20 🔺 ( previous job: 90.74, degradation: 103.81%)
  • whonix-gateway-17_socket-data-duplex: 166.64 🔺 ( previous job: 161.95, degradation: 102.90%)
  • whonix-workstation-17_exec: 8.07 🟢 ( previous job: 8.27, improvement: 97.58%)
  • whonix-workstation-17_exec-root: 54.29 🟢 ( previous job: 57.61, improvement: 94.24%)
  • whonix-workstation-17_socket: 9.13 🔺 ( previous job: 8.97, degradation: 101.82%)
  • whonix-workstation-17_socket-root: 8.10 🟢 ( previous job: 9.46, improvement: 85.58%)
  • whonix-workstation-17_exec-data-simplex: 78.77 🔺 ( previous job: 74.54, degradation: 105.68%)
  • whonix-workstation-17_exec-data-duplex: 76.07 🔺 ( previous job: 74.84, degradation: 101.65%)
  • whonix-workstation-17_socket-data-duplex: 170.98 🔺 ( previous job: 160.20, degradation: 106.73%)
  • debian-12-xfce_dispvm(avg:6.038): 96.61
  • debian-12-xfce_dispvm-gui(avg:7.168): 114.69
  • debian-12-xfce_dispvm-concurrent(avg:2.855): 45.67
  • debian-12-xfce_dispvm-gui-concurrent(avg:3.517): 56.27
  • debian-12-xfce_dispvm-dom0(avg:6.747): 107.95
  • debian-12-xfce_dispvm-dom0-gui(avg:7.949): 127.19
  • debian-12-xfce_dispvm-dom0-concurrent(avg:3.278): 52.45
  • debian-12-xfce_dispvm-dom0-gui-concurrent(avg:3.819): 61.10
  • debian-12-xfce_dispvm-preload(avg:3.539): 56.62
  • debian-12-xfce_dispvm-preload-gui(avg:4.014): 64.23
  • debian-12-xfce_dispvm-preload-concurrent(avg:2.604): 41.66
  • debian-12-xfce_dispvm-preload-gui-concurrent(avg:3.198): 51.16
  • debian-12-xfce_dispvm-preload-dom0(avg:3.556): 56.90
  • debian-12-xfce_dispvm-preload-dom0-gui(avg:5.308): 84.93
  • debian-12-xfce_dispvm-preload-dom0-concurrent(avg:2.925): 46.81
  • debian-12-xfce_dispvm-preload-dom0-gui-concurrent(avg:3.666): 58.65
  • debian-12-xfce_dispvm-api(avg:6.828): 109.25
  • debian-12-xfce_dispvm-gui-api(avg:7.894): 126.31
  • debian-12-xfce_dispvm-concurrent-api(avg:3.222): 51.56
  • debian-12-xfce_dispvm-gui-concurrent-api(avg:3.808): 60.92
  • debian-12-xfce_dispvm-preload-api(avg:3.576): 57.21
  • debian-12-xfce_dispvm-preload-less-api(avg:6.112): 97.80
  • debian-12-xfce_dispvm-preload-more-api(avg:3.883): 62.12
  • debian-12-xfce_dispvm-preload-gui-api(avg:5.073): 81.17
  • debian-12-xfce_dispvm-preload-concurrent-api(avg:2.939): 47.02
  • debian-12-xfce_dispvm-preload-gui-concurrent-api(avg:3.630): 58.09
  • debian-12-xfce_vm(avg:0.410): 6.56
  • debian-12-xfce_vm-gui(avg:0.512): 8.19
  • debian-12-xfce_vm-concurrent(avg:0.412): 6.58
  • debian-12-xfce_vm-gui-concurrent(avg:0.446): 7.13
  • debian-12-xfce_vm-api(avg:0.096): 1.54
  • debian-12-xfce_vm-gui-api(avg:0.124): 1.98
  • debian-12-xfce_vm-concurrent-api(avg:0.048): 0.77
  • debian-12-xfce_vm-gui-concurrent-api(avg:0.109): 1.75
  • fedora-42-xfce_dispvm(avg:7.218): 115.50
  • fedora-42-xfce_dispvm-gui(avg:8.632): 138.11
  • fedora-42-xfce_dispvm-concurrent(avg:3.771): 60.34
  • fedora-42-xfce_dispvm-gui-concurrent(avg:4.448): 71.17
  • fedora-42-xfce_dispvm-dom0(avg:7.791): 124.66
  • fedora-42-xfce_dispvm-dom0-gui(avg:9.187): 147.00
  • fedora-42-xfce_dispvm-dom0-concurrent(avg:3.948): 63.17
  • fedora-42-xfce_dispvm-dom0-gui-concurrent(avg:4.966): 79.45
  • fedora-42-xfce_dispvm-preload(avg:4.314): 69.02
  • fedora-42-xfce_dispvm-preload-gui(avg:4.907): 78.51
  • fedora-42-xfce_dispvm-preload-concurrent(avg:3.083): 49.33
  • fedora-42-xfce_dispvm-preload-gui-concurrent(avg:4.403): 70.44
  • fedora-42-xfce_dispvm-preload-dom0(avg:4.537): 72.59
  • fedora-42-xfce_dispvm-preload-dom0-gui(avg:5.851): 93.61
  • fedora-42-xfce_dispvm-preload-dom0-concurrent(avg:3.846): 61.53
  • fedora-42-xfce_dispvm-preload-dom0-gui-concurrent(avg:4.468): 71.48
  • fedora-42-xfce_dispvm-api(avg:7.845): 125.52
  • fedora-42-xfce_dispvm-gui-api(avg:9.496): 151.94
  • fedora-42-xfce_dispvm-concurrent-api(avg:3.985): 63.75
  • fedora-42-xfce_dispvm-gui-concurrent-api(avg:4.700): 75.20
  • fedora-42-xfce_dispvm-preload-api(avg:4.581): 73.29
  • fedora-42-xfce_dispvm-preload-less-api(avg:7.390): 118.23
  • fedora-42-xfce_dispvm-preload-more-api(avg:4.343): 69.48
  • fedora-42-xfce_dispvm-preload-gui-api(avg:5.629): 90.06
  • fedora-42-xfce_dispvm-preload-concurrent-api(avg:3.592): 57.47
  • fedora-42-xfce_dispvm-preload-gui-concurrent-api(avg:4.671): 74.73
  • fedora-42-xfce_vm(avg:0.594): 9.51
  • fedora-42-xfce_vm-gui(avg:0.575): 9.20
  • fedora-42-xfce_vm-concurrent(avg:0.538): 8.60
  • fedora-42-xfce_vm-gui-concurrent(avg:0.642): 10.27
  • fedora-42-xfce_vm-api(avg:0.145): 2.32
  • fedora-42-xfce_vm-gui-api(avg:0.147): 2.35
  • fedora-42-xfce_vm-concurrent-api(avg:0.095): 1.52
  • fedora-42-xfce_vm-gui-concurrent-api(avg:0.136): 2.18
  • whonix-workstation-17_dispvm(avg:8.013): 128.21
  • whonix-workstation-17_dispvm-gui(avg:9.209): 147.34
  • whonix-workstation-17_dispvm-concurrent(avg:4.063): 65.00
  • whonix-workstation-17_dispvm-dom0(avg:8.500): 136.00
  • whonix-workstation-17_dispvm-dom0-gui(avg:9.758): 156.12
  • whonix-workstation-17_dispvm-dom0-concurrent(avg:4.537): 72.59
  • whonix-workstation-17_dispvm-dom0-gui-concurrent(avg:5.497): 87.94
  • whonix-workstation-17_dispvm-preload(avg:7.518): 120.30
  • whonix-workstation-17_dispvm-preload-gui(avg:8.814): 141.02
  • whonix-workstation-17_dispvm-preload-concurrent(avg:4.179): 66.86
  • whonix-workstation-17_dispvm-preload-gui-concurrent(avg:5.023): 80.37
  • whonix-workstation-17_dispvm-preload-dom0(avg:5.230): 83.68
  • whonix-workstation-17_dispvm-preload-dom0-gui(avg:6.578): 105.25
  • whonix-workstation-17_dispvm-preload-dom0-concurrent(avg:4.470): 71.52
  • whonix-workstation-17_dispvm-preload-dom0-gui-concurrent(avg:5.596): 89.53
  • whonix-workstation-17_dispvm-api(avg:8.697): 139.16
  • whonix-workstation-17_dispvm-gui-api(avg:9.839): 157.43
  • whonix-workstation-17_dispvm-concurrent-api(avg:4.435): 70.95
  • whonix-workstation-17_dispvm-gui-concurrent-api(avg:5.121): 81.94
  • whonix-workstation-17_dispvm-preload-api(avg:5.173): 82.77
  • whonix-workstation-17_dispvm-preload-less-api(avg:8.282): 132.51
  • whonix-workstation-17_dispvm-preload-more-api(avg:5.682): 90.91
  • whonix-workstation-17_dispvm-preload-gui-api(avg:6.871): 109.94
  • whonix-workstation-17_dispvm-preload-concurrent-api(avg:4.766): 76.26
  • whonix-workstation-17_dispvm-preload-gui-concurrent-api(avg:5.657): 90.51
  • whonix-workstation-17_vm(avg:0.589): 9.43
  • whonix-workstation-17_vm-gui(avg:0.582): 9.32
  • whonix-workstation-17_vm-concurrent(avg:0.580): 9.28
  • whonix-workstation-17_vm-gui-concurrent(avg:0.629): 10.06
  • whonix-workstation-17_vm-api(avg:0.146): 2.34
  • whonix-workstation-17_vm-gui-api(avg:0.163): 2.61
  • whonix-workstation-17_vm-concurrent-api(avg:0.134): 2.15
  • whonix-workstation-17_vm-gui-concurrent-api(avg:0.160): 2.55

@ben-grande
Copy link
Author

PipelineRetryFailed

@marmarek
Copy link
Member

marmarek commented Aug 7, 2025

PipelineRetry

@codecov
Copy link

codecov bot commented Aug 7, 2025

Codecov Report

❌ Patch coverage is 98.63014% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.01%. Comparing base (70de337) to head (a8a15ca).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
qubes_config/tests/test_basics_handler.py 97.43% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #272      +/-   ##
==========================================
+ Coverage   93.00%   93.01%   +0.01%     
==========================================
  Files          64       64              
  Lines       13217    13269      +52     
==========================================
+ Hits        12292    12342      +50     
- Misses        925      927       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ben-grande
Copy link
Author

ben-grande commented Aug 7, 2025

Passed checks: codecov/patch is considering tests.

Copy link
Member

@marmarta marmarta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's almost ideal, except for this small alignment issue.

<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkSpinButton" id="basics_preload_dispvm_threshold">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs margin-start? Because in the finished window it's a couple of pixels to the left of the other controls in its column.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@ben-grande ben-grande force-pushed the preload-mem-threshold branch from dd2b3a9 to a8a15ca Compare August 8, 2025 09:25
@marmarek marmarek merged commit a14ba90 into QubesOS:main Aug 8, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants