From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754844AbcIDVNe (ORCPT ); Sun, 4 Sep 2016 17:13:34 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:31970 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754248AbcIDVN2 (ORCPT ); Sun, 4 Sep 2016 17:13:28 -0400 Subject: Re: [PATCH linux v3 3/9] xen: introduce xen_vcpu_id mapping To: Julien Grall , Vitaly Kuznetsov , xen-devel@lists.xenproject.org References: <1469536228-29932-1-git-send-email-vkuznets@redhat.com> <1469536228-29932-4-git-send-email-vkuznets@redhat.com> <258e8e2e-29c4-1a88-2271-581f2ea59ec2@arm.com> Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Stefano Stabellini , David Vrabel , Juergen Gross , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Jan Beulich , Andrew Cooper , Steve Capper , Wei Chen , Kaly Xin From: Boris Ostrovsky Message-ID: <073f9a00-3aef-2b13-fa87-0ac402b90aff@oracle.com> Date: Sun, 4 Sep 2016 17:12:18 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <258e8e2e-29c4-1a88-2271-581f2ea59ec2@arm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/02/2016 11:29 AM, Julien Grall wrote: > >> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c >> index 0f87db2..c833912 100644 >> --- a/arch/x86/xen/enlighten.c >> +++ b/arch/x86/xen/enlighten.c >> @@ -1795,6 +1806,12 @@ static void __init init_hvm_pv_info(void) >> >> xen_setup_features(); >> >> + cpuid(base + 4, &eax, &ebx, &ecx, &edx); >> + if (eax & XEN_HVM_CPUID_VCPU_ID_PRESENT) >> + this_cpu_write(xen_vcpu_id, ebx); >> + else >> + this_cpu_write(xen_vcpu_id, smp_processor_id()); >> + >> pv_info.name = "Xen HVM"; >> >> xen_domain_type = XEN_HVM_DOMAIN; >> @@ -1806,6 +1823,10 @@ static int xen_hvm_cpu_notify(struct >> notifier_block *self, unsigned long action, >> int cpu = (long)hcpu; >> switch (action) { >> case CPU_UP_PREPARE: >> + if (cpu_acpi_id(cpu) != U32_MAX) >> + per_cpu(xen_vcpu_id, cpu) = cpu_acpi_id(cpu); >> + else >> + per_cpu(xen_vcpu_id, cpu) = cpu; > > I have not tried myself. But looking at the code, the notifiers > xen_hvm_cpu_notifier and evtchn_fifo_cpu_notifier have the same > priority. So what does prevent the code above to be executed after the > event channel callback? We will be converting to new hotplug state machine where this order will be guaranteed: https://lists.xenproject.org/archives/html/xen-devel/2016-08/msg01914.html -boris