OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 1:53 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Read '0' from local APIC timer registers.
PostPosted: Tue Feb 26, 2019 12:15 am 
Offline

Joined: Fri Nov 17, 2017 7:02 am
Posts: 20
I am writing a Linux kernel module to read dump local APIC timer registers.
I am using Ubuntu 16.04 desktop on X86_64 platform.
X2APIC is disabled, and nohz=off in grub.cfg.

Here comes the code.

#include <linux/slab.h>
#include <linux/time.h>
#include <asm/string.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/hrtimer.h>
#include <linux/ktime.h>
#include <asm/apic.h>

void read_apic_timer(void)
{
printk("APIC_TDCR = 0x%x\n", apic_read(APIC_TDCR));
printk("APIC_TMICT = 0x%x\n", apic_read(APIC_TMICT));
printk("APIC_TMCCT = 0x%x\n", apic_read(APIC_TMCCT));
}

static int __init timer_init(void)
{
read_apic_timer();
return 0;
}

static void __exit timer_exit(void)
{
printk("module uninstalling\n");
}

module_init(timer_init);
module_exit(timer_exit);
MODULE_LICENSE("GPL");

And what I got is below,

[ 5619.047497] APIC_TDCR = 0x0
[ 5619.047498] APIC_TMICT = 0x0
[ 5619.047499] APIC_TMCCT = 0x0

I am not sure if it is correct or NOT.

Thanks,


Top
 Profile  
 
 Post subject: Re: Read '0' from local APIC timer registers.
PostPosted: Thu Feb 28, 2019 8:18 pm 
Offline

Joined: Fri Nov 17, 2017 7:02 am
Posts: 20
Finally, I got the reason of 0s.
It is because, in my host, it supports TSC_DEADLINE mode, so Linux will configure APIC timer to this mode, without using TMICT/TMCCT/TMDCR.

Thanks,


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 492 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group