Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753090AbdLMAui (ORCPT ); Tue, 12 Dec 2017 19:50:38 -0500 Received: from mail-sn1nam01on0116.outbound.protection.outlook.com ([104.47.32.116]:44032 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752924AbdLMAuc (ORCPT ); Tue, 12 Dec 2017 19:50:32 -0500 From: "Michael Kelley (EOSG)" To: Vitaly Kuznetsov , "kvm@vger.kernel.org" , "x86@kernel.org" CC: Paolo Bonzini , =?iso-8859-2?Q?Radim_Kr=E8m=E1=F8?= , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , KY Srinivasan , Haiyang Zhang , "Stephen Hemminger" , Andy Lutomirski , Mohammed Gamal , Cathy Avery , "linux-kernel@vger.kernel.org" , "devel@linuxdriverproject.org" Subject: RE: [PATCH 3/6] x86/hyper-v: reenlightenment notifications support Thread-Topic: [PATCH 3/6] x86/hyper-v: reenlightenment notifications support Thread-Index: AQHTcBJbfXJIq0bVk0iF2kCGexUxl6NAc3Fw Date: Wed, 13 Dec 2017 00:50:19 +0000 Message-ID: References: <20171208105000.25116-1-vkuznets@redhat.com> <20171208105000.25116-4-vkuznets@redhat.com> In-Reply-To: <20171208105000.25116-4-vkuznets@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=mikelley@ntdev.microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2017-12-13T00:50:17.8541386Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General x-originating-ip: [24.22.167.197] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BN6PR21MB0785;6:rvkxLXA93cKAMv0OmPa1l7C5QGyHy0tchIbHEYbNq0S5ZCYChwPjY+XfHaSunBRahgRIbJu9rLr0NT9emOd1hQQW9MeXjruz37EZFTkvB45oxOF81Ap5lFPKHMkKDa0rJThuhoJKvtb9vygq7XOKTTuJjctc3kvT8wB4xke0vGw/9++bCnDXYPzxKBBGhRq+zAfCdA+PG7GUzFThTBfdVSfyWNQNODBqfkxHHZdWxeYQoCR53cFbtRA9K6enlfuAcXLGbtS208fAAty0Ey45OVWgLmqlCrAzCrLwu764k82FVA623dO0ZRoj/SPYyFNIAShxkDZetmbELPOioZelhg5JWCuzjWWy611wcH495ug=;5:DKO2pNmrBXr0HnLJjrjN9PuQbVxqWatNowZOdMM1TalDWJkbOmwMQTErya41kOIDP1LF0ZxvOvI+kQ5bFsW5+dI93sToJYGTSOH6Q7zdoblGL87j9rdRPT/fAdcEujoAVz8NgnyD4SDlfKHZszjVCa58IKPENfQj3qm3EoN3hNk=;24:UrBzcCl0+ZEzSg+kHv54wuUeDYcof7W/Dv29Q0U89S2yqeZcsGf4qD2WFrIJj60EYa07XBybZcPDXI1n9yYPQNEuT+rSccJxaiuHUaO5pR4=;7:Gvqz257bn+6JGhjd/d0ueYfi3yWv7d4Mfd28NHIUBf+sSRwXWSPPJqjgC1LMExd8o/yfwG+YePDUo0dwjqrHZaQHAMPfI/dfkuR986YlYNNyt0wIfLHrHUfb+MewpBN8YYvxpDtTu3wUeLWqvkKOmtJIHQnEF0xCEV87R4F3EAdpmPvpI1cbvn7O249VZM3PPdfvvIVA09zkqzLy7lAAgMlrf91JkVSNIMx+sdh3KFiywxEjP/zjAM3kSQo89Tdr x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10019020)(366004)(376002)(346002)(39860400002)(199004)(24454002)(13464003)(189003)(110136005)(105586002)(7416002)(81156014)(81166006)(2950100002)(305945005)(25786009)(3846002)(102836003)(7736002)(6116002)(106356001)(53936002)(22452003)(74316002)(316002)(229853002)(2501003)(99286004)(53546011)(6506007)(6246003)(10090500001)(8676002)(54906003)(7696005)(2900100001)(68736007)(15650500001)(77096006)(72206003)(3280700002)(66066001)(2906002)(3660700001)(10290500003)(9686003)(5660300001)(14454004)(8936002)(33656002)(478600001)(59450400001)(2201001)(8990500004)(6436002)(76176011)(86362001)(97736004)(86612001)(4326008)(55016002)(575784001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR21MB0785;H:BN6PR21MB0739.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: d3a77b85-09db-4886-9156-08d541c37bdb x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307);SRVR:BN6PR21MB0785; x-ms-traffictypediagnostic: BN6PR21MB0785: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Michael.H.Kelley@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(89211679590171)(9452136761055); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040450)(2401047)(8121501046)(5005006)(3231023)(10201501046)(3002001)(93006095)(93001095)(6055026)(61426038)(61427038)(6041248)(20161123562025)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(6072148)(201708071742011);SRVR:BN6PR21MB0785;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:BN6PR21MB0785; x-forefront-prvs: 052017CAF1 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-2" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3a77b85-09db-4886-9156-08d541c37bdb X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Dec 2017 00:50:19.3958 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR21MB0785 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 nfs id vBD0oiYk004733 Content-Length: 2989 Lines: 67 On Fri, Dec 08, 2017 at 11:49:57AM +0100, Vitaly Kuznetsov wrote: > -----Original Message----- > From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com] > Sent: Friday, December 8, 2017 2:50 AM > To: kvm@vger.kernel.org; x86@kernel.org > Cc: Paolo Bonzini ; Radim Kr?m?? ; Thomas > Gleixner ; Ingo Molnar ; H. Peter Anvin > ; KY Srinivasan ; Haiyang Zhang > ; Stephen Hemminger ; Michael > Kelley (EOSG) ; Andy Lutomirski ; > Mohammed Gamal ; Cathy Avery ; linux- > kernel@vger.kernel.org; devel@linuxdriverproject.org > Subject: [PATCH 3/6] x86/hyper-v: reenlightenment notifications support > > Hyper-V supports Live Migration notification. This is supposed to be used in conjunction with > TSC emulation: when we are migrated to a host with different TSC frequency for some short > period host emulates our accesses to TSC and sends us an interrupt to notify about the event. > When we're done updating everything we can disable TSC emulation and everything will start > working fast again. > > We didn't need these notifications before as Hyper-V guests are not supposed to use TSC as a > clocksource: in Linux we even mark it as unstable on boot. Guests normally use 'tsc page' > clocksouce and host updates its values on migrations automatically. > > Things change when we want to run nested virtualization: even when we pass through PV > clocksources (kvm-clock or tsc page) to our guests we need to know TSC frequency and when it > changes. > > Hyper-V Top Level Functional Specification (as of v5.0b) wrongly specifies > EAX:BIT(12) of CPUID:0x40000009 as the feature identification bit. The right one to check is > EAX:BIT(13) of CPUID:0x40000003. I was assured that the fix in on the way. > > Signed-off-by: Vitaly Kuznetsov [snip] > diff --git a/arch/x86/include/asm/irq_vectors.h > b/arch/x86/include/asm/irq_vectors.h > index 67421f649cfa..e71c1120426b 100644 > --- a/arch/x86/include/asm/irq_vectors.h > +++ b/arch/x86/include/asm/irq_vectors.h > @@ -103,7 +103,12 @@ > #endif > > #define MANAGED_IRQ_SHUTDOWN_VECTOR 0xef > -#define LOCAL_TIMER_VECTOR 0xee > + > +#if IS_ENABLED(CONFIG_HYPERV) > +#define HYPERV_REENLIGHTENMENT_VECTOR 0xee > +#endif > + > +#define LOCAL_TIMER_VECTOR 0xed > > #define NR_VECTORS 256 [snip] Since you are pre-allocating a new vector, would you want to update the irq_cpustat_t data structure and your interrupt handler to count the occurrences of these interrupts, and update arch_show_interrupts() to show the count? Then cat /proc/interrupts will show the count. The reenlightenment interrupts will presumably be rare, but so are some of the others that are already counted and displayed, and it seems like consistency should be maintained. Michael