Finally some success with suspend/resume

Crivens

Moderator
Staff member
Moderator

Reaction score: 1,593
Messages: 2,473

Hello world,

I finally had some progress with my laptop which would not resume. Resume from S3 would result in a forced power cycle after watching a black screen until bored.

What did the trick for me was to set
Code:
hw.usb.no_suspend_wait=1
and now it works a lot better. Well, this is easy considering it did not work at all before that. And it only works when in the console, not X11. That is a bit strange, the console is using the new vt driver, so basically there should be little difference, yes?

Anyway, I post this here so some other users may have a try at this. The most interesting point is that suspend/resume would also hang when USB was disabled in the BIOS and no driver was loaded. Now it would be interesting what else that sysctl affects, but that is "more research required".
 
OP
Crivens

Crivens

Moderator
Staff member
Moderator

Reaction score: 1,593
Messages: 2,473

To be more detailed: I cleaned up my sysctl.conf after the success to remove old crud from a long history of getting this to work. And what could possibly go wrong? It did no longer work. You also need these entries:
Code:
hw.pci.do_power_suspend=0
hw.pci.do_power_nodriver=1
The last one, I am not sure about. But I have restored them from a backup and it now works. So you need more than one setting, and why these are connected is not really obvious (to me).
 
OP
Crivens

Crivens

Moderator
Staff member
Moderator

Reaction score: 1,593
Messages: 2,473

It's an ASUS F8P. The ACPI seems to be, well, seems to have much room for improvements on any ASUS hardware I have. This might be normal, as I do not switch my hardware like some fashion victim, it has to work some years before being even considered old. So my experience with newer hardware (<5 years) is very limited. Maybe it is much better these days, maybe not.
 

Juanitou

Well-Known Member

Reaction score: 127
Messages: 453

Also, do you know why there are no memstick images of FreeBSD-11.0-CURRENT for amd64 or i386 here?
 

jrm@

Daemon
Developer

Reaction score: 489
Messages: 1,215

I asked Glen Barber and he said there is a problem. They should be back soon.
 
OP
Crivens

Crivens

Moderator
Staff member
Moderator

Reaction score: 1,593
Messages: 2,473

To be more detailed: I cleaned up my sysctl.conf after the success to remove old crud from a long history of getting this to work. And what could possibly go wrong? It did no longer work. You also need these entries:

The last one, I am not sure about. But I have restored them from a backup and it now works. So you need more than one setting, and why these are connected is not really obvious (to me).
And I found something which I consider worth mentioning: you not only need to disable the power management for suspend, but you have to keep the power management for resume!

So this is my current sysctl.conf:
Code:
#do this to keep suspend from hanging the system at resume
hw.usb.no_suspend_wait=1
hw.pci.do_power_suspend=0

#just to make sure...
hw.pci.do_power_resume=1

hw.pci.do_power_nodriver=3

hw.acpi.lid_switch_state=S3
Also I would like to take this chance to praise ZFS for its robustness while trying things out - no file system damage from not resuming is a great thing.
 
OP
Crivens

Crivens

Moderator
Staff member
Moderator

Reaction score: 1,593
Messages: 2,473

Well, when I discovered 2 days ago that I was running a system from november, I did an update to 10.1-STABLE r276813, but now suspend is completely borked. When it was a good chance that the resume would work 2 out of three times, it now does not even suspend correctly. Just the screen goes dark, and that's it. Setting debug.acpi.suspend_bounce to 1 does not give information, it also simply turns the screen off and does nothing. And that is even the case when all settings I had done before are removed. So, sadly I am worse off than before, but I will not give up. Who knows, in the end this might motivate me enough to work on some suspend-to-disc.
 
OP
Crivens

Crivens

Moderator
Staff member
Moderator

Reaction score: 1,593
Messages: 2,473

Okay - I was at the point where the system will not even suspend. One good tip for anyone trying to get suspend/resume to work is this: get rid of VESA support in your kernel config!

After removing this by the use of a nooptions VESA line in my kernel config (you see, I include GENERIC and strip out anything I do not need) I can now suspend and resume again. This worked in 100% of attempts (N=1, so there is more testing needed!), but all in all this looks like it can be the problem.
 

merkata

New Member

Reaction score: 1
Messages: 1

I'm writing in this thread, because I found it while on my quest to get my suspend/resume working (again) on my Sony VAIO VPCYB3V1E - it wasn't working on 10.1, so I updated to -CURRENT and things were looking pretty great (suspend/resume working with some graphics issues on resuming that were fixed in later commits). Now this is some months ago and update after update things were the same or better. I hadn't updated -CURRENTcurrent on my laptop in about a month as of this writing, so I updated, but after that suspending failed. It is quite odd, since I haven't changed anything in my setup or configurations. Following the suspend hints in the wiki, I tried to narrow down the possible reasons by eliminating unnecessary kernel modules, though I wasn't able to remove the bluetooth modules, ng_bluetooth and others. I put a WITHOUT_BLUETOOTH=yes in my /etc/src.conf and rebuild world and kernel, a reboot later my worries were gone - the system suspends just fine now. Hopefully it can save someone with similar troubles some time.
 
