]> xenbits.xensource.com Git - people/hx242/xen.git/log
people/hx242/xen.git
5 years agoxen/page_alloc: destroy the direct map when initialising allocators directnonmap-v2.2
Hongyan Xia [Tue, 1 Oct 2019 13:14:24 +0000 (14:14 +0100)]
xen/page_alloc: destroy the direct map when initialising allocators

If configured without the direct map, the allocators will ensure there
are no direct map mappings when new memory is received.

Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agox86/setup: do not map memory when passing to allocators
Hongyan Xia [Tue, 1 Oct 2019 11:15:59 +0000 (12:15 +0100)]
x86/setup: do not map memory when passing to allocators

Remove the mappings to the direct map region when passing memory to
allocators.

Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agox86: properly (un)map pages in restore_all_guests.
Hongyan Xia [Fri, 13 Sep 2019 16:59:30 +0000 (17:59 +0100)]
x86: properly (un)map pages in restore_all_guests.

Before, it assumed both cr3 could be accessed via a direct map. This is
no longer true.

Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agox86/mm: don't call unmap on a xenheap allocation
Hongyan Xia [Mon, 30 Sep 2019 18:23:25 +0000 (19:23 +0100)]
x86/mm: don't call unmap on a xenheap allocation

This used to work when unmap on the direct map was just a no-op, which
is no longer true.

Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agox86/domain_page: remove fast paths that depend on the direct map
Hongyan Xia [Tue, 1 Oct 2019 09:50:24 +0000 (10:50 +0100)]
x86/domain_page: remove fast paths that depend on the direct map

Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agoxen/page_alloc: add a path for xenheap when there is no direct map
Hongyan Xia [Tue, 1 Oct 2019 09:30:45 +0000 (10:30 +0100)]
xen/page_alloc: add a path for xenheap when there is no direct map

When there is not an always-mapped direct map, xenheap allocations need
to be mapped and unmapped on-demand.

Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agoacpi: add a path to work with no direct map
Hongyan Xia [Fri, 13 Sep 2019 08:21:11 +0000 (09:21 +0100)]
acpi: add a path to work with no direct map

Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agoxen/page_alloc: statically allocate bootmem_region_list
Hongyan Xia [Tue, 1 Oct 2019 09:13:20 +0000 (10:13 +0100)]
xen/page_alloc: statically allocate bootmem_region_list

This is to avoid all sorts of bootstrapping problems, especially when
we do not have a direct map.

Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agox86/pv: refactor how building dom0 in PV handles domheap mappings
Hongyan Xia [Fri, 13 Sep 2019 14:23:52 +0000 (15:23 +0100)]
x86/pv: refactor how building dom0 in PV handles domheap mappings

Building a PV dom0 is allocating from the domheap but uses it like the
xenheap. This is clearly wrong. Fix.

Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agox86/pv: domheap pages should be mapped while relocating initrd
Wei Liu [Tue, 19 Feb 2019 15:45:12 +0000 (15:45 +0000)]
x86/pv: domheap pages should be mapped while relocating initrd

Xen shouldn't use domheap page as if they were xenheap pages. Map and
unmap pages accordingly.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/domain_page: use PMAP when d/vcache is not ready
Hongyan Xia [Mon, 30 Sep 2019 17:06:51 +0000 (18:06 +0100)]
x86/domain_page: use PMAP when d/vcache is not ready

Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agox86/mapcache: initialise the mapcache even for the idle domain
Hongyan Xia [Wed, 11 Sep 2019 09:37:14 +0000 (10:37 +0100)]
x86/mapcache: initialise the mapcache even for the idle domain

In situations where PMAP cannot be used or the mapcache of a domain is
simply not ready, we need to have a mapcache in the idle domain to map
pages when there is no direct map.

Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agox86: lift vcpu mapcache to arch_vcpu
Wei Liu [Mon, 17 Dec 2018 15:58:13 +0000 (15:58 +0000)]
x86: lift vcpu mapcache to arch_vcpu

It is going to be needed by HVM as well, because we want even HVM vcpu
to have a per-vcpu mapcache.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agox86: lift domain mapcache to arch_domain
Wei Liu [Mon, 17 Dec 2018 15:50:49 +0000 (15:50 +0000)]
x86: lift domain mapcache to arch_domain

It is going to be needed by HVM as well, because we want even HVM
domain to have a per-domain mapcache.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86: add Persistent Map (PMAP) infrastructure
Wei Liu [Fri, 11 Jan 2019 17:20:21 +0000 (17:20 +0000)]
x86: add Persistent Map (PMAP) infrastructure

The basic idea is like Persistent Kernel Map (PKMAP) in linux. We
pre-populate all the relevant page tables before system is fully set
up.

It is needed to bootstrap map domain page infrastructure -- we need
some way to map pages to set up the mapcache without a direct map.

