kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: me@tobin.cc (Tobin C. Harding)
To: kernelnewbies@lists.kernelnewbies.org
Subject: powerpc build fail
Date: Tue, 21 Feb 2017 21:53:01 +1100	[thread overview]
Message-ID: <20170221105301.GA6678@eros> (raw)

The current (2bfe01e) torvalds git tree fails to build with the following error

arch/powerpc/kernel/time.c: In function ?running_clock?:
arch/powerpc/kernel/time.c:712:25: error: implicit declaration of function ?cputime_to_nsecs? [-Werror=implicit-function-declaration]
  return local_clock() - cputime_to_nsecs(kcpustat_this_cpu->cpustat[CPUTIME_STEAL]);
                         ^
I would like to do more than just file a bug report. Further
investigation (cputime.h) shows that cputime_to_nsecs has a
preprocessor guard on the config option (currently enabled)
CONFIG_VIRT_CPU_ACCOUNTING_NATIVE. 

CONFIG_PPC_PSERIES is also enabled.

The offending code in arch/powerpc/kernel/time.c is

#ifdef CONFIG_PPC_PSERIES

/*                                                                                    
 * Running clock - attempts to give a view of time passing for a virtualised          
 * kernels.                                                                           
 * Uses the VTB register if available otherwise a next best guess.                    
 */
unsigned long long running_clock(void)
{
 	/*                                                                            
         * Don't read the VTB as a host since KVM does not switch in host             
         * timebase into the VTB when it takes a guest off the CPU, reading the       
         * VTB would result in reading 'last switched out' guest VTB.                 
         *                                                                            
         * Host kernels are often compiled with CONFIG_PPC_PSERIES checked, it        
         * would be unsafe to rely only on the #ifdef above.                          
         */
	if (firmware_has_feature(FW_FEATURE_LPAR) &&
            cpu_has_feature(CPU_FTR_ARCH_207S))
		return mulhdu(get_vtb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift;

	/*                                                                            
         * This is a next best approximation without a VTB.                           
         * On a host which is running bare metal there should never be any stolen     
         * time and on a host which doesn't do any virtualisation TB *should* equal   
         * VTB so it makes no difference anyway.                                      
         */
	return local_clock() - cputime_to_nsecs(kcpustat_this_cpu->cpustat[CPUTIME_STEAL]);
}
#endif

Can anyone give me a hint on this one? Where to start reading?

thanks,
Tobin.

             reply	other threads:[~2017-02-21 10:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 10:53 Tobin C. Harding [this message]
2017-02-21 23:37 ` powerpc build fail Tobin C. Harding

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=20170221105301.GA6678@eros \
    --to=me@tobin.cc \
    --cc=kernelnewbies@lists.kernelnewbies.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).