[personal profile] mjg59
Recent Intel-based systems often implement something called Intel Rapid Start Technology. Like many things with the word "Technology" in the name, there's a large part of this that's marketing. The relatively small amount of technical documentation available implies that it's tied to your motherboard chipset and CPU, but as far as I can tell it's entirely implemented in firmware and could work just as well on, say, a Cyrix on a circa 1996 SIS-based motherboard if someone wrote the BIOS code[1]. But since nobody has, we're stuck with the vendors who've met Intel's requirements and licensed the code.

The concept of IRST is pretty simple. There's a firmware mechanism for setting a sleep timeout. If you suspend your computer and this timeout expires, it'll resume. However, instead of handing control back to the OS, the firmware just copies the entire contents of RAM to a special partition and turns the computer off. Next time you hit the power button, the firmware dumps the partition contents back into RAM and resumes as if nothing had changed. This takes a few seconds longer than resume from S3 but is far faster than resume from hibernation since it starts the moment the system gets power.

At a more technical level, it's a little more complicated. The first thing to know about this feature is that it's entirely invisible unless your hard drive is set up correctly. There needs to be a partition that's at least the size of your system's physical RAM. For GPT systems, this needs to have a type GUID of D3BFE2DE-3DAF-11DF-BA-40-E3A556D89593. For MBR systems, you need a partition type of 0x84[2]. If the firmware doesn't find an appropriate partition then the OS will get no indication that the firmware supports it. Boo.

(The second thing is that it seems like it really does have to be on an SSD, and if you try to do this on spinning media your firmware will ignore it anyway)

If all the prerequisites are in place, an ACPI device with an HID of INT3392 will exist. It has four methods associated with it: GFFS, SFFS, GFTV and SFTV. GFFS returns an integer representing the events that will cause the system to wake up from S3 and suspend to SSD. The system will wake after the timeout expires if bit 0 is set, and will wake when the battery becomes critically low if bit 1 is set. The other bits appear to be unused at the moment[3]. SFFS sets the wakeup events, using the same bit values as GFFS. GFTV returns an integer containing the current wakeup timeout in minutes. SFTV sets it. Values above 1440 (ie, 24 hours) seem to be considered invalid - if I set them the value instead ends up as 10 and the timeout flag gets cleared from the wakeup events field.

I've submitted a patch that adds a sysfs interface for setting these values, and unless anyone objects it'll probably end up in 3.11. There's still the remaining question of how userspace should make use of these, and also how installers should behave when it comes to systems that support IRST. As previously mentioned, there's no obvious indication to the OS that the feature is supported unless the appropriate partition already exists. The easiest way to deal with this is for installers to default to retaining any partitions with the magic IDs, but I'm still looking into whether it's possible to get the firmware to cough up some more information so it can be created automatically even if the drive's entirely blank.

And now, having got this working on a test machine, I just need to split my Thinkpad's swap partition in half and make sure it works here as well. Woo.

[1] Note: I am not going to do this.
[2] Conveniently, the same as the partition type that APM systems used for suspend to disk back when dubstep hadn't been invented yet
[3] At least, if you attempt to set them they get ignored.
Page 2 of 3 << [1] [2] [3] >>

Re: Thanks for this!

Date: 2013-07-04 07:56 pm (UTC)
From: (Anonymous)
Interesting. Thanks Matthew. I think I'll give it a try.

So basically I just need to set up something to echo my desired value on boot, yes? I wonder if systemd's tmpfiles.d or a udev rule would do the trick...

Re: Thanks for this!

Date: 2013-07-04 09:43 pm (UTC)
From: (Anonymous)
Just FYI. I just finished patching this into 3.10 (I know it is meant for the linux-next branch). I haven't really had a chance to test it at all. But I built it as a module, and it gets loaded automatically by udev. Also, I am able to find a /sys/bus/acpi/drivers/intel_rapid_start directory. But I don't have a /sys/bus/acpi/intel_rapid_start directory like the documentation says I should.

