All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
	boris.ostrovsky@oracle.com, david.vrabel@citrix.com,
	mukesh.rathor@oracle.com
Subject: Re: [PATCH v12 05/18] xen/mmu/p2m: Refactor the xen_pagetable_init code.
Date: Fri, 3 Jan 2014 11:02:00 -0500	[thread overview]
Message-ID: <20140103160200.GE27019@phenom.dumpdata.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1401031544180.8667@kaball.uk.xensource.com>

On Fri, Jan 03, 2014 at 03:47:15PM +0000, Stefano Stabellini wrote:
> On Tue, 31 Dec 2013, Konrad Rzeszutek Wilk wrote:
> > The revector and copying of the P2M only happens when
> > !auto-xlat and on 64-bit builds. It is not obvious from
> > the code, so lets have seperate 32 and 64-bit functions.
> > 
> > We also invert the check for auto-xlat to make the code
> > flow simpler.
> > 
> > Suggested-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > ---
> >  arch/x86/xen/mmu.c | 73 ++++++++++++++++++++++++++++++------------------------
> >  1 file changed, 40 insertions(+), 33 deletions(-)
> > 
> > diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
> > index ce563be..d792a69 100644
> > --- a/arch/x86/xen/mmu.c
> > +++ b/arch/x86/xen/mmu.c
> > @@ -1198,44 +1198,40 @@ static void __init xen_cleanhighmap(unsigned long vaddr,
> >  	 * instead of somewhere later and be confusing. */
> >  	xen_mc_flush();
> >  }
> > -#endif
> > -static void __init xen_pagetable_init(void)
> > +static void __init xen_pagetable_p2m_copy(void)
> >  {
> > -#ifdef CONFIG_X86_64
> >  	unsigned long size;
> >  	unsigned long addr;
> > -#endif
> > -	paging_init();
> > -	xen_setup_shared_info();
> > -#ifdef CONFIG_X86_64
> > -	if (!xen_feature(XENFEAT_auto_translated_physmap)) {
> > -		unsigned long new_mfn_list;
> > +	unsigned long new_mfn_list;
> > +
> > +	if (xen_feature(XENFEAT_auto_translated_physmap))
> > +		return;
> > +
> > +	size = PAGE_ALIGN(xen_start_info->nr_pages * sizeof(unsigned long));
> > +
> > +	/* On 32-bit, we get zero so this never gets executed. */
> 
> Given that this code is already ifdef'ed CONFIG_X86_64, this comment
> should be removed.

Sure.
> 
> 
> > +	new_mfn_list = xen_revector_p2m_tree();
> 
> I take from the comment that new_mfn_list must not be zero. Maybe we
> want a BUG_ON or a WARN_ON?

It can be zero, in which case we don't want to revector.
> 
> 
> > +	if (new_mfn_list && new_mfn_list != xen_start_info->mfn_list) {
> > +		/* using __ka address and sticking INVALID_P2M_ENTRY! */
> > +		memset((void *)xen_start_info->mfn_list, 0xff, size);
> > +
> > +		/* We should be in __ka space. */
> > +		BUG_ON(xen_start_info->mfn_list < __START_KERNEL_map);
> > +		addr = xen_start_info->mfn_list;
> > +		/* We roundup to the PMD, which means that if anybody at this stage is
> > +		 * using the __ka address of xen_start_info or xen_start_info->shared_info
> > +		 * they are in going to crash. Fortunatly we have already revectored
> > +		 * in xen_setup_kernel_pagetable and in xen_setup_shared_info. */
> > +		size = roundup(size, PMD_SIZE);
> > +		xen_cleanhighmap(addr, addr + size);
> >  
> >  		size = PAGE_ALIGN(xen_start_info->nr_pages * sizeof(unsigned long));
> > +		memblock_free(__pa(xen_start_info->mfn_list), size);
> > +		/* And revector! Bye bye old array */
> > +		xen_start_info->mfn_list = new_mfn_list;
> > +	} else
> > +		return;
> 
> This was a normal condition when the function was executed on both
> x86_64 and x86_32. Now that it is only executed on x86_64, is it still
> the case?

It could be. Since this particular patch just moves code I would hesitate
to make changes here. Perhaps a seperate patch after the conditions
under which the xen_revector_p2m_tree() fail can be done?

> 
> 
> > -		/* On 32-bit, we get zero so this never gets executed. */
> > -		new_mfn_list = xen_revector_p2m_tree();
> > -		if (new_mfn_list && new_mfn_list != xen_start_info->mfn_list) {
> > -			/* using __ka address and sticking INVALID_P2M_ENTRY! */
> > -			memset((void *)xen_start_info->mfn_list, 0xff, size);
> > -
> > -			/* We should be in __ka space. */
> > -			BUG_ON(xen_start_info->mfn_list < __START_KERNEL_map);
> > -			addr = xen_start_info->mfn_list;
> > -			/* We roundup to the PMD, which means that if anybody at this stage is
> > -			 * using the __ka address of xen_start_info or xen_start_info->shared_info
> > -			 * they are in going to crash. Fortunatly we have already revectored
> > -			 * in xen_setup_kernel_pagetable and in xen_setup_shared_info. */
> > -			size = roundup(size, PMD_SIZE);
> > -			xen_cleanhighmap(addr, addr + size);
> > -
> > -			size = PAGE_ALIGN(xen_start_info->nr_pages * sizeof(unsigned long));
> > -			memblock_free(__pa(xen_start_info->mfn_list), size);
> > -			/* And revector! Bye bye old array */
> > -			xen_start_info->mfn_list = new_mfn_list;
> > -		} else
> > -			goto skip;
> > -	}
> >  	/* At this stage, cleanup_highmap has already cleaned __ka space
> >  	 * from _brk_limit way up to the max_pfn_mapped (which is the end of
> >  	 * the ramdisk). We continue on, erasing PMD entries that point to page
> > @@ -1255,8 +1251,19 @@ static void __init xen_pagetable_init(void)
> >  	 * anything at this stage. */
> >  	xen_cleanhighmap(MODULES_VADDR, roundup(MODULES_VADDR, PUD_SIZE) - 1);
> >  #endif
> > -skip:
> > +}
> > +#else
> > +static void __init xen_pagetable_p2m_copy(void)
> > +{
> > +	/* Nada! */
> > +}
> >  #endif
> > +
> > +static void __init xen_pagetable_init(void)
> > +{
> > +	paging_init();
> > +	xen_setup_shared_info();
> > +	xen_pagetable_p2m_copy();
> >  	xen_post_allocator_init();
> >  }
> >  static void xen_write_cr2(unsigned long cr2)
> > -- 
> > 1.8.3.1
> > 

  parent reply	other threads:[~2014-01-03 16:03 UTC|newest]

