Commit cf3dbe5d authored by Vasily Gorbik's avatar Vasily Gorbik Committed by Martin Schwidefsky

s390/kasan: support preemptible kernel build

When the kernel is built with:
CONFIG_PREEMPT=y
CONFIG_PREEMPT_COUNT=y
"stfle" function used by kasan initialization code makes additional
call to preempt_count_add/preempt_count_sub. To avoid removing kasan
instrumentation from sched code where those functions leave split stfle
function and provide __stfle variant without preemption handling to be
used by Kasan.
Reported-by: default avatarBenjamin Block <bblock@linux.ibm.com>
Acked-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 63c19be0
...@@ -64,11 +64,10 @@ static inline int test_facility(unsigned long nr) ...@@ -64,11 +64,10 @@ static inline int test_facility(unsigned long nr)
* @stfle_fac_list: array where facility list can be stored * @stfle_fac_list: array where facility list can be stored
* @size: size of passed in array in double words * @size: size of passed in array in double words
*/ */
static inline void stfle(u64 *stfle_fac_list, int size) static inline void __stfle(u64 *stfle_fac_list, int size)
{ {
unsigned long nr; unsigned long nr;
preempt_disable();
asm volatile( asm volatile(
" stfl 0(0)\n" " stfl 0(0)\n"
: "=m" (S390_lowcore.stfl_fac_list)); : "=m" (S390_lowcore.stfl_fac_list));
...@@ -85,6 +84,12 @@ static inline void stfle(u64 *stfle_fac_list, int size) ...@@ -85,6 +84,12 @@ static inline void stfle(u64 *stfle_fac_list, int size)
nr = (reg0 + 1) * 8; /* # bytes stored by stfle */ nr = (reg0 + 1) * 8; /* # bytes stored by stfle */
} }
memset((char *) stfle_fac_list + nr, 0, size * 8 - nr); memset((char *) stfle_fac_list + nr, 0, size * 8 - nr);
}
static inline void stfle(u64 *stfle_fac_list, int size)
{
preempt_disable();
__stfle(stfle_fac_list, size);
preempt_enable(); preempt_enable();
} }
......
...@@ -222,8 +222,8 @@ static void __init kasan_enable_dat(void) ...@@ -222,8 +222,8 @@ static void __init kasan_enable_dat(void)
static void __init kasan_early_detect_facilities(void) static void __init kasan_early_detect_facilities(void)
{ {
stfle(S390_lowcore.stfle_fac_list, __stfle(S390_lowcore.stfle_fac_list,
ARRAY_SIZE(S390_lowcore.stfle_fac_list)); ARRAY_SIZE(S390_lowcore.stfle_fac_list));
if (test_facility(8)) { if (test_facility(8)) {
has_edat = true; has_edat = true;
__ctl_set_bit(0, 23); __ctl_set_bit(0, 23);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment