Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755182AbbGTSu4 (ORCPT ); Mon, 20 Jul 2015 14:50:56 -0400 Received: from mail-bl2on0148.outbound.protection.outlook.com ([65.55.169.148]:31968 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753044AbbGTSuy convert rfc822-to-8bit (ORCPT ); Mon, 20 Jul 2015 14:50:54 -0400 From: KY Srinivasan To: Dexuan Cui , "gregkh@linuxfoundation.org" , "linux-kernel@vger.kernel.org" , "devel@linuxdriverproject.org" , "olaf@aepfle.de" , "apw@canonical.com" , "vkuznets@redhat.com" , "jasowang@redhat.com" Subject: RE: [PATCH 5/5] Drivers: hv: vmbus: Implement a clocksource based on the TSC page Thread-Topic: [PATCH 5/5] Drivers: hv: vmbus: Implement a clocksource based on the TSC page Thread-Index: AQHQwpGi+LWMWfCe/EqHiPkutq1H1J3kRgiAgABtwZA= Date: Mon, 20 Jul 2015 18:50:52 +0000 Message-ID: References: <1437363419-3511-1-git-send-email-kys@microsoft.com> <1437363447-3554-1-git-send-email-kys@microsoft.com> <1437363447-3554-5-git-send-email-kys@microsoft.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: microsoft.com; dkim=none (message not signed) header.d=none; x-originating-ip: [2001:4898:80e8:2::6e2] x-microsoft-exchange-diagnostics: 1;BY2PR0301MB1655;5:w5HTq2xJEwhZ29bsD8iKKdgQqC2LOr6B4771qRe5U2z5fYOH0tos2cXDiRAs4Ou3Vur/kzfSVTiJlJkVEDotve9ZleIwKPStr+hIgkr2rIubGn39uoDxDRi7VGRrWduxeQSBmU+UEOD/VQKHRpkIsQ==;24:l47A+cGQEYPUGZNVpLwddubObHZ10XXjHnS8bHwBQ1yfM5qZKRuzKu9TseKcr3QmpiywkrcVNwoYNPaEzMbVxK5NwUNxFO/3Xo6jX1ldUKE=;20:FAjKHdQvPIMbIkRtEpND06QMrb2311orVJsUzfgKVP1nE2wH6nQyAWmRIMw4yr02nTGBVeODO/tmLV1LyM//Gw== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB1655; by2pr0301mb1655: X-MS-Exchange-Organization-RulesExecuted x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401001)(5005006)(3002001);SRVR:BY2PR0301MB1655;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB1655; x-forefront-prvs: 0643BDA83C x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(13464003)(377454003)(19580405001)(77156002)(5003600100002)(19580395003)(2501003)(33656002)(106116001)(1511001)(2201001)(74316001)(76576001)(92566002)(189998001)(2421001)(50986999)(76176999)(5002640100001)(2656002)(40100003)(102836002)(5001960100002)(86612001)(86362001)(54356999)(93886004)(2900100001)(107886002)(77096005)(122556002)(2950100001)(46102003)(87936001)(5001770100001)(62966003)(10090500001)(3826002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR0301MB1655;H:BY2PR0301MB1654.namprd03.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2015 18:50:52.5614 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB1655 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2042 Lines: 65 > -----Original Message----- > From: Dexuan Cui > Sent: Monday, July 20, 2015 5:14 AM > To: KY Srinivasan; gregkh@linuxfoundation.org; linux- > kernel@vger.kernel.org; devel@linuxdriverproject.org; olaf@aepfle.de; > apw@canonical.com; vkuznets@redhat.com; jasowang@redhat.com > Subject: RE: [PATCH 5/5] Drivers: hv: vmbus: Implement a clocksource based > on the TSC page > > > From: devel [mailto:driverdev-devel-bounces...linuxdriverproject.org] On > Behalf > > Of K. Y. Srinivasan > > Sent: Monday, July 20, 2015 11:37 > > > > The current Hyper-V clock source is based on the per-partition reference > counter > > and this counter is being accessed via s synthetic MSR - > > HV_X64_MSR_TIME_REF_COUNT. > > Hyper-V has a more efficient way of computing the per-partition reference > > counter value that does not involve reading a synthetic MSR. We > implement > > a time source based on this mechanism. > > ... > > diff --git a/arch/x86/include/uapi/asm/hyperv.h > > @@ -183,6 +233,22 @@ int hv_init(void) > > > > hv_context.hypercall_page = virtaddr; > > > > +#ifdef CONFIG_X86_64 > > + if (ms_hyperv.features & > HV_X64_MSR_REFERENCE_TSC_AVAILABLE) { > > + va_tsc = __vmalloc(PAGE_SIZE, GFP_KERNEL, > PAGE_KERNEL); > > + if (!va_tsc) > > + goto cleanup; > > + hv_context.tsc_page = va_tsc; > > + > > + rdmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64); > > + > > + tsc_msr.enable = 1; > > + tsc_msr.guest_physical_address = vmalloc_to_pfn(va_tsc); > > + > > + wrmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64); > > + clocksource_register_hz(&hyperv_cs_tsc, > NSEC_PER_SEC/100); > > + } > > +#endif > > Should we disable the mechanism and vfree() the page in hv_cleanup() for > kexec/kdump? Thanks Dexuan. I will update the patch and resend. Regards, K. Y > > -- Dexuan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/