public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michal Suchánek" <msuchanek@suse.de>
To: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: David Hildenbrand <david@redhat.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	David Howells <dhowells@redhat.com>,
	Paul Mackerras <paulus@samba.org>,
	Breno Leitao <leitao@debian.org>,
	Michael Neuling <mikey@neuling.org>,
	Nicolai Stange <nstange@suse.de>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Allison Randal <allison@lohutok.net>,
	Firoz Khan <firoz.khan@linaro.org>, Joel Stanley <joel@jms.id.au>,
	Arnd Bergmann <arnd@arndb.de>,
	Nicholas Piggin <npiggin@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Christian Brauner <christian@brauner.io>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Andrew Donnellan <andrew.donnellan@au1.ibm.com>,
	Hari Bathini <hbathini@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v5 5/5] powerpc/perf: split callchain.c by bitness
Date: Fri, 30 Aug 2019 09:12:12 +0200	[thread overview]
Message-ID: <20190830091212.4d1d619f@naga> (raw)
In-Reply-To: <20190830084225.527f4265@naga>

On Fri, 30 Aug 2019 08:42:25 +0200
Michal Suchánek <msuchanek@suse.de> wrote:

> On Fri, 30 Aug 2019 06:35:11 +0000 (UTC)
> Christophe Leroy <christophe.leroy@c-s.fr> wrote:
> 
> > On 08/29/2019 10:28 PM, Michal Suchanek wrote:  

> >  obj-$(CONFIG_PPC_PERF_CTRS)	+= core-book3s.o bhrb.o
> > diff --git a/arch/powerpc/perf/callchain_32.c b/arch/powerpc/perf/callchain_32.c
> > index 0bd4484eddaa..17c43ae03084 100644
> > --- a/arch/powerpc/perf/callchain_32.c
> > +++ b/arch/powerpc/perf/callchain_32.c
> > @@ -15,50 +15,13 @@
> >  #include <asm/sigcontext.h>
> >  #include <asm/ucontext.h>
> >  #include <asm/vdso.h>
> > -#ifdef CONFIG_PPC64
> > -#include "../kernel/ppc32.h"
> > -#endif
> >  #include <asm/pte-walk.h>
> >  
> >  #include "callchain.h"
> >  
> >  #ifdef CONFIG_PPC64
> > -static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret)
> > -{
> > -	if ((unsigned long)ptr > TASK_SIZE - sizeof(unsigned int) ||
> > -	    ((unsigned long)ptr & 3))
> > -		return -EFAULT;
> > -
> > -	pagefault_disable();
> > -	if (!__get_user_inatomic(*ret, ptr)) {
> > -		pagefault_enable();
> > -		return 0;
> > -	}
> > -	pagefault_enable();
> > -
> > -	return read_user_stack_slow(ptr, ret, 4);
> > -}
> > -#else /* CONFIG_PPC64 */
> > -/*
> > - * On 32-bit we just access the address and let hash_page create a
> > - * HPTE if necessary, so there is no need to fall back to reading
> > - * the page tables.  Since this is called at interrupt level,
> > - * do_page_fault() won't treat a DSI as a page fault.
> > - */
> > -static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret)
> > -{
> > -	int rc;
> > -
> > -	if ((unsigned long)ptr > TASK_SIZE - sizeof(unsigned int) ||
> > -	    ((unsigned long)ptr & 3))
> > -		return -EFAULT;
> > -
> > -	pagefault_disable();
> > -	rc = __get_user_inatomic(*ret, ptr);
> > -	pagefault_enable();
> > -
> > -	return rc;
> > -}
> > +#include "../kernel/ppc32.h"
> > +#else
> >  
> >  #define __SIGNAL_FRAMESIZE32	__SIGNAL_FRAMESIZE
> >  #define sigcontext32		sigcontext
> > @@ -95,6 +58,30 @@ struct rt_signal_frame_32 {
> >  	int			abigap[56];
> >  };
> >  
> > +/*
> > + * On 32-bit we just access the address and let hash_page create a
> > + * HPTE if necessary, so there is no need to fall back to reading
> > + * the page tables.  Since this is called at interrupt level,
> > + * do_page_fault() won't treat a DSI as a page fault.
> > + */
> > +static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret)
> > +{
> > +	int rc;
> > +
> > +	if ((unsigned long)ptr > TASK_SIZE - sizeof(unsigned int) ||
> > +	    ((unsigned long)ptr & 3))
> > +		return -EFAULT;
> > +
> > +	pagefault_disable();
> > +	rc = __get_user_inatomic(*ret, ptr);
> > +	pagefault_enable();
> > +
> > +	if (IS_ENABLED(CONFIG_PPC32) || !rc)
> > +		return rc;
> > +
> > +	return read_user_stack_slow(ptr, ret, 4);
> > +}
> > +
> >  static int is_sigreturn_32_address(unsigned int nip, unsigned int fp)
> >  {
> >  	if (nip == fp + offsetof(struct signal_frame_32, mctx.mc_pad))  
> 
> I will leave consolidating this function to somebody who knows what the
> desired semantic is. With a short ifdef section at the top of the file
> it is a low-hanging fruit.

It looks ok if done as a separate patch.

Thanks

Michal

  reply	other threads:[~2019-08-30  7:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-29 22:28 [PATCH v5 0/5] Disable compat cruft on ppc64le v5 Michal Suchanek
2019-08-29 22:28 ` [PATCH v5 1/5] powerpc: make llseek 32bit-only Michal Suchanek
2019-08-29 22:28 ` [PATCH v5 2/5] powerpc: move common register copy functions from signal_32.c to signal.c Michal Suchanek
2019-08-29 22:28 ` [PATCH v5 3/5] powerpc/64: make buildable without CONFIG_COMPAT Michal Suchanek
2019-08-30  6:35   ` Christophe Leroy
2019-08-30  7:54     ` Michal Suchánek
2019-08-30  8:01       ` Christophe Leroy
2019-08-29 22:28 ` [PATCH v5 4/5] powerpc/64: Make COMPAT user-selectable disabled on littleendian by default Michal Suchanek
2019-08-29 22:28 ` [PATCH v5 5/5] powerpc/perf: split callchain.c by bitness Michal Suchanek
2019-08-30  6:35   ` Christophe Leroy
2019-08-30  6:42     ` Michal Suchánek
2019-08-30  7:12       ` Michal Suchánek [this message]
2019-08-30  7:15         ` Christophe Leroy

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=20190830091212.4d1d619f@naga \
    --to=msuchanek@suse.de \
    --cc=allison@lohutok.net \
    --cc=andrew.donnellan@au1.ibm.com \
    --cc=arnd@arndb.de \
    --cc=christian@brauner.io \
    --cc=christophe.leroy@c-s.fr \
    --cc=david@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=firoz.khan@linaro.org \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hbathini@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=joel@jms.id.au \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=npiggin@gmail.com \
    --cc=nstange@suse.de \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /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