drm/msm: Do not notify events during system shutdown

It's been observed that a panic could occur due to a race with
a MSM_DRM_BLANK_POWERDOWN handler and a driver removal function
upon shutdown while the screen is on.

Since this shouldn't happen, send DRM events only when the system is running.

This doesn't seem to be easy to detect as the events are sent after the
userspace drm process terminates, which is before init binary notifies
the kernel about the shutdown.

Workaround this by detecting shutdown upon sysrq kill-all-tasks(i),
sent from the init binary.

Change-Id: Ibb79bda42af633c957e1f5ec436355d5bfdec21e
Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Park Ju Hyung 2019-04-07 01:39:39 +09:00 committed by Richard Raya
parent 0a2e0a5f75
commit 2021026503
2 changed files with 13 additions and 0 deletions

View File

@ -67,12 +67,23 @@ EXPORT_SYMBOL(msm_drm_unregister_client);
* @v: notifier data, inculde display id and display blank
* event(unblank or power down).
*/
static bool notifier_enabled __read_mostly = true;
static int msm_drm_notifier_call_chain(unsigned long val, void *v)
{
if (unlikely(!notifier_enabled))
return 0;
return blocking_notifier_call_chain(&msm_drm_notifier_list, val,
v);
}
void msm_drm_notifier_enable(bool val)
{
notifier_enabled = val;
mb();
}
EXPORT_SYMBOL(msm_drm_notifier_enable);
/* block until specified crtcs are no longer pending update, and
* atomically mark them as pending update
*/

View File

@ -402,8 +402,10 @@ static struct sysrq_key_op sysrq_thaw_op = {
};
#endif
extern void msm_drm_notifier_enable(bool val);
static void sysrq_handle_kill(int key)
{
msm_drm_notifier_enable(false);
send_sig_all(SIGKILL);
console_loglevel = CONSOLE_LOGLEVEL_DEBUG;
}