So I did "modinfo intel-rst" to get the alias. Sure enough I have a /sys/bus/acpi/devices/INT3392:00, which has a physical path of /sys/devices/LNXSYSTM:00/device:00/INT3392:00. In this directory I am able to find the wakeup_events and wakeup_time files.

Is this a result of using it on 3.10 and not 3.11?

Re: Threat to dm-crypt

Date: 2013-07-05 12:02 am (UTC)
From: (Anonymous)
Unencrypted RAM doesn't leave data behind. SSDs do. They are not equivalent except in some scenarios. Using the slippery slope argument here just dodges good discussion. :/

Critical level

Date: 2013-07-05 03:00 am (UTC)
From: (Anonymous)
So I understand that a value of 3 in wakeup_events will enable transition into hibernation from both timer events as well as reaching a "critical level".

But what is the "critical level"? Can I set this myself, or is it hard coded into the firmware?

sysfs Patches

Date: 2013-07-05 07:42 am (UTC)
From: (Anonymous)
Any patches yet? Would love to backport them to my distro kernel to configure and test this. The Windows GUI is horrible.

Re: Threat to dm-crypt

Date: 2013-07-05 11:55 am (UTC)
From: (Anonymous)
Of course they do, you can read out RAM by freezing it first, then you can take it out, and read it.

Re: sysfs Patches

Date: 2013-07-05 03:08 pm (UTC)
From: (Anonymous)
There is a link to the patches in the blog post. They work just fine as far as I can tell so far. But yu should be aware that this is really just adding Linux userspace configuration ability. The patches are not required at all to get this functioanlity going. It just makes it much nicer to deal with.

Re: Critical level

Date: 2013-07-05 11:24 pm (UTC)
From: (Anonymous)
Correct, "critical level" empirically is when the battery is low enough that the system is going to lose power soon but large enough to allow a hibernate.

Re: Threat to dm-crypt

Date: 2013-07-08 03:03 am (UTC)
From: (Anonymous)
Unencrypted RAM can be easily read with physical access to the machine, just like the SSD.

See this 2008 paper (https://citp.princeton.edu/research/memory/) or watch the video (http://www.youtube.com/watch?v=JDaicPIgn9U) demonstrating a technique to pull unencrypted passphrases/keys out of RAM from a suspended machine to unlock dm-crypt, TrueCrypt, FileVault, etc.

Re: What goes around comes around

Date: 2013-07-09 07:24 pm (UTC)
torkell: (Default)
From: [personal profile] torkell
I used to have an IBM Aptiva with this feature, which as it happens was indeed a circa 1996 SIS-based system (though not with a Cyrix processor).

Re: What goes around comes around

Date: 2013-07-09 07:27 pm (UTC)
From: (Anonymous)
By "this feature" I meant "Rapid Resume", not IRST.

Working only with UEFI?

Date: 2013-07-11 11:35 am (UTC)
From: (Anonymous)
Hi there,

Sorry if this is a stupid question. Does this stuff only work when you boot in UEFI mode, or also with legacy BIOS? Asking because I am using a Samsung laptop, and I am forced booting with legacy BIOS if I want to load the samsung-laptop-module.

Second question, should I create some filesystem on the partition, or it does not matter?

Cheers,
Alessandro

Re: Working only with UEFI?

Date: 2013-07-11 11:58 am (UTC)
From: (Anonymous)
Nice :)

Trying it today!

Thanks a lot for the nice blog post

Re: Working only with UEFI?

Date: 2013-07-11 08:55 pm (UTC)
From: (Anonymous)
OK, tried it, and I have comment that might help (if it is found to be true).

If I boot in BIOS mode, and I use a GPT partition table, then the thing does not work, and there is no INT3392 under /sys. However, after some gdisk magic and turning my partition table to MBR, now it works as a charm :)

Hence, I guess that you either need BIOS+MBR or UEFI+GPT (I wanted to try the UEFI+GPT combination first, but I have no idea for what damn reason I cannot make the laptop booting my Linux EFI stub).

Thanks again for the blog post and for the driver, this thing seems to be quite nice since it recovers from hibernation much more quickly than other methods

Just Works

