Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752452AbdLKRKr (ORCPT ); Mon, 11 Dec 2017 12:10:47 -0500 Received: from mail-he1eur02hn0210.outbound.protection.outlook.com ([104.47.5.210]:15540 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750707AbdLKRKn (ORCPT ); Mon, 11 Dec 2017 12:10:43 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Date: Mon, 11 Dec 2017 20:10:24 +0300 From: Roman Kagan To: Vitaly Kuznetsov Cc: kvm@vger.kernel.org, x86@kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , 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 Message-ID: <20171211171023.GA2304@rkaganb.sw.ru> Mail-Followup-To: Roman Kagan , Vitaly Kuznetsov , kvm@vger.kernel.org, x86@kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Andy Lutomirski , Mohammed Gamal , Cathy Avery , linux-kernel@vger.kernel.org, devel@linuxdriverproject.org References: <20171208105000.25116-1-vkuznets@redhat.com> <20171208105000.25116-4-vkuznets@redhat.com> <20171208181059.GB4777@rkaganb.sw.ru> <87bmj5k2pa.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87bmj5k2pa.fsf@vitty.brq.redhat.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR05CA0252.eurprd05.prod.outlook.com (2603:10a6:3:fb::28) To VI1PR08MB0847.eurprd08.prod.outlook.com (2a01:111:e400:5a05::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c6c24ad1-d838-4090-af4a-08d540ba14f5 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(2017052603307);SRVR:VI1PR08MB0847; X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB0847;3:CuavYGFcg8o0UgWv7E9hjW/YA2Pju0IgMP/jy7oyYV4wdn0Xme4gD34IDmse9t4ZmZ0Gdj4daaDMcDSgR2u2Zu6Z+UdpEjhUlDqducnBHQ9Vv4laiMxRg4TTTpIReaFzCz5+9Mf9DkUtugEQGInH4L6ChdDPybTzazl07qixogvdkP+z+UFNsQ0VU2pTV9Swezg2/LSB6nlHQTDc78+PeH36p01aulddGBlgGzNONAKFyS4SyxR493Q6M7fX0wZR;25:jBcgy2cMYUw/AoZWT+06uWMrHSUbkQmBDDuu+Q9ejDd3jcXTpHUDEenNNVIojRyfKkiXBGjQf1NHm7rnF8n+B5FSt+YMhKEUaQsrSuvBWtNirtIzyLIdYBX0Lv9fTeWOMXXZNH/nYut9rmhw4WDZR2Yi678BKy+8qIU2lXtKI7FHm89AstVGU6NqHT/DbXzB7cSgiUmozmnsccvoniafFaB40h6lGlDRzT5IyuuO3xVrWHiUsKafiUiAHuTNaZSVTGdj7fXm8iHvbfK2IiWrxsrMmBFdYZC0DWzjPkwn7QI9s9nmj7Twwa4bPFYc8Rfy+9giaeTDOy0G/PdCfjz6GA==;31:a4crft08ZxHMYfCcAp71HazQt914Loe4qBTlwO+n6ptG9OBTSmRqZaJ/CWurpBsWGrx/YtIYR4sfJT7fuQZwrC9bMM1+r44RgMdcrCXy8uGd6UNSCxlic+RmfKNGi1vzGV9xKPM9XGxn41clFWJL2Ruzj7vQhuvp1UAlXCGiMKjod8A/jgU0IW8ywuqkMUKpNXL+CoHrBoSUx3hY8/7BPeIyVEp15Lw2Arncppd/m8M= X-MS-TrafficTypeDiagnostic: VI1PR08MB0847:|VI1PR08MB0847: X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB0847;20:EwNlvGKpNpJBTC+O+4D4YZal298oDeal8MLZjbjW4gXb/yBz2jL9ARKBdlxHev0frNbEft9o/BgmWDAqIGiAR/Ttyx2yjGC4ggurv2HOZ8fZDMtTjgE/hHXmsSUl15OLU43S7UKijRFqto7o3H+j70LOK975Zn28JkSaDNc4McS1ap1os/TE4EYziR0iQAIqVvzsw20kAV2ojLAP2ElHJUjas+yhw3IzwV3Br4AArqcZzH5+TLGsqof51XJJDZZI3Z9vJ0rLXdL5kGeDeVVBQkdJu4dhu6V3nTrflLwHwwh0sVvF56oCyaqfq2c4qiKL+jcKrpuUpTiLm126yFRJbylkUGf4IToO+yifOrz1BmuMjogsjaFklloc6VO/8csPP6mzBKagTrr6xNagEf14fOmVFVsF+AvgGtS/aLVn7zk=;4:qcTyYUvpOivF7X71yGxhLL7aRGu6GcHg47ryLF/Tdq2lqk6AaEhGQnVMvLBEBz1HMSIqWOI1K/PAbNJPFizDSUN5vgNT8mqbGnTtX8FXJZgTgVV9k66V+RLg3qYluRWg50ZjrC1h7EQLEKA7vr702gK2MjZYN4lbQDo8GrLKYNpynOE5n6J/ziHUcdE7wTZgnB0+S4BzYeYMrg7v5WGEEjYuG5VEGHXg37/kSPBV/PWCixA160Ci1bcAQQMvXQ0ZVdmQhZ9KqloMdOFcLREkOw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231022)(10201501046)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148)(201708071742011);SRVR:VI1PR08MB0847;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:VI1PR08MB0847; X-Forefront-PRVS: 0518EEFB48 X-Forefront-Antispam-Report: SFV:SPM;SFS:(10019020)(366004)(346002)(376002)(189003)(199004)(24454002)(2950100002)(6916009)(7696005)(83506002)(81166006)(2906002)(97736004)(81156014)(55236003)(52116002)(6666003)(76176011)(5660300001)(33656002)(478600001)(7736002)(7416002)(305945005)(8676002)(53416004)(50466002)(4326008)(25786009)(53936002)(6246003)(105586002)(69596002)(229853002)(316002)(106356001)(3846002)(23726003)(54906003)(58126008)(16586007)(8936002)(6116002)(68736007)(86362001)(1076002)(9686003)(93886005)(36756003)(47776003)(16526018)(66066001)(8666007)(55016002)(6506006)(59450400001)(30126002);DIR:OUT;SFP:1501;SCL:5;SRVR:VI1PR08MB0847;H:rkaganb.sw.ru;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR08MB0847;23:vqy3fSFdPZnQl93lOzxkYdOye5spnrpXCK12ZtbPF?= =?us-ascii?Q?aQ2d7bXJrYX50au3uciuUCVSOpBjFvvLY8JWofVtXhXiOQCMhgWwaH7cJDCG?= =?us-ascii?Q?HKG6/bHT/gBPcco7Ftwqm3Tnot3DUrl9ouEfAuaPa/7kZLML/yj7TA1QkKG7?= =?us-ascii?Q?BiVH/zh5wfqu8+27MvezRGSMoATjHnFI2r734MbqRULbzYE6a6aywfM5u1dZ?= =?us-ascii?Q?QPuLeugHjrHOne0m33K9IIkqm6n814t+b+7ZzlHVDzLvNTZ3ZrvD7J6QqNek?= =?us-ascii?Q?mGxFgHZKdFDA7adXeFY3PPDwVoNl3ahnv2egyjOwHgZzYnxo3O3UjVu7vXGU?= =?us-ascii?Q?mqxezEsSq5qZLD7JBj0FB3U8bzORBW4M6nyh0BPeplBzNMCzv+ZcBPMmrbb8?= =?us-ascii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BF5DEzKX26uIJHPz9ma99ApmLpn3?= =?us-ascii?Q?FezFd2HDVhPWhesB7mj0FNcEcomAr74boDHYW9T9zC9?= X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB0847;23:mVWlJbWo6O5jZJcBIh7XXMBbnme78+87u4ibxp2vLK3hM3MnVOWuZhXhbuPGOJaXelAH5OG59yP52Q4krJxWJwsmue4BpQpwObEEjLympONn/nF9RJBVY2OhylDH67FCqLMYridGTO7PEUsU63USwA==;6:y8MEnvaOH/MOdbrBHvHryLyqHV1VCr9r0bk3fz3gmf2aIFiIB+HW613UZ1uKDfQySnynVizubTi+wMRqBQuCyVw7HY8ojIbO+wpyWuHXBVwbZjcHZFdRu7xgTg63Xb0wNg9/z9vFqE50LiQ2kipgjzo4y8B5B0Qs3XHLnNFxl0VqyHMxmgd2MQHUUdZFCb5Itijs/Db5ePa/q1PMpgyOYKBS29UJQHO1O0ruz1JSmBxIcZz/Ngv0eg1bgpCpNFwKi6a5tRZG6RbMCcUXA4XGV+UHwL9+brKqeWx5LQq9K6WSXyPEf+uiFi5S0mniialasjJnobx3XX5OUzvlGSvPciEcWixZ+xymf91U76qOiw0=;5:K+7iYM1fl3W00H2/9BL8RXBPwFRUVGx4njdQJRTJ/c7aoVASv+75FFNo4giptss4kF3x2bj3SCGsFCx57pWLU++gtHiViPg24MwE0bEQHaKeeSIWg2L9tgRXExbzQclZIpb6OIyxQGGmMO/FuZOCuLy7kKde5E2AYUwj6MnHyPQ= SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB0847;7:dNN1mVmsPsqmgbG7d4grrDTppQyHh9Qu0jkELD8vQfFeINMKr93vXo07zfksYjQTVUhcgVKY89ZfQdUEv2C2z81rKueNCtbbH94i/mBFdl3DMsHhyQmMMf0v4d7cffPb3SoXLr8b3L7VxXtTEEbqXgj3hCbosM+r9mQfAu6yym4Rvw8j3RbML4mZplcSa0VrrPYvCggw4KRYq+FwLyLXhoQZbRs5QT7OO0mNUSwMAU05uYs7BPXL1H7T3cpndGBv;20:QSfwb82g9ZSDSxIYyVZGuQDIvT4xIm1+YqErw/Y2/E612mnrEqViZLBU5z/I5/Z/OeHSRz+qaenRZWo1P+aUM6MOD4a8RfsIkVL4Irp7upAVfbvgit4oNa0bAO5CAf5O+cLrtLgXWEESvU02gZ9KM/CL8XgLoQHVYN2KT5Bbxm4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2017 17:10:28.8939 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c6c24ad1-d838-4090-af4a-08d540ba14f5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB0847 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1576 Lines: 42 On Mon, Dec 11, 2017 at 10:56:33AM +0100, Vitaly Kuznetsov wrote: > Roman Kagan writes: > > On Fri, Dec 08, 2017 at 11:49:57AM +0100, Vitaly Kuznetsov wrote: > >> +void register_hv_tsc_update(void (*cb)(void)) > >> +{ > > > > The function name seems unfortunate. IMHO such a name suggests > > registering a callback on a notifier chain (rather than unconditionally > > replacing the old callback), and having no other side effects. > > I see, any suggestion? register_hv_reenlightenment_cb? register_hv_tscchange_cb? IMHO arm_hv_reenlightenment_cb or arm_hv_tscchange_cb would be better, but I'm not very good at giving descriptive names. > > > > >> + struct hv_reenlightenment_control re_ctrl = { > >> + .vector = HYPERV_REENLIGHTENMENT_VECTOR, > >> + .enabled = 1, > >> + .target_vp = hv_vp_index[smp_processor_id()] > >> + }; > >> + struct hv_tsc_emulation_control emu_ctrl = {.enabled = 1}; > >> + > >> + if (!(ms_hyperv.features & HV_X64_ACCESS_REENLIGHTENMENT)) > >> + return; > > > > What happens then? L2 guests keep running with their clocks ticking at > > a different speed? > > > > In reallity this never happens -- in case nested virtualization is > supported reenlightenment is also available. In theory, L0 can emulate > TSC acceess for forever after migration. I would think that Hyper-V only started rdtsc emulation if TSC_EMULATION_CONTROL was turned on, which wouldn't happen here. But indeed, normally this shouldn't be a problem. It may make sense just to issue a warning if the feature is unsupported, though. Roman.