From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH RFC 0/1] Introduce VCPUOP_reset_vcpu_info Date: Wed, 6 Aug 2014 11:02:22 -0400 Message-ID: <20140806150222.GB14744@laptop.dumpdata.com> References: <1407330502-18768-1-git-send-email-vkuznets@redhat.com> <53E253470200007800029C1D@mail.emea.novell.com> <20140806145158.GF13079@laptop.dumpdata.com> <53E25F1C0200007800029CCB@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XF2jZ-0005T8-6M for xen-devel@lists.xenproject.org; Wed, 06 Aug 2014 15:02:33 +0000 Content-Disposition: inline In-Reply-To: <53E25F1C0200007800029CCB@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel@lists.xenproject.org, Andrew Jones , Vitaly Kuznetsov , David Vrabel , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Wed, Aug 06, 2014 at 04:00:12PM +0100, Jan Beulich wrote: > >>> On 06.08.14 at 16:51, wrote: > > On Wed, Aug 06, 2014 at 03:09:43PM +0100, Jan Beulich wrote: > >> >>> On 06.08.14 at 15:08, wrote: > >> > --- a/arch/x86/xen/enlighten.c > >> > +++ b/arch/x86/xen/enlighten.c > >> > @@ -183,8 +183,6 @@ static void xen_vcpu_setup(int cpu) > >> > * This path is called twice on PVHVM - first during bootup via > >> > * smp_init -> xen_hvm_cpu_notify, and then if the VCPU is being > >> > * hotplugged: cpu_up -> xen_hvm_cpu_notify. > >> > - * As we can only do the VCPUOP_register_vcpu_info once lets > >> > - * not over-write its result. > >> > * > >> > * For PV it is called during restore (xen_vcpu_restore) and bootup > >> > * (xen_setup_vcpu_info_placement). The hotplug mechanism does not > >> > @@ -207,14 +205,23 @@ static void xen_vcpu_setup(int cpu) > >> > info.mfn = arbitrary_virt_to_mfn(vcpup); > >> > info.offset = offset_in_page(vcpup); > >> > > >> > + /* > >> > + * Call VCPUOP_reset_vcpu_info before VCPUOP_register_vcpu_info, > > this > >> > + * is required if we boot after kexec. > >> > + */ > >> > + > >> > + if (cpu != 0) { > >> > + err = HYPERVISOR_vcpu_op(VCPUOP_reset_vcpu_info, cpu, > > NULL); > >> > + if (err) > >> > + pr_warn("VCPUOP_reset_vcpu_info for CPU%d failed: > > %d\n", > >> > + cpu, err); > >> > + } > >> > >> Just for my understanding of why exactly you need the new operation: > >> Why is this being done here, when you already do the reset in the > >> cpu-die/shutdown paths? And why not for CPU 0? > > > > For CPU0 it will always error out (as we can't do the hypercall on > > v != current as we are doing this on an BSP path) in the hypervisor. > > > > This path could also been taken when doing a kdump instead of kexec > > path - hence the reset hadn't happen in the cpu-die shutdown paths. > > But that's unsafe, as the hypervisor would continue to write fields > in that structure if it finds a need to. That is OK. The kdump kernel boots from a reserved region so the area where the hypervisor keeps on writting is in the 'outside-kdump-kernel' boot area. > > Jan >