All of lore.kernel.org
 help / color / mirror / Atom feed
* [CPUFREQ] Fix implicit declarations in ondemand.
@ 2006-07-05  9:22 Dave Jones
  2006-07-05  9:36 ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Dave Jones @ 2006-07-05  9:22 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, Linux Kernel

drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration of function ‘jiffies64_to_cputime64’
drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration of function ‘cputime64_sub’

Signed-off-by: Dave Jones <davej@redhat.com>

--- linux-2.6/drivers/cpufreq/cpufreq_ondemand.c~	2006-07-05 05:19:26.000000000 -0400
+++ linux-2.6/drivers/cpufreq/cpufreq_ondemand.c	2006-07-05 05:20:01.000000000 -0400
@@ -18,6 +18,7 @@
 #include <linux/jiffies.h>
 #include <linux/kernel_stat.h>
 #include <linux/mutex.h>
+#include <asm/cputime.h>
 
 /*
  * dbs is used in this file as a shortform for demandbased switching

-- 
http://www.codemonkey.org.uk

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [CPUFREQ] Fix implicit declarations in ondemand.
  2006-07-05  9:22 [CPUFREQ] Fix implicit declarations in ondemand Dave Jones
@ 2006-07-05  9:36 ` Andrew Morton
  2006-07-05  9:42   ` Dave Jones
  2006-07-05  9:43   ` David Woodhouse
  0 siblings, 2 replies; 8+ messages in thread
From: Andrew Morton @ 2006-07-05  9:36 UTC (permalink / raw)
  To: Dave Jones; +Cc: torvalds, linux-kernel

On Wed, 5 Jul 2006 05:22:54 -0400
Dave Jones <davej@redhat.com> wrote:

> drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
> drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration of function ‘jiffies64_to_cputime64’
> drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration of function ‘cputime64_sub’
> 
> Signed-off-by: Dave Jones <davej@redhat.com>
> 
> --- linux-2.6/drivers/cpufreq/cpufreq_ondemand.c~	2006-07-05 05:19:26.000000000 -0400
> +++ linux-2.6/drivers/cpufreq/cpufreq_ondemand.c	2006-07-05 05:20:01.000000000 -0400
> @@ -18,6 +18,7 @@
>  #include <linux/jiffies.h>
>  #include <linux/kernel_stat.h>
>  #include <linux/mutex.h>
> +#include <asm/cputime.h>
>  

But kernel_stat.h already includes cputime.h, as does sched.h, and pretty
much everything pulls in sched.h.

It's not bad to avoid a dependency upon nested includes, but I do wonder
how this error came about??

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [CPUFREQ] Fix implicit declarations in ondemand.
  2006-07-05  9:36 ` Andrew Morton
@ 2006-07-05  9:42   ` Dave Jones
  2006-07-05  9:43   ` David Woodhouse
  1 sibling, 0 replies; 8+ messages in thread
From: Dave Jones @ 2006-07-05  9:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: torvalds, linux-kernel, dwmw2

On Wed, Jul 05, 2006 at 02:36:41AM -0700, Andrew Morton wrote:
 > On Wed, 5 Jul 2006 05:22:54 -0400
 > Dave Jones <davej@redhat.com> wrote:
 > 
 > > drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
 > > drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration of function ‘jiffies64_to_cputime64’
 > > drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration of function ‘cputime64_sub’
 > > 
 > > Signed-off-by: Dave Jones <davej@redhat.com>
 > > 
 > > --- linux-2.6/drivers/cpufreq/cpufreq_ondemand.c~	2006-07-05 05:19:26.000000000 -0400
 > > +++ linux-2.6/drivers/cpufreq/cpufreq_ondemand.c	2006-07-05 05:20:01.000000000 -0400
 > > @@ -18,6 +18,7 @@
 > >  #include <linux/jiffies.h>
 > >  #include <linux/kernel_stat.h>
 > >  #include <linux/mutex.h>
 > > +#include <asm/cputime.h>
 > >  
 > 
 > But kernel_stat.h already includes cputime.h, as does sched.h, and pretty
 > much everything pulls in sched.h.
 > 
 > It's not bad to avoid a dependency upon nested includes, but I do wonder
 > how this error came about??

Yeah, this is the wrong fix. Turns out it blew up on ppc64, which doesn't
have those functions in its cputime.h

hrmph.

		Dave

-- 
http://www.codemonkey.org.uk

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [CPUFREQ] Fix implicit declarations in ondemand.
  2006-07-05  9:36 ` Andrew Morton
  2006-07-05  9:42   ` Dave Jones
@ 2006-07-05  9:43   ` David Woodhouse
  2006-07-05  9:46     ` Dave Jones
  1 sibling, 1 reply; 8+ messages in thread
From: David Woodhouse @ 2006-07-05  9:43 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Dave Jones, torvalds, linux-kernel

On Wed, 2006-07-05 at 02:36 -0700, Andrew Morton wrote:
> On Wed, 5 Jul 2006 05:22:54 -0400 Dave Jones <davej@redhat.com> wrote:
> 
> > drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
> > drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration
> of function ‘jiffies64_to_cputime64’
> > drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration
> of function ‘cputime64_sub’

> > +#include <asm/cputime.h>

> But kernel_stat.h already includes cputime.h, as does sched.h, and
> pretty much everything pulls in sched.h.
> 
> It's not bad to avoid a dependency upon nested includes, but I do
> wonder how this error came about?? 

asm-powerpc/cputime.h doesn't declare jiffies64_to_cputime64() or
cputime64_sub()

-- 
dwmw2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [CPUFREQ] Fix implicit declarations in ondemand.
  2006-07-05  9:43   ` David Woodhouse
@ 2006-07-05  9:46     ` Dave Jones
  2006-07-05  9:57       ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Dave Jones @ 2006-07-05  9:46 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Andrew Morton, torvalds, linux-kernel

On Wed, Jul 05, 2006 at 10:43:05AM +0100, David Woodhouse wrote:
 > On Wed, 2006-07-05 at 02:36 -0700, Andrew Morton wrote:
 > > On Wed, 5 Jul 2006 05:22:54 -0400 Dave Jones <davej@redhat.com> wrote:
 > > 
 > > > drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
 > > > drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration
 > > of function ‘jiffies64_to_cputime64’
 > > > drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration
 > > of function ‘cputime64_sub’
 > 
 > > > +#include <asm/cputime.h>
 > 
 > > But kernel_stat.h already includes cputime.h, as does sched.h, and
 > > pretty much everything pulls in sched.h.
 > > 
 > > It's not bad to avoid a dependency upon nested includes, but I do
 > > wonder how this error came about?? 
 > 
 > asm-powerpc/cputime.h doesn't declare jiffies64_to_cputime64() or
 > cputime64_sub()

The curious part is why it isn't picking up the definition from asm-generic
like x86-64 & friends do.

		Dave

-- 
http://www.codemonkey.org.uk

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [CPUFREQ] Fix implicit declarations in ondemand.
  2006-07-05  9:46     ` Dave Jones
@ 2006-07-05  9:57       ` Andrew Morton
  2006-07-05 10:24         ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2006-07-05  9:57 UTC (permalink / raw)
  To: Dave Jones; +Cc: dwmw2, torvalds, linux-kernel

On Wed, 5 Jul 2006 05:46:57 -0400
Dave Jones <davej@redhat.com> wrote:

> On Wed, Jul 05, 2006 at 10:43:05AM +0100, David Woodhouse wrote:
>  > On Wed, 2006-07-05 at 02:36 -0700, Andrew Morton wrote:
>  > > On Wed, 5 Jul 2006 05:22:54 -0400 Dave Jones <davej@redhat.com> wrote:
>  > > 
>  > > > drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
>  > > > drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration
>  > > of function ‘jiffies64_to_cputime64’
>  > > > drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration
>  > > of function ‘cputime64_sub’
>  > 
>  > > > +#include <asm/cputime.h>
>  > 
>  > > But kernel_stat.h already includes cputime.h, as does sched.h, and
>  > > pretty much everything pulls in sched.h.
>  > > 
>  > > It's not bad to avoid a dependency upon nested includes, but I do
>  > > wonder how this error came about?? 
>  > 
>  > asm-powerpc/cputime.h doesn't declare jiffies64_to_cputime64() or
>  > cputime64_sub()
> 
> The curious part is why it isn't picking up the definition from asm-generic
> like x86-64 & friends do.
> 

CONFIG_VIRT_CPU_ACCOUNTING.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [CPUFREQ] Fix implicit declarations in ondemand.
  2006-07-05  9:57       ` Andrew Morton
@ 2006-07-05 10:24         ` David Woodhouse
  2006-07-05 23:09           ` Paul Mackerras
  0 siblings, 1 reply; 8+ messages in thread
From: David Woodhouse @ 2006-07-05 10:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Dave Jones, torvalds, linux-kernel, paulus

On Wed, 2006-07-05 at 02:57 -0700, Andrew Morton wrote:
> On Wed, 5 Jul 2006 05:46:57 -0400
> Dave Jones <davej@redhat.com> wrote:
> 
> > On Wed, Jul 05, 2006 at 10:43:05AM +0100, David Woodhouse wrote:
> >  > On Wed, 2006-07-05 at 02:36 -0700, Andrew Morton wrote:
> >  > > On Wed, 5 Jul 2006 05:22:54 -0400 Dave Jones <davej@redhat.com> wrote:
> >  > > 
> >  > > > drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
> >  > > > drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration
> >  > > of function ‘jiffies64_to_cputime64’
> >  > > > drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration
> >  > > of function ‘cputime64_sub’
> >  > 
> >  > > > +#include <asm/cputime.h>
> >  > 
> >  > > But kernel_stat.h already includes cputime.h, as does sched.h, and
> >  > > pretty much everything pulls in sched.h.
> >  > > 
> >  > > It's not bad to avoid a dependency upon nested includes, but I do
> >  > > wonder how this error came about?? 
> >  > 
> >  > asm-powerpc/cputime.h doesn't declare jiffies64_to_cputime64() or
> >  > cputime64_sub()
> > 
> > The curious part is why it isn't picking up the definition from asm-generic
> > like x86-64 & friends do.
> > 
> 
> CONFIG_VIRT_CPU_ACCOUNTING.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>

--- linux-2.6.17.ppc64/include/asm-powerpc/cputime.h~	2006-06-18 02:49:35.000000000 +0100
+++ linux-2.6.17.ppc64/include/asm-powerpc/cputime.h	2006-07-05 11:19:35.000000000 +0100
@@ -43,6 +43,7 @@ typedef u64 cputime64_t;
 
 #define cputime64_zero			((cputime64_t)0)
 #define cputime64_add(__a, __b)		((__a) + (__b))
+#define cputime64_sub(__a, __b)		((__a) - (__b))
 #define cputime_to_cputime64(__ct)	(__ct)
 
 #ifdef __KERNEL__
@@ -74,6 +75,23 @@ static inline cputime_t jiffies_to_cputi
 	return ct;
 }
 
+static inline cputime64_t jiffies64_to_cputime64(const u64 jif)
+{
+	cputime_t ct;
+	u64 sec;
+
+	/* have to be a little careful about overflow */
+	ct = jif % HZ;
+	sec = jif / HZ;
+	if (ct) {
+		ct *= tb_ticks_per_sec;
+		do_div(ct, HZ);
+	}
+	if (sec)
+		ct += (cputime_t) sec * tb_ticks_per_sec;
+	return ct;
+}
+
 static inline u64 cputime64_to_jiffies64(const cputime_t ct)
 {
 	return mulhdu(ct, __cputime_jiffies_factor);

-- 
dwmw2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [CPUFREQ] Fix implicit declarations in ondemand.
  2006-07-05 10:24         ` David Woodhouse
@ 2006-07-05 23:09           ` Paul Mackerras
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Mackerras @ 2006-07-05 23:09 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Andrew Morton, Dave Jones, torvalds, linux-kernel

David Woodhouse writes:

> +static inline cputime64_t jiffies64_to_cputime64(const u64 jif)
> +{
> +	cputime_t ct;
> +	u64 sec;
> +
> +	/* have to be a little careful about overflow */
> +	ct = jif % HZ;
> +	sec = jif / HZ;

I think we want to use do_div here, just in case we ever get around to
implementing this stuff on ppc32.

Paul.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-07-05 23:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-05  9:22 [CPUFREQ] Fix implicit declarations in ondemand Dave Jones
2006-07-05  9:36 ` Andrew Morton
2006-07-05  9:42   ` Dave Jones
2006-07-05  9:43   ` David Woodhouse
2006-07-05  9:46     ` Dave Jones
2006-07-05  9:57       ` Andrew Morton
2006-07-05 10:24         ` David Woodhouse
2006-07-05 23:09           ` Paul Mackerras

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.