Skip to content

Commit 3c7ce80

Browse files
committed
x86/mce: Mark mce_panic() noinstr
And allow instrumentation inside it because it does calls to other facilities which will not be tagged noinstr. Fixes vmlinux.o: warning: objtool: do_machine_check()+0xc73: call to mce_panic() leaves .noinstr.text section Signed-off-by: Borislav Petkov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0a5b288 commit 3c7ce80

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

arch/x86/kernel/cpu/mce/core.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,17 @@ static void wait_for_panic(void)
266266
panic("Panicing machine check CPU died");
267267
}
268268

269-
static void mce_panic(const char *msg, struct mce *final, char *exp)
269+
static noinstr void mce_panic(const char *msg, struct mce *final, char *exp)
270270
{
271-
int apei_err = 0;
272271
struct llist_node *pending;
273272
struct mce_evt_llist *l;
273+
int apei_err = 0;
274+
275+
/*
276+
* Allow instrumentation around external facilities usage. Not that it
277+
* matters a whole lot since the machine is going to panic anyway.
278+
*/
279+
instrumentation_begin();
274280

275281
if (!fake_panic) {
276282
/*
@@ -285,7 +291,7 @@ static void mce_panic(const char *msg, struct mce *final, char *exp)
285291
} else {
286292
/* Don't log too much for fake panic */
287293
if (atomic_inc_return(&mce_fake_panicked) > 1)
288-
return;
294+
goto out;
289295
}
290296
pending = mce_gen_pool_prepare_records();
291297
/* First print corrected ones that are still unlogged */
@@ -321,6 +327,9 @@ static void mce_panic(const char *msg, struct mce *final, char *exp)
321327
panic(msg);
322328
} else
323329
pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg);
330+
331+
out:
332+
instrumentation_end();
324333
}
325334

326335
/* Support code for software error injection */

0 commit comments

Comments
 (0)