Skip to content

Commit

Permalink
Protect fapi rc between processor and async thread
Browse files Browse the repository at this point in the history
Since we share a global fapi rc betweeen threads,
to avoid corruption, following approach -
1. Run processor thread at higher priority than async thread
2. Once async thread is unlocked, make it non pre-emptable

Change-Id: I873affbc15d99c8020c3d074e58aae1165e7ae12
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/61355
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
(cherry picked from commit bcd84270938b75c83cc364ff2c75133638cddb6e)
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/61461
  • Loading branch information
Shakeebbk authored and sgupta2m committed Jul 3, 2018
1 parent 022cf9e commit bba0cab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/sbefw/core/sbecmdprocessor.C
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ void sbeAsyncCommandProcessor_routine(void *arg)

ReturnCode rc = FAPI2_RC_SUCCESS;
Target<TARGET_TYPE_PROC_CHIP > proc = plat_getChipTarget();

// Run the procedure atomically
PkMachineContext ctx;
pk_critical_section_enter(&ctx);

SBE_EXEC_HWP(rc, p9_sbe_io_eol_toggle, proc)
if (rc != FAPI2_RC_SUCCESS)
{
Expand All @@ -463,6 +468,8 @@ void sbeAsyncCommandProcessor_routine(void *arg)
captureAsyncFFDC(SBE_PRI_GENERIC_EXECUTION_FAILURE,
SBE_SEC_PERIODIC_IO_TOGGLE_FAILED);
}

pk_critical_section_exit(&ctx);
} while(1);
#endif // PERIODIC_IO_TOGGLE_SUPPORTED
#undef SBE_FUNC
Expand Down
4 changes: 2 additions & 2 deletions src/sbefw/core/sbemain.C
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ int sbeInitThreads(void)
(void *)0,
(PkAddress)sbeSyncCommandProcessor_stack,
SBE_THREAD_SYNC_CMD_PROC_STACK_SIZE,
THREAD_PRIORITY_7);
THREAD_PRIORITY_6);
if (l_rc)
{
break;
Expand All @@ -238,7 +238,7 @@ int sbeInitThreads(void)
(void *)0,
(PkAddress)sbeAsyncCommandProcessor_stack,
SBE_THREAD_ASYNC_CMD_PROC_STACK_SIZE,
THREAD_PRIORITY_6);
THREAD_PRIORITY_7);
if (l_rc)
{
break;
Expand Down

0 comments on commit bba0cab

Please sign in to comment.