2017-08-04 11:36:19

by Jürgen Groß

[permalink] [raw]
Subject: [PATCH 0/3] xen: do some cleanups

Remove stuff no longer needed.

Juergen Gross (3):
xen: remove tests for pvh mode in pure pv paths
xen: remove unused function xen_set_domain_pte()
xen: remove not used trace functions

arch/x86/include/asm/xen/page.h | 5 -----
arch/x86/xen/mmu_pv.c | 20 --------------------
arch/x86/xen/p2m.c | 25 +------------------------
arch/x86/xen/setup.c | 5 +----
include/trace/events/xen.h | 38 --------------------------------------
5 files changed, 2 insertions(+), 91 deletions(-)

--
2.12.3


2017-08-04 11:36:33

by Jürgen Groß

[permalink] [raw]
Subject: [PATCH 2/3] xen: remove unused function xen_set_domain_pte()

The function xen_set_domain_pte() is used nowhere in the kernel.
Remove it.

Signed-off-by: Juergen Gross <[email protected]>
---
arch/x86/include/asm/xen/page.h | 2 --
arch/x86/xen/mmu_pv.c | 20 --------------------
include/trace/events/xen.h | 18 ------------------
3 files changed, 40 deletions(-)

diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
index 497f7d28c1d6..07b6531813c4 100644
--- a/arch/x86/include/asm/xen/page.h
+++ b/arch/x86/include/asm/xen/page.h
@@ -314,8 +314,6 @@ static inline pte_t __pte_ma(pteval_t x)
#define p4d_val_ma(x) ((x).p4d)
#endif

-void xen_set_domain_pte(pte_t *ptep, pte_t pteval, unsigned domid);
-
xmaddr_t arbitrary_virt_to_machine(void *address);
unsigned long arbitrary_virt_to_mfn(void *vaddr);
void make_lowmem_page_readonly(void *vaddr);
diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c
index cab28cf2cffb..0422ee7e70b3 100644
--- a/arch/x86/xen/mmu_pv.c
+++ b/arch/x86/xen/mmu_pv.c
@@ -162,26 +162,6 @@ static bool xen_page_pinned(void *ptr)
return PagePinned(page);
}

-void xen_set_domain_pte(pte_t *ptep, pte_t pteval, unsigned domid)
-{
- struct multicall_space mcs;
- struct mmu_update *u;
-
- trace_xen_mmu_set_domain_pte(ptep, pteval, domid);
-
- mcs = xen_mc_entry(sizeof(*u));
- u = mcs.args;
-
- /* ptep might be kmapped when using 32-bit HIGHPTE */
- u->ptr = virt_to_machine(ptep).maddr;
- u->val = pte_val_ma(pteval);
-
- MULTI_mmu_update(mcs.mc, mcs.args, 1, NULL, domid);
-
- xen_mc_issue(PARAVIRT_LAZY_MMU);
-}
-EXPORT_SYMBOL_GPL(xen_set_domain_pte);
-
static void xen_extend_mmu_update(const struct mmu_update *update)
{
struct multicall_space mcs;
diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h
index b70a38b7fa84..677e8ac2bb81 100644
--- a/include/trace/events/xen.h
+++ b/include/trace/events/xen.h
@@ -149,24 +149,6 @@ DECLARE_EVENT_CLASS(xen_mmu__set_pte,
DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte);
DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte_atomic);

