Make sure the function reentrant, prepare for rpc method. Change-Id: Ie5230e4ac6c9a750e8e779c5e0b67134729c07e3 Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>