Re: [PATCH] Xen: Fix pte unpin BUG when !CONFIG_SMP

From: Jeremy Fitzhardinge
Date: Tue Sep 09 2008 - 14:06:13 EST


Alex Nixon wrote:
> We still need to pin PTEs, even if there are no PTE locks. Otherwise we'll BUG whenever there aren't PTE locks (i.e. whenever NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS), as we try to unpin PTEs which were never pinned in the first place.
>

Where does the unpin happen? xen_unpin_page() also checks to see if it
took the lock before trying to unpin, symmetric with xen_pin_page().

J
> Signed-off-by: Alex Nixon <alex.nixon@xxxxxxxxxx>
> Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxx>
> ---
> arch/x86/xen/mmu.c | 7 +++----
> 1 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
> index f5af913..1239bda 100644
> --- a/arch/x86/xen/mmu.c
> +++ b/arch/x86/xen/mmu.c
> @@ -819,9 +819,10 @@ static int xen_pin_page(struct page *page, enum pt_level level)
> pfn_pte(pfn, PAGE_KERNEL_RO),
> level == PT_PGD ? UVMF_TLB_FLUSH : 0);
>
> - if (ptl) {
> + if (level == PT_PTE)
> xen_do_pin(MMUEXT_PIN_L1_TABLE, pfn);
>
> + if (ptl) {
> /* Queue a deferred unlock for when this batch
> is completed. */
> xen_mc_callback(xen_pte_unlock, ptl);
> @@ -924,9 +925,7 @@ static int xen_unpin_page(struct page *page, enum pt_level level)
> */
> if (level == PT_PTE) {
> ptl = xen_pte_lock(page);
> -
> - if (ptl)
> - xen_do_pin(MMUEXT_UNPIN_TABLE, pfn);
> + xen_do_pin(MMUEXT_UNPIN_TABLE, pfn);
> }
>
> mcs = __xen_mc_entry(0);
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/