“maxmem” ? You disabled memory balancing, correct ?
I don’t have issue doing what you are trying to do, and if you haven’t done any modification to either xen.xml or stubdom then I have no idea what the problem could be.
Maybe this specific usb controller have requirement similar to a GPU, but that case should not exist
If you try the same thing in a linux HVM, does it work ?
If it doesn’t work in the linux HVM, set the ram to ~500MiB and share the output of the command lspci -vvvnns YOUR_USB_CONTROLLER_IDENTIFIER from your linux hvm
Ok, I have a ugly bruteforce proposal.
Trying a lot of different values for max-ram-below-4g.
Clone your linux hvm (with your usb pci passthrough and 8G of ram) to a vm named “totest”
In dom0, copy the script “putain1.sh” and run it
(The goal of this script is to create a stubdom rootfs with configurable value for max-ram-below-4g)
putain1.sh :
#!/bin/bash
patch_rootfs(){
filename=${1?Filename is required}
cd ~/
sudo rm -R "patched_$filename"
mkdir "patched_$filename"
cp /usr/libexec/xen/boot/$filename "patched_$filename/$filename.gz"
cp /usr/libexec/xen/boot/$filename "$filename.original"
cd patched_$filename
gunzip $filename.gz
cpio -i -d -H newc --no-absolute-filenames < "$filename"
sudo rm $filename
grep -i "max-ram-below-4g" init && echo "!!ERROR!! The thing is already patched ! EXITING ! " >&2 && exit
patch_string=$(cat <<'EOF'
vm_name=$(xenstore-read "/local/domain/$domid/name")
if [ $(echo "$vm_name" | grep -iEc '^gpu_' ) -eq 1 ]; then
max_ram_below_4g=$(echo "$vm_name" | grep -iEo "_([0-9]*(n[0-9]*)?)._" | cut -d '_' -f 2)
if [[ -z "$max_ram_below_4g" ]];
then
max_ram_below_4g="2G"
fi
max_ram_below_4g=$(echo "$max_ram_below_4g" | sed 's/n/./g')
dm_args=$(echo "$dm_args" | sed -n '1h;2,$H;${g;s/\\(-machine\\nxenfv\\)/\\1,max-ram-below-4g='"$max_ram_below_4g"'/g;p}')
fi
\# $dm_args and $kernel
EOF
)
awk -v r="$patch_string" '{gsub(/^# \$dm_args and \$kernel/,r)}1' init > init2
mv init2 init
chmod +x init
find . -print0 | cpio --null -ov \
--format=newc | gzip -9 > ../$filename.patched
sudo cp ../$filename.patched /usr/libexec/xen/boot/$filename
cd ~/
}
grep -i "max-ram-below-4g" /usr/share/qubes/templates/libvirt/xen.xml && "!!ERROR!! xen.xml is patched ! EXITING ! " && exit
patch_rootfs "qemu-stubdom-linux-rootfs"
patch_rootfs "qemu-stubdom-linux-full-rootfs"
echo "stubdom have been patched."
Then in dom0 copy the file “putain2.sh” and run it.
The goal of this script is to try a lot of different value for max-ram-below-4g.
putain2 :
#!/bin/bash
VM_TO_TEST="totest"
data=$(qvm-prefs "$VM_TO_TEST")
echo "$data" | grep -E "^name" || echo "The VM $VM_TO_TEST doesn't exist. it will crash"
echo "$data" | grep -E "^virt_mode"
echo "$data" | grep -E "^maxmem"
echo "$data" | grep -E "^memory"
for i in "4G" "3.9G" "3.6G" "3.5G" "3.4G" "3.1G" "3G" "2.9G" "2.6G" "2.5G" "2.4G" "2.1G" "2G" "1.9G" "1.6G" "1.5G" "1.4G" "1.1G" "1G" "0.9G" "0.6G" "0.5G" "0.4G"
do
echo "testing $i"
newvm="gpu_""$i""_putain"
newvm=$(echo "$newvm" | sed "s/\./n/g")
echo "trying to create $newvm"
qvm-clone "$VM_TO_TEST" "$newvm"
# Depending on how slow your computer is you could need to increase the value '30' to something bigger
sleep 30 && qvm-shutdown --force "$newvm" 2> /dev/null > /dev/null &
qvm-run --pass-io "$newvm" "uname -a" && echo "SUCCESS! REPORT THIS: $newvm"
qvm-shutdown --force "$newvm"
# Depending on how slow your computer is you could need to increase the value '10' to something bigger
sleep 10
qvm-remove -f "$newvm"
done
I am interested in the output of thoses scripts.
“SUCCESS! REPORT THIS” being the one that interest you the most.
If you find no “SUCCESS! REPORT THIS” in the output of “putain2.sh” you can try to add additional value in the putain2.sh script (like testing every 100mb of ram “4G” “3.9G” “3.8G” “3.7G” … “0.2G” “0.1G” )
I have the exact same problem. Windows 10 guest, only a single Thunderbolt USB dock attached via the Qube Manager. It works when memory is set to 800MB, but not if I use anything larger. @balko did you make progress on this?
No progress. @neowutran in the previous post gave me some info about what else can be tried with this max-ram-below-4g magic, but I has not tried it yet and currently I work without PCI attachment in Win10 (and have a lot of memory set).
So, maybe you can try it, especially considering the fact your limit of 800 MiB is almost the same as I had.
It is a different issue (and reason), isn’t it? I mean your case is even worse and should be addressed faster by devs. Can you remind the issue on github?
Well, I had the problem with only PCI right from the start. Yes, it is about USB Controller, but it is a PCI device, not USB device itself. So, nothing actually changed for me. If I attach PCI USB Controller to the Win10 qube it won’t start with any reasonable amount of memory.