Last edited by a moderator:
OP
Crivens

Crivens

Moderator
Staff member
Moderator

Reaction score: 1,593
Messages: 2,473

Worth a try - I have been faced with a broken suspend/resume again for some time, but do not know which update brought it in again. I use it seldom, but when I do I would like it to work. If I knew it would work, I would use it more.

I also tried -current, but that made no difference. I do not even know which driver in particular does the breaking. Some more testing will be in order there. But I will definitely give the removal of bluetooth a try.
 

jrm@

Daemon
Developer

Reaction score: 489
Messages: 1,215

Now that frequent -CURRENT snapshots are released, it's easier to narrow down the commit that introduced the problem. Unfortunately, you still have to bisect the problem by wiping and installing your system some number of times.
 

gofer_touch

Well-Known Member

Reaction score: 133
Messages: 275

Is there anyone out there using FreeBSD 10.2 or higher with working suspend resume for the Thinkpad X230?
 

lme@

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 303
Messages: 776

Is there anyone out there using FreeBSD 10.2 or higher with working suspend resume for the Thinkpad X230?
Works almost flawlessly here. Only issue is the dead SD card reader after resuming.
 

gofer_touch

Well-Known Member

Reaction score: 133
Messages: 275

WOW! This is great news then. Are your USB ports still functional after resume? Did you have to do any specific tuning/tweaks/configs to get this to work or does it work out of the box?

I am asking these questions because if this is the case I can switch over my main workstation which is a laptop to FreeBSD.
 

lme@

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 303
Messages: 776

You need to use vt instead of sc. Apart from that no further configuration is needed IIRC. USB still works after resuming. That was fixed some time ago.
 

Seagate

Member


Messages: 20

And I found something which I consider worth mentioning: you not only need to disable the power management for suspend, but you have to keep the power management for resume!

So this is my current sysctl.conf:
Code:
#do this to keep suspend from hanging the system at resume
hw.usb.no_suspend_wait=1
hw.pci.do_power_suspend=0

#just to make sure...
hw.pci.do_power_resume=1

hw.pci.do_power_nodriver=3

hw.acpi.lid_switch_state=S3
Also I would like to take this chance to praise ZFS for its robustness while trying things out - no file system damage from not resuming is a great thing.

i've try with your sysctl.conf in Thinkpad T420. suspend and resume is work but resuming with black screen.
how to fix that ?
 

hph

New Member


Messages: 8

Would someone (lme@) be interested in sharing their settings for the x230 for the current 12.2 release
I'm at loss with my configs, since both audio and usb after suspend doesn't work that nicely as before.

Thanks and best regards
 

Mjölnir

Daemon

Reaction score: 1,507
Messages: 2,114

