From: Peter Zijlstra <peterz@infradead.org>
To: Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
rdunlap@infradead.org, jpoimboe@redhat.com, sfr@canb.auug.org.au,
tony.luck@intel.com
Subject: Re: [RFC][PATCH 6/6] x86/mce: Dont use noinstr for now
Date: Thu, 7 Jan 2021 13:58:21 +0100 [thread overview]
Message-ID: <X/cFbZVSFXLuj40Q@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20210107100626.GG14697@zn.tnic>
On Thu, Jan 07, 2021 at 11:06:26AM +0100, Borislav Petkov wrote:
> On Wed, Jan 06, 2021 at 03:57:55PM +0100, Boris Petkov wrote:
> > Another thing that we could do is carve out only the stuff which needs
> > to be noinstr into a separate compilation unit and disable tracing
> > only for that while keeping the rest traceable. Need to try it to see
> > how ugly it'll get...
>
> Something like the below, it barely builds.
>
> I haven't found out whether I can even do
>
> ccflags-remove
>
> on a per-file basis, I guess I cannot so that's not there yet.
>
> core_noinstr.c ended up containing all the code needed by the #MC
> handler so that should be ok-ish, carve-out-wise.
>
> Also, I've exported a bunch of functions which are in mce/core.c through
> the internal.h header so that core_noinstr.c can call them. There are
> no more objtool warnings but if it turns out that we have to move those
> functions:
>
> +/* core_noinstr.c */
> +bool mce_check_crashing_cpu(void);
> +void print_mce(struct mce *m);
> +void mce_reset(void);
> +bool whole_page(struct mce *m);
> +u64 mce_rdmsrl(u32 msr);
> +void mce_wrmsrl(u32 msr, u64 v);
> +void mce_read_aux(struct mce *m, int i);
> +void mce_gather_info(struct mce *m, struct pt_regs *regs);
>
> to core_noinstr.c after all, then we can do your solution directly.
>
> Ok, gnight. :-)
>
> ---
> diff --git a/arch/x86/kernel/cpu/mce/Makefile b/arch/x86/kernel/cpu/mce/Makefile
> index 9f020c994154..2fa36118a05f 100644
> --- a/arch/x86/kernel/cpu/mce/Makefile
> +++ b/arch/x86/kernel/cpu/mce/Makefile
> @@ -1,5 +1,10 @@
> # SPDX-License-Identifier: GPL-2.0
> -obj-y = core.o severity.o genpool.o
> +# No instrumentation for #MC handler code
> +KASAN_SANITIZE_core_instr.o := n
> +UBSAN_SANITIZE_core_instr.o := n
> +KCOV_INSTRUMENT_core_instr.o := n
ifdef CONFIG_FUNCTION_TRACER
CFLAGS_REMOVE_core_instr.o = $(CC_FLAGS_FTRACE)
endif
> +
> +obj-y = core.o core_noinstr.o severity.o genpool.o
I'm thinking
next prev parent reply other threads:[~2021-01-08 20:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-06 14:36 [PATCH 0/6] x86 noinstr fixes Peter Zijlstra
2021-01-06 14:36 ` [PATCH 1/6] x86/entry: Fix noinstr fail Peter Zijlstra
2021-01-12 20:12 ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2021-01-06 14:36 ` [PATCH 2/6] x86/sev: Fix nonistr violation Peter Zijlstra
2021-01-06 17:59 ` Randy Dunlap
2021-01-07 9:36 ` Peter Zijlstra
2021-01-07 10:18 ` [PATCH 7/6] x86: __always_inline __{rd,wr}msr() Peter Zijlstra
2021-01-07 10:31 ` David Laight
2021-01-07 16:49 ` Randy Dunlap
2021-01-12 20:12 ` [tip: x86/urgent] x86/sev: Fix nonistr violation tip-bot2 for Peter Zijlstra
2021-01-06 14:36 ` [PATCH 3/6] locking/lockdep: Cure noinstr fail Peter Zijlstra
2021-01-12 20:12 ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2021-01-06 14:36 ` [PATCH 4/6] locking/lockdep: Avoid noinstr warning for DEBUG_LOCKDEP Peter Zijlstra
2021-01-12 20:12 ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2021-01-06 14:36 ` [PATCH 5/6] x86/mce: Remove explicit/superfluous tracing Peter Zijlstra
2021-01-12 20:12 ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2021-01-06 14:36 ` [RFC][PATCH 6/6] x86/mce: Dont use noinstr for now Peter Zijlstra
2021-01-06 14:57 ` Boris Petkov
2021-01-07 10:06 ` Borislav Petkov
2021-01-07 12:58 ` Peter Zijlstra [this message]
2021-01-07 13:13 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=X/cFbZVSFXLuj40Q@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=sfr@canb.auug.org.au \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).