How to controll windowed watchdog (WWDG) with dynamically scaling CPU frequencies?
I am not familiar with the particular "windowed watch dog" peripheral you mentioned, or where it gets its clock from. Its possible that the WD may run from something like a real-time clock (RTC) 32.768 KHz clock source, and would thus be independent of the processor frequency. Regardless, there should be some way to calibrate the amount of time that the WD timer counts before interrupting/resetting. You could use this to adjust the time based on the current clock frequency. To make this easier, why not write a single function responsible for both changing clock frequency and updating the WD timer values based on the new frequency.

If the WD gets its clock source from the SysTick timer built into the CM4, then check out the SysTick registers for how to change the count values: ARM InfoCenter Doc on SysTick

A lot of this is device dependent, so you will need to consult the manufacturer's documentation for your specific device. It should give you some guidance.

(I am assuming that you are using clock divider circuitry on board the processor for changing frequency. Despite the previous commenter, there is nothing wrong with this. It's a standard way of reducing power. Now, if you were actually changing the clock frequency that you fed into the part, that WOULD be a bad idea, most likely.)