#ifdef CONFIG_PPC_WATCHDOG
        factor = nmi_wd_lpm_factor;
 #endif
+       /*
+        * When the migration is initiated, the hypervisor changes VAS
+        * mappings to prepare before OS gets the notification and
+        * closes all VAS windows. NX generates continuous faults during
+        * this time and the user space can not differentiate these
+        * faults from the migration event. So reduce this time window
+        * by closing VAS windows at the beginning of this function.
+        */
+       vas_migration_handler(VAS_SUSPEND);
+
        ret = wait_for_vasi_session_suspending(handle);
        if (ret)
-               return ret;
-
-       vas_migration_handler(VAS_SUSPEND);
+               goto out;
 
        if (factor)
                watchdog_nmi_set_timeout_pct(factor);
        if (factor)
                watchdog_nmi_set_timeout_pct(0);
 
+out:
        vas_migration_handler(VAS_RESUME);
 
        return ret;