From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752390AbcF2M0h (ORCPT ); Wed, 29 Jun 2016 08:26:37 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:58813 "EHLO SMTP02.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751767AbcF2M0e (ORCPT ); Wed, 29 Jun 2016 08:26:34 -0400 X-IronPort-AV: E=Sophos;i="5.26,546,1459814400"; d="scan'208";a="370342335" Subject: Re: [Xen-devel] [PATCH linux 3/8] x86/xen: use xen_vcpu_id mapping for HYPERVISOR_vcpu_op To: Vitaly Kuznetsov , References: <1467132449-1030-1-git-send-email-vkuznets@redhat.com> <1467132449-1030-4-git-send-email-vkuznets@redhat.com> CC: Juergen Gross , Stefano Stabellini , , , Julien Grall , Ingo Molnar , "David Vrabel" , "H. Peter Anvin" , "Boris Ostrovsky" , Thomas Gleixner From: David Vrabel Message-ID: <5773BE70.2000802@citrix.com> Date: Wed, 29 Jun 2016 13:26:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 MIME-Version: 1.0 In-Reply-To: <1467132449-1030-4-git-send-email-vkuznets@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-DLP: MIA1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/06/16 17:47, Vitaly Kuznetsov wrote: > HYPERVISOR_vcpu_op passes Linux's idea of vCPU id as a parameter while > Xen's idea is expected. In some cases these ideas diverge so we need to > do remapping. > > There is an issue, however. PV guests do VCPUOP_is_up very early > (see xen_fill_possible_map() and xen_filter_cpu_maps()) when we don't have > perpu areas initialized. While it could be solved with switching to > early_percpu for xen_vcpu_id I think it's not worth it: PV guests will > probably never get to the point where their idea of vCPU id diverges from > Xen's. [...] > static inline int > HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args) > { > - return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args); > + /* > + * PV guests call HYPERVISOR_vcpu_op before percpu areas are > + * initialized. As we always use direct mapping for vCPU ids > + * for them we can simply use Linux vcpuid here. > + */ > + return _hypercall3(int, vcpu_op, cmd, > + per_cpu(xen_vcpu_id, vcpuid) != -1 ? > + per_cpu(xen_vcpu_id, vcpuid) : vcpuid, > + extra_args); > } HYPERVISOR_vcpu_op() should take Xen VCPUs, with the callers doing the mapping. David