In order to keep the number of entries minimal, this infrastructure
can only be used by one CPU at a time.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agox86/mm: drop _new suffix for page table APIs
Wei Liu [Fri, 8 Feb 2019 17:19:26 +0000 (17:19 +0000)]
x86/mm: drop _new suffix for page table APIs

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyax@amazon.com>
---
Changed since v1:
- Fix rebase conflicts against new master and other changes since v1.

Changed since v2:
- Also drop _new for the fix of l2t leak.

5 years agox86: switch to use domheap page for page tables
Wei Liu [Tue, 5 Feb 2019 17:20:11 +0000 (17:20 +0000)]
x86: switch to use domheap page for page tables

Modify all the _new APIs to handle domheap pages.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/mm: drop old page table APIs
Wei Liu [Tue, 5 Feb 2019 17:06:43 +0000 (17:06 +0000)]
x86/mm: drop old page table APIs

Now that we've switched all users to the new APIs, the old ones aren't
needed anymore.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86: remove lXe_to_lYe in __start_xen
Wei Liu [Tue, 5 Feb 2019 17:04:56 +0000 (17:04 +0000)]
x86: remove lXe_to_lYe in __start_xen

Properly map and unmap page tables where necessary.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/pv: properly map and unmap page table in dom0_construct_pv
Wei Liu [Tue, 5 Feb 2019 16:35:28 +0000 (16:35 +0000)]
x86/pv: properly map and unmap page table in dom0_construct_pv

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/pv: properly map and unmap page tables in mark_pv_pt_pages_rdonly
Wei Liu [Tue, 5 Feb 2019 16:32:54 +0000 (16:32 +0000)]
x86/pv: properly map and unmap page tables in mark_pv_pt_pages_rdonly

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/smpboot: remove lXe_to_lYe in cleanup_cpu_root_pgt
Wei Liu [Tue, 5 Feb 2019 13:51:12 +0000 (13:51 +0000)]
x86/smpboot: remove lXe_to_lYe in cleanup_cpu_root_pgt

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86_64/mm: map and unmap page tables in subarch_memory_op
Wei Liu [Tue, 5 Feb 2019 13:47:07 +0000 (13:47 +0000)]
x86_64/mm: map and unmap page tables in subarch_memory_op

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86_64/mm: map and unmap page tables in subarch_init_memory
Wei Liu [Tue, 5 Feb 2019 13:44:22 +0000 (13:44 +0000)]
x86_64/mm: map and unmap page tables in subarch_init_memory

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86_64/mm: map and unmap page tables in cleanup_frame_table
Wei Liu [Tue, 5 Feb 2019 13:35:19 +0000 (13:35 +0000)]
x86_64/mm: map and unmap page tables in cleanup_frame_table

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86_64/mm: map and unmap page tables in setup_compat_m2p_table
Wei Liu [Tue, 5 Feb 2019 13:25:05 +0000 (13:25 +0000)]
x86_64/mm: map and unmap page tables in setup_compat_m2p_table

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86_64/mm: map and unmap page tables in destroy_m2p_mapping
Wei Liu [Tue, 5 Feb 2019 13:19:43 +0000 (13:19 +0000)]
x86_64/mm: map and unmap page tables in destroy_m2p_mapping

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86_64/mm: map and unmap page tables in destroy_compat_m2p_mapping
Wei Liu [Tue, 5 Feb 2019 13:09:18 +0000 (13:09 +0000)]
x86_64/mm: map and unmap page tables in destroy_compat_m2p_mapping

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86_64/mm: map and unmap page tables in share_hotadd_m2p_table
Wei Liu [Tue, 5 Feb 2019 13:06:08 +0000 (13:06 +0000)]
x86_64/mm: map and unmap page tables in share_hotadd_m2p_table

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86_64/mm: map and unmap page tables in m2p_mapped
Wei Liu [Tue, 5 Feb 2019 12:56:41 +0000 (12:56 +0000)]
x86_64/mm: map and unmap page tables in m2p_mapped

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/shim: map and unmap page tables in replace_va_mapping
Wei Liu [Tue, 5 Feb 2019 12:48:03 +0000 (12:48 +0000)]
x86/shim: map and unmap page tables in replace_va_mapping

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/smpboot: drop lXe_to_lYe invocations from cleanup_cpu_root_pgt
Wei Liu [Mon, 4 Feb 2019 18:16:30 +0000 (18:16 +0000)]
x86/smpboot: drop lXe_to_lYe invocations from cleanup_cpu_root_pgt

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/smpboot: switch pl*e to use new APIs in clone_mapping
Wei Liu [Mon, 4 Feb 2019 17:57:33 +0000 (17:57 +0000)]
x86/smpboot: switch pl*e to use new APIs in clone_mapping

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agox86/smpboot: clone_mapping should have one exit path
Wei Liu [Mon, 4 Feb 2019 17:48:45 +0000 (17:48 +0000)]
x86/smpboot: clone_mapping should have one exit path

