From patchwork Wed Aug 30 15:23:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Plotnikov X-Patchwork-Id: 9930079 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1E8FD60383 for ; Wed, 30 Aug 2017 15:26:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11701286C0 for ; Wed, 30 Aug 2017 15:26:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05E60286C5; Wed, 30 Aug 2017 15:26:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CA2D286C0 for ; Wed, 30 Aug 2017 15:26:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751632AbdH3PZO (ORCPT ); Wed, 30 Aug 2017 11:25:14 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:1209 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751416AbdH3PZN (ORCPT ); Wed, 30 Aug 2017 11:25:13 -0400 Received: from dptest2.qa.sw.ru (msk-vpn.virtuozzo.com [195.214.232.6]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id v7UFO9MY003593; Wed, 30 Aug 2017 18:24:11 +0300 (MSK) 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 Subject: [PATCH v5 1/6] timekeeper: introduce extended clocksource reading callback Date: Wed, 30 Aug 2017 18:23:43 +0300 Message-Id: <1504106628-172372-2-git-send-email-dplotnikov@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1504106628-172372-1-git-send-email-dplotnikov@virtuozzo.com> References: <1504106628-172372-1-git-send-email-dplotnikov@virtuozzo.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The callback provides extended information about just read clocksource value. It's going to be used in cases when detailed system information needed for further time related values calculation, e.g in KVM masterclock settings calculation. Signed-off-by: Denis Plotnikov --- include/linux/clocksource.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index a78cb18..786a522 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h @@ -48,7 +48,14 @@ struct module; * 400-499: Perfect * The ideal clocksource. A must-use where * available. - * @read: returns a cycle value, passes clocksource as argument + * @read: returns a cycle value (might be not quite cycles: + * see pvclock) passes clocksource as argument + * @read_with_stamp: saves cycles value (got from timekeeper) and cycles + * stamp (got from hardware counter value and used by + * timekeeper to calculate the cycles value) to + * corresponding input pointers return true if cycles + * stamp holds real cycles and false if it holds some + * time derivative value * @enable: optional function to enable the clocksource * @disable: optional function to disable the clocksource * @mask: bitmask for two's complement @@ -78,6 +85,8 @@ struct module; */ struct clocksource { u64 (*read)(struct clocksource *cs); + bool (*read_with_stamp)(struct clocksource *cs, + u64 *cycles, u64 *cycles_stamp); u64 mask; u32 mult; u32 shift;