From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752042AbcAEMUg (ORCPT ); Tue, 5 Jan 2016 07:20:36 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:35859 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751614AbcAEMUe (ORCPT ); Tue, 5 Jan 2016 07:20:34 -0500 Subject: Re: [PATCH RFC 2/3] x86/xen/time: setup vcpu 0 time info page To: Boris Ostrovsky References: <1451339557-24473-1-git-send-email-joao.m.martins@oracle.com> <1451339557-24473-3-git-send-email-joao.m.martins@oracle.com> <568A98D9.9090501@oracle.com> <568AD8F3.2050600@oracle.com> <568AE553.5030303@oracle.com> Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xen.org, Konrad Rzeszutek Wilk , David Vrabel , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org From: Joao Martins Message-ID: <568BB4FF.6030605@oracle.com> Date: Tue, 5 Jan 2016 12:20:15 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.4.0 MIME-Version: 1.0 In-Reply-To: <568AE553.5030303@oracle.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/04/2016 09:34 PM, Boris Ostrovsky wrote: > On 01/04/2016 03:41 PM, Joao Martins wrote: >> >> On 01/04/2016 04:07 PM, Boris Ostrovsky wrote: >>> On 12/28/2015 04:52 PM, Joao Martins wrote: >>> >>>> + >>>> + size = PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)); >>>> + mem = memblock_alloc(size, PAGE_SIZE); >>>> + if (!mem) >>>> + return -ENOMEM; >>>> + >>>> + ti = __va(mem); >>>> + memset(ti, 0, size); >>> Can you just use get_zeroed_page()? (struct pvclock_vsyscall_time_info >>> is always less than a page, isn't it?). >> Yeah, I can use get_zeroed_page() (struct pvclock_vsyscall_time_info is always >> less than a page). >> >> Additionally perhaps this region shouldn't be freed if PVCLOCK_TSC_STABLE_BIT >> isn't supported, because otherwise I would end up corrupting data elsewhere >> since the pvti would still be periodically updated by Xen, right? > > You could try setting it back to NULL. e.g. > if (!HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_time_memory_area, cpu, > NULL)) > free_page(..); > Ah, forgot about that option. Thanks! We can't register it explicitly as NULL as the hypercall would return -EFAULT but having a valid argument with NULL as the address works nicely. > -boris >