Date: 2013-07-13 02:50 pm (UTC)
From: (Anonymous)
Matt,

FWIW, I created the requisite type 84 partition of the necessary size on my new W530, having installed a 240GB Plextor mSATA drive, and Rapid Start is working with Linux Mint 15 stock.

I guess that's not much of a surprise, given that Rapid Start is BIOS-based with only some optional hints from the OS, but I thought that you'd want a confirmation.

Since I do have it working, I'll also volunteer to once again be one of your guinea pigs. :-) Presumably you'll want for me to install Fedora into the mix?

Just Works

Date: 2013-07-13 03:33 pm (UTC)
From: [identity profile] https://login.ubuntu.com/+id/xFtsTRh
Matt,

FWIW, I created the requisite type 84 partition of the necessary size on my new W530, having installed a 240GB Plextor mSATA drive, and Rapid Start is working with Linux Mint 15 stock.

I guess that's not much of a surprise, given that Rapid Start is BIOS-based with only some optional hints from the OS, but I thought that you'd want a confirmation.

Since I do have it working, I'll also volunteer to once again be one of your guinea pigs. :-) Presumably you'll want for me to install Fedora into the mix?

Was working with a Medion Akoya i7

Date: 2013-07-15 08:49 am (UTC)
From: (Anonymous)
First I wasn't sure what that iFFS entry was in my BIOS until I detected this website http://blog.adios.tw/2012/10/funtoo-linux-and-intel-rapid-start.html which explains it pretty well.

The good thing about it is that it is working totally separate from the OS. The bad thing - if you change your RAM size you have to grow the partition!

I have tested it but it wasn't really quicker as normal hibernate and hibernating 8 Gig or more takes a while (~20 seconds). Booting the system from scratch is faster (~10 seconds). So I stick with suspend-to-ram (~1 sec) or just plain boot on SSD anyway.

HP

Re: Threat to dm-crypt

Date: 2013-07-16 04:36 am (UTC)
From: [identity profile] flowerpt.myopenid.com
Heck, I'd be OK with it requiring me to enter a passphrase on resume. I'd even be OK with linux having a tunable to hand my root LUKS passphrase to this facility, to keep it easy. Just about everything this runs on should have AES-NI and the on-disk format should be verifyable. This would be a great extension to the service from Intel.

I actually got as far as setting up the partition's GUID before the implications occurred to me. It would be nice, but for now hibernate is my only safe option.

Testing in other kernels than mainline

Date: 2013-07-21 10:46 pm (UTC)
From: (Anonymous)
Hi,

I was anxiously waiting for someone with some insight on this tech to develop some way of setting up the timeout value on linux, thanks a lot!

Since I didn't want to build the whole kernel to test the module, I isolated it and set up a dkms script for it along with some upstart script to set values on boot.

https://kassick@bitbucket.org/kassick/intel-rst.git
(clone and run setup.sh )

I've just installed it on Quantal/3.5.0-31-generic, seems to work fine; I'll keep you posted.

Kassick.

Re: Testing in other kernels than mainline

Date: 2013-07-21 11:06 pm (UTC)
From: (Anonymous)
https://bitbucket.org/kassick/intel-rst/

Re: Testing in other kernels than mainline

Date: 2013-07-22 02:21 pm (UTC)
From: (Anonymous)
Thanks for providing this dkms version. Here is a package for Arch linux:

https://aur.archlinux.org/packages/dkms-intel-rst/

Re: Just Works

Date: 2013-09-26 05:24 pm (UTC)
From: [identity profile] psusi [launchpad.net]
It does? From the description in the linked page, it sounds like the firmware wakes up from S3 and it's up to software to move to S4. If that's the case, then it can't "just work"; you need the software to recognize the wake reason and switch to S4.
Page 2 of 3 << [1] [2] [3] >>

Profile

Matthew Garrett

About Matthew

Power management, mobile and firmware developer on Linux. Security developer at Aurora. Ex-biologist. [personal profile] mjg59 on Twitter. Content here should not be interpreted as the opinion of my employer. Also on Mastodon.

Expand Cut Tags

No cut tags