You are not logged in.

#1 2024-04-05 11:37:41

LaserB
Member
Registered: 2024-04-05
Posts: 1

Swap on VRAM error

Hello, I am trying to set the swap on my VRAM. My laptop has a discrete NVIDIA graphic card which I don't use with 4 GB of VRAM. I am following the Arch Wiki https://wiki.archlinux.org/title/Swap_on_video_RAM, but I am not able to create the swap.

This is what I did:

lspci -vvv output:

VGA compatible controller: NVIDIA Corporation GA107M [GeForce RTX 3050 Ti Mobile] (rev a1) (prog-if 00 [VGA controller])
DeviceName: Second VGA
Subsystem: ASUSTeK Computer Inc. GA107M [GeForce RTX 3050 Ti Mobile]
Physical Slot: 1
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 153
IOMMU group: 16
Region 0: Memory at 83000000 (32-bit, non-prefetchable) [size=16M]
Region 1: Memory at 6000000000 (64-bit, prefetchable) [size=4G]
Region 3: Memory at 6100000000 (64-bit, prefetchable) [size=32M]
Region 5: I/O ports at 4000 [size=128]
Expansion ROM at 84000000 [disabled] [size=512K]
Capabilities: <access denied>
Kernel driver in use: nouveau
Kernel modules: nouveau

I would like to use region 1, so I create the /etc/modprobe.d/vram-swap.conf file. I set all VRAM space because I am not going to use the graphics card at all (I also tried with less):

options phram phram=VRAM,0x6000000000,4096Mi

I also create the /etc/modules-load.d/vramswap.conf file for the two modules.

Now I see the correct mtd block:

mtd0: fe000000 00001000 "VRAM"

Before trying to make it automatic with systemd I want to try to do it manually:

sudo mkswap /dev/mtdblock0
Setting up swapspace version 1, size = 4 GiB (4261408768 bytes)
no label, UUID=d0e118e5-1ef2-4027-be1a-88395bc12d93

The problem is that the command doesn't seem to have any effect on the system. It does not appear in the blkid output. Then if I try to enable it I get this error:

sudo swapon /dev/mtdblock0 -p 10
swapon: /dev/mtdblock0: read swap header failed

What do you think I'm doing wrong? Thank you!

Offline

#2 2024-04-05 12:20:44

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,287

Re: Swap on VRAM error

https://bbs.archlinux.org/viewtopic.php … 0#p1478040

head -c4k /dev/mtdblock0

should say sth. like "SWAPSWAPSPACE2"

The "4096Mi" looks questionable, the suggested syntax is hexadecimal bytes, ie. 0x100000000
The "00001000" up there looks more like 4096 bytes hmm

Offline

#3 2024-04-05 19:30:11

Laserc2
Member
Registered: 2024-04-05
Posts: 6

Re: Swap on VRAM error

Hello, sorry if I write with my second account, but I have completely lost access to the other one. Anyway, I have changed 4096 Mi and now I see this:

dev:    size   erasesize  name
mtd0: 100000000 00001000 "VRAM"

This is the output of the head command:

sudo head -c4k /dev/mtdblock0 | hexdump
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0001000

I still get the same error. I tried to follow the link you sent, but no luck. Unfortunately I don't see much support for this online.

Offline

#4 2024-04-05 19:58:44

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,287

Re: Swap on VRAM error

You're trying to use the complete VRAM, have you made sure the GPU isn't used by anything (specifically X11)?

Offline

#5 2024-04-05 20:35:23

Laserc2
Member
Registered: 2024-04-05
Posts: 6

Re: Swap on VRAM error

Thank you for your help, I really appreciate it.

I checked with:

sudo cat /sys/kernel/debug/vgaswitcheroo/switch
0:DIS: :DynOff:0000:01:00.0
1:IGD:+:Pwr:0000:00:02.0

The first is the Nvidia one, and according to the Gentoo wiki "DIS represents the discrete graphics card, which is inactive, but currently disconnected (DynOff)." (https://wiki.gentoo.org/wiki/AMDGPU#Ide … _is_in_use).

My laptop should be only using the integrated one. Is there any other way I can check if the discrete one is being used? I also tried to do the same process leaving 32 MB to the GPU and I got the same error.

Offline

#6 2024-04-05 20:43:27

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,287

Re: Swap on VRAM error

The "dynoff" might actually be an issue (see mich41's concern in the old thread) - what if you move it "ON"?

Offline

#7 2024-04-06 06:14:29

Laserc2
Member
Registered: 2024-04-05
Posts: 6

Re: Swap on VRAM error

I tried with these two commands as root but it remains on dynoff.

echo "ON" > /sys/kernel/debug/vgaswitcheroo/switch
echo "DIS" > /sys/kernel/debug/vgaswitcheroo/switch

What I understood is that it means it is ready to work when needed. If I do "DRI_PRIME=1 glxgears" it turns to dynpwr.

Last edited by Laserc2 (2024-04-06 06:15:31)

Offline

#8 2024-04-06 06:41:36

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,287

Re: Swap on VRAM error

If I do "DRI_PRIME=1 glxgears" it turns to dynpwr.

seth wrote:

You're trying to use the complete VRAM, have you made sure the GPU isn't used by anything (specifically X11)?

Have you tried the behavior on the multi-user.target (2nd link below, no X11/wayland running whatsoever)?
You'll probably have to completely disable the GPU for X11, ie. DRI_PRIME won't work/is inert.

Offline

#9 2024-04-06 07:08:00

Laserc2
Member
Registered: 2024-04-05
Posts: 6

Re: Swap on VRAM error

On multi-user.target I got the same error. Also, I'm on Wayland.

Regarding disabling the GPU, on the wiki I only see ways to completely disable it. If I blacklist the nouveau driver, DRI_PRIME does not work anymore, but I still can't create the swap.

At this point, I'm really out of ideas. The strange thing to me is that mkswap does not give any error.

Offline

#10 2024-04-06 07:54:35

Laserc2
Member
Registered: 2024-04-05
Posts: 6

Re: Swap on VRAM error

I've just tried setting mtdblock0 as 256 MB, but got the same error.

Offline

Board footer

Powered by FluxBB