Re: [Xen-devel] [PATCH V2 2/5] xen: Delay m2p_override initialization

From: David Vrabel
Date: Fri Nov 07 2014 - 08:04:18 EST


On 06/11/14 05:47, Juergen Gross wrote:
> The m2p overrides are used to be able to find the local pfn for a
> foreign mfn mapped into the domain. They are used by driver backends
> having to access frontend data.
>
> As this functionality isn't used in early boot it makes no sense to
> initialize the m2p override functions very early. It can be done
> later without doing any harm, removing the need for allocating memory
> via extend_brk().
>
> While at it make some m2p override functions static as they are only
> used internally.
[...]
> }
> /* This should be the leafs allocated for identity from _brk. */
> }
> - return (unsigned long)mfn_list;
>
> + m2p_override_init();
> + return (unsigned long)mfn_list;
> }
> #else
> unsigned long __init xen_revector_p2m_tree(void)
> {
> use_brk = 0;
> + m2p_override_init();
> return 0;
> }

This is mentioned in the description...

> #endif
> @@ -794,15 +794,16 @@ bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
> #define M2P_OVERRIDE_HASH_SHIFT 10
> #define M2P_OVERRIDE_HASH (1 << M2P_OVERRIDE_HASH_SHIFT)
>
> -static RESERVE_BRK_ARRAY(struct list_head, m2p_overrides, M2P_OVERRIDE_HASH);
> +static struct list_head *m2p_overrides;
> static DEFINE_SPINLOCK(m2p_override_lock);
>
> static void __init m2p_override_init(void)
> {
> unsigned i;
>
> - m2p_overrides = extend_brk(sizeof(*m2p_overrides) * M2P_OVERRIDE_HASH,
> - sizeof(unsigned long));
> + m2p_overrides = alloc_bootmem_align(
> + sizeof(*m2p_overrides) * M2P_OVERRIDE_HASH,
> + sizeof(unsigned long));

...as is this.

> -int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
> - struct gnttab_map_grant_ref *kmap_ops,
> - struct page **pages, unsigned int count)
> -{
> - int i, ret = 0;
> - bool lazy = false;
> - pte_t *pte;
> -
> - if (xen_feature(XENFEAT_auto_translated_physmap))
> - return 0;
> -
> - if (kmap_ops &&
> - !in_interrupt() &&
> - paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) {
> - arch_enter_lazy_mmu_mode();
> - lazy = true;
> - }

... but, what's going on here. What are the rest of these changes?

I suppose this is the "make some functions static" but it's an
unreviewable mess. If you can't do this with some one line changes
adding "static" and perhaps some forward declarations then please drop
this bit.

David
--
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/