Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751365AbdIKJYw (ORCPT ); Mon, 11 Sep 2017 05:24:52 -0400 Received: from mail-eopbgr20107.outbound.protection.outlook.com ([40.107.2.107]:56736 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751114AbdIKJYu (ORCPT ); Mon, 11 Sep 2017 05:24:50 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=dplotnikov@virtuozzo.com; Subject: Re: [PATCH v5 0/6] KVM: x86: get rid of pvclock_gtod_copy From: Denis Plotnikov To: pbonzini@redhat.com, rkrcmar@redhat.com, kvm@vger.kernel.org, john.stultz@linaro.org, tglx@linutronix.de Cc: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, x86@kernel.org, rkagan@virtuozzo.com, den@virtuozzo.com References: <1504106628-172372-1-git-send-email-dplotnikov@virtuozzo.com> Message-ID: <92d82044-66ee-602a-1f91-76851f34d88e@virtuozzo.com> Date: Mon, 11 Sep 2017 12:24:10 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1504106628-172372-1-git-send-email-dplotnikov@virtuozzo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR07CA0010.eurprd07.prod.outlook.com (2603:10a6:7:67::20) To HE1PR0802MB2219.eurprd08.prod.outlook.com (2603:10a6:3:c3::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e6ca5882-1bab-46be-703e-08d4f8f6f244 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:HE1PR0802MB2219; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0802MB2219;3:J05tnK6berwQjkPUfRzOOf3qew0G9Ow7z+i7cgXAjZh0I4GLnErSsogxcWGBPjeYOcs1HVxOzIfpE4QB4XX9zzP0C6iSKIM20ys+crDa7JdxNnYZEkPY9podoE8m6cjOSeR50jRgV4jZdWVg/ozqicRtT1yHp6/Ag4u8KP6bn8LLl7cQokZbiNKCPwbT5V0iWAb5fB1FV+H1GMEGD9a2fipJ2Ve1TKYFR2cP+ZEhih+vrVPZqTGaaEyQa6cTlTHx;25:DE3mkZA7GcNQuD+0WtoqKL5SZSvLdR5yTz3Az2ST81rf7hCjBN1GMZBHqY7wog1n91nrbZpf4HkM/WtlB806jqXGdAHZUfrwc07kqx57W3dYQQC3ymPTvID3F36c4TbV7YSvSqsaNlRZ87KVGIIHUDrDqBT+izNgZ+urALA1e5H3dJ4z8BMXquU8nZsgqE8doxquwgVF82n/tl9VucgzF/W/EnR06CPpqyVdhYwsd2cmH0V9tzjOV28yDEyVBRgTIg5u6vnDoHJJGCFeGHwFNMkdxeAnuCLjNiX1yoHMyLC3vxY73DZLOJYachGlegHh8nrFyn6qcfUMdwgna0Q5UQ==;31:FHAKswZr1KchOGrfumZ7Y8kjn0c7g2CmV4/xC5F3CAoKygAQtmQUkIK1iMKR7XYJG4/+Zwamy6MIjWOQiwA9rpvcmJz7m6BEUpGsYppuz//iFJgSzF/yTKGEPM7g4NaGEOKDLVBUkCNSG0Swp5HimCidUet4N4bSF0GtHYQgLk7vMx5iTFHzyZ2AtXjAsozShEq/5Rkj4DYYEqMdL4xVQjM55nidX3qO7iNkAe3kpHA= X-MS-TrafficTypeDiagnostic: HE1PR0802MB2219: X-Microsoft-Exchange-Diagnostics: 1;HE1PR0802MB2219;20:k3F/C2RzOUQvrjcCWtK8CZCcrNVI+uWowCanOLOaa3ql63krpMhTkrtjRbXcvsibsHH8D9q3lSM9W5+xXdFMeq3mIxGh6ZNQNEZE8n11Y6Uy3So4oyPynJcoTQvqJIB+KG1ETdpdn2sgIzjAVkxFRGHOGr+8Ev0mdC3rPzwdjk25pZv+Itcai6QqqE+WZDSk107qPlMX3DwgtiODdG+nVHGG4OyxkcW1ByV3J8Bm2e+17T76gUukhPdPqZYN1pG0szAHcbgbHDsDuY8Fj1UK98zFnUxnX81r8J08ya6XN8zBOBuXX4aPVcyDqGtTAquOa9FNzH/XpMbwR7H6Ng4nwdWOYB7mpS2YmiSSrOXTE0sR9Km2a/uboOiJMWmc8pbnfImAyoxkhheVlUH3aTZe1IOZj3GYGjsq8r8sKFsQAAc=;4:gVWOQNBd9ri7V/+ALPo59M4mxkOHSEYVDm26FNHf7QZBpeYWnK5aR03b06T8K7IO30EUCfbGozuhi6ad7VOwAm78kpgEBxJydcCKAUKZ0n6cOyjv2xYzJ9tu2d1lBnz0YqtwO0PCvSKFc9wkkp8xFdJpamlCGMU5FnWTc120hofNWtPlust+7Vhok4XfD36Ja5TpY6/dzSF/XTWWVel6rNr6Ew7sg0zZD1OmTvx4biOsCJ0UAru6kIV015xMTthKgAlbSd5FKaLBK7t/LIBVI3vqNE+PqQU+2u75Es0MfOE= X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(100000703101)(100105400095)(6041248)(20161123558100)(20161123555025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:HE1PR0802MB2219;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:HE1PR0802MB2219; X-Forefront-PRVS: 04270EF89C X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(7370300001)(6009001)(6049001)(39830400002)(189002)(24454002)(199003)(305945005)(2950100002)(25786009)(4326008)(6666003)(189998001)(42186005)(230700001)(77096006)(36756003)(6246003)(229853002)(107886003)(110136004)(6486002)(7350300001)(33646002)(53546010)(65956001)(50466002)(2906002)(86362001)(66066001)(478600001)(83506001)(53936002)(65806001)(101416001)(31686004)(23676002)(64126003)(6116002)(68736007)(4001350100001)(106356001)(54356999)(7736002)(97736004)(76176999)(50986999)(3846002)(31696002)(65826007)(8676002)(81166006)(81156014)(47776003)(5660300001)(105586002)(26583001);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0802MB2219;H:[172.16.25.125];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjA4MDJNQjIyMTk7MjM6U01Wc3JqZUtkZ3g2alNEbk1CMDBQTGZF?= =?utf-8?B?QmhjazcvTXZyT0dJQUtEUmlzeFBBRU04S1RPVDNwQ1lNcnVJeDQzNE5uRjRH?= =?utf-8?B?NHNlUEdNYVFlVjAxenBQSFFUWmtaMnJ6aU15Q1pJWkMvc0l1WGk1MExrRmVp?= =?utf-8?B?ajlCMktMaFVjWXdmZzNZWm1VYW9sN2RPN2dnbTV4dlhpR1F2UkRvNUJlMXdw?= =?utf-8?B?dWc1MUhxZndzaTR4ZXl1aUplQkQyanU1OW9pY1FER3NhVmV4eHV3Y1JoUzVV?= =?utf-8?B?TEtFVTFFcHRYbEozL0Zsb3k5RHJtVmF2WHA0MlduWGR2d1Q2MU9seERETmpF?= =?utf-8?B?aGtxZWF2S3R0VFVsUm5rQ1VYZngxcFdTMW9JaHdha2x3K0YrL2pSVm83Qkda?= =?utf-8?B?TXNVaXJ1VVM0cHMxZlVCMjdiSnJRL3V6eHFZMXNxVll0YS9GWlBpRE1VaDU2?=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ak1k3xi1283v2B0EXbHPEE0Db2D8qSDYxat9tlDLq/dC25y2vzY/HvvZnX7viU78XkzUFNuwbqqAexSATu+YDfe5dA5qYCag==;24:U3ijbE+bJP65vnW6wiQxjrMW6SZS+Un6ngahBtDmr+erQkTfN3lxjQ7cwkL+kSKqvjyZBlpLpt8Fy+MjDH5tVF3r5NY/UqelylMnmWIb6FQ=;7:rB5MSvhyvyP+M50HlnJ139jIZMx1UK4mw60U9r4LM1TZwFZLX94CD8Nqy4f9P1BhBcQUDKPbn0zTBOaw0FzDbeCf0bBAdjmvilNI4XmAbrxcCFQi+T4ExMuYjoC1sty5yHp5jIrRb0WYmkIePBXLcfYStJfSiAh7e4Ui+otDbP0QKFV4Qf9ZGM5Pih6jO+VJAS43yV0K4icEhgtDHfFOfx6vdFZgZlDq063N9gYZoGI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0802MB2219;20:ZYGgRG8uh1qboe6wuJk2/2+CTHm4v6Jwg9+RTcQW9tbCk4QDE7xn1hyZ9YnFd4sXzULZWg6A6h+gpg2o6reeTmtBn+J8y2OKbirttlvWz9NyGnrUJxlzxzKekPpFWTLHKORhuROVMgKtxjFy1OpL3hzjGPPsQtHnt8Hobc53ugM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2017 09:24:46.9734 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2219 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3172 Lines: 73 ping! On 30.08.2017 18:23, Denis Plotnikov wrote: > V5: > It was decided to split the series > "make L2's kvm-clock stable, get rid of pvclock_gtod_copy in KVM" > into two parts to make the changes finer grained: > 1. get rid of pvclock_gtod_copy in KVM > 2. make L2's kvm-clock stable > This V5 series implements the 1st part. This part gets rid > of pvclock_gtod_copy by switching to use the timekeeper functionality > being extended. This new scheme doesn't add any new notifiers and keeps > using the existing one (see patch 6 description) which had been used by > the pvclock_gtod_copy to keep track timekeeper data changes. > > The 2nd part is being discussed and is going to be sent later on. > > V4: > * removed "is stable" function with vague definition of stability > there is the only function which does time with cycle stamp getting > * some variables renamed > * some patches split into smaller once > * atomic64_t usage is replaced with atomic_t > > V3: > Changing the timekeeper interface for clocksource reading looks like > an overkill to achive the goal of getting cycles stamp for KVM. > Instead extend the timekeeping interface and add functions which provide > necessary data: read clocksource with cycles stamp, check whether the > clock source is stable. > > Use those functions and improve existing timekeeper functionality to > replace pvclock_gtod_copy scheme in masterclock data calculation. > > V2: > The main goal is to make L2 kvm-clock be stable when it's running over L1 > with stable kvm-clock. > > The patch series is for x86 architecture only. If the series is approved > I'll do changes for other architectures but I don't have an ability to > compile and check for every single on (help needed) > > The patch series do the following: > > * change timekeeper interface to get cycles stamp value from > the timekeeper > * get rid of pvclock copy in KVM by using the changed timekeeper > interface: get time and cycles right from the timekeeper > * make KVM recognize a stable kvm-clock as stable clocksource > and use the KVM masterclock in this case, which means making > L2 stable when running over stable L1 kvm-clock > > Denis Plotnikov (6): > timekeeper: introduce extended clocksource reading callback > timekeeper: introduce boot field in system_time_snapshot > timekeeper: use the extended reading function on snapshot acquiring > tsc: implement the extended tsc reading function > KVM: x86: switch to masterclock update using timekeeper functionality > KVM: x86: remove not used pvclock_gtod_copy > > arch/x86/include/asm/kvm_host.h | 2 +- > arch/x86/kernel/tsc.c | 10 ++ > arch/x86/kvm/trace.h | 31 ++--- > arch/x86/kvm/x86.c | 245 +++++++++------------------------------- > include/linux/clocksource.h | 11 +- > include/linux/timekeeping.h | 5 + > kernel/time/timekeeping.c | 17 ++- > 7 files changed, 104 insertions(+), 217 deletions(-) > -- Best, Denis