From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 24 13:34:36 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A09DA1065670; Thu, 24 Mar 2011 13:34:36 +0000 (UTC) (envelope-from jing.huang.pku@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 27B368FC08; Thu, 24 Mar 2011 13:34:35 +0000 (UTC) Received: by qyk35 with SMTP id 35so5396131qyk.13 for ; Thu, 24 Mar 2011 06:34:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to:cc :content-type; bh=8wjV/LZ1Xro1RtFpKkqsqx6MTX+NvjbioO1aov7sLDA=; b=WGjmGpk134an/sq+y/CTuehTLLJeSY0AjJRsXlEBu+pYpVL5M2IJndvrsYEGn6+rOi Cvd5OM97IT/IPeGEyV1U0jQYC6MkC0iJZvwYOL6sef7ujakRwYp1ZYgMrDIU6bw0PTnN wWHqfGtiEtKbwdPRscAKNClGNPwDCV6SE2mkw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=NcviuDg0AkZL7mYP2IOnZ3bLhBOYMILM0qjljK0BWSbnpR7sDPlgexvC4/AjYtYUUW wrAqUHwS7H610YQBc6k5M867+OJ1IL0T1wdL1cIsvE39CbCIcTwSRUYsiydy/YYX3G6b Y451ahhEa3bEbEJQkbxq8x7AtpBP8/bNlY2bE= MIME-Version: 1.0 Received: by 10.229.141.129 with SMTP id m1mr7051438qcu.52.1300973675221; Thu, 24 Mar 2011 06:34:35 -0700 (PDT) Received: by 10.229.100.132 with HTTP; Thu, 24 Mar 2011 06:34:35 -0700 (PDT) Date: Thu, 24 Mar 2011 21:34:35 +0800 Message-ID: From: Jing Huang To: ivoras@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-hackers@freebsd.org Subject: [GSoc] Timeconter Performance Improvements X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Mar 2011 13:34:36 -0000 Hi, Thanks for your replay. That is just my self-introduction:) I want to borrow the shared memory idea from KVM, I am not want to port a whole KVM:) But for this project, there are some basic problems. As I know, tsc counter is CPU specific. If the process running on a multi-core platform, we must consider switching problem. The one way, we can let the kernel to take of this. When switching to another CPU, the kernel will reset the shared memory according to the new CPU. The second way, we can use CPUID instruction to get the info of current CPU, which can be executed in user mode ether. At the same time, the kernel maintains shared memory for each CPU. When invoke gettimeofday, the function will calculate precise time with current CPU's shared memory. I don't know which is better? Could I need to deal other problems? Jing.