We will soon need to clean up page table mappings in the exit path.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/smpboot: add emacs block
Wei Liu [Mon, 4 Feb 2019 17:45:50 +0000 (17:45 +0000)]
x86/smpboot: add emacs block

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agoefi: switch EFI L4 table to use new APIs
Wei Liu [Mon, 4 Feb 2019 17:19:27 +0000 (17:19 +0000)]
efi: switch EFI L4 table to use new APIs

This requires storing the MFN instead of linear address of the L4
table. Adjust code accordingly.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agoefi: add emacs block to boot.c
Wei Liu [Mon, 4 Feb 2019 17:01:10 +0000 (17:01 +0000)]
efi: add emacs block to boot.c

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agoefi: use new page table APIs in efi_init_memory
Wei Liu [Mon, 4 Feb 2019 17:00:59 +0000 (17:00 +0000)]
efi: use new page table APIs in efi_init_memory

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agoefi: avoid using global variable in copy_mapping
Wei Liu [Mon, 4 Feb 2019 16:40:34 +0000 (16:40 +0000)]
efi: avoid using global variable in copy_mapping

We will soon switch efi_l4_table to use ephemeral mapping. Make
copy_mapping take a pointer to the mapping instead of using the global
variable.

No functional change intended.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agoefi: use new page table APIs in copy_mapping
Wei Liu [Mon, 4 Feb 2019 16:01:03 +0000 (16:01 +0000)]
efi: use new page table APIs in copy_mapping

After inspection ARM doesn't have alloc_xen_pagetable so this function
is x86 only, which means it is safe for us to change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
XXX test this in gitlab ci to be sure.

5 years agox86_64/mm: drop lXe_to_lYe invocations from setup_m2p_table
Wei Liu [Thu, 31 Jan 2019 19:04:23 +0000 (19:04 +0000)]
x86_64/mm: drop lXe_to_lYe invocations from setup_m2p_table

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86_64/mm: switch to new APIs in setup_m2p_table
Wei Liu [Thu, 31 Jan 2019 19:01:11 +0000 (19:01 +0000)]
x86_64/mm: switch to new APIs in setup_m2p_table

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86_64/mm: introduce pl2e in setup_m2p_table
Wei Liu [Thu, 31 Jan 2019 18:52:48 +0000 (18:52 +0000)]
x86_64/mm: introduce pl2e in setup_m2p_table

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86_64/mm.c: remove code that serves no purpose in setup_m2p_table
Wei Liu [Thu, 31 Jan 2019 18:49:36 +0000 (18:49 +0000)]
x86_64/mm.c: remove code that serves no purpose in setup_m2p_table

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86_64/mm: drop l4e_to_l3e invocation from paging_init
Wei Liu [Thu, 31 Jan 2019 18:31:04 +0000 (18:31 +0000)]
x86_64/mm: drop l4e_to_l3e invocation from paging_init

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86_64/mm: switch to new APIs in paging_init
Wei Liu [Tue, 29 Jan 2019 14:40:26 +0000 (14:40 +0000)]
x86_64/mm: switch to new APIs in paging_init

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyax@amazon.com>
---
Changed since v1:
- Use a global mapping for compat_idle_pg_table_l2, otherwise
  l2_ro_mpt will unmap it.

5 years agox86_64/mm: introduce pl2e in paging_init
Wei Liu [Thu, 31 Jan 2019 18:06:53 +0000 (18:06 +0000)]
x86_64/mm: introduce pl2e in paging_init

Introduce pl2e so that we can use l2_ro_mpt to point to the page table
itself.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/mm: switch to new APIs in arch_init_memory
Wei Liu [Tue, 29 Jan 2019 14:15:47 +0000 (14:15 +0000)]
x86/mm: switch to new APIs in arch_init_memory

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/mm: drop lXe_to_lYe invocations from modify_xen_mappings
Wei Liu [Fri, 1 Feb 2019 13:15:59 +0000 (13:15 +0000)]
x86/mm: drop lXe_to_lYe invocations from modify_xen_mappings

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/mm: switch to new APIs in modify_xen_mappings
Wei Liu [Tue, 29 Jan 2019 14:03:48 +0000 (14:03 +0000)]
x86/mm: switch to new APIs in modify_xen_mappings

Page tables allocated in that function should be mapped and unmapped
now.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyax@amazon.com>
---
Changed since v1:
- Remove redundant lines.

5 years agox86/mm: drop lXe_to_lYe invocations in map_pages_to_xen
Wei Liu [Fri, 1 Feb 2019 12:39:26 +0000 (12:39 +0000)]
x86/mm: drop lXe_to_lYe invocations in map_pages_to_xen

Map and unmap page tables where necessary.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyax@amazon.com>
---
Changed since v2:
- Fix a leak in mapping l2t.

5 years agox86/mm: switch to new APIs in map_pages_to_xen
Wei Liu [Tue, 29 Jan 2019 13:56:43 +0000 (13:56 +0000)]
x86/mm: switch to new APIs in map_pages_to_xen

Page tables allocated in that function should be mapped and unmapped
now.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyax@amazon.com>
---
Changed since v1:
- Remove redundant lines.