Would someone (lme@) be interested in sharing their settings for the x230 for the current 12.2 release
I'm at loss with my configs, since both audio and usb after suspend doesn't work that nicely as before
Just post your your /boot/loader.conf, /etc/sysctl.conf and the output of sysrc {kld_list,{economy,performance}_cx_lowest}. Put short output inside [CODE]like this (let's say up to 20 lines +/- X)[/CODE], long output as attachment. Maybe you have to cheat the file ending to be .txt. Alternative to attachment: put in [SPOILER=filename.conf]
config knob
plethora of more config knobs ...
[/SPOILER]
PS if you have any *.local config files, naturally we need to see those, too, at least what is related to the issue. You're running 12.2-RELEASE-p4, correct? Else please post the [ICODE]output of the command 'uname -aU'[/ICODE]
 

hph

New Member


Messages: 8

Thanks Mjölnir

uname -aU returns
> FreeBSD fravia.freebsd.mkf 12.2-RELEASE-p4 FreeBSD 12.2-RELEASE-p4 GENERIC amd64 1202000

Brace yourself
(I somewhat heavily commented, sourced configs from different places, not sure if that's helpful or only spaghetti :-/)
here's my

loader.conf

Code:
###############################################################################
# /boot/loader.conf configuration file for x230 thinkpad                      #
###############################################################################
### Structure
## SYSTEM
# General
# -
# Networking
# Specific
# Disabled

# General
# Dtrace system state information
security.bsd.allow_destructive_dtrace=0

# Asynchronous I/O
aio_load="YES"


## System dependent
# enable LCD backlight control, ThinkPad buttons, etc
acpi_ibm_load="YES"

#increase inactivity periods by reducing the interrupt rate
kern.hz="100"
hint.atrtc.0.clock="0"

# Disk organization mgmgt
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"

# filesystems support
zfs_load="YES"
# Load MMC/SD card-reader support
mmc_load="YES"
mmcsd_load="YES"
sdhci_load="YES"
# Filesystems in Userspace
fuse_load="YES"
# desktop-ish filesystems, webcam driver, etc
cuse4bsd_load="YES"

# Handle Unicode on removable media
libiconv_load="YES"
libmchain_load="YES"
cd9660_iconv_load="YES"
msdosfs_iconv_load="YES"

# Access ATAPI devices through the CAM subsystem
atapicam_load="YES"


## kernel
# Boot-time kernel tuning
kern.ipc.shmseg=1024
kern.ipc.shmmni=1024
kern.maxproc=100000

# Bootup, Startup
boot_mute="YES"
autoboot_delay=5


## audio
hw.syscons.bell=0
kern.vt.enable_bell=0
snd_hda_load="YES"


## virtualization
# Skip the often slow memory tests in VMs
hw.memtest.tests=0

## Synaptics
# Enable psm configuration interface for trackpad/trackpoint:
hw.psm.synaptics_support=1
hw.psm.trackpoint_support=1


## Networking
# increase the network interface queue link default (50) is way too low
net.link.ifqmaxlen="2048" # 1024
#WiFi
iwn6000g2afw_load="YES"
#if_iwn_load="YES"
legal.intel_iwn.license_ack=1
#WLAN
wlan_wep_load="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
# Load the H-TCP algorithm. It has a more aggressive ramp-up to max
cc_htcp_load="YES"


## CPU
# enable CPU firmware updates
cpuctl_load="YES"

## Power management
# Disable acpi throttle by default, fixes issues with powerd and later AMDs
hint.acpi_throttle.0.disabled="1"
# Intel Core thermal sensors
coretemp_load="YES"

hint.p4tcc.1.disabled=1
hint.acpi.0.diabled="0"
hint.acpi_throttle.0.disabled="1"
hint.ahcich.0.pm_level="5"
hint.ahcich.1.pm_level="5"
hint.ahcich.2.pm_level="5"
hint.ahcich.3.pm_level="5"
hint.ahcich.4.pm_level="5"
hint.ahcich.5.pm_level="5"

# suspend on lid close
hw.acpi.lid_switch_state=s3

# Any PCI devices that do not have a driver put into ACPI D3 power state (off)
hw.pci.do_power_nodriver=3

#higher sound card buffering latency
hw.snd.latency=4 #7

hint.pcm.0.buffersize=65536
hint.pcm.1.buffersize=65536
hint.pcm.2.buffersize=65536
hw.snd.feeder_buffersize=65536

# Enable GPU power-saving idle states
compat.linuxkpi.enable_rc6=7

## virtualization
vboxdrv_load="YES"
vfs.aio.max_buf_aio=8192
vfs.aio.max_aio_queue_per_proc=65536
vfs.aio.max_aio_per_proc=8192
vfs.aio.max_aio_queue=65536

# Enable NewCons / vt
kern.vty=vt
# enable i915 kernel mode setting:
i915kms_load="YES"

################################################################################
# p4tcc Intel-Relict of netburst ages
hint.p4tcc.0.disabled=1
hint.p4tcc.1.disabled=1

hint.acpi_throttle.0.disabled="1"
hint.ahcich.0.pm_level="5"
hint.ahcich.1.pm_level="5"
hint.ahcich.2.pm_level="5"
hint.ahcich.3.pm_level="5"
hint.ahcich.4.pm_level="5"
hint.ahcich.5.pm_level="5"

# Devil worship in loader logo
#loader_logo="beastie"

# Boot-time kernel tuning
kern.ipc.shmseg=1024
kern.ipc.shmmni=1024
kern.maxproc=60000

# In-memory filesystems
tmpfs_load="YES"

# Intel i915 tunables (many of those are often default in Linux distros)
#enable power savings
drm.i915.powersave="1"
#enable render C-state 6.
drm.i915.enable_rc6="7"
#enable Intel IOMMU,
drm.i915.intel_iommu_enabled="1"
#enable LVDS downlock,
drm.i915.lvds_downclock=1
#use semaphores for inter-ring sync
drm.i915.semaphores="1"
#enable framebuffer compression
drm.i915.enable_fbc="1"

#enable LCD screen brightness control (see below)
#acpi_video_load="YES"  #suppressed

#limit ZFS ARC (4G instead of default  half=8Gb out of 16)
vfs.zfs.arc_max="4G"

#enable CPU freq monitoring
cpufreq_load="YES"
#enable temperature monitoring
coretemp_load="YES"

#kern.vt.fb.default_mode="1366x768"

# Disable legacy p4 and acpi power management
hint.p4tcc.0.disabled=1
hint.acpi_throttle.0.disabled=1

# Enable GPU power-saving idle states
compat.linuxkpi.enable_rc6=7

###################################################

umass_load="YES"
hint.acpi.0.disabled="0"
hint.pcm.0.buffersize=65536
hint.pcm.1.buffersize=66536
hw.snd.feeder_buffersize=65536
#hw.psm.synaptics_support="1"

# Load Linux compat
linux_load="YES"

sysctlinfo_load="YES"

# enable
aesni_load="YES"

### Disabled
#opensolaris_load="YES"

sysctl.conf
Code:
# $FreeBSD: releng/12.2/sbin/sysctl/sysctl.conf 337624 2018-08-11 13:28:03Z brd $
#
#  This file is read when going to multi-user and its contents piped thru
#  ``sysctl'' to adjust kernel values.  ``man 5 sysctl.conf'' for details.
#

# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0
security.bsd.see_other_uids=0
security.bsd.see_other_gids=0
security.bsd.see_jail_proc=0
security.bsd.unprivileged_read_msgbuf=0
security.bsd.unprivileged_proc_debug=0
kern.randompid=1
vfs.zfs.min_auto_ashift=12

# increase laptop speaker volume
hw.snd.default_auto=1
hw.snd.vpc_0db=30 #45 (origval)
hw.snd.latency=0

# Fix resume from suspend
hw.usb.no_suspend_wait=1
hw.pci.do_power_suspend=0
hw.pci.do_power_resume=1
hw.pci.do_power_nodriver=3

# suspend when lid is closed
hw.acpi.lid_switch_state=S3
hw.syscons.sc_no_suspend_vtswitch=1
dev.acpi_ibm.0.events=1

# Enhance shared memory X11 interface
kern.ipc.shmmax=67108864
kern.ipc.shmall=32768

# Enhance desktop responsiveness under high CPU use (200/224)
kern.sched.preempt_thresh=224

# Bump up maximum number of open files
kern.maxfiles=200000

# Disable PC Speaker
hw.syscons.bell=0

# Enable shared memory (for Chromium)
kern.ipc.shm_allow_removed=1

# Allow users to mount disks
vfs.usermount=1


# vfs VirtualBox
vfs.aio.max_buf_aio=8192
vfs.aio.max_aio_queue_per_proc=4096
vfs.aio.max_aio_per_proc=8192
vfs.aio.max_aio_queue=8192

# stop scattered core files
kern.corefile=/tmp/%N.core

############################################################3
net.local.stream.recvspace=65536
net.local.stream.sendspace=65536



# Enhance shared memory X11 interface
kern.ipc.shmmax=67108864
kern.ipc.shmall=32768



# Enhance desktop responsiveness under high CPU use (200/224)
kern.sched.preempt_thresh=224




# Bump up maximum number of open files
kern.maxfiles=200000



# increase UFS readahead
vfs.read_max=128

# needed for chromium to work
kern.ipc.shm_allow_removed=1
hw.syscons.bell=0
kern.vt.enable_bell=0

# performance and behaviour
kern.metadelay=8
kern.filedelay=10
kern.filedelay=13


#attinutation to prevent clipping
hw.snd.vpc_0db=1
hw.snd.vpc_mixer_bypass=1
hw.snd.latency=5
hw.snd.feeder_rate_quality=4
 
Last edited:

Mjölnir

Daemon

Reaction score: 1,507
Messages: 2,114

You're running 12.2-RELEASE-p4, correct? Else please post the [ICODE]output of the command 'uname -aU'[/ICODE]
hph uname -aU >> forum
How can the contents of a singe file be "sourced configs from different places"?
What is the meaning of "Brace yourself"? Never heard that before.
 

Snurg

Daemon

Reaction score: 588
Messages: 1,349

Mjölnir , I guess he intended to say something like "be prepared for something", as the configs look like (at least in my impression) a highly convoluted collection from the internet, which he also said in other words.

If I may give hph an advice... boil down all that to what originally was there, eg leave only the ashift setting.
Nobody can tell whether some of these settings disrupt your computer from resuming correctly.
Then re-enable step-by-step to find the offender.

If you then still have problems, read the Wiki (it's partly obsolete, but still a must read).
Don't worry, on Thinkpads with Intel graphics suspend/resume usually works fine.
 
  • Like
Reactions: hph

hph

New Member


Messages: 8

@Mjölnir thank you, I updated the report
@Snurg thanks for translating :) - will try that

Sorry for not pointing this out before.
Hope I didn't derail the thread, my suspend and resume work nicely (aside from pulling an external devices before suspend now and then) but my audio is kind of broken since I upgraded the Release - I can connect via device.hints but my mixer setting/audio
is reacting strange.

If someone has a working setup with 12.2-RELEASE-p4, I'd happy to get your configs.

Thanks again
 
Top