Skip to content

Commit

Permalink
Add runtime setting for unresponsive lipstick killing delay
Browse files Browse the repository at this point in the history
The default lipstick kill delay is 30 seconds from issuing
asynchronous setUpdatesEnabled D-Bus method call.

This can now be changed via
  mcetool --set-lipstick-core-delay=<seconds>

If zero delay is used, mce will not kill lipstick.

[mce] Add runtime setting for unresponsive lipstick killing delay
  • Loading branch information
spiiroin committed Apr 8, 2014
1 parent 19624ed commit 8c299ef
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
6 changes: 6 additions & 0 deletions builtin-gconf.c
Expand Up @@ -1342,6 +1342,12 @@ static const setting_t gconf_defaults[] =
.type = "i",
.def = "0", // = GOVERNOR_UNSET = no override
},
{
// MCE_GCONF_LIPSTICK_CORE_DELAY_PATH @ modules/display.h
.key = "/system/osso/dsm/display/lipstick_core_dump_delay",
.type = "i",
.def = "30",
},
{
// MCE_GCONF_TK_AUTO_BLANK_DISABLE_PATH @ tklock.h
.key = "/system/osso/dsm/locks/tklock_blank_disable",
Expand Down
19 changes: 19 additions & 0 deletions modules/display.c
Expand Up @@ -3474,6 +3474,9 @@ static waitfb_t mdy_waitfb_data =
/** Delay [s] from setUpdatesEnabled() to attempting lipstick core dump */
static gint mdy_lipstick_killer_core_delay = 30;

/** GConf callback ID for mdy_lipstick_killer_core_delay setting */
static guint mdy_lipstick_killer_core_delay_gconf_cb_id = 0;

/* Delay [s] from attempting lipstick core dump to killing lipstick */
static gint mdy_lipstick_killer_kill_delay = 25;

Expand Down Expand Up @@ -3657,6 +3660,10 @@ static void mdy_lipstick_killer_schedule(void)
if( !mce_log_p(LL_DEVEL) )
goto EXIT;

/* Setting the core dump delay to zero disables killing too. */
if( mdy_lipstick_killer_core_delay <= 0 )
goto EXIT;

/* Note: Initially we might not yet know the lipstick PID. But once
* it gets known, the kill timer chain will lock in to it.
* If lipstick name owner changes, the timer chain is cancelled
Expand Down Expand Up @@ -6692,6 +6699,10 @@ static void mdy_gconf_cb(GConfClient *const gcc, const guint id,
mdy_disp_never_blank = gconf_value_get_int(gcv);
mce_log(LL_NOTICE, "never_blank = %d", mdy_disp_never_blank);
}
else if( id == mdy_lipstick_killer_core_delay_gconf_cb_id ) {
mdy_lipstick_killer_core_delay = gconf_value_get_int(gcv);
mce_log(LL_NOTICE, "lipstick kill delay = %d", mdy_lipstick_killer_core_delay);
}
else {
mce_log(LL_WARN, "Spurious GConf value received; confused!");
}
Expand Down Expand Up @@ -6837,6 +6848,14 @@ static void mdy_gconf_init(void)
MCE_GCONF_BLANKING_INHIBIT_MODE_PATH,
mdy_gconf_cb,
&mdy_blanking_inhibit_mode_gconf_cb_id);

/* Delay for killing unresponsive lipstick */
mce_gconf_notifier_add(MCE_GCONF_DISPLAY_PATH,
MCE_GCONF_LIPSTICK_CORE_DELAY_PATH,
mdy_gconf_cb,
&mdy_lipstick_killer_core_delay_gconf_cb_id);
mce_gconf_get_int(MCE_GCONF_LIPSTICK_CORE_DELAY_PATH,
&mdy_lipstick_killer_core_delay);
}

static void mdy_gconf_quit(void)
Expand Down
3 changes: 3 additions & 0 deletions modules/display.h
Expand Up @@ -142,6 +142,9 @@
/** Path to the use cpu scaling governor GConf setting */
#define MCE_GCONF_CPU_SCALING_GOVERNOR_PATH MCE_GCONF_DISPLAY_PATH "/cpu_scaling_governor"

/** Path to the unresponsive lipstick core dump delay */
#define MCE_GCONF_LIPSTICK_CORE_DELAY_PATH MCE_GCONF_DISPLAY_PATH "/lipstick_core_dump_delay"

/** Default display brightness on a scale from 1-5 */
#define DEFAULT_DISP_BRIGHTNESS 3 /* 60% */
/** Default display brightness (power save mode active) on a scale from 1-5 */
Expand Down
28 changes: 28 additions & 0 deletions tools/mcetool.c
Expand Up @@ -2320,6 +2320,28 @@ static void xmce_get_inhibit_mode(void)
printf("%-"PAD1"s %s \n", "Blank inhibit:", txt ?: "unknown");
}

/* ------------------------------------------------------------------------- *
* lipstick killer
* ------------------------------------------------------------------------- */

static void xmce_set_lipstick_core_delay(const char *args)
{
debugf("%s(%s)\n", __FUNCTION__, args);
int val = xmce_parse_integer(args);
mcetool_gconf_set_int(MCE_GCONF_LIPSTICK_CORE_DELAY_PATH, val);
}

static void xmce_get_lipstick_core_delay(void)
{
gint val = 0;
char txt[32];

strcpy(txt, "unknown");
if( mcetool_gconf_get_int(MCE_GCONF_LIPSTICK_CORE_DELAY_PATH, &val) )
snprintf(txt, sizeof txt, "%d", (int)val);
printf("%-"PAD1"s %s (seconds)\n", "Lipstick core delay:", txt);
}

/* ------------------------------------------------------------------------- *
* cpu scaling governor override
* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -2691,6 +2713,7 @@ static void xmce_get_status(void)
xmce_get_fake_doubletap();
#endif
xmce_get_tklock_blank();
xmce_get_lipstick_core_delay();

printf("\n");
}
Expand Down Expand Up @@ -2889,6 +2912,8 @@ EXTRA" 'short', 'double' and 'long'\n"
PARAM"-D, --set-demo-mode=<on|off>\n"
EXTRA" set the display demo mode to STATE;\n"
EXTRA" valid states are: 'on' and 'off'\n"
PARAM"--set-lipstick-core-delay=<secs>\n"
EXTRA"set the delay for dumping core from unresponsive lipstick\n"
PARAM"-N, --status\n"
EXTRA"output MCE status\n"
PARAM"-B, --block[=<secs>]\n"
Expand Down Expand Up @@ -3077,6 +3102,7 @@ struct option const OPT_L[] =
#ifdef ENABLE_DOUBLETAP_EMULATION
{ "set-fake-doubletap", 1, 0, 'i' }, // xmce_set_fake_doubletap()
#endif
{ "set-lipstick-core-delay", 1, 0, 900 }, // xmce_set_lipstick_core_delay()
{ 0, 0, 0, 0 }
};

Expand Down Expand Up @@ -3165,6 +3191,8 @@ int main(int argc, char **argv)
case 'N': xmce_get_status(); break;
case 'B': mcetool_block(optarg); break;

case 900: xmce_set_lipstick_core_delay(optarg); break;

case 'h':
usage_short();
exitcode = EXIT_SUCCESS;
Expand Down

0 comments on commit 8c299ef

Please sign in to comment.