I have understood that most recent cars have a knock sensor. This allows among other things greater timing advance due to detecting knock in case the fuel doesn't work well with a greatly advanced timing.
Now, what will happen if the knock sensor fails? If it is unable to detect knock, is the engine at risk of damage from knocking? Or is the ECU smart enough to occasionally test a ridiculously advanced timing resulting in knock (which a correctly operating sensor would detect), and then detect a failed knock sensor and run with a safe timing resulting in reduced engine power output? Or is the ECU able to detect a failed knock sensor in some other way?
Are there any diagnostic trouble codes related to failed knock sensors? How often do knock sensors in general fail?