From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753986AbdASRY5 (ORCPT ); Thu, 19 Jan 2017 12:24:57 -0500 Received: from mail-by2nam03on0101.outbound.protection.outlook.com ([104.47.42.101]:56034 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753819AbdASRYz (ORCPT ); Thu, 19 Jan 2017 12:24:55 -0500 From: KY Srinivasan To: Greg KH CC: "linux-kernel@vger.kernel.org" , "devel@linuxdriverproject.org" , "olaf@aepfle.de" , "apw@canonical.com" , "vkuznets@redhat.com" , "jasowang@redhat.com" , "leann.ogasawara@canonical.com" Subject: RE: [PATCH V2 05/18] Drivers: hv: vmbus: Consolidate all Hyper-V specific clocksource code Thread-Topic: [PATCH V2 05/18] Drivers: hv: vmbus: Consolidate all Hyper-V specific clocksource code Thread-Index: AQHSceUbNar2g9YLwkatB9gh/J6K36E/okWAgAAuOGA= Date: Thu, 19 Jan 2017 16:49:35 +0000 Message-ID: References: <1484783072-32286-1-git-send-email-kys@exchange.microsoft.com> <1484783117-32324-5-git-send-email-kys@exchange.microsoft.com> <20170119105857.GA24341@kroah.com> In-Reply-To: <20170119105857.GA24341@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=kys@microsoft.com; x-originating-ip: [65.26.59.169] x-ms-office365-filtering-correlation-id: e679abc5-d59a-4f27-cd1e-08d4408b2666 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR03MB2483; x-microsoft-exchange-diagnostics: 1;BN6PR03MB2483;7:tTBiifyYoWUxaWeCCARrd+WLwYyJ+jVORXOb8GkTw9gOYZKoluO6JymauqnruHftPff0UYlc3F/nBgDgLnBjUZhzry/qRaQXl72W7nAjWNm/Erw5pXze96KDcz7fIyA0JFCKW2hlEfvAtkg3vVMrFtVmdrKZhtwvGqY52R+DcSWA/RXDYkFMeUcaIqhFV0B1U0TH5G5z06dl5J4STeSfZnjD24CFQpEt5hDezIO6hKM5FuNyZOUW/r4kjj2yoZTQ1bNp/OUOwm8Y5z28vGvqH5rPLB14CYxh7lveqjcQxGnh+GMtvwUeKPicJhO/YINasnYUVJrRdD/O39qrTZ8ielGb2MI7MGaaCd60/KhEYHteDxNdTOYFsNu1FwBm/VwhCuzXlUX2RG4uRpOEZZsErXl6rG+YlHQFSiUaVtdV1citw1qInv74iMWepCBjx9eotUzvfF1Yguve53eF7pofNwJ3+3wwxOgNyqFCoArJxVk= x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(140211028294663)(198206253151910); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148)(6047074);SRVR:BN6PR03MB2483;BCL:0;PCL:0;RULEID:;SRVR:BN6PR03MB2483; x-forefront-prvs: 0192E812EC x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(39410400002)(39450400003)(39840400002)(39860400002)(39850400002)(377454003)(189002)(199003)(13464003)(24454002)(25786008)(3280700002)(102836003)(6116002)(3846002)(8936002)(53936002)(101416001)(106356001)(76176999)(54356999)(50986999)(10090500001)(77096006)(92566002)(106116001)(105586002)(229853002)(2906002)(2900100001)(4326007)(38730400001)(5660300001)(5005710100001)(110136003)(6916009)(8990500004)(2950100002)(6436002)(10290500002)(7696004)(6506006)(68736007)(33656002)(54906002)(66066001)(99286003)(86362001)(3660700001)(74316002)(97736004)(122556002)(86612001)(81156014)(9686003)(345774005)(305945005)(81166006)(189998001)(55016002)(7736002)(8676002);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR03MB2483;H:BN6PR03MB2481.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jan 2017 16:49:35.4145 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2483 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v0JHP94M031761 > -----Original Message----- > From: Greg KH [mailto:gregkh@linuxfoundation.org] > Sent: Thursday, January 19, 2017 4:59 AM > To: KY Srinivasan > Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org; > olaf@aepfle.de; apw@canonical.com; vkuznets@redhat.com; > jasowang@redhat.com; leann.ogasawara@canonical.com > Subject: Re: [PATCH V2 05/18] Drivers: hv: vmbus: Consolidate all Hyper-V > specific clocksource code > > On Wed, Jan 18, 2017 at 04:45:04PM -0700, kys@exchange.microsoft.com > wrote: > > From: K. Y. Srinivasan > > > > As part of the effort to separate out architecture specific code, > > consolidate all Hyper-V specific clocksource code to an architecture > > specific code. > > > > Signed-off-by: K. Y. Srinivasan > > --- > > arch/x86/hyperv/hv_init.c | 104 > +++++++++++++++++++++++++++++++++++++++ > > arch/x86/include/asm/mshyperv.h | 12 +++++ > > arch/x86/kernel/cpu/mshyperv.c | 23 --------- > > drivers/hv/hv.c | 95 ----------------------------------- > > drivers/hv/hyperv_vmbus.h | 8 --- > > 5 files changed, 116 insertions(+), 126 deletions(-) > > > > diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c > > index b5c8e04..691dfaf 100644 > > --- a/arch/x86/hyperv/hv_init.c > > +++ b/arch/x86/hyperv/hv_init.c > > @@ -24,6 +24,79 @@ > > #include > > #include > > #include > > +#include > > + > > + > > +#ifdef CONFIG_X86_64 > > + > > +static struct ms_hyperv_tsc_page *tsc_pg; > > + > > +static u64 read_hv_clock_tsc(struct clocksource *arg) > > +{ > > + u64 current_tick; > > + > > + if (tsc_pg->tsc_sequence != 0) { > > + /* > > + * Use the tsc page to compute the value. > > + */ > > + > > + while (1) { > > + u64 tmp; > > + u32 sequence = tsc_pg->tsc_sequence; > > + u64 cur_tsc; > > + u64 scale = tsc_pg->tsc_scale; > > + s64 offset = tsc_pg->tsc_offset; > > + > > + rdtscll(cur_tsc); > > + /* current_tick = ((cur_tsc *scale) >> 64) + offset */ > > + asm("mulq %3" > > + : "=d" (current_tick), "=a" (tmp) > > + : "a" (cur_tsc), "r" (scale)); > > + > > + current_tick += offset; > > + if (tsc_pg->tsc_sequence == sequence) > > + return current_tick; > > + > > + if (tsc_pg->tsc_sequence != 0) > > + continue; > > + /* > > + * Fallback using MSR method. > > + */ > > + break; > > + } > > + } > > + rdmsrl(HV_X64_MSR_TIME_REF_COUNT, current_tick); > > + return current_tick; > > +} > > + > > +static struct clocksource hyperv_cs_tsc = { > > + .name = "hyperv_clocksource_tsc_page", > > + .rating = 400, > > + .read = read_hv_clock_tsc, > > + .mask = CLOCKSOURCE_MASK(64), > > + .flags = CLOCK_SOURCE_IS_CONTINUOUS, > > +}; > > +#endif > > + > > +static u64 read_hv_clock_msr(struct clocksource *arg) > > +{ > > + u64 current_tick; > > + /* > > + * Read the partition counter to get the current tick count. This count > > + * is set to 0 when the partition is created and is incremented in > > + * 100 nanosecond units. > > + */ > > + rdmsrl(HV_X64_MSR_TIME_REF_COUNT, current_tick); > > + return current_tick; > > +} > > + > > +static struct clocksource hyperv_cs_msr = { > > + .name = "hyperv_clocksource_msr", > > + .rating = 400, > > + .read = read_hv_clock_msr, > > + .mask = CLOCKSOURCE_MASK(64), > > + .flags = CLOCK_SOURCE_IS_CONTINUOUS, > > +}; > > > > static void *hypercall_pg; > > /* > > @@ -31,6 +104,7 @@ > > * hypervisor has been detected. > > * > > * 1. Setup the hypercall page. > > + * 2. Register Hyper-V specific clocksource. > > */ > > void hyperv_init(void) > > { > > @@ -58,6 +132,36 @@ void hyperv_init(void) > > hypercall_msr.enable = 1; > > hypercall_msr.guest_physical_address = > vmalloc_to_pfn(hypercall_pg); > > wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64); > > + > > + /* > > + * Register Hyper-V specific clocksource. > > + */ > > +#ifdef CONFIG_X86_64 > > + if (ms_hyperv.features & > HV_X64_MSR_REFERENCE_TSC_AVAILABLE) { > > + union hv_x64_msr_hypercall_contents tsc_msr; > > + > > + tsc_pg = __vmalloc(PAGE_SIZE, GFP_KERNEL, > PAGE_KERNEL); > > + if (!tsc_pg) > > + clocksource_register_hz(&hyperv_cs_msr, > NSEC_PER_SEC/100); > > + return; > > There's a reason you always test-build your patches and pay attention to > the warnings! > > How did this pass your tests? > > I've stopped applying patches here. Greg, Thank you for spotting the issue; I will fix the problem and resend. K. Y > > greg k-h