LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Ganesh" <ganeshgr@linux.ibm.com>,
	<linuxppc-dev@lists.ozlabs.org>, <mpe@ellerman.id.au>
Cc: mahesh@linux.ibm.com, sachinp@linux.ibm.com
Subject: Re: [PACTH v2] powerpc/pseries/mce: Avoid instrumentation in realmode
Date: Tue, 20 Sep 2022 13:51:59 +1000	[thread overview]
Message-ID: <CN0X9CSRA9D7.ZZVYTCRQ0EWE@bobo> (raw)
In-Reply-To: <895f4387-582a-6d60-a176-e2112f506e12@linux.ibm.com>

On Mon Sep 19, 2022 at 4:03 PM AEST, Ganesh wrote:
> On 9/7/22 09:49, Nicholas Piggin wrote:
>
> > On Mon Sep 5, 2022 at 4:38 PM AEST, Ganesh Goudar wrote:
> >> Part of machine check error handling is done in realmode,
> >> As of now instrumentation is not possible for any code that
> >> runs in realmode.
> >> When MCE is injected on KASAN enabled kernel, crash is
> >> observed, Hence force inline or mark no instrumentation
> >> for functions which can run in realmode, to avoid KASAN
> >> instrumentation.
> >>
> >> Signed-off-by: Ganesh Goudar<ganeshgr@linux.ibm.com>
> >> ---
> >> v2: Force inline few more functions.
> >> ---
> >>   arch/powerpc/include/asm/hw_irq.h    | 8 ++++----
> >>   arch/powerpc/include/asm/interrupt.h | 2 +-
> >>   arch/powerpc/include/asm/rtas.h      | 4 ++--
> >>   arch/powerpc/kernel/rtas.c           | 4 ++--
> >>   4 files changed, 9 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
> >> index 26ede09c521d..3264991fe524 100644
> >> --- a/arch/powerpc/include/asm/hw_irq.h
> >> +++ b/arch/powerpc/include/asm/hw_irq.h
> >> @@ -111,7 +111,7 @@ static inline void __hard_RI_enable(void)
> >>   #ifdef CONFIG_PPC64
> >>   #include <asm/paca.h>
> >>   
> >> -static inline notrace unsigned long irq_soft_mask_return(void)
> >> +static __always_inline notrace unsigned long irq_soft_mask_return(void)
> >>   {
> >>   	return READ_ONCE(local_paca->irq_soft_mask);
> >>   }
> >> @@ -121,7 +121,7 @@ static inline notrace unsigned long irq_soft_mask_return(void)
> >>    * for the critical section and as a clobber because
> >>    * we changed paca->irq_soft_mask
> >>    */
> >> -static inline notrace void irq_soft_mask_set(unsigned long mask)
> >> +static __always_inline notrace void irq_soft_mask_set(unsigned long mask)
> >>   {
> >>   	/*
> >>   	 * The irq mask must always include the STD bit if any are set.
> > This doesn't give a reason why it's __always_inline, and having the
> > notrace attribute makes it possibly confusing. I think it would be easy
> > for someone to break without realising. Could you add a noinstr to these
> > instead / as well?
>
> Yeah we can add noinstr. Missed to see your comment, Sorry for the delayed reply

Okay that would be good. I would prefer to avoid changing the
inline-ness of things in a fix patch if possible.
>
> >
> > What about adding a 'realmode' function annotation that includes noinstr?
>
> You mean to define a new function annotation?

Yes, a powerpc specific one that has the necessary adjustments. I
think it would be helpful documentation for the code and possibly
something we could use to do additional debug checking with at
some point too.

Thanks,
Nick

      reply	other threads:[~2022-09-20  3:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05  6:38 [PACTH v2] powerpc/pseries/mce: Avoid instrumentation in realmode Ganesh Goudar
2022-09-06  4:58 ` Sachin Sant
2022-09-07  4:19 ` Nicholas Piggin
2022-09-19  6:03   ` Ganesh
2022-09-20  3:51     ` Nicholas Piggin [this message]

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=CN0X9CSRA9D7.ZZVYTCRQ0EWE@bobo \
    --to=npiggin@gmail.com \
    --cc=ganeshgr@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mahesh@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=sachinp@linux.ibm.com \
    /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