From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751392AbdJBSow (ORCPT ); Mon, 2 Oct 2017 14:44:52 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:45351 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751120AbdJBSou (ORCPT ); Mon, 2 Oct 2017 14:44:50 -0400 Subject: Re: [PATCH v5 3/4] x86/xen/time: setup vcpu 0 time info page To: Joao Martins , linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org References: <20171002183122.3961-1-joao.m.martins@oracle.com> <20171002183122.3961-4-joao.m.martins@oracle.com> Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Juergen Gross , Andy Lutomirski From: Boris Ostrovsky Message-ID: <5eb802fb-c802-b501-9182-3e18af8b8651@oracle.com> Date: Mon, 2 Oct 2017 14:44:20 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20171002183122.3961-4-joao.m.martins@oracle.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > + > +static void xen_setup_vsyscall_time_info(void) > +{ > + struct vcpu_register_time_memory_area t; > + struct pvclock_vsyscall_time_info *ti; > + int ret; In the previous version you'd return immediately if PVCLOCK_TSC_STABLE_BIT was not set. Don't you still need to check this? Especially give... > + > + ti = (struct pvclock_vsyscall_time_info *)get_zeroed_page(GFP_KERNEL); > + if (!ti) > + return; > + > + t.addr.v = &ti->pvti; > + > + ret = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_time_memory_area, 0, &t); > + if (ret) { > + pr_notice("xen: VCLOCK_PVCLOCK not supported (err %d)\n", ret); > + free_page((unsigned long)ti); > + return; > + } > + > + /* > + * If primary time info had this bit set, secondary should too since ... this comment? -boris > + * it's the same data on both just different memory regions. But we > + * still check it in case hypervisor is buggy. > + */ > + if (!(ti->pvti.flags & PVCLOCK_TSC_STABLE_BIT)) { > + t.addr.v = NULL; > + ret = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_time_memory_area, > + 0, &t); > + if (!ret) > + free_page((unsigned long)ti); > + > + pr_notice("xen: VCLOCK_PVCLOCK not supported (tsc unstable)\n"); > + return; > + } > + > + xen_clock = ti; > + pvclock_set_pvti_cpu0_va(xen_clock); > + > + xen_clocksource.archdata.vclock_mode = VCLOCK_PVCLOCK; > +} > + >