Thread overview: 169+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-01  4:35 [PATCH v12] Linux Xen PVH support Konrad Rzeszutek Wilk
2014-01-01  4:35 ` [PATCH v12 01/18] xen/p2m: Check for auto-xlat when doing mfn_to_local_pfn Konrad Rzeszutek Wilk
2014-01-01  4:35 ` [PATCH v12 02/18] xen/pvh/x86: Define what an PVH guest is (v2) Konrad Rzeszutek Wilk
2014-01-02 11:13   ` David Vrabel
2014-01-03 15:33     ` Stefano Stabellini
2014-01-03 15:33     ` Stefano Stabellini
2014-01-02 11:13   ` David Vrabel
2014-01-01  4:35 ` Konrad Rzeszutek Wilk
2014-01-01  4:35 ` [PATCH v12 03/18] xen/pvh: Early bootup changes in PV code (v2) Konrad Rzeszutek Wilk
2014-01-02 15:32   ` David Vrabel
2014-01-02 18:32     ` Konrad Rzeszutek Wilk
2014-01-02 18:32     ` Konrad Rzeszutek Wilk
2014-01-03  1:34       ` Mukesh Rathor
2014-01-03  1:34       ` Mukesh Rathor
2014-01-03 11:29         ` David Vrabel
2014-01-03 11:29         ` David Vrabel
2014-01-03 15:37           ` Stefano Stabellini
2014-01-03 15:37           ` Stefano Stabellini
2014-01-03 17:35         ` Konrad Rzeszutek Wilk
2014-01-04  1:13           ` Mukesh Rathor
2014-01-04  1:13           ` Mukesh Rathor
2014-01-03 17:35         ` Konrad Rzeszutek Wilk
2014-01-03 11:25       ` David Vrabel
2014-01-03 11:25       ` David Vrabel
2014-01-02 15:32   ` David Vrabel
2014-01-01  4:35 ` [PATCH v12 04/18] xen/pvh: Don't setup P2M tree Konrad Rzeszutek Wilk
2014-01-01  4:35 ` Konrad Rzeszutek Wilk
2014-01-02 11:17   ` David Vrabel
2014-01-02 11:17   ` David Vrabel
2014-01-03 15:41   ` Stefano Stabellini
2014-01-03 15:41   ` Stefano Stabellini
2014-01-01  4:35 ` [PATCH v12 05/18] xen/mmu/p2m: Refactor the xen_pagetable_init code Konrad Rzeszutek Wilk
2014-01-02 11:21   ` David Vrabel
2014-01-02 11:21   ` David Vrabel
2014-01-03 15:47   ` Stefano Stabellini
2014-01-03 16:02     ` Konrad Rzeszutek Wilk
2014-01-03 16:02     ` Konrad Rzeszutek Wilk [this message]
2014-01-03 16:23       ` Stefano Stabellini
2014-01-03 16:23       ` Stefano Stabellini
2014-01-03 15:47   ` Stefano Stabellini
2014-01-01  4:35 ` [PATCH v12 06/18] xen/pvh: MMU changes for PVH (v2) Konrad Rzeszutek Wilk
2014-01-02 11:24   ` David Vrabel
2014-01-03  1:36     ` Mukesh Rathor
2014-01-03  1:36     ` Mukesh Rathor
2014-01-03 10:14       ` David Vrabel
2014-01-03 10:14       ` David Vrabel
2014-01-03 15:50     ` Stefano Stabellini
2014-01-03 15:50     ` Stefano Stabellini
2014-01-02 11:24   ` David Vrabel
2014-01-01  4:35 ` [PATCH v12 07/18] xen/pvh: Setup up shared_info Konrad Rzeszutek Wilk
2014-01-02 11:27   ` David Vrabel
2014-01-02 18:23     ` Konrad Rzeszutek Wilk
2014-01-02 18:23     ` Konrad Rzeszutek Wilk
2014-01-03 14:39     ` Konrad Rzeszutek Wilk
2014-01-03 15:18       ` David Vrabel
2014-01-03 15:18       ` David Vrabel
2014-01-03 14:39     ` Konrad Rzeszutek Wilk
2014-01-02 11:27   ` David Vrabel
2014-01-01  4:35 ` Konrad Rzeszutek Wilk
2014-01-01  4:35 ` [PATCH v12 08/18] xen/pvh: Load GDT/GS in early PV bootup code for BSP Konrad Rzeszutek Wilk
2014-01-02 11:31   ` David Vrabel
2014-01-02 18:24     ` Konrad Rzeszutek Wilk
2014-01-03 11:27       ` David Vrabel
2014-01-03 11:27       ` David Vrabel
2014-01-02 18:24     ` Konrad Rzeszutek Wilk
2014-01-02 11:31   ` David Vrabel
2014-01-01  4:35 ` Konrad Rzeszutek Wilk
2014-01-01  4:35 ` [PATCH v12 09/18] xen/pvh: Secondary VCPU bringup (non-bootup CPUs) Konrad Rzeszutek Wilk
2014-01-02 16:07   ` David Vrabel
2014-01-02 16:07   ` David Vrabel
2014-01-01  4:35 ` [PATCH v12 10/18] xen/pvh: Update E820 to work with PVH (v2) Konrad Rzeszutek Wilk
2014-01-02 16:14   ` David Vrabel
2014-01-02 18:41     ` Konrad Rzeszutek Wilk
2014-01-02 18:41     ` Konrad Rzeszutek Wilk
2014-01-04  1:23       ` Mukesh Rathor
2014-01-04  1:23       ` Mukesh Rathor
2014-01-04  2:25         ` Konrad Rzeszutek Wilk
2014-01-04  2:25         ` Konrad Rzeszutek Wilk
2014-01-02 16:14   ` David Vrabel
2014-01-03 16:30   ` Stefano Stabellini
2014-01-03 16:30   ` Stefano Stabellini
2014-01-01  4:35 ` [PATCH v12 11/18] xen/pvh: Piggyback on PVHVM for event channels (v2) Konrad Rzeszutek Wilk
2014-01-01  4:35 ` Konrad Rzeszutek Wilk
2014-01-02 15:43   ` David Vrabel
2014-01-02 15:43   ` David Vrabel
2014-01-03 16:34   ` Stefano Stabellini
2014-01-03 16:34   ` Stefano Stabellini
2014-01-03 18:10     ` Konrad Rzeszutek Wilk
2014-01-03 18:10     ` Konrad Rzeszutek Wilk
2014-01-01  4:35 ` [PATCH v12 12/18] xen/grants: Remove gnttab_max_grant_frames dependency on gnttab_init Konrad Rzeszutek Wilk
2014-01-02 11:38   ` David Vrabel
2014-01-02 11:38   ` David Vrabel
2014-01-03 16:40   ` Stefano Stabellini
2014-01-03 16:40   ` Stefano Stabellini
2014-01-01  4:35 ` Konrad Rzeszutek Wilk
2014-01-01  4:35 ` [PATCH v12 13/18] xen/grant-table: Refactor gnttab_init Konrad Rzeszutek Wilk
2014-01-02 11:39   ` David Vrabel
2014-01-02 11:39   ` David Vrabel
2014-01-03 16:43   ` Stefano Stabellini
2014-01-03 16:43   ` Stefano Stabellini
2014-01-01  4:35 ` [PATCH v12 14/18] xen/grant: Implement an grant frame array struct Konrad Rzeszutek Wilk
2014-01-02 16:27   ` David Vrabel
2014-01-02 16:27   ` David Vrabel
2014-01-02 18:47     ` Konrad Rzeszutek Wilk
2014-01-03 12:11       ` [Xen-devel] " David Vrabel
2014-01-03 15:09         ` Konrad Rzeszutek Wilk
2014-01-03 15:09         ` Konrad Rzeszutek Wilk
2014-01-03 12:11       ` David Vrabel
2014-01-02 18:47     ` Konrad Rzeszutek Wilk
2014-01-03 16:53   ` Stefano Stabellini
2014-01-03 19:18     ` [Xen-devel] " Konrad Rzeszutek Wilk
2014-01-03 19:18     ` Konrad Rzeszutek Wilk
2014-01-03 16:53   ` Stefano Stabellini
2014-01-01  4:35 ` [PATCH v12 15/18] xen/pvh: Piggyback on PVHVM for grant driver (v2) Konrad Rzeszutek Wilk
2014-01-02 16:32   ` David Vrabel
2014-01-02 18:50     ` Konrad Rzeszutek Wilk
2014-01-02 18:50     ` Konrad Rzeszutek Wilk
2014-01-03 11:54       ` David Vrabel
2014-01-03 14:44         ` Konrad Rzeszutek Wilk
2014-01-03 15:41           ` David Vrabel
2014-01-03 15:48             ` [Xen-devel] " Konrad Rzeszutek Wilk
2014-01-03 15:48               ` Konrad Rzeszutek Wilk
2014-01-03 17:20               ` [Xen-devel] " Stefano Stabellini
2014-01-03 18:14                 ` Konrad Rzeszutek Wilk
2014-01-03 18:29                   ` Stefano Stabellini
2014-01-03 18:29                   ` [Xen-devel] " Stefano Stabellini
2014-01-03 18:39                     ` Konrad Rzeszutek Wilk
2014-01-03 18:39                     ` [Xen-devel] " Konrad Rzeszutek Wilk
2014-01-03 19:02                       ` Stefano Stabellini
2014-01-03 19:02                       ` Stefano Stabellini
2014-01-03 18:14                 ` Konrad Rzeszutek Wilk
2014-01-03 17:20               ` Stefano Stabellini
2014-01-03 15:41           ` David Vrabel
2014-01-03 14:44         ` Konrad Rzeszutek Wilk
2014-01-03 11:54       ` David Vrabel
2014-01-02 16:32   ` David Vrabel
2014-01-03 17:26   ` Stefano Stabellini
2014-01-03 17:26   ` Stefano Stabellini
2014-01-03 18:20     ` Konrad Rzeszutek Wilk
2014-01-03 18:20     ` Konrad Rzeszutek Wilk
2014-01-01  4:35 ` [PATCH v12 16/18] xen/pvh: Piggyback on PVHVM XenBus Konrad Rzeszutek Wilk
2014-01-02 11:43   ` David Vrabel
2014-01-02 11:43   ` David Vrabel
2014-01-03 17:22   ` Stefano Stabellini
2014-01-03 17:22   ` Stefano Stabellini
2014-01-01  4:35 ` Konrad Rzeszutek Wilk
2014-01-01  4:35 ` [PATCH v12 17/18] xen/pvh/arm/arm64: Disable PV code that does not work with PVH (v2) Konrad Rzeszutek Wilk
2014-01-02 11:44   ` David Vrabel
2014-01-02 11:44   ` David Vrabel
2014-01-03 16:22   ` Stefano Stabellini
2014-01-03 16:22   ` Stefano Stabellini
2014-01-03 17:59     ` Konrad Rzeszutek Wilk
2014-01-03 17:59     ` Konrad Rzeszutek Wilk
2014-01-01  4:35 ` [PATCH v12 18/18] xen/pvh: Support ParaVirtualized Hardware extensions (v2) Konrad Rzeszutek Wilk
2014-01-01  4:35 ` Konrad Rzeszutek Wilk
2014-01-02 11:48   ` David Vrabel
2014-01-02 18:27     ` Konrad Rzeszutek Wilk
2014-01-02 18:27     ` Konrad Rzeszutek Wilk
2014-01-02 11:48   ` David Vrabel
2014-01-02 16:50 ` [PATCH v12] Linux Xen PVH support David Vrabel
2014-01-02 19:02   ` Konrad Rzeszutek Wilk
2014-01-02 19:02   ` Konrad Rzeszutek Wilk
2014-01-03 13:37     ` David Vrabel
2014-01-03 13:37     ` David Vrabel
2014-01-02 16:50 ` David Vrabel
2014-01-02 18:39 ` H. Peter Anvin
2014-01-02 18:39 ` H. Peter Anvin
2014-01-02 19:12   ` Konrad Rzeszutek Wilk
2014-01-02 19:12   ` Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140103160200.GE27019@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mukesh.rathor@oracle.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.