5 years agox86/mm: rewrite virt_to_xen_l*e
Wei Liu [Tue, 29 Jan 2019 12:42:23 +0000 (12:42 +0000)]
x86/mm: rewrite virt_to_xen_l*e

Rewrite that function to use the new APIs. Modify its callers to unmap
the pointer returned.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agox86/mm: change pl*e to l*t in virt_to_xen_l*e xen_pte_map-v3
Wei Liu [Tue, 29 Jan 2019 12:54:48 +0000 (12:54 +0000)]
x86/mm: change pl*e to l*t in virt_to_xen_l*e

We will need to have a variable named pl*e when we rewrite
virt_to_xen_l*e. Change pl*e to l*t to reflect better its purpose.
This will make reviewing later patch easier.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyax@amazon.com>
5 years agox86/mm: add an end_of_loop label in modify_xen_mappings
Wei Liu [Mon, 28 Jan 2019 18:45:06 +0000 (18:45 +0000)]
x86/mm: add an end_of_loop label in modify_xen_mappings

We will soon need to clean up mappings whenever the out most loop
is ended. Add a new label and turn relevant continue's into goto's.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/mm: make sure there is one exit path for modify_xen_mappings
Wei Liu [Mon, 28 Jan 2019 18:41:26 +0000 (18:41 +0000)]
x86/mm: make sure there is one exit path for modify_xen_mappings

We will soon need to handle dynamically mapping / unmapping page
tables in the said function.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/mm: add an end_of_loop label in map_pages_to_xen
Wei Liu [Mon, 28 Jan 2019 18:35:52 +0000 (18:35 +0000)]
x86/mm: add an end_of_loop label in map_pages_to_xen

We will soon need to clean up mappings whenever the out most loop is
ended. Add a new label and turn relevant continue's into goto's.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/mm: map_pages_to_xen should have one exit path
Wei Liu [Mon, 28 Jan 2019 18:30:47 +0000 (18:30 +0000)]
x86/mm: map_pages_to_xen should have one exit path

We will soon rewrite the function to handle dynamically mapping and
unmapping of page tables.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/mm: introduce l{1,2}t local variables to modify_xen_mappings
Wei Liu [Mon, 28 Jan 2019 18:10:10 +0000 (18:10 +0000)]
x86/mm: introduce l{1,2}t local variables to modify_xen_mappings

The pl2e and pl1e variables are heavily (ab)used in that function.  It
is fine at the moment because all page tables are always mapped so
there is no need to track the life time of each variable.

We will soon have the requirement to map and unmap page tables. We
need to track the life time of each variable to avoid leakage.

Introduce some l{1,2}t variables with limited scope so that we can
track life time of pointers to xen page tables more easily.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86/mm: introduce l{1,2}t local variables to map_pages_to_xen
Wei Liu [Mon, 28 Jan 2019 17:54:24 +0000 (17:54 +0000)]
x86/mm: introduce l{1,2}t local variables to map_pages_to_xen

The pl2e and pl1e variables are heavily (ab)used in that function. It
is fine at the moment because all page tables are always mapped so
there is no need to track the life time of each variable.

We will soon have the requirement to map and unmap page tables. We
need to track the life time of each variable to avoid leakage.

Introduce some l{1,2}t variables with limited scope so that we can
track life time of pointers to xen page tables more easily.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86: introduce a new set of APIs to manage Xen page tables
Wei Liu [Wed, 23 Jan 2019 15:33:07 +0000 (15:33 +0000)]
x86: introduce a new set of APIs to manage Xen page tables

We are going to switch to using domheap page for page tables.
A new set of APIs is introduced to allocate, map, unmap and free pages
for page tables.

The allocation and deallocation work on mfn_t but not page_info,
because they are required to work even before frame table is set up.

Implement the old functions with the new ones. We will rewrite, site
by site, other mm functions that manipulate page tables to use the new
APIs.

Note these new APIs still use xenheap page underneath and no actual
map and unmap is done so that we don't break xen half way. They will
be switched to use domheap and dynamic mappings when usage of old APIs
is eliminated.

No functional change intended in this patch.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agox86: move some xen mm function declarations
Wei Liu [Wed, 23 Jan 2019 15:17:41 +0000 (15:17 +0000)]
x86: move some xen mm function declarations

They were put into page.h but mm.h is more appropriate.

The real reason is that I will be adding some new functions which
takes mfn_t. It turns out it is a bit difficult to do in page.h.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
5 years agolibxl: wait for the ack when issuing power control requests
Roger Pau Monne [Tue, 1 Oct 2019 15:22:33 +0000 (17:22 +0200)]
libxl: wait for the ack when issuing power control requests

Currently only suspend power control requests wait for an ack from the
domain, while power off or reboot requests simply write the command to
xenstore and exit.

Introduce a 1 minute wait for the domain to acknowledge the request, or
else return an error. The suspend code is slightly modified to use the
new infrastructure added, but shouldn't have any functional change.

Fix the ocaml bindings and also provide a backwards compatible
interface for the reboot and poweroff libxl API functions.

