From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751181AbdKTMWu (ORCPT ); Mon, 20 Nov 2017 07:22:50 -0500 Received: from mout.web.de ([212.227.15.4]:53249 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750952AbdKTMWt (ORCPT ); Mon, 20 Nov 2017 07:22:49 -0500 Subject: Re: [PATCH 05/10] x86: jailhouse: Set up timekeeping To: Thomas Gleixner Cc: Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, Linux Kernel Mailing List , jailhouse-dev@googlegroups.com References: <62f3fde8db44e5aedf934b5a753d448979f50082.1510817211.git.jan.kiszka@siemens.com> <12f18935-51a5-08a1-bf72-42e3367a2f87@web.de> From: Jan Kiszka Message-ID: <3ddc32e7-d1a0-445d-f820-985d89bbb16a@web.de> Date: Mon, 20 Nov 2017 13:21:25 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:3Gh5SN9PjZ93Dhbym7/64Isn6cX7IGWzbhVX/wOwvCwfVcWNugH NCNULMehHVV56aqPPCpW4TAamG7YjqPIk8UfvDi4vITpJSB2L8P1TiMq+Eww+3pdcNdDU9c IqnQEMskV65IlErrZiPYaSBlsWh4p0GJx2dI+s+zoYgCTExnWn/yfanTZvtPq/vXdlNUWBE TR3hw+QlkUK5evi7mYAWg== X-UI-Out-Filterresults: notjunk:1;V01:K0:yg9sR2i8OcE=:LzKY5Wok66psxIHYD+yjVO haqsx67fPOD8xnIW2JFNtp/HjCD4iWTDbrOJEa7viCYbgJQuha6c5bfwwz+oNrpKAcJ7dI/QX M/GVbqJfky/IbrbFaCst7tf3P87pj3esHdwGTbqT66VTmHxUnlx2liGJaLwpvnfPIokQcDOUv +tSS89pFVAZMs4/cN6lQgqp73AwmoWZlN9UtVKPeBTv3vk+RESXylgSbcmCzjU8uNAdGCSObD 6M0XMOjy3588BLUJwzzcGvf6nFHHgKb81kfpDgPO3PxwRUTJwoR94ifyhGlAvZnu33DvhlUaq Cb12wTl/6YNpWc7VEqXNk1N2zuZ8OCB4kXEiQcDMOf+C/beYharBBUjPxJUlI2CtmdChucUTZ 5+RYjDrsX5+SesBNp0fCZ5plc7eINwNrPBuCAV534ZmvyHr3QSmu87qAUWCK1RgsbYFwc5Nk8 mIIZVEvW8WsBNJyllaxhpa29So1aIO0MmNTG9LD93qCGAS883HI/jYjV03DpBo/ZZ+ACMdogC llsDj1qTdwu1nZgFL2MeXXRX2vlzuAmfaUs0SE2b0Th0IM/K6LV+OEhfIL5FKVsZtyAGyTXp8 Ql5/6qcn30DeskRlpX/0nUJeoNF1a2kLuClcYLwBRKZ9f2MJyrzBFPmBvuXU0ZNDmXbWkiTJJ 8ebeyOGE38uoK7DqtSMvFDr69GNrpBpL3DI47BjzHZZJpTKz4W8YChH3ow+jQFCfcnxpWtedE rsWoKk+gCf2qBlJVUm70wRyJhH8FqcLlYGkmuh1ZKwpC7wVKtQnWi6eBFnOBVFjOC37g2iNpP IfqIneCwmHWoRFw5DwuFfCs4QBOmdKIf678ClTAFbsVvUiHHdM= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017-11-20 12:24, Thomas Gleixner wrote: > On Sat, 18 Nov 2017, Jan Kiszka wrote: >> On 2017-11-17 23:49, Thomas Gleixner wrote: >>> On Thu, 16 Nov 2017, Jan Kiszka wrote: >>>> Calibrate the TSC and, where necessary, the APIC timer against the >>>> TMTIMER. We need our own implementation as neither the PIC nor the HPET >>>> are available, and the standard calibration routines try to make use of >>>> them. >>> >>> Why is this needed at all? >>> >>> The host the frequency already. So this can be done w/o pmtimer and extra >>> calibration routine. >> >> The hypervisor does not have the frequencies. It will never use the APIC >> timer (it's owned by the guests), and it has no use case for the TSC so >> far. Only the root cell (the Linux that booted the system) has that >> data. Now we could >> >> - trust the root cell to provide the right values and export them during >> startup to the hypervisor and from there to the non-root cells. >> >> - calculate the frequencies once and store them in the hyperivsor >> config, just like other system-specific information, for re-export to >> the cells. >> >> But I don't think option 1 will be ok for all use cases. Maybe a >> combination of both, falling back to the root cell data if nothing is >> defined in the config. Let me think about this. > > Another question is whether systems which can support jailhouse, have the > frequencies available via cpuid/msr and can avoid that calibration thing > completely. OK, some may (not Xeons, though), and we would not exploit it with this approach. Jan