Post B6G8fZRM6CPv9mRLrE by lw@bsd.cafe
 (DIR) More posts by lw@bsd.cafe
 (DIR) Post #B6G8fZRM6CPv9mRLrE by lw@bsd.cafe
       1 likes, 0 repeats
       
       "EPOW_POWER_OFF 7 The system will lose power. The hardware ensures that at least 4 milliseconds of power within operational thresholds is available after signalling an interrupt."so, you're an operating system kernel, and you've just been informed you only have 4ms to live.  what do you do?- sync disks: usually takes longer than 4ms, and an interrupted sync on UFS can do more damage than not syncing- log the event: but what is the point of the log if it's not committed to disk?- try a normal immediate shutdown and hope we actually have more than 4ms left?
       
 (DIR) Post #B6G8fZdlM4LFmGFGCG by linear@nya.social
       1 likes, 0 repeats
       
       @lw@mastodon.bsd.cafe serious answer from an embedded software engineer (me):quickly write some flags into a predefined region indicating the emergency power loss event, in case the cpu restarts and it tries to boot again during brownout, and power off any peripherals that might be dangerous if left outside active software controla specific example that comes to mind would be, say, an embedded linux device that does real time control of an RF power chain and beamforming for cellular communications, which might be at a high-power state that can only be maintained for a very short period, and which could damage hardware even if power is lost from residual energy stored in capacitors and the like if the chain is not configured correctly.why was it actually added? no idea.
       
 (DIR) Post #B6G8pVaBIRUe5XJ68W by linear@nya.social
       0 likes, 0 repeats
       
       @lw@mastodon.bsd.cafe for a desktop/server operating system? just halt and wait, i guess
       
 (DIR) Post #B6G92NGxVKH650S0xs by linear@nya.social
       0 likes, 0 repeats
       
       @lw@mastodon.bsd.cafe logging to disk might not be an option with that timeframe, but sending off a packet to the network might be