Reported-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
[ wei: change ret to rc to fix build ]
Signed-off-by: Wei Liu <wl@xen.org>
5 years agotools/xen-cpuid: avoid producing bogus output
Jan Beulich [Wed, 2 Oct 2019 11:38:02 +0000 (13:38 +0200)]
tools/xen-cpuid: avoid producing bogus output

I was (mistakenly, as - looking at the code - it's clearly not intended
to work) passing the tool "Raw" and "Host" as command line arguments.
Avoid printing just "Raw       " with not even a newline at the end in
such a case. Instead report what wasn't understood by the parsing logic.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wl@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
5 years agoMAINTAINERS: add tools/misc/xen-cpuid to "X86 ARCHITECTURE"
Jan Beulich [Wed, 2 Oct 2019 11:37:43 +0000 (13:37 +0200)]
MAINTAINERS: add tools/misc/xen-cpuid to "X86 ARCHITECTURE"

Along the lines of other x86-specific pieces under tools/.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wl@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
5 years agoIOMMU: add missing HVM check
Jan Beulich [Wed, 2 Oct 2019 11:36:59 +0000 (13:36 +0200)]
IOMMU: add missing HVM check

Fix an unguarded d->arch.hvm access in assign_device().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
5 years agomicrocode: rendezvous CPUs in NMI handler and load ucode
Sergey Dyasli [Wed, 2 Oct 2019 11:35:44 +0000 (13:35 +0200)]
microcode: rendezvous CPUs in NMI handler and load ucode

When one core is loading ucode, handling NMI on sibling threads or
on other cores in the system might be problematic. By rendezvousing
all CPUs in NMI handler, it prevents NMI acceptance during ucode
loading.

Basically, some work previously done in stop_machine context is
moved to NMI handler. Primary threads call in and load ucode in
NMI handler. Secondary threads wait for the completion of ucode
loading on all CPU cores. An option is introduced to disable this
behavior.

Control thread doesn't rendezvous in NMI handler by calling self_nmi()
(in case of unknown_nmi_error() being triggered). The side effect is
control thread might be handling an NMI while other threads are loading
ucode. If an ucode is to update something shared by a whole socket,
control thread may be accessing things that are being updating by the
ucode loading on other cores. It is not safe. Update ucode on the
control thread first to mitigate this issue.

Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
Signed-off-by: Chao Gao <chao.gao@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
5 years agox86/crash: force unlock console before printing on kexec crash
Igor Druzhinin [Tue, 1 Oct 2019 19:15:57 +0000 (20:15 +0100)]
x86/crash: force unlock console before printing on kexec crash

There is a small window where shootdown NMI might come to a CPU
(e.g. in serial interrupt handler) where console lock is taken. In order
not to leave following console prints waiting infinitely for shot down
CPUs to free the lock - force unlock the console.

The race has been frequently observed while crashing nested Xen in
an HVM domain.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
5 years agoSUPPORT.md: Describe Renesas IPMMU-VMSA support (Arm)
Oleksandr Tyshchenko [Thu, 26 Sep 2019 14:22:02 +0000 (17:22 +0300)]
SUPPORT.md: Describe Renesas IPMMU-VMSA support (Arm)

Renesas IPMMU-VMSA support (Arm) can be considered
as Technological Preview feature.

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
5 years agoxen/arm: Implement workaround for Cortex A-57 and Cortex A72 AT speculate
Julien Grall [Tue, 24 Sep 2019 10:39:10 +0000 (11:39 +0100)]
xen/arm: Implement workaround for Cortex A-57 and Cortex A72 AT speculate

Both Cortex-A57 (erratum 1319537) and Cortex-A72 (erratum 1319367) can
end with corrupted TLBs if they speculate an AT instruction while S1/S2
system registers in inconsistent state.

The workaround is the same as for Cortex A-76 implemented by commit
a18be06aca "xen/arm: Implement workaround for Cortex-A76 erratum 1165522",
so it is only necessary to plumb in the cpuerrata framework.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
5 years agoxen/arm: domain_build: Don't continue if unable to allocate all dom0 banks
Julien Grall [Wed, 21 Aug 2019 21:42:31 +0000 (22:42 +0100)]
xen/arm: domain_build: Don't continue if unable to allocate all dom0 banks

Xen will only print a warning if there are memory unallocated when using
1:1 mapping (only used by dom0). This also includes the case where no
memory has been allocated.

It will bring to all sort of issues that can be hard to diagnostic for
users (the warning can be difficult to spot or disregard).

If the users request 1GB of memory, then most likely they want the exact
amount and not 512MB. So panic if all the memory has not been allocated.

After this change, the behavior is the same as for non-1:1 memory
allocation (used by domU).

At the same time, reflow the message to have the format on a single
line.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
5 years agoxen/arm: domain_build: Print the correct domain in initrd_load()
Julien Grall [Thu, 15 Aug 2019 17:30:42 +0000 (18:30 +0100)]
xen/arm: domain_build: Print the correct domain in initrd_load()

