From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Scott Wood <scottwood@freescale.com>
Cc: linuxppc-dev@lists.ozlabs.org, Paul Mackerras <paulus@samba.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc 32: Provides VIRT_CPU_ACCOUNTING
Date: Wed, 30 Apr 2014 14:56:27 +1000 [thread overview]
Message-ID: <1398833787.31586.8.camel@pasglop> (raw)
In-Reply-To: <1395266717.12479.293.camel@snotra.buserror.net>
On Wed, 2014-03-19 at 17:05 -0500, Scott Wood wrote:
> On Wed, 2014-03-19 at 22:52 +0100, Christophe Leroy wrote:
> > This patch provides VIRT_CPU_ACCOUTING to PPC32 architecture.
> > Unlike PPC64, PPC32 doesn't provide the PACA register. Therefore the
> > implementation is similar to the one done in the IA64 architecture.
> > It is based on additional information added to the Task Info structure.
>
> PACA isn't a register -- just a convention for how Linux uses a GPR.
> Maybe it's time to use it on PPC32 as well?
PACA is actually a data structure and you really really don't want it
on ppc32 :-) Having a register point to current works, having a register
point to per-cpu data instead works too (ie, change what we do today),
but don't introduce a PACA *please* :-)
>
> > Index: b/arch/powerpc/kernel/asm-offsets.c
> > ===================================================================
> > --- b/arch/powerpc/kernel/asm-offsets.c (revision 5607)
> > +++ b/arch/powerpc/kernel/asm-offsets.c (revision 5608)
> > @@ -167,6 +167,10 @@
> > DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
> > DEFINE(TI_TASK, offsetof(struct thread_info, task));
> > DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
> > + DEFINE(TI_AC_STAMP, offsetof(struct thread_info, ac_stamp));
> > + DEFINE(TI_AC_LEAVE, offsetof(struct thread_info, ac_leave));
> > + DEFINE(TI_AC_STIME, offsetof(struct thread_info, ac_stime));
> > + DEFINE(TI_AC_UTIME, offsetof(struct thread_info, ac_utime));
>
> Doesn't this need to be protected by #ifdef
> CONFIG_VIRT_CPU_ACCOUNTING_NATIVE?
>
> >
> > #ifdef CONFIG_PPC64
> > DEFINE(DCACHEL1LINESIZE, offsetof(struct ppc64_caches, dline_size));
> > Index: b/arch/powerpc/include/asm/thread_info.h
> > ===================================================================
> > --- b/arch/powerpc/include/asm/thread_info.h (revision 5607)
> > +++ b/arch/powerpc/include/asm/thread_info.h (revision 5608)
> > @@ -43,6 +43,12 @@
> > int cpu; /* cpu we're on */
> > int preempt_count; /* 0 => preemptable,
> > <0 => BUG */
> > +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
> > + __u32 ac_stamp;
> > + __u32 ac_leave;
> > + __u32 ac_stime;
> > + __u32 ac_utime;
> > +#endif
>
> This isn't uapi; why not use "u32"?
>
> Plus, it should be made clear that this is only used on 32-bit.
>
> > struct restart_block restart_block;
> > unsigned long local_flags; /* private flags for thread */
> >
> > @@ -58,6 +64,8 @@
> > .task = &tsk, \
> > .exec_domain = &default_exec_domain, \
> > .cpu = 0, \
> > + .ac_stime = 0, \
> > + .ac_utime = 0, \
>
> Also needs to be ifdeffed -- which isn't going to work in a macro, so
> maybe remove the ifdef from the variable declarations, or just let the
> fields be initialized to zero by default. Or add PACA to 32-bit. :-)
>
> -Scott
>
next prev parent reply other threads:[~2014-04-30 4:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-19 21:52 [PATCH] powerpc 32: Provides VIRT_CPU_ACCOUNTING Christophe Leroy
2014-03-19 22:05 ` Scott Wood
2014-04-30 4:56 ` Benjamin Herrenschmidt [this message]
2014-04-30 18:14 ` Scott Wood
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=1398833787.31586.8.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
--cc=scottwood@freescale.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;
as well as URLs for NNTP newsgroup(s).