Date: Thu, 24 Mar 2011 17:00:02 +0800 From: Jing Huang <jing.huang.pku@gmail.com> To: kris@freebsd.org Cc: freebsd-hackers@freebsd.org, hackers@FreeBSD.org Subject: Timecounter Project (GSoc2011) Message-ID: <AANLkTim1CHsasQTNqGDSHqP_Vesvb03FxDixiLfEJu8_@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi Everyone, I am a student of Peking University in China. I am interest in the FreeBSD project of "Timecounter Performance Improvements". I am familiar with Linux kernel and virtualization systems, like KVM and Xen. I have maintained the Linux Server for my College for last whole year. Recently, I learned a lot about KVM and assigned VMs to students who need them. I also have experience of install and config FreeBSD system. In this scenario, I plan to use both tsc and shared memory to calculate precise time in user mode. The shared memory includes system_time, tsc_system_time and factor_tsc-system_time. a) system_time is the current time since the system boots, and it will be updated by time interrupt handling function. b) tsc_system_time is the tsc value when system_time update, and it is used to calculate rough delta. c) factor_tsc-system_time records the correspondence between tsc and time. It is used to calculate precise delta. When the process invokes gettimeofday, our mechanism will calculate time like: system_time+ ( factor_tsc-system_time(instant_rdtsc - tsc_system_time ) ). We see factor_tsc-system_time as a computing method here. I could refer to the relative implementation in KVM or Xen virtual machine. The real problem is that tsc counter is CPU sensitive. Our process will get wrong tsc value when switching to another CPU. I plan to force the FreeBSD kernel to update shared memory when monitoring context switch event. Alternatively, we can build NR_CPUS shared memories, and every CPU has one. Hmm.. how to recognize which CPU we are using in user mode? We also consider the CPU frequency, because tsc counter is related to it. When kernel changes CPU frequency, the shared memory should be update subsequently. Would some one give me some suggestions? Looking forward to your reply. yours sincerely. Jing
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTim1CHsasQTNqGDSHqP_Vesvb03FxDixiLfEJu8_>