initrd_load() can be called by other domain than dom0. To avoid
confusion in the log, print the correct domain.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
5 years agoxen/arm: domain_build: Remove redundant check in make_vpl011_uart_node()
Julien Grall [Thu, 15 Aug 2019 19:46:24 +0000 (20:46 +0100)]
xen/arm: domain_build: Remove redundant check in make_vpl011_uart_node()

None of the code since the last check of res modify the value. So the
check can be removed.

Coverity-ID: 1476824
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
5 years agoxen/arm: domain_build: Print the correct domain in construct_domain()
Julien Grall [Thu, 15 Aug 2019 17:34:21 +0000 (18:34 +0100)]
xen/arm: domain_build: Print the correct domain in construct_domain()

construct_domain() can be called by other domain than dom0. To avoid
confusion in the log, print the correct domain.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
5 years agoxen/arm: p2m: Free the p2m entry after flushing the IOMMU TLBs
Julien Grall [Fri, 9 Aug 2019 12:59:15 +0000 (13:59 +0100)]
xen/arm: p2m: Free the p2m entry after flushing the IOMMU TLBs

When freeing a p2m entry, all the sub-tree behind it will also be freed.
This may include intermediate page-tables or any l3 entry requiring to
drop a reference (e.g for foreign pages). As soon as pages are freed,
they may be re-used by Xen or another domain. Therefore it is necessary
to flush *all* the TLBs beforehand.

While CPU TLBs will be flushed before freeing the pages, this is not
the case for IOMMU TLBs. This can be solved by moving the IOMMU TLBs
flush earlier in the code.

This wasn't considered as a security issue as device passthrough on Arm
is not security supported.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Tested-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Release-acked-by: Juergen Gross <jgross@suse.com>
5 years agoxen/arm: p2m: Fix typo in the comment on top of P2M_ROOT_LEVEL
Julien Grall [Sun, 29 Sep 2019 16:35:10 +0000 (17:35 +0100)]
xen/arm: p2m: Fix typo in the comment on top of P2M_ROOT_LEVEL

Signed-off-by: Julien Grall <julien.grall@arm.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
5 years agoxen/arm: domain_build: Avoid implicit conversion from ULL to UL
Julien Grall [Sun, 29 Sep 2019 15:56:26 +0000 (16:56 +0100)]
xen/arm: domain_build: Avoid implicit conversion from ULL to UL

Clang 8.0 will fail to build domain_build.c on Arm32 because of the
following error:

domain_build.c:448:21: error: implicit conversion from 'unsigned long long' to 'unsigned long' changes value from 1090921693184 to 0
[-Werror,-Wconstant-conversion]
    bank_size = MIN(GUEST_RAM1_SIZE, kinfo->unassigned_mem);

Arm32 is able to support more than 4GB of physical memory, so it would
be theorically possible to create domain with more the 4GB of RAM.
Therefore, the size of a bank may not fit in 32-bit.

This can be resolved by switch the variable bank_size and the parameter
tot_size to "paddr_t".

Signed-off-by: Julien Grall <julien.grall@arm.com>
Released-acked-by: Juergen Gross <jgross@suse.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
5 years agoxen/arm32: head: Fix build when using GAS 2.25.0
Julien Grall [Mon, 30 Sep 2019 18:44:25 +0000 (19:44 +0100)]
xen/arm32: head: Fix build when using GAS 2.25.0

GAS 2.25.0 throws multiple errors when building arm32/head.S:

arm32/head.S: Assembler messages:
arm32/head.S:452: Error: invalid constant (f7f) after fixup
arm32/head.S:453: Error: invalid constant (f7f) after fixup
arm32/head.S:495: Error: invalid constant (f7f) after fixup
arm32/head.S:510: Error: invalid constant (f7f) after fixup
arm32/head.S:514: Error: invalid constant (f7f) after fixup
arm32/head.S:516: Error: invalid constant (f7f) after fixup
arm32/head.S:633: Error: invalid constant (f7f) after fixup

