linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Denis Kirjanov <kda@linux-powerpc.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Scott Wood <oss@buserror.net>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH v5] powerpc32: provide VIRT_CPU_ACCOUNTING
Date: Mon, 15 Feb 2016 10:33:19 +0100	[thread overview]
Message-ID: <56C19B5F.70801@c-s.fr> (raw)
In-Reply-To: <CAOJe8K0VJM8VEEN2i+ufV0YjSrRYHO+o7k3Tiv=va9LnH02R7w@mail.gmail.com>

Le 14/02/2016 21:40, Denis Kirjanov a écrit :
> On 2/11/16, Christophe Leroy <christophe.leroy@c-s.fr> wrote:
>> This patch provides VIRT_CPU_ACCOUTING to PPC32 architecture.
>> PPC32 doesn't have the PACA structure, so we use the task_info
>> structure to store the accounting data.
>>
>> In order to reuse on PPC32 the PPC64 functions, all u64 data has
>> been replaced by 'unsigned long' so that it is u32 on PPC32 and
>> u64 on PPC64
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> Doesn't build for me with the patch applied
>
> To see full details build your kernel with:
> 'make CONFIG_DEBUG_SECTION_MISMATCH=y'
>    GEN     .version
>    CHK     include/generated/compile.h
>    UPD     include/generated/compile.h
>    CC      init/version.o
>    LD      init/built-in.o
> drivers/built-in.o: In function `get_cpu_idle_time':
> (.text+0x1261c4): undefined reference to `__umoddi3'
> drivers/built-in.o: In function `get_cpu_idle_time':
> (.text+0x1261e0): undefined reference to `__udivdi3'
> Makefile:936: recipe for target 'vmlinux' failed
> make: *** [vmlinux] Error 1
>
>
Looks like you have CONFIG_CPU_FREQ, which I don't have.

The issue comes from the jiffies64_to_cputime64() defined in 
arch/powerpc/include/asm/cputime.h :

static inline cputime64_t jiffies64_to_cputime64(const u64 jif)
{
         u64 ct;
         u64 sec;

         /* have to be a little careful about overflow */
         ct = jif % HZ;
         sec = jif / HZ;



On 32 bits, 64 bits % and / require __udivdi3() and __umoddi3(), which 
are not implemented in the kernel.

As HZ fits in 32 bits, the solution is to use do_div(). I should not 
change anything on PPC64 and would solve your issue.
I will submit an update of the patch within an hour.

Christophe

  reply	other threads:[~2016-02-15  9:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 16:16 [PATCH v5] powerpc32: provide VIRT_CPU_ACCOUNTING Christophe Leroy
2016-02-12  8:25 ` Denis Kirjanov
2016-02-14 20:40 ` Denis Kirjanov
2016-02-15  9:33   ` Christophe Leroy [this message]
2016-02-16 21:21 ` Scott Wood
2016-02-17 16:29   ` Christophe Leroy
2016-02-23  1:22     ` Scott Wood
2016-02-23  2:04   ` Michael Ellerman
2016-02-23  2:15     ` Scott Wood
2016-02-23  3:25       ` Michael Ellerman

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=56C19B5F.70801@c-s.fr \
    --to=christophe.leroy@c-s.fr \
    --cc=benh@kernel.crashing.org \
    --cc=dwmw2@infradead.org \
    --cc=kda@linux-powerpc.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=oss@buserror.net \
    --cc=paulus@samba.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).