-TRACE_EVENT(xen_mmu_set_domain_pte,
- TP_PROTO(pte_t *ptep, pte_t pteval, unsigned domid),
- TP_ARGS(ptep, pteval, domid),
- TP_STRUCT__entry(
- __field(pte_t *, ptep)
- __field(pteval_t, pteval)
- __field(unsigned, domid)
- ),
- TP_fast_assign(__entry->ptep = ptep;
- __entry->pteval = pteval.pte;
- __entry->domid = domid),
- TP_printk("ptep %p pteval %0*llx (raw %0*llx) domid %u",
- __entry->ptep,
- (int)sizeof(pteval_t) * 2, (unsigned long long)pte_val(native_make_pte(__entry->pteval)),
- (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval,
- __entry->domid)
- );
-
TRACE_EVENT(xen_mmu_set_pte_at,
TP_PROTO(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pteval),
--
2.12.3

2017-08-04 11:36:32

by Jürgen Groß

[permalink] [raw]
Subject: [PATCH 1/3] xen: remove tests for pvh mode in pure pv paths

Remove the last tests for XENFEAT_auto_translated_physmap in pure
PV-domain specific paths. PVH V1 is gone and the feature will always
be "false" in PV guests.

Signed-off-by: Juergen Gross <[email protected]>
---
arch/x86/include/asm/xen/page.h | 3 ---
arch/x86/xen/p2m.c | 25 +------------------------
arch/x86/xen/setup.c | 5 +----
3 files changed, 2 insertions(+), 31 deletions(-)

diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
index 8417ef7c3885..497f7d28c1d6 100644
--- a/arch/x86/include/asm/xen/page.h
+++ b/arch/x86/include/asm/xen/page.h
@@ -158,9 +158,6 @@ static inline unsigned long mfn_to_pfn_no_overrides(unsigned long mfn)
unsigned long pfn;
int ret;

- if (xen_feature(XENFEAT_auto_translated_physmap))
- return mfn;
-
if (unlikely(mfn >= machine_to_phys_nr))
return ~0;

diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 276da636dd39..6083ba462f35 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -212,8 +212,7 @@ void __ref xen_build_mfn_list_list(void)
unsigned int level, topidx, mididx;
unsigned long *mid_mfn_p;

- if (xen_feature(XENFEAT_auto_translated_physmap) ||
- xen_start_info->flags & SIF_VIRT_P2M_4TOOLS)
+ if (xen_start_info->flags & SIF_VIRT_P2M_4TOOLS)
return;

/* Pre-initialize p2m_top_mfn to be completely missing */
@@ -269,9 +268,6 @@ void __ref xen_build_mfn_list_list(void)

void xen_setup_mfn_list_list(void)
{
- if (xen_feature(XENFEAT_auto_translated_physmap))
- return;
-
BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info);

if (xen_start_info->flags & SIF_VIRT_P2M_4TOOLS)
@@ -291,9 +287,6 @@ void __init xen_build_dynamic_phys_to_machine(void)
{
unsigned long pfn;

- if (xen_feature(XENFEAT_auto_translated_physmap))
- return;
-
xen_p2m_addr = (unsigned long *)xen_start_info->mfn_list;
xen_p2m_size = ALIGN(xen_start_info->nr_pages, P2M_PER_PAGE);

@@ -540,9 +533,6 @@ int xen_alloc_p2m_entry(unsigned long pfn)
unsigned long addr = (unsigned long)(xen_p2m_addr + pfn);
unsigned long p2m_pfn;

- if (xen_feature(XENFEAT_auto_translated_physmap))
- return 0;
-
ptep = lookup_address(addr, &level);
BUG_ON(!ptep || level != PG_LEVEL_4K);
pte_pg = (pte_t *)((unsigned long)ptep & ~(PAGE_SIZE - 1));
@@ -640,9 +630,6 @@ unsigned long __init set_phys_range_identity(unsigned long pfn_s,
if (unlikely(pfn_s >= xen_p2m_size))
return 0;

- if (unlikely(xen_feature(XENFEAT_auto_translated_physmap)))
- return pfn_e - pfn_s;
-
if (pfn_s > pfn_e)
return 0;

@@ -660,10 +647,6 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn)
pte_t *ptep;
unsigned int level;

- /* don't track P2M changes in autotranslate guests */
- if (unlikely(xen_feature(XENFEAT_auto_translated_physmap)))
- return true;
-
if (unlikely(pfn >= xen_p2m_size)) {
BUG_ON(mfn != INVALID_P2M_ENTRY);
return true;
@@ -711,9 +694,6 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
int i, ret = 0;
pte_t *pte;

- if (xen_feature(XENFEAT_auto_translated_physmap))
- return 0;
-
if (kmap_ops) {
ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,
kmap_ops, count);
@@ -756,9 +736,6 @@ int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
{
int i, ret = 0;

- if (xen_feature(XENFEAT_auto_translated_physmap))
- return 0;
-
for (i = 0; i < count; i++) {
unsigned long mfn = __pfn_to_mfn(page_to_pfn(pages[i]));
unsigned long pfn = page_to_pfn(pages[i]);
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index c81046323ebc..ac55c02f98e9 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -340,8 +340,6 @@ static void __init xen_do_set_identity_and_remap_chunk(

WARN_ON(size == 0);

- BUG_ON(xen_feature(XENFEAT_auto_translated_physmap));
-
mfn_save = virt_to_mfn(buf);

for (ident_pfn_iter = start_pfn, remap_pfn_iter = remap_pfn;
@@ -1024,8 +1022,7 @@ void __init xen_pvmmu_arch_setup(void)
void __init xen_arch_setup(void)
{
xen_panic_handler_init();
- if (!xen_feature(XENFEAT_auto_translated_physmap))
- xen_pvmmu_arch_setup();
+ xen_pvmmu_arch_setup();

#ifdef CONFIG_ACPI
if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
--
2.12.3

2017-08-04 11:36:31

by Jürgen Groß

[permalink] [raw]
Subject: [PATCH 3/3] xen: remove not used trace functions

There are some Xen specific trace functions defined in
include/trace/events/xen.h. Remove them.

Signed-off-by: Juergen Gross <[email protected]>
---
include/trace/events/xen.h | 20 --------------------
1 file changed, 20 deletions(-)

diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h
index 677e8ac2bb81..1b4fed72f573 100644
--- a/include/trace/events/xen.h
+++ b/include/trace/events/xen.h
@@ -248,16 +248,6 @@ TRACE_EVENT(xen_mmu_set_p4d,
(int)sizeof(p4dval_t) * 2, (unsigned long long)pgd_val(native_make_pgd(__entry->p4dval)),
(int)sizeof(p4dval_t) * 2, (unsigned long long)__entry->p4dval)
);
-
-TRACE_EVENT(xen_mmu_pud_clear,
- TP_PROTO(pud_t *pudp),
- TP_ARGS(pudp),
- TP_STRUCT__entry(
- __field(pud_t *, pudp)
- ),
- TP_fast_assign(__entry->pudp = pudp),
- TP_printk("pudp %p", __entry->pudp)
- );
#else

TRACE_EVENT(xen_mmu_set_pud,
@@ -277,16 +267,6 @@ TRACE_EVENT(xen_mmu_set_pud,

#endif

-TRACE_EVENT(xen_mmu_pgd_clear,
- TP_PROTO(pgd_t *pgdp),
- TP_ARGS(pgdp),
- TP_STRUCT__entry(
- __field(pgd_t *, pgdp)
- ),
- TP_fast_assign(__entry->pgdp = pgdp),
- TP_printk("pgdp %p", __entry->pgdp)
- );
-
DECLARE_EVENT_CLASS(xen_mmu_ptep_modify_prot,
TP_PROTO(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pteval),
--
2.12.3

2017-08-04 19:15:12

by Boris Ostrovsky

[permalink] [raw]
Subject: Re: [PATCH 1/3] xen: remove tests for pvh mode in pure pv paths

On 08/04/2017 07:36 AM, Juergen Gross wrote:
> Remove the last tests for XENFEAT_auto_translated_physmap in pure
> PV-domain specific paths. PVH V1 is gone and the feature will always
> be "false" in PV guests.
>
> Signed-off-by: Juergen Gross <[email protected]>

Reviewed-by: Boris Ostrovsky <[email protected]>

I wonder whether the remaining use of this flag can be replaced with
appropriate xen_*_domain()?

-boris

2017-08-04 19:20:47

by Boris Ostrovsky

[permalink] [raw]
Subject: Re: [PATCH 2/3] xen: remove unused function xen_set_domain_pte()

On 08/04/2017 07:36 AM, Juergen Gross wrote:
> The function xen_set_domain_pte() is used nowhere in the kernel.
> Remove it.
>
> Signed-off-by: Juergen Gross <[email protected]>

Reviewed-by: Boris Ostrovsky <[email protected]>

(+ Ingo and Steven who are maintainers of include/trace/events/xen.h)

> ---
> arch/x86/include/asm/xen/page.h | 2 --
> arch/x86/xen/mmu_pv.c | 20 --------------------
> include/trace/events/xen.h | 18 ------------------
> 3 files changed, 40 deletions(-)
>
> diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
> index 497f7d28c1d6..07b6531813c4 100644
> --- a/arch/x86/include/asm/xen/page.h
> +++ b/arch/x86/include/asm/xen/page.h
> @@ -314,8 +314,6 @@ static inline pte_t __pte_ma(pteval_t x)
> #define p4d_val_ma(x) ((x).p4d)
> #endif
>
> -void xen_set_domain_pte(pte_t *ptep, pte_t pteval, unsigned domid);
> -
> xmaddr_t arbitrary_virt_to_machine(void *address);
> unsigned long arbitrary_virt_to_mfn(void *vaddr);
> void make_lowmem_page_readonly(void *vaddr);
> diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c
> index cab28cf2cffb..0422ee7e70b3 100644
> --- a/arch/x86/xen/mmu_pv.c
> +++ b/arch/x86/xen/mmu_pv.c
> @@ -162,26 +162,6 @@ static bool xen_page_pinned(void *ptr)
> return PagePinned(page);
> }
>
> -void xen_set_domain_pte(pte_t *ptep, pte_t pteval, unsigned domid)
> -{
> - struct multicall_space mcs;
> - struct mmu_update *u;
> -
> - trace_xen_mmu_set_domain_pte(ptep, pteval, domid);
> -
> - mcs = xen_mc_entry(sizeof(*u));
> - u = mcs.args;
> -
> - /* ptep might be kmapped when using 32-bit HIGHPTE */
> - u->ptr = virt_to_machine(ptep).maddr;
> - u->val = pte_val_ma(pteval);
> -
> - MULTI_mmu_update(mcs.mc, mcs.args, 1, NULL, domid);
> -
> - xen_mc_issue(PARAVIRT_LAZY_MMU);
> -}
> -EXPORT_SYMBOL_GPL(xen_set_domain_pte);
> -
> static void xen_extend_mmu_update(const struct mmu_update *update)
> {
> struct multicall_space mcs;
> diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h
> index b70a38b7fa84..677e8ac2bb81 100644
> --- a/include/trace/events/xen.h
> +++ b/include/trace/events/xen.h
> @@ -149,24 +149,6 @@ DECLARE_EVENT_CLASS(xen_mmu__set_pte,
> DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte);
> DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte_atomic);
>
> -TRACE_EVENT(xen_mmu_set_domain_pte,
> - TP_PROTO(pte_t *ptep, pte_t pteval, unsigned domid),
> - TP_ARGS(ptep, pteval, domid),
> - TP_STRUCT__entry(
> - __field(pte_t *, ptep)
> - __field(pteval_t, pteval)
> - __field(unsigned, domid)
> - ),
> - TP_fast_assign(__entry->ptep = ptep;
> - __entry->pteval = pteval.pte;
> - __entry->domid = domid),
> - TP_printk("ptep %p pteval %0*llx (raw %0*llx) domid %u",
> - __entry->ptep,
> - (int)sizeof(pteval_t) * 2, (unsigned long long)pte_val(native_make_pte(__entry->pteval)),
> - (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval,
> - __entry->domid)
> - );
> -
> TRACE_EVENT(xen_mmu_set_pte_at,
> TP_PROTO(struct mm_struct *mm, unsigned long addr,
> pte_t *ptep, pte_t pteval),

2017-08-04 19:35:22

by Boris Ostrovsky

[permalink] [raw]
Subject: Re: [PATCH 3/3] xen: remove not used trace functions

On 08/04/2017 07:36 AM, Juergen Gross wrote:
> There are some Xen specific trace functions defined in
> include/trace/events/xen.h. Remove them.
>
> Signed-off-by: Juergen Gross <[email protected]>

(Again, adding Ingo and Steven)

Reviewed-by: Boris Ostrovsky <[email protected]>

although I think "s/some Xen/some unused Xen/" in the commit message
would make it clearer.

> ---
> include/trace/events/xen.h | 20 --------------------
> 1 file changed, 20 deletions(-)
>
> diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h
> index 677e8ac2bb81..1b4fed72f573 100644
> --- a/include/trace/events/xen.h
> +++ b/include/trace/events/xen.h
> @@ -248,16 +248,6 @@ TRACE_EVENT(xen_mmu_set_p4d,
> (int)sizeof(p4dval_t) * 2, (unsigned long long)pgd_val(native_make_pgd(__entry->p4dval)),
> (int)sizeof(p4dval_t) * 2, (unsigned long long)__entry->p4dval)
> );
> -
> -TRACE_EVENT(xen_mmu_pud_clear,
> - TP_PROTO(pud_t *pudp),
> - TP_ARGS(pudp),
> - TP_STRUCT__entry(
> - __field(pud_t *, pudp)
> - ),
> - TP_fast_assign(__entry->pudp = pudp),
> - TP_printk("pudp %p", __entry->pudp)
> - );
> #else
>
> TRACE_EVENT(xen_mmu_set_pud,
> @@ -277,16 +267,6 @@ TRACE_EVENT(xen_mmu_set_pud,
>
> #endif
>
> -TRACE_EVENT(xen_mmu_pgd_clear,
> - TP_PROTO(pgd_t *pgdp),
> - TP_ARGS(pgdp),
> - TP_STRUCT__entry(
> - __field(pgd_t *, pgdp)
> - ),
> - TP_fast_assign(__entry->pgdp = pgdp),
> - TP_printk("pgdp %p", __entry->pgdp)
> - );
> -
> DECLARE_EVENT_CLASS(xen_mmu_ptep_modify_prot,
> TP_PROTO(struct mm_struct *mm, unsigned long addr,
> pte_t *ptep, pte_t pteval),

2017-08-14 20:28:38

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 2/3] xen: remove unused function xen_set_domain_pte()

On Fri, 4 Aug 2017 15:20:30 -0400
Boris Ostrovsky <[email protected]> wrote:

> On 08/04/2017 07:36 AM, Juergen Gross wrote:
> > The function xen_set_domain_pte() is used nowhere in the kernel.
> > Remove it.
> >
> > Signed-off-by: Juergen Gross <[email protected]>
>
> Reviewed-by: Boris Ostrovsky <[email protected]>
>
> (+ Ingo and Steven who are maintainers of include/trace/events/xen.h)

But the maintainers of where the tracepoints are located have final
say (in this case, the Xen maintainers). I like to be Cc'd to make sure
that the events are efficient and don't waste cpu unnecessary CPU
cycles or memory.

-- Steve

2017-08-14 20:29:37

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 3/3] xen: remove not used trace functions

On Fri, 4 Aug 2017 15:35:06 -0400
Boris Ostrovsky <[email protected]> wrote:

> On 08/04/2017 07:36 AM, Juergen Gross wrote:
> > There are some Xen specific trace functions defined in
> > include/trace/events/xen.h. Remove them.
> >
> > Signed-off-by: Juergen Gross <[email protected]>
>
> (Again, adding Ingo and Steven)

Feel free to add:

Acked-by: Steven Rostedt (VMware) <[email protected]>

to both.

-- Steve

>
> Reviewed-by: Boris Ostrovsky <[email protected]>
>
> although I think "s/some Xen/some unused Xen/" in the commit message
> would make it clearer.
>

2017-08-16 15:10:04

by Boris Ostrovsky

[permalink] [raw]
Subject: Re: [PATCH 0/3] xen: do some cleanups

On 08/04/2017 07:36 AM, Juergen Gross wrote:
> Remove stuff no longer needed.
>
> Juergen Gross (3):
> xen: remove tests for pvh mode in pure pv paths
> xen: remove unused function xen_set_domain_pte()
> xen: remove not used trace functions
>
> arch/x86/include/asm/xen/page.h | 5 -----
> arch/x86/xen/mmu_pv.c | 20 --------------------
> arch/x86/xen/p2m.c | 25 +------------------------
> arch/x86/xen/setup.c | 5 +----
> include/trace/events/xen.h | 38 --------------------------------------
> 5 files changed, 2 insertions(+), 91 deletions(-)
>

Applied to for-linus-4.14.

-boris