From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752567AbcBOJd1 (ORCPT ); Mon, 15 Feb 2016 04:33:27 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:34574 "EHLO mailhub1.si.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750881AbcBOJdX (ORCPT ); Mon, 15 Feb 2016 04:33:23 -0500 Subject: Re: [PATCH v5] powerpc32: provide VIRT_CPU_ACCOUNTING To: Denis Kirjanov References: <20160211161650.1F12C1A2400@localhost.localdomain> Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Scott Wood , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, David Woodhouse From: Christophe Leroy Message-ID: <56C19B5F.70801@c-s.fr> Date: Mon, 15 Feb 2016 10:33:19 +0100 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 14/02/2016 21:40, Denis Kirjanov a écrit : > On 2/11/16, Christophe Leroy 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 > 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