News for hackers. Stuff that matters.
Re:Apple's custom NVMes are amazingly fast – if you don't ca... by rowanG077 on Thursday February 17, 2022 @03:49AM (#30370903)
You think it's oke that restarting your PC leads to data loss or corruption? That's basically a product killer for me. I reboot my laptop everyday.
Re:Apple's custom NVMes are amazingly fast – if you don't ca... by marcan_42 on Thursday February 17, 2022 @03:51AM (#30370913)
You presumably don't reboot your laptop by connecting a USB-PD gadget that issues a hard reset. A normal OS reboot is fine, that will flush the cache.

The most common situation where this would affect laptops, in my experience so far, would be a broken driver causing a kernel lockup (not a panic) which triggers a watchdog reboot. That situation wouldn't allow for an NVMe flush.

Re:Apple's custom NVMes are amazingly fast – if you don't ca... by signal11 on Thursday February 17, 2022 @03:59AM (#30370977)
For products like the Mac Mini, which don’t have a battery, does this mean that a loss of mains power will cause data loss? Because brownouts do happen occasionally…
Re:Apple's custom NVMes are amazingly fast – if you don't ca... by marcan_42 on Thursday February 17, 2022 @04:05AM (#30371019)
Yes. I've tested yanking the power and can easily see 5 seconds of data loss for data that was fsync()ed (but not full synced). I'm not sure yet if corruption due to reordering is also possible, but it seems likely.
Re:Apple's custom NVMes are amazingly fast – if you don't ca... by rowanG077 on Thursday February 17, 2022 @03:54AM (#30370946)
Depends what exactly is a hard reboot. I don't reboot my laptop by issueing USB-PD command. But I do by holding the power button.
Re:Apple's custom NVMes are amazingly fast – if you don't ca... by marcan_42 on Thursday February 17, 2022 @04:04AM (#30371005)
I just tested that. Holding down the power button invokes a (somewhat special) btn_rst kernel panic before it has a chance to invoke a true hardware reset, and kernel panics involve an NVMe driver hook which I'm pretty sure issues a flush. Should be safe.

At least re: this issue; it's still a bad idea because it's only safe if all software is written following data integrity and flush rules to the letter, and most software isn't. You're eventually going to run into issues on any OS by doing that, because most software doesn't get this right unless it's a database. And you're still going to lose data that's in buffer cache, I'm pretty sure that won't get flushed.

Re:Apple's custom NVMes are amazingly fast – if you don't ca... by Cthulhu_ on Thursday February 17, 2022 @03:58AM (#30370973)
See, that's a forced shutdown, a last resort measure; it's using a sledgehammer to tap in a nail. You shouldn't do that as a habit, even if this particular optimization issue wasn't a thing.

I mean I grew up diligently turning off my PC by parking the disk and using the various operating system level shutdown procedures. Nowadays I smack the off button, but that still just triggers the OS shutdown procedure. I don't turn my Mac off as a rule, its sleep mode actually works. ish.

Re:Apple's custom NVMes are amazingly fast – if you don't ca... by Thomaschaaf on Thursday February 17, 2022 @04:03AM (#30371001)
Care to explain why?
Re:Apple's custom NVMes are amazingly fast – if you don't ca... by olliej on Thursday February 17, 2022 @04:12AM (#30371058)
If they're like me: outside of a software update I only reboot when the machine is not responding, at which point hard reboot is faster and more robust. I recognize it's not ideal, but I also don't think it's reasonable for the system to ever get to a point where I should be wanting to restart to "fix" it - and I would think it is a serious bug if doing so ever corrupted the system or lost any "saved" data.
Re:Apple's custom NVMes are amazingly fast – if you don't ca... by rowanG077 on Thursday February 17, 2022 @04:17AM (#30371089)
Systemd takes 2 minutes to shutdown and I never got any way to resolve that.
Re:Apple's custom NVMes are amazingly fast – if you don't ca... by vgel on Thursday February 17, 2022 @04:50AM (#30371328)
Linux Magic SysRq + R S E I V B key chord will immediately shut down while still properly flushing disk cache and such. A bit annoying to enter, but a handy tool to have in your toolbox.
Re:Apple's custom NVMes are amazingly fast – if you don't ca... by tashbarg on Thursday February 17, 2022 @05:48AM (#30371715)
That's not the right keys and not the right order to do that. You should not flush caches before you terminated as much processes as possible correctly. And you are rebooting at the end.

REISUB for a somewhat safe EMERGENCY reboot and O instead of B at the end for shutdown.

Re:Apple's custom NVMes are amazingly fast – if you don't ca... by vgel on Thursday February 17, 2022 @03:30PM (#30378237)
Oh hmm, you're right. I've always done it with the other order and never had problems. Forget where I learned it that way...
Re:Apple's custom NVMes are amazingly fast – if you don't ca... by vondro on Thursday February 17, 2022 @03:51AM (#30370918)
Shouldn't Mac OS issue flush on restart, as it does on sleep?
Re:Apple's custom NVMes are amazingly fast – if you don't ca... by Bud on Thursday February 17, 2022 @05:21AM (#30371541)
1) A normal restart doesn't have this issue, at all.

2) Why are you rebooting a laptop daily? My uptime on my MacBook Pro averages 30-60 days. There's zero reason to reboot any modern OS daily.

Re:Apple's custom NVMes are amazingly fast – if you don't ca... by lobocinza on Thursday February 17, 2022 @06:05AM (#30371816)
> There's zero reason to reboot any modern OS daily.

- I use Arch, I like to avoid accumulating too much major updates between reboots. - For a time I was facing a bug that resulted in a black screen of death after resuming sleep.