This makes sense because the instruction mov is only able to deal with a
specific set of immediate (see "modified immediate constants in ARM
instructions"). For any 16-bit immediate, the instruction movw should be
used.

It looks like newer version of GAS will seemly switch to movw if the
immediate does not fit in the immediate encoding for mov. But we should
not rely on this. So switch to movw.

Fixes: 23dfe48d10 ("xen/arm32: head: Introduce macros to create table and mapping entry")
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Julien Grall <julien.grall@arm.com>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
5 years agoMAINTAINERS: Update e-mail address
Julien Grall [Mon, 30 Sep 2019 16:53:09 +0000 (17:53 +0100)]
MAINTAINERS: Update e-mail address

I will soon lose access to my Arm e-mail address. Update it to
julien@xen.org

Signed-off-by: Julien Grall <julien.grall@arm.com>
Cc: julien@xen.org
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
5 years agox86/iommu: fix hwdom iommu requirements check
Roger Pau Monné [Mon, 30 Sep 2019 13:46:57 +0000 (15:46 +0200)]
x86/iommu: fix hwdom iommu requirements check

Both a shadow and a HAP hwdom require an iommu and must be run in
strict mode. Change the HAP check into a hvm domain check.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
5 years agox86: correct bogus error indicator of cpu_add()
Jan Beulich [Mon, 30 Sep 2019 13:46:24 +0000 (15:46 +0200)]
x86: correct bogus error indicator of cpu_add()

Commit 54ce2db8b8 ("x86/numa: adjust datatypes for node and pxm")
changed this from the -1 (i.e. -EPERM, which was already bogus) that
comes back from setup_node() to NUMA_NO_NODE (0xff). Use a proper error
indicator instead.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
5 years agox86emul: move ARPL #UD check
Jan Beulich [Mon, 30 Sep 2019 13:45:16 +0000 (15:45 +0200)]
x86emul: move ARPL #UD check

The #UD for being outside of protected mode gets raised for ARPL only
after having read the memory operand - correct this by moving up the
respective construct.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
5 years agons16550: make PCI device hiding uniform
Jan Beulich [Tue, 3 Sep 2019 13:58:08 +0000 (15:58 +0200)]
ns16550: make PCI device hiding uniform

The difference between pci_hide_device() and pci_ro_device() is that
the former only prevents a device from getting assigned to a guest,
while the latter additionally arranges for Dom0 write attempts to the
device's config space to be ignored/discarded. Whether we want one or
the other certainly doesn't depend on whether the device is in our set
of known devices. All that matters is whether we use a PCI device: Call
pci_ro_device() in any such case.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Julien Grall <julien.grall@arm.com>
5 years agoxen/sched: move struct task_slice into struct sched_unit
Juergen Gross [Fri, 27 Sep 2019 07:00:31 +0000 (09:00 +0200)]
xen/sched: move struct task_slice into struct sched_unit

In order to prepare for multiple vcpus per schedule unit move struct
task_slice in schedule() from the local stack into struct sched_unit
of the currently running unit. To make access easier for the single
schedulers add the pointer of the currently running unit as a parameter
of do_schedule().

While at it switch the tasklet_work_scheduled parameter of
do_schedule() from bool_t to bool.

As struct task_slice is only ever modified with the local schedule
lock held it is safe to directly set the different units in struct
sched_unit instead of using an on-stack copy for returning the data.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen/sched: Change vcpu_migrate_*() to operate on schedule unit
Juergen Gross [Fri, 27 Sep 2019 07:00:30 +0000 (09:00 +0200)]
xen/sched: Change vcpu_migrate_*() to operate on schedule unit

vcpu_migrate_start() and vcpu_migrate_finish() are used only to ensure
a vcpu is running on a suitable processor, so they can be switched to
operate on schedule units instead of vcpus.

While doing that rename them accordingly.

Call vcpu_sync_execstate() for each vcpu of the unit when changing
processors in order to make that an explicit action (otherwise this
would happen later when either the vcpu is scheduled on the new
processor or another non-idle vcpu is scheduled on the old processor).

vcpu_move_locked() is switched to schedule unit, too.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen/sched: add runstate counters to struct sched_unit
Juergen Gross [Fri, 27 Sep 2019 07:00:29 +0000 (09:00 +0200)]
xen/sched: add runstate counters to struct sched_unit

Add counters to struct sched_unit summing up runstates of associated
vcpus. This allows doing quick checks whether a unit has any vcpu
running or whether only a single vcpu of a unit is running.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen: switch from for_each_vcpu() to for_each_sched_unit()
Juergen Gross [Fri, 27 Sep 2019 07:00:28 +0000 (09:00 +0200)]
xen: switch from for_each_vcpu() to for_each_sched_unit()

Where appropriate switch from for_each_vcpu() to for_each_sched_unit()
in order to prepare core scheduling.

As it is beneficial once here and for sure in future add a
unit_scheduler() helper and let vcpu_scheduler() use it.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
5 years agoxen/sched: switch sched_move_irqs() to take sched_unit as parameter
Juergen Gross [Fri, 27 Sep 2019 07:00:27 +0000 (09:00 +0200)]
xen/sched: switch sched_move_irqs() to take sched_unit as parameter

sched_move_irqs() should work on a sched_unit as that is the unit
moved between cpus.

Rename the current function to vcpu_move_irqs() as it is still needed
in schedule().

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen/sched: switch schedule() from vcpus to sched_units
Juergen Gross [Fri, 27 Sep 2019 07:00:26 +0000 (09:00 +0200)]
xen/sched: switch schedule() from vcpus to sched_units

Use sched_units instead of vcpus in schedule(). This includes the
introduction of sched_unit_runstate_change() as a replacement of
vcpu_runstate_change() in schedule().

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen/sched: use sched_resource cpu instead smp_processor_id in schedulers
Juergen Gross [Fri, 27 Sep 2019 07:00:25 +0000 (09:00 +0200)]
xen/sched: use sched_resource cpu instead smp_processor_id in schedulers

Especially in the do_schedule() functions of the different schedulers
using smp_processor_id() for the local cpu number is correct only if
the sched_unit is a single vcpu. As soon as larger sched_units are
used most uses should be replaced by the master_cpu number of the local
sched_resource instead.

Add a helper to get that sched_resource master_cpu and modify the
schedulers to use it in a correct way.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen: let vcpu_create() select processor
Juergen Gross [Fri, 27 Sep 2019 07:00:24 +0000 (09:00 +0200)]
xen: let vcpu_create() select processor

Today there are two distinct scenarios for vcpu_create(): either for
creation of idle-domain vcpus (vcpuid == processor) or for creation of
"normal" domain vcpus (including dom0), where the caller selects the
initial processor on a round-robin scheme of the allowed processors
(allowed being based on cpupool and affinities).

Instead of passing the initial processor to vcpu_create() and passing
on to sched_init_vcpu() let sched_init_vcpu() do the processor
selection. For supporting dom0 vcpu creation use the node_affinity of
the domain as a base for selecting the processors. User domains will
have initially all nodes set, so this is no different behavior compared
to today. In theory this is not guaranteed as vcpus are created only
with XEN_DOMCTL_max_vcpus being called, but this call is going to be
removed in future and the toolstack doesn't call
XEN_DOMCTL_setnodeaffinity before calling XEN_DOMCTL_max_vcpus.

To be able to use const struct domain * make cpupool_domain_cpumask()
take a const domain pointer, too.

A further simplification is possible by having a single function for
creating the dom0 vcpus with vcpu_id > 0 and doing the required pinning
for all vcpus after that. This allows to make sched_set_affinity()
private to schedule.c and switch it to sched_units easily. Note that
this functionality is x86 only.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com> [x86]
5 years agoxen: add sched_unit_pause_nosync() and sched_unit_unpause()
Juergen Gross [Fri, 27 Sep 2019 07:00:23 +0000 (09:00 +0200)]
xen: add sched_unit_pause_nosync() and sched_unit_unpause()

The credit scheduler calls vcpu_pause_nosync() and vcpu_unpause()
today. Add sched_unit_pause_nosync() and sched_unit_unpause() to
perform the same operations on scheduler units instead.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen/sched: make arinc653 scheduler vcpu agnostic.
Juergen Gross [Fri, 27 Sep 2019 07:00:22 +0000 (09:00 +0200)]
xen/sched: make arinc653 scheduler vcpu agnostic.

Switch arinc653 scheduler completely from vcpu to sched_unit usage.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen/sched: make credit2 scheduler vcpu agnostic.
Juergen Gross [Fri, 27 Sep 2019 07:00:21 +0000 (09:00 +0200)]
xen/sched: make credit2 scheduler vcpu agnostic.

Switch credit2 scheduler completely from vcpu to sched_unit usage.

As we are touching lots of lines remove some white space at the end of
the line, too.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen/sched: make credit scheduler vcpu agnostic.
Juergen Gross [Fri, 27 Sep 2019 07:00:20 +0000 (09:00 +0200)]
xen/sched: make credit scheduler vcpu agnostic.

Switch credit scheduler completely from vcpu to sched_unit usage.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen/sched: make rt scheduler vcpu agnostic.
Juergen Gross [Fri, 27 Sep 2019 07:00:19 +0000 (09:00 +0200)]
xen/sched: make rt scheduler vcpu agnostic.

Switch rt scheduler completely from vcpu to sched_unit usage.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen/sched: make null scheduler vcpu agnostic.
Juergen Gross [Fri, 27 Sep 2019 07:00:18 +0000 (09:00 +0200)]
xen/sched: make null scheduler vcpu agnostic.

Switch null scheduler completely from vcpu to sched_unit usage.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen/sched: add is_running indicator to struct sched_unit
Juergen Gross [Fri, 27 Sep 2019 07:00:17 +0000 (09:00 +0200)]
xen/sched: add is_running indicator to struct sched_unit

Add an is_running indicator to struct sched_unit which will be set
whenever the unit is being scheduled. Switch scheduler code to use
unit->is_running instead of vcpu->is_running for scheduling decisions.

At the same time introduce a state_entry_time field in struct
sched_unit being updated whenever the is_running indicator is changed.
Use that new field in the schedulers instead of the similar vcpu field.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen/sched: switch struct task_slice from vcpu to sched_unit
Juergen Gross [Fri, 27 Sep 2019 07:00:16 +0000 (09:00 +0200)]
xen/sched: switch struct task_slice from vcpu to sched_unit

Let the schedulers put a sched_unit pointer into struct task_slice
instead of a vcpu pointer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
5 years agoxen/sched: rename scheduler related perf counters
Juergen Gross [Fri, 27 Sep 2019 07:00:15 +0000 (09:00 +0200)]
xen/sched: rename scheduler related perf counters

Rename the scheduler related perf counters from vcpu* to unit* where
appropriate.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>