]> xenbits.xensource.com Git - xen.git/log
xen.git
8 years agoxen/arm64: Don't zero BSS when booting using EFI
Julien Grall [Wed, 8 Feb 2017 10:48:14 +0000 (10:48 +0000)]
xen/arm64: Don't zero BSS when booting using EFI

Commit 146786b "efi: create efi_enabled()" introduced a variable
efi_flags stored in BSS and used to pass information between the stub
and Xen. However on ARM, BSS is zeroed after the stub has finished to
run and before Xen is started. This means that the bits set in efi_flags
will be lost.

We were not affected before because all the variables used to pass
information between Xen and the stub are living in initdata or data.

Looking at the description of the field SizeOfRawData in the PE/COFF
header (see [1]):

"If this is less than VirtualSize, the remainder of the section is
zero-filled. Because the SizeOfRawData field is rounded but the
VirtualSize field is not, it is possible for SizeOfRawData to be greater
than VirtualSize as well. When a section contains only uninitialized
data, this field should be zero."

Both VirtualSize and SizeOfRawData are correctly set in the header (see
arch/arm/arm64/head.S) so the EFI firmware will zero BSS for us.

Therefore we don't need to zero BSS before running the EFI stub and can
skip the one between the EFI stub and Xen.

To avoid another branch instruction, slightly refactor the code. The
register x26 is allocated to hold whether BSS is skipped. The value will
be:
    - 0 when the code is running on CPU0 and EFI is not used
    - 1 when EFI is used or running on other processor than the boot one.

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/ms680547(v=vs.85).aspx

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
8 years agox86/p2m: Stop other vcpus using a nested p2m before clearing it
Andrew Cooper [Tue, 7 Feb 2017 14:01:29 +0000 (14:01 +0000)]
x86/p2m: Stop other vcpus using a nested p2m before clearing it

Until the IPI has completed, other processors might be running on this nested
p2m object.  clear_domain_page() does not guarantee to make 8-byte atomic
updates, which means that a pagewalk on a remote processor might encounter a
partial update.

This is currently safe as other issues prevents a nested p2m ever being shared
between two cpus (although this is contrary to the original plan).

Setting p2m->np2m_base to P2M_BASE_EADDR before the IPI ensures that the IPI'd
processors won't continue to use the flushed mappings.

While modifying this function, remove all the trailing whitespace and tweak
style in the affected areas.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86/time: Adjust init-time handling of pit0_ticks
Andrew Cooper [Wed, 7 Dec 2016 13:52:02 +0000 (13:52 +0000)]
x86/time: Adjust init-time handling of pit0_ticks

There is no need for the volatile cast in the timer interrupt; the compiler
may not elide the update.  This reduces the generated assembly from a read,
local modify, write to a single add instruction.

Drop the memory barriers from timer_irq_works(), as they are not needed.
pit0_ticks is only modified by timer_interrupt() running on the same CPU, so
all that is required is a volatile reference to prevent the compiler from
eliding the second read.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agolibxl: don't segfault when creating domain with invalid pvusb device
Juergen Gross [Wed, 8 Feb 2017 13:34:08 +0000 (14:34 +0100)]
libxl: don't segfault when creating domain with invalid pvusb device

Creating a domain with an invalid controller specification for a pvusb
device will currently segfault.

Avoid this by bailing out early in case of a mandatory xenstore path
not existing.

Signed-of-by: Juergen Gross <jgross@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
8 years agox86/vmx: Drop ept_get_*() helpers
Andrew Cooper [Mon, 30 Jan 2017 16:43:39 +0000 (16:43 +0000)]
x86/vmx: Drop ept_get_*() helpers

The ept_get_*() helpers are not used consistently, and are more verbose than
the code they wrap.  Drop the wrappers and use the internal union names
consistently.

While making these adjustments, drop the redundant ept_* prefix from mt, wl
and ad, and rename the asr field to mfn for consistency with Xen's existing
terminology.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
8 years agoxl: Make the devid attribute manually settable for nics
Fatih Acar [Thu, 2 Feb 2017 12:20:49 +0000 (13:20 +0100)]
xl: Make the devid attribute manually settable for nics

This permits to have control over the devid attribute when attaching new nics.
It may become useful if one has its own nic indexing somewhere else than xl/xenstore.

Signed-off-by: Fatih Acar <fatih.acar@gandi.net>
Signed-off-by: Nikita Kozlov <nikita.kozlov@gandi.net>
Signed-off-by: Vincent Legout <vincent.legout@gandi.net>
Signed-off-by: Baptiste Daroussin <baptiste.daroussin@gandi.net>
Acked-by: Wei Liu <wei.liu2@citrix.com>
8 years agofuzz/x86emul: remove bogus check against fuzzer msr index
Wei Liu [Tue, 7 Feb 2017 11:02:40 +0000 (11:02 +0000)]
fuzz/x86emul: remove bogus check against fuzzer msr index

The "reg" variable in fuzz_read_msr stores the real MSR index, not an
index within the fuzzer.

The rest of that function already handles things correctly. We just need
to remove the bogus check.

Spotted by Coverity.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agox86/time: correctly honor late clearing of TSC related feature flags
Jan Beulich [Tue, 7 Feb 2017 13:32:40 +0000 (14:32 +0100)]
x86/time: correctly honor late clearing of TSC related feature flags

As such clearing of flags may have an impact on the selected rendezvous
function, defer the establishing of a rendezvous function other than
the initial default one (std) until after all APs have been brought up.

But don't allow such feature flags to be cleared during CPU hotplug:
Platform and local system times may have diverged significantly by
then, potentially causing noticeably (even if only temporary) strange
behavior. As we're anyway expecting only sufficiently similar CPUs to
appear during hotplug, this shouldn't be introducing new limitations.

Reported-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agopage_alloc: clear nr_bootmem_regions in end_boot_allocator()
Jan Beulich [Tue, 7 Feb 2017 13:32:05 +0000 (14:32 +0100)]
page_alloc: clear nr_bootmem_regions in end_boot_allocator()

... to make alloc_boot_pages() fail for late callers. Don't rely on
reaching the BOOT_BUG_ON(1) near the end of that function though, but
instead make this situation easier to distinguish from actual
allocation failures by adding an explicit check.

While there, make the iteration variable unsigned and guard against
underflow.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoMerge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging
Jan Beulich [Tue, 7 Feb 2017 13:31:36 +0000 (14:31 +0100)]
Merge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging

8 years agoVT-d/RMRR: Adjust the return values of register_one_rmrr()
Venu Busireddy [Tue, 7 Feb 2017 13:31:03 +0000 (14:31 +0100)]
VT-d/RMRR: Adjust the return values of register_one_rmrr()

Adjust/manage the return values of register_one_rmrr() such that new
callers log errors for non-debug builds too, while not affecting the
behavior of the original callers.

Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
8 years agoxen/common: Replace __FUNCTION__ with __func__
Andrew Cooper [Fri, 3 Feb 2017 20:51:11 +0000 (20:51 +0000)]
xen/common: Replace __FUNCTION__ with __func__

__func__ is standard C99, whereas __FUNCTION__ is a GCCism.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
8 years agox86/ept: allow write-combining on !mfn_valid() MMIO mappings again
David Woodhouse [Tue, 7 Feb 2017 13:30:01 +0000 (14:30 +0100)]
x86/ept: allow write-combining on !mfn_valid() MMIO mappings again

For some MMIO regions, such as those high above RAM, mfn_valid() will
return false.

Since the fix for XSA-154 in commit c61a6f74f80e ("x86: enforce
consistent cachability of MMIO mappings"), guests have no longer been
able to use PAT to obtain write-combining on such regions because the
'ignore PAT' bit is set in EPT.

We probably want to err on the side of caution and preserve that
behaviour for addresses in mmio_ro_ranges, but not for normal MMIO
mappings. That necessitates a slight refactoring to check mfn_valid()
later, and let the MMIO case get through to the right code path.

Since we're not bailing out for !mfn_valid() immediately, the range
checks need to be adjusted to cope \97 simply by masking in the low bits
to account for 'order' instead of adding, to avoid overflow when the mfn
is INVALID_MFN (which happens on unmap, since we carefully call this
function to fill in the EMT even though the PTE won't be valid).

The range checks are also slightly refactored to put only one of them in
the fast path in the common case. If it doesn't overlap, then it
*definitely* isn't contained, so we don't need both checks. And if it
overlaps and is only one page, then it definitely *is* contained.

Finally, add a comment clarifying how that 'return -1' works \97 it isn't
returning an error and causing the mapping to fail; it relies on
resolve_misconfig() being able to split the mapping later. So it's
*only* sane to do it where order>0 and the 'problem' will be solved by
splitting the large page. Not for blindly returning 'error', which I was
tempted to do in my first attempt.

Signed-off-by: David Woodhouse <dwmw@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
8 years agoxenstore: remove XS_RESTRICT support
Juergen Gross [Fri, 27 Jan 2017 11:47:22 +0000 (12:47 +0100)]
xenstore: remove XS_RESTRICT support

XS_RESTRICT and the xenstore library function xs_restrict() have never
been usable in all configurations and there are no known users.

This functionality was thought to limit access rights of device models
to xenstore in order to avoid affecting other domains in case of a
security breech. Unfortunately XS_RESTRICT won't help as current
qemu is requiring access to dom0 only accessible xenstore paths to
work correctly. So this command is useless and should be removed.

In order to avoid problems in the future remove all support for
XS_RESTRICT from xenstore.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: David Scott <dave@recoil.org>
8 years agoxen/mm: Alter is_iomem_page() to use mfn_t
Andrew Cooper [Mon, 6 Feb 2017 13:54:03 +0000 (13:54 +0000)]
xen/mm: Alter is_iomem_page() to use mfn_t

Switch its return type to bool to match its use, and simplify the ARM
implementation slightly.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agofuzz: update README.afl example
Wei Liu [Wed, 25 Jan 2017 15:40:44 +0000 (15:40 +0000)]
fuzz: update README.afl example

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
8 years agofuzz/x86emul: print out minimal input size
Wei Liu [Wed, 25 Jan 2017 15:35:54 +0000 (15:35 +0000)]
fuzz/x86emul: print out minimal input size

... so that users can know how big the initial input should be.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agofuzz/x86emul: update fuzzer
Wei Liu [Wed, 25 Jan 2017 13:45:39 +0000 (13:45 +0000)]
fuzz/x86emul: update fuzzer

Provide the fuzzer with more ops, and more sophisticated input
structure.

Based on a patch originally written by Andrew and George.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86emul: use CR definitions in x86-defns.h
Wei Liu [Mon, 30 Jan 2017 15:20:08 +0000 (15:20 +0000)]
x86emul: use CR definitions in x86-defns.h

And remove the duplicates.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86: add UMIP CR4 bit
Wei Liu [Mon, 30 Jan 2017 15:17:40 +0000 (15:17 +0000)]
x86: add UMIP CR4 bit

It will be used later to remove duplicates in x86emul.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86emul: use msr definitions in msr-index.h
Wei Liu [Mon, 30 Jan 2017 15:02:40 +0000 (15:02 +0000)]
x86emul: use msr definitions in msr-index.h

Change the names used in code according to numeric values. Remove the
now unused macros in x86_emualte.c and fix indentation. This in turns
requires including msr-index.h  and removing duplicates in userspace
x86_emulate.c in userspace harness program.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86emul: use eflags definitions in x86-defns.h
Wei Liu [Mon, 30 Jan 2017 14:00:46 +0000 (14:00 +0000)]
x86emul: use eflags definitions in x86-defns.h

Basically this patch does 's/EFLG_/X86_EFLAGS_/g' and with indentation
fixed up. And remove the duplicates in x86_emualte.c.  This in turn
requires userspace test harness to include x86-defns.h. Also remove a
few duplicates in userspace harness program.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86emul/test: use x86-vendors.h
Wei Liu [Mon, 30 Jan 2017 12:55:45 +0000 (12:55 +0000)]
x86emul/test: use x86-vendors.h

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86: extract vendor numeric id to x86-vendors.h
Wei Liu [Mon, 30 Jan 2017 12:51:08 +0000 (12:51 +0000)]
x86: extract vendor numeric id to x86-vendors.h

They will be shared between xen and userspace programs.

This is not strictly necessary, but it helps reduce overall code size.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
8 years agox86: extract macros to x86-defns.h
Wei Liu [Mon, 23 Jan 2017 17:47:41 +0000 (17:47 +0000)]
x86: extract macros to x86-defns.h

... so that they can be used by userspace x86 instruction emulator test
program and fuzzer as well.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agofuzz/x86emul: use macro to reduce repetition in Makefile
Wei Liu [Fri, 3 Feb 2017 11:42:48 +0000 (11:42 +0000)]
fuzz/x86emul: use macro to reduce repetition in Makefile

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86emul/test: add missing dependency for x86_emulate.o
Wei Liu [Wed, 1 Feb 2017 11:49:41 +0000 (11:49 +0000)]
x86emul/test: add missing dependency for x86_emulate.o

f4497d6b74 added x86_emulate.h private header but didn't add dependency
for it.

Use macro to reduce repetition.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agoFix mispelling of length
Julien Grall [Thu, 2 Feb 2017 20:42:44 +0000 (20:42 +0000)]
Fix mispelling of length

There are quite a few usage of "lenght" instead of "length" in different
part of the repo. Correct it once for all.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
8 years agoxl: track size of diskws with a dedicated counter
Wei Liu [Thu, 2 Feb 2017 16:16:53 +0000 (16:16 +0000)]
xl: track size of diskws with a dedicated counter

The num_disks field can change during guest lifetime. Don't use that as
the size of diskws, use a dedicated counter instead.

Also free diskws and reset diskws to NULL after disabling events so that
it will be automatically re-created when the guest reboots.

Reported-by: Fatih Acar <fatih.acar@gandi.net>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: Fatih Acar <fatih.acar@gandi.net>
8 years agoxl: free event in DOMAIN_RESTART_RENAME error path
Wei Liu [Thu, 2 Feb 2017 15:30:32 +0000 (15:30 +0000)]
xl: free event in DOMAIN_RESTART_RENAME error path

Otherwise it is leaked. Found by code inspection.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agocompat.h: drop COMPAT_HANDLE_PARAM()
Jan Beulich [Thu, 2 Feb 2017 14:49:42 +0000 (15:49 +0100)]
compat.h: drop COMPAT_HANDLE_PARAM()

The need for 8844ed299a ("x86/dmop: Fix compat_dm_op() ABI") has made
clear that its presence is actively dangerous. At the hypercall entry
points XEN_GUEST_HANDLE_PARAM() should be used anyway (regardless of
whether these are native or compat entry points), and passing around
handles internally shouldn't use their compat representation either.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
8 years agoMerge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging
Jan Beulich [Thu, 2 Feb 2017 14:49:28 +0000 (15:49 +0100)]
Merge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging

8 years agox86: undo vm_init() movement from 1a6e3220cc
Jan Beulich [Thu, 2 Feb 2017 14:46:17 +0000 (15:46 +0100)]
x86: undo vm_init() movement from 1a6e3220cc

There must not be any alloc_xen_pagetable() calls between
end_boot_allocator() and the setting of SYS_STATE_boot.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
8 years agoxl: Fix assertion on domain reboot with new configuration
Fatih Acar [Mon, 30 Jan 2017 14:33:18 +0000 (15:33 +0100)]
xl: Fix assertion on domain reboot with new configuration

libxl_domain_build_info_dispose is not resetting the type field to LIBXL_DOMAIN_TYPE_INVALID.
Instead, it is memseting the struct to 0 thus when libxl_domain_build_info_init_type is called
after a dispose on the same struct, an assertion is triggered because type != LIBXL_DOMAIN_TYPE_INVALID.
Calling libxl_domain_build_info_init makes sure the type field is correctly initialized.

Signed-off-by: Fatih Acar <fatih.acar@gandi.net>
Signed-off-by: Nikita Kozlov <nikita.kozlov@gandi.net>
Signed-off-by: Vincent Legout <vincent.legout@gandi.net>
Signed-off-by: Baptiste Daroussin <baptiste.daroussin@gandi.net>
Acked-by: Wei Liu <wei.liu2@citrix.com>
8 years agolibs/gnttab: add FreeBSD handlers for the grant-table user-space device
Roger Pau Monne [Wed, 1 Feb 2017 17:44:55 +0000 (17:44 +0000)]
libs/gnttab: add FreeBSD handlers for the grant-table user-space device

This patch adds the headers and helpers for the FreeBSD gntdev, used in order
to map grants from remote domains and to allocate grants on behalf of the
current domain.

Current code has been tested with the QEMU/Qdisk backend.

Signed-off-by: Akshay Jaggi <akshay1994.leo@gmail.com>
[ added dummy stub for osdep_gnttab_grant_copy ]
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Move PAGE_* back to {linux,freebsd}.c due to breakage in stubdom build.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
8 years agoacpi: switch to dynamic mapping at SYS_STATE_boot
Boris Ostrovsky [Thu, 2 Feb 2017 11:51:39 +0000 (12:51 +0100)]
acpi: switch to dynamic mapping at SYS_STATE_boot

We can switch ACPI from using fixmap to dynamic mapping as soon as
the system enters SYS_STATE_boot. This will allow us, for example,
to map MADT on systems with large number of processors where the
table might not fit into NUM_FIXMAP_ACPI_PAGES (currently set to 4).

To avoid having a window between system entering SYS_STATE_boot and
vmap area being initialized move vm_init() a little higher.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86/HVM: make hvm_find_io_handler() static
Jan Beulich [Thu, 2 Feb 2017 11:50:35 +0000 (12:50 +0100)]
x86/HVM: make hvm_find_io_handler() static

This reduces the chance of misuse - calling it must in particular
always be accompanied by calling the corresponding ->complete() hook.
Constify its parameter at once.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
8 years agox86emul: correct behavior for single iteration REP INS/OUTS
Jan Beulich [Thu, 2 Feb 2017 11:48:59 +0000 (12:48 +0100)]
x86emul: correct behavior for single iteration REP INS/OUTS

The initial operation done on these paths may raise an exception (for
->read_io() that's possible only on the PV path, when the I/O port
access check has been deferred). We have to suppress put_rep_prefix()
updating rCX in that case. From an abstract perspective this also
applies to RETRY being returned.

Reported-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Tested-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agox86/dmop: Fix compat_dm_op() ABI
Andrew Cooper [Tue, 31 Jan 2017 19:15:17 +0000 (19:15 +0000)]
x86/dmop: Fix compat_dm_op() ABI

The parameter to compat_dm_op() is a pointer to an array of
compat_dm_op_buf_t's in guest RAM.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agoxen: credit2: non Credit2 pCPUs are ok during shutdown/suspend.
Dario Faggioli [Sat, 28 Jan 2017 01:42:22 +0000 (02:42 +0100)]
xen: credit2: non Credit2 pCPUs are ok during shutdown/suspend.

Commit 7478ebe1602e6 ("xen: credit2: fix shutdown/suspend
when playing with cpupools"), while doing the right thing
for actual code, forgot to update the ASSERT()s accordingly,
in csched2_vcpu_migrate().

In fact, as stated there already, during shutdown/suspend,
we must allow a Credit2 vCPU to temporarily migrate to a
non Credit2 BSP, without any ASSERT() triggering.

Move them down, after the check for whether or not we are
shutting down, where the assumption that the pCPU must be
valid Credit2 ones, is valid.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
8 years agoxen/tools: tracing: credits can go negative, so use int.
Dario Faggioli [Wed, 18 Jan 2017 11:32:21 +0000 (12:32 +0100)]
xen/tools: tracing: credits can go negative, so use int.

For Credit2, in both the trace records, inside Xen,
and in their parsing, in xenalyze.

In fact, as it is quite a bit better, in order to
understand how much negative credits have gone for
a certain vCPU, to see an actual negative number,
as compared to a wrapped around unsigned!

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
8 years agoxen: credit2: improve debug dump output.
Dario Faggioli [Wed, 18 Jan 2017 01:10:14 +0000 (02:10 +0100)]
xen: credit2: improve debug dump output.

Scheduling information debug dump for Credit2 is hard
to read as it contains the same information repeated
multiple time in different ways.

In fact, in Credit2, CPUs are grouped in runqueus. Before
this change, for each CPU, we were printing the while
content of the runqueue, as shown below:

 CPU[00]  sibling=000003, core=0000ff
    run: [32767.0] flags=0 cpu=0 credit=-1073741824 [w=0] load=0 (~0%)
      1: [0.0] flags=0 cpu=2 credit=3860932 [w=256] load=262144 (~100%)
      2: [0.1] flags=0 cpu=2 credit=3859906 [w=256] load=262144 (~100%)
 CPU[01]  sibling=000003, core=0000ff
    run: [32767.1] flags=0 cpu=1 credit=-1073741824 [w=0] load=0 (~0%)
      1: [0.0] flags=0 cpu=2 credit=2859840 [w=256] load=262144 (~100%)
      2: [0.3] flags=0 cpu=2 credit=-17466062 [w=256] load=262144 (~100%)
 CPU[02]  sibling=00000c, core=0000ff
    run: [0.0] flags=2 cpu=2 credit=1858628 [w=256] load=262144 (~100%)
      1: [0.3] flags=0 cpu=2 credit=-17466062 [w=256] load=262144 (~100%)
      2: [0.1] flags=0 cpu=2 credit=-23957055 [w=256] load=262144 (~100%)
 CPU[03]  sibling=00000c, core=0000ff
    run: [32767.3] flags=0 cpu=3 credit=-1073741824 [w=0] load=0 (~0%)
      1: [0.1] flags=0 cpu=2 credit=-3957055 [w=256] load=262144 (~100%)
      2: [0.0] flags=0 cpu=2 credit=-6216254 [w=256] load=262144 (~100%)
 CPU[04]  sibling=000030, core=0000ff
    run: [32767.4] flags=0 cpu=4 credit=-1073741824 [w=0] load=0 (~0%)
      1: [0.1] flags=0 cpu=2 credit=3782667 [w=256] load=262144 (~100%)
      2: [0.3] flags=0 cpu=2 credit=-16287483 [w=256] load=262144 (~100%)

As it can be seen, all the CPUs print the whole content
of the runqueue they belong to, at the time of their
sampling, and this is cumbersome and hard to interpret!

In new output format we print, for each CPU, only the vCPU
that is running there (if that's not the idle vCPU, in which
case, nothing is printed), while the runqueues content
is printed only once, in a dedicated section.

An example:

 CPUs info:
 CPU[02]  runq=0, sibling=00000c, core=0000ff
    run: [0.3] flags=2 cpu=2 credit=8054391 [w=256] load=262144 (~100%)
 CPU[14]  runq=1, sibling=00c000, core=00ff00
    run: [0.4] flags=2 cpu=14 credit=8771420 [w=256] load=262144 (~100%)
 ... ... ... ... ... ... ... ... ...
 Runqueue info:
 runqueue 0:
      0: [0.1] flags=0 cpu=2 credit=7869771 [w=256] load=262144 (~100%)
      1: [0.0] flags=0 cpu=2 credit=7709649 [w=256] load=262144 (~100%)
 runqueue 1:
      0: [0.5] flags=0 cpu=14 credit=-1188 [w=256] load=262144 (~100%)

Note that there still is risk of inconsistency between
what is printed in the 'Runqueue info:' and in 'CPUs info:'
sections. That is unavoidable, as the relevant locks are
released and re-acquired, around each single operation.

At least, the inconsistency is less severe than before.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
8 years agofuzz: don't buffer stdout in afl stubs
Wei Liu [Tue, 31 Jan 2017 11:07:58 +0000 (11:07 +0000)]
fuzz: don't buffer stdout in afl stubs

... to avoid obscuring output.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agoxen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c
Edgar E. Iglesias [Thu, 26 Jan 2017 13:16:02 +0000 (14:16 +0100)]
xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c

Since the hardware domain is a trusted domain, we extend the
trust to include making final decisions on what attributes to
use when mapping memory regions.

For ACPI configured hardware domains, this patch relaxes the hardware
domains mapping attributes to p2m_mmio_direct_c. This will allow the
hardware domain to control the attributes via its S1 mappings.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
8 years agoRevert "xen/arm: Map mmio-sram nodes as un-cached memory"
Edgar E. Iglesias [Thu, 26 Jan 2017 13:16:01 +0000 (14:16 +0100)]
Revert "xen/arm: Map mmio-sram nodes as un-cached memory"

This reverts commit 1e75ed8b64bc1a9b47e540e6f100f17ec6d97f1b.

The default attribute mapping for MMIO as been relaxed and now rely on
the hardware domain to set the correct memory attribute

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
8 years agoxen/arm: dt: Relax hw domain mapping attributes to p2m_mmio_direct_c
Edgar E. Iglesias [Thu, 26 Jan 2017 13:16:00 +0000 (14:16 +0100)]
xen/arm: dt: Relax hw domain mapping attributes to p2m_mmio_direct_c

Since the hardware domain is a trusted domain, we extend the
trust to include making final decisions on what attributes to
use when mapping memory regions.

For device-tree configured hardware domains, this patch relaxes
the hardware domains mapping attributes to p2m_mmio_direct_c.
This will allow the hardware domain to control the attributes
via its S1 mappings.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
8 years agoxen/arm: flush icache as well when XEN_DOMCTL_cacheflush is issued
Tamas K Lengyel [Fri, 27 Jan 2017 18:25:23 +0000 (11:25 -0700)]
xen/arm: flush icache as well when XEN_DOMCTL_cacheflush is issued

When the toolstack modifies memory of a running ARM VM it may happen
that the underlying memory of a current vCPU PC is changed. Without
flushing the icache the vCPU may continue executing stale instructions.

Also expose the xc_domain_cacheflush through xenctrl.h.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
8 years agop2m: split mem_access into separate files
Tamas K Lengyel [Fri, 9 Dec 2016 19:59:25 +0000 (12:59 -0700)]
p2m: split mem_access into separate files

This patch relocates mem_access components that are currently mixed with p2m
code into separate files. This better aligns the code with similar subsystems,
such as mem_sharing and mem_paging, which are already in separate files. There
are no code-changes introduced, the patch is mechanical code movement.

On ARM we also relocate the static inline gfn_next_boundary function to p2m.h
as it is a function the mem_access code needs access to.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
8 years agoarm/mem_access: adjust check_and_get_page to not rely on current
Tamas K Lengyel [Fri, 9 Dec 2016 19:59:24 +0000 (12:59 -0700)]
arm/mem_access: adjust check_and_get_page to not rely on current

The only caller of this function is get_page_from_gva which already takes
a vcpu pointer as input. Pass this along to make the function in-line with
its intended use-case.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
8 years agoxsm: Permit dom0 to use dmops
Andrew Cooper [Fri, 27 Jan 2017 14:16:58 +0000 (14:16 +0000)]
xsm: Permit dom0 to use dmops

c/s 524a98c2ac5 "public / x86: introduce __HYPERCALL_dm_op" gave flask
permisisons for a stubdomain to use dmops, but omitted the case of a device
model running in dom0.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Tested-by: Paul Durrant <paul.durrant@citrix.com>
8 years agoVT-d/RMRR: Avoid memory corruption in add_user_rmrr()
Andrew Cooper [Mon, 30 Jan 2017 10:09:06 +0000 (10:09 +0000)]
VT-d/RMRR: Avoid memory corruption in add_user_rmrr()

register_one_rmrr() already frees its parameter if errors are encountered.

Introduced by c/s 431685e8de and spotted by Coverity.

Coverity-ID: 1399607
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agotools/libxc: Fix missing va_end() in do_dm_op() error path
Andrew Cooper [Mon, 30 Jan 2017 10:08:50 +0000 (10:08 +0000)]
tools/libxc: Fix missing va_end() in do_dm_op() error path

The fail3 error path skips the va_end() call, which typically leaks memory for
64bit x86 code.

Introduced by c/s 524a98c2ac5, spotted by Coverity.

Coverity-ID: 1399608
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
8 years agodocs: clarify xl mem-max semantics
Juergen Gross [Fri, 27 Jan 2017 11:45:18 +0000 (12:45 +0100)]
docs: clarify xl mem-max semantics

The information given in the xl man page for the mem-max command is
rather brief. Expand it in order to let the reader understand what it
is really doing.

As the related libxl function libxl_domain_setmaxmem() isn't much
clearer add a comment to it explaining the desired semantics.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
8 years agoarm/p2m: Fix regression during domain shutdown with active mem_access
Tamas K Lengyel [Wed, 25 Jan 2017 16:12:01 +0000 (09:12 -0700)]
arm/p2m: Fix regression during domain shutdown with active mem_access

The change in commit 438c5fe4f0c introduced a regression for domains where
mem_acces is or was active. When relinquish_p2m_mapping attempts to clear
a page where the order is not 0 the following ASSERT is triggered:

    ASSERT(!p2m->mem_access_enabled || page_order == 0);

This regression was unfortunately not caught during testing in preparation
for the 4.8 release.

In this patch we adjust the ASSERT to not trip when the domain
is being shutdown.

Ideally this fix would be part of Xen 4.8.1.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
Acked-by: Julien Grall <julien.grall@arm.com>
8 years agox86/dmar: place the initdata annotation after the variable type
Roger Pau Monne [Thu, 26 Jan 2017 16:18:10 +0000 (16:18 +0000)]
x86/dmar: place the initdata annotation after the variable type

clang cannot cope with the annotation being in the middle of the variable
declaration.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agoflask: fix build after the introduction of DMOP
Wei Liu [Wed, 25 Jan 2017 10:43:11 +0000 (10:43 +0000)]
flask: fix build after the introduction of DMOP

In 58cbc034 send_irq permission was removed but there was still
reference to it in policy file. Remove the stale reference.

And now we also need dm permission. Add that.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
xsm/build: Further build fixes following the DMop series

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agofuzz/libelf: exit with fuzzer function return value
Wei Liu [Wed, 25 Jan 2017 11:14:43 +0000 (11:14 +0000)]
fuzz/libelf: exit with fuzzer function return value

Now the function can return nonzero value. Use that value as exit code
for the stub program. AFL might be able to use such information to
optimise fuzzing process.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
8 years agofuzz/libelf: return early if elf_init fails
Wei Liu [Wed, 25 Jan 2017 11:14:42 +0000 (11:14 +0000)]
fuzz/libelf: return early if elf_init fails

Coverity-ID: 1399557

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
8 years agodocs/misc: update the meaning of the 'disk unplug' flag
Paul Durrant [Wed, 25 Jan 2017 10:42:55 +0000 (10:42 +0000)]
docs/misc: update the meaning of the 'disk unplug' flag

The documentation states that a value of '1' will cause unplug of
emulated IDE disks. This is not quite correct, as QEMU will also unplug
emulated SCSI disks at the same time.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
8 years agoMoving ept code to ept specific files.
Paul Lai [Thu, 10 Nov 2016 23:45:52 +0000 (15:45 -0800)]
Moving ept code to ept specific files.

Renamed p2m_init_altp2m_helper() to p2m_init_altp2m_ept().

Signed-off-by: Paul Lai <paul.c.lai@intel.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
8 years agoinclude: speed up compat header generation
Jan Beulich [Wed, 25 Jan 2017 14:10:21 +0000 (15:10 +0100)]
include: speed up compat header generation

Recent additions to xlat.lst have apparently resulted in Python's
garbage collection getting in the way: I would guess that so far it
managed to re-use previously compiled regular expressions, but with the
higher number of them now can't anymore (at least with default
settings). Do the compilation explicitly. While at it, combine the two
lists, and avoid using re.subn() when re.sub() suffices.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agox86/emulate: don't assume that addr_size == 32 implies protected mode
George Dunlap [Wed, 25 Jan 2017 14:09:55 +0000 (15:09 +0100)]
x86/emulate: don't assume that addr_size == 32 implies protected mode

Callers of x86_emulate() generally define addr_size based on the code
segment.  In vm86 mode, the code segment is set by the hardware to be
16-bits; but it is entirely possible to enable protected mode, set the
CS to 32-bits, and then disable protected mode.  (This is commonly
called "unreal mode".)

But the instruction decoder only checks for protected mode when
addr_size == 16.  So in unreal mode, hardware will throw a #UD for VEX
prefixes, but our instruction decoder will decode them, triggering an
ASSERT() further on in _get_fpu().  (With debug=n the emulator will
incorrectly emulate the instruction rather than throwing a #UD, but
this is only a bug, not a crash, so it's not a security issue.)

Teach the instruction decoder to check that we're in protected mode,
even if addr_size is 32.

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Split real mode and VM86 mode handling, as VM86 mode is strictly 16-bit
at all times. Re-base.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agox86emul: correct VEX/XOP/EVEX operand size handling for 16-bit code
Jan Beulich [Wed, 25 Jan 2017 14:08:59 +0000 (15:08 +0100)]
x86emul: correct VEX/XOP/EVEX operand size handling for 16-bit code

Operand size defaults to 32 bits in that case, but would not have been
set that way in the absence of an operand size override.

Reported-by: Wei Liu <wei.liu2@citrix.com> (by AFL fuzzing)
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agox86/cpuid: Remove the legacy path handling extd leaves
Andrew Cooper [Fri, 20 Jan 2017 13:58:44 +0000 (13:58 +0000)]
x86/cpuid: Remove the legacy path handling extd leaves

All leaves in the extd union are handled in guest_cpuid() now, so remove
legacy handling.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86/cpuid: Handle leaf 0x8000001c in guest_cpuid()
Andrew Cooper [Fri, 20 Jan 2017 13:56:10 +0000 (13:56 +0000)]
x86/cpuid: Handle leaf 0x8000001c in guest_cpuid()

Leaf 0x8000001c contains LWP information.  edx contains hardware supported
features (and is clamped against the maximum), while ecx and ebx contain
various properties of the implementation.  eax is entirely dynamic, depending
on xcr0 and MSR_LWP_CFG.

The call to guest_cpuid() in svm_update_lwp_cfg() can now be replaced by
reading the data straight out of the cpuid_policy block.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86/cpufeatures: Hide Instruction Based Sampling from guests
Andrew Cooper [Fri, 20 Jan 2017 14:48:57 +0000 (14:48 +0000)]
x86/cpufeatures: Hide Instruction Based Sampling from guests

Xen advertises the IBS feature flag to guests on capable AMD hardware.
However, the PV path in Xen, and both the PV and HVM paths in libxc
deliberately clobber the IBS CPUID leaf.

Furthermore, Xen has nothing providing an implementation of the IBS MSRs, so
guests can't actually use the feature at all.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86/cpuid: Handle leaves 0x8000000b-1a in guest_cpuid()
Andrew Cooper [Fri, 20 Jan 2017 13:36:36 +0000 (13:36 +0000)]
x86/cpuid: Handle leaves 0x8000000b-1a in guest_cpuid()

Leaves 8000000b-18 are reserved.  Leaf 80000019 is 1G TLB information and leaf
0x8000001a is performance hints.  These leaves have previously been hidden
from guests, but are perfectly safe to expose when appicable.

Update libxc to also expose these leaves.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86/cpuid: Handle leaf 0x8000000a in guest_cpuid()
Andrew Cooper [Sun, 22 Jan 2017 17:50:12 +0000 (17:50 +0000)]
x86/cpuid: Handle leaf 0x8000000a in guest_cpuid()

Leaf 0x8000000a contains SVM information.  The feature choices are borrowed
straight from the libxc policy code.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agox86/cpuid: Handle leaf 0x80000009 in guest_cpuid()
Andrew Cooper [Fri, 20 Jan 2017 13:41:47 +0000 (13:41 +0000)]
x86/cpuid: Handle leaf 0x80000009 in guest_cpuid()

Leaf 0x80000009 is reserved.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86/cpuid: Handle leaf 0x80000008 in guest_cpuid()
Andrew Cooper [Fri, 20 Jan 2017 13:00:32 +0000 (13:00 +0000)]
x86/cpuid: Handle leaf 0x80000008 in guest_cpuid()

The entirety of edx is reserved.

Intel only defines the lower 16 bits of eax, although ebx is covered by the
featureset ABI, so left unclobbered.

AMD uses 24 bits in eax, although nothing thus far has ever exposed a non-zero
guest maxphysaddr to HVM guests.  Its semantics are not clearly expressed, so
it is explicitly clobbered.  ecx contains some reserved bits, and several
pieces of static topology information, which are left as the toolstack
chooses.

A side effect of the common recalculation of maxlinaddr is that 32bit PV
guests see a maximum linear address of 32, which is consistent with the hiding
of other long mode information from them.

Finally, the call to guest_cpuid() in mtrr_var_range_msr_set() (introduced in
c/s fff8160a) can be dropped, now that maxphysaddr can be read straight out of
the cpuid_policy block.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86/cpuid: Handle leaves 0x80000005-7 in guest_cpuid()
Andrew Cooper [Fri, 20 Jan 2017 15:35:08 +0000 (15:35 +0000)]
x86/cpuid: Handle leaves 0x80000005-7 in guest_cpuid()

Leaf 0x80000005 contains L1 cache/TLB information, 0x80000006 L2 & L3
cache/TLB information, and 0x80000007 Power management information.

Intel reserves all of this information other than the L2 cache information,
and the ITSC bit from the power management leaf.

AMD passes all of the cache/TLB information through to the guest, while most
of of the power management information is explicitly clobbered by the
toolstack.

0x80000007 edx (containing ITSC) is covered by the featureset logic.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86/cpuid: Handle the long vendor string in guest_cpuid()
Andrew Cooper [Wed, 18 Jan 2017 18:13:17 +0000 (18:13 +0000)]
x86/cpuid: Handle the long vendor string in guest_cpuid()

Leaves 0x80000002 through 0x80000004 are plain ASCII text, and are left
exactly as the toolstack chooses.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86/cpuid: Handle leaf 0x80000001 in guest_cpuid()
Andrew Cooper [Fri, 20 Jan 2017 14:47:34 +0000 (14:47 +0000)]
x86/cpuid: Handle leaf 0x80000001 in guest_cpuid()

Intel reserve eax and ebx, while AMD duplicates eax from the low
family/model/stepping leaf.  For AMD, ebx contains further brand/package
information which is left as the toolstack chooses (other than bits 27:16
which are reserved).

While moving the dynamic adjustments from the legacy path, simplify the shadow
PSE36 adjustment.  PAE paging is a prerequisite for enabling long mode, making
the long mode check redundant; the case where it doesn't get short circuited
is the case where it is architecturally 0.  Make the same adjustment to the
leaf 1 legacy path.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86/cpuid: Handle more simple Intel leaves in guest_cpuid()
Andrew Cooper [Tue, 17 Jan 2017 17:32:50 +0000 (17:32 +0000)]
x86/cpuid: Handle more simple Intel leaves in guest_cpuid()

Intel now document leaf 2 as a plain leaf, with %al always containing the
value 0x01.  Collect this leaf normally in calculate_raw_policy() and expose
it to guests.  The leaf is reserved by AMD.

Intel leaves 3 and 9 (PSN and DCA respectively) are not exposed to guests at
all.  They are reserved by AMD.

Leaves 8 and 0xc are reserved by both vendors.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86/cpuid: Only recalculate the shared feature bits once
Andrew Cooper [Tue, 17 Jan 2017 17:08:04 +0000 (17:08 +0000)]
x86/cpuid: Only recalculate the shared feature bits once

With accurate vendor information available, the shared bits can be sorted out
during recalculation, rather than at query time in the legacy cpuid path.

This means that:
 * Duplication can be dropped from the automatically generated cpuid data.
 * The toolstack need not worry about setting them appropriately.
 * They can be dropped from the system maximum featuresets.

While editing gen-cpuid.py, reflow some comments which exceeded the expected
line length.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agox86/cpuid: Handle leaf 0x80000000 in guest_cpuid()
Andrew Cooper [Tue, 17 Jan 2017 16:52:14 +0000 (16:52 +0000)]
x86/cpuid: Handle leaf 0x80000000 in guest_cpuid()

The calculations for p->extd.max_leaf are reworked to force a value of at
least 0x80000000, and to take the domains chosen vendor into account when
clamping maximum value.

The high short vendor information is clobbered or duplicated according to the
chosen vendor.

As a side effect of handing out an audited max_leaf value, the 0x8000001e case
can be dropped from pv_cpuid(), as it outside of the visible range.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
Reviewed-by: Jan Beulich <JBeulich@suse.com>
8 years agox86/cpufeatures: Expose self-snoop to all guests
Andrew Cooper [Thu, 19 Jan 2017 10:26:14 +0000 (10:26 +0000)]
x86/cpufeatures: Expose self-snoop to all guests

Self-snoop describes a property of the CPU cache behaviour, which FreeBSD uses
to optimise its cache flushing algorithm.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Roger Pau Monné <roger.pau@citrix.com>
8 years agotools/fuzz: add README.afl
Wei Liu [Fri, 20 Jan 2017 11:21:40 +0000 (11:21 +0000)]
tools/fuzz: add README.afl

And rename README to README.oss-fuzz.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agotools/fuzz: add AFL stub program for libefl fuzzer
Wei Liu [Fri, 20 Jan 2017 11:57:58 +0000 (11:57 +0000)]
tools/fuzz: add AFL stub program for libefl fuzzer

And hook it up into build system.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agotools/fuzz: add AFL stub program for x86 insn emulator fuzzer
Wei Liu [Fri, 20 Jan 2017 11:17:29 +0000 (11:17 +0000)]
tools/fuzz: add AFL stub program for x86 insn emulator fuzzer

This is a basic program to call into the unified fuzzing function.

Hook it up into build system so that we can always build test it.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agotools/fuzz: add missing dependencies in x86 insn fuzzer build rule
Wei Liu [Fri, 20 Jan 2017 11:39:41 +0000 (11:39 +0000)]
tools/fuzz: add missing dependencies in x86 insn fuzzer build rule

The said file needs the two header files.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agocredit2: performance counter for load balancing call
Praveen Kumar [Wed, 25 Jan 2017 09:51:47 +0000 (10:51 +0100)]
credit2: performance counter for load balancing call

The patch introduces a new performance counter that counts how many times we go
through the load balancing logic in Credit2.

Signed-off-by: Praveen Kumar <kpraveen.lkml@gmail.com>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
8 years agox86/hvm: serialize trap injecting producer and consumer
Jan Beulich [Wed, 25 Jan 2017 09:51:10 +0000 (10:51 +0100)]
x86/hvm: serialize trap injecting producer and consumer

Since injection works on a remote vCPU, and since there's no
enforcement of the subject vCPU being paused, there's a potential race
between the producing and consuming sides. Fix this by leveraging the
vector field as synchronization variable.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
[re-based]
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agodm_op: convert HVMOP_inject_trap and HVMOP_inject_msi
Paul Durrant [Wed, 25 Jan 2017 09:49:52 +0000 (10:49 +0100)]
dm_op: convert HVMOP_inject_trap and HVMOP_inject_msi

NOTE: This patch also modifies the types of the 'vector', 'type' and
      'insn_len' arguments of xc_hvm_inject_trap() from uint32_t to
      uint8_t. In practice the values passed were always truncated to
      8 bits.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agodm_op: convert HVMOP_set_mem_type
Paul Durrant [Wed, 25 Jan 2017 09:48:25 +0000 (10:48 +0100)]
dm_op: convert HVMOP_set_mem_type

This patch removes the need for handling HVMOP restarts, so that
infrastructure is removed.

NOTE: This patch also modifies the type of the 'nr' argument of
      xc_hvm_set_mem_type() from uint64_t to uint32_t. In practice the
      value passed was always truncated to 32 bits.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agodm_op: convert HVMOP_modified_memory
Paul Durrant [Wed, 25 Jan 2017 09:47:13 +0000 (10:47 +0100)]
dm_op: convert HVMOP_modified_memory

This patch introduces code to handle DMOP continuations.

NOTE: This patch also modifies the type of the 'nr' argument of
      xc_hvm_modified_memory() from uint64_t to uint32_t. In practice the
      value passed was always truncated to 32 bits.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agodm_op: convert HVMOP_set_pci_intx_level, HVMOP_set_isa_irq_level, and...
Paul Durrant [Wed, 25 Jan 2017 09:44:50 +0000 (10:44 +0100)]
dm_op: convert HVMOP_set_pci_intx_level, HVMOP_set_isa_irq_level, and...

... HVMOP_set_pci_link_route

These HVMOPs were exposed to guests so their definitions need to be
preserved for compatibility. This patch therefore updates
__XEN_LATEST_INTERFACE_VERSION__ to 0x00040900 and makes the HVMOP
defintions conditional on __XEN_INTERFACE_VERSION__ less than that value.

NOTE: This patch also widens the 'domain' parameter of
      xc_hvm_set_pci_intx_level() from a uint8_t to a uint16_t.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agodm_op: convert HVMOP_track_dirty_vram
Paul Durrant [Wed, 25 Jan 2017 09:43:14 +0000 (10:43 +0100)]
dm_op: convert HVMOP_track_dirty_vram

The handle type passed to the underlying shadow and hap functions is
changed for compatibility with the new hypercall buffer.

NOTE: This patch also modifies the type of the 'nr' parameter of
      xc_hvm_track_dirty_vram() from uint64_t to uint32_t. In practice
      the value passed was always truncated to 32 bits.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agodm_op: convert HVMOP_*ioreq_server*
Paul Durrant [Wed, 25 Jan 2017 09:41:35 +0000 (10:41 +0100)]
dm_op: convert HVMOP_*ioreq_server*

The definitions of HVM_IOREQSRV_BUFIOREQ_* have to persist as they are
already in use by callers of the libxc interface.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agopublic / x86: introduce __HYPERCALL_dm_op...
Paul Durrant [Wed, 25 Jan 2017 09:40:51 +0000 (10:40 +0100)]
public / x86: introduce __HYPERCALL_dm_op...

...as a set of hypercalls to be used by a device model.

As stated in the new docs/designs/dm_op.markdown:

"The aim of DMOP is to prevent a compromised device model from
compromising domains other then the one it is associated with. (And is
therefore likely already compromised)."

See that file for further information.

This patch simply adds the boilerplate for the hypercall.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Suggested-by: Ian Jackson <ian.jackson@citrix.com>
Suggested-by: Jennifer Herbert <jennifer.herbert@citrix.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agoVT-d: add command line option for extra rmrrs
Elena Ufimtseva [Wed, 25 Jan 2017 09:38:05 +0000 (10:38 +0100)]
VT-d: add command line option for extra rmrrs

On some platforms firmware fails to specify RMRR regions in ACPI tables and
thus those regions will not be mapped in dom0 or guests and may cause IO
Page Faults and prevent dom0 from booting if "iommu=dom0-strict" option is
specified on the Xen command line.

New Xen command line option rmrr allows to specify such devices and
memory regions. These regions are added to the list of RMRR defined in ACPI
if the device is present in system. As a result, additional RMRRs will be
mapped 1:1 in dom0 with correct permissions.

The above mentioned problems were discovered during the PVH work with
ThinkCentre M and Dell 5600T. No official documentation was found so far
in regards to what devices and why cause this. Experiments show that
ThinkCentre M USB devices with enabled debug port generate DMA read
transactions to the regions of memory marked reserved in host e820 map.

For Dell 5600T the device and faulting addresses are not found yet.
For detailed history of the discussion please check following threads:
    http://lists.Xen.org/archives/html/xen-devel/2015-02/msg01724.html
    http://lists.Xen.org/archives/html/xen-devel/2015-01/msg02513.html

Format for rmrr Xen command line option:
    rmrr=start<-end>=[s1]bdf1[,[s1]bdf2[,...]];start<-end>=[s2]bdf1[,[s2]bdf2[,...]]
    For example, for Lenovo ThinkCentre M, use:
        rmrr=0xd5d45=0:0:1d.0;0xd5d46=0:0:1a.0
    If grub2 used and multiple ranges are specified, ';' should be
    quoted/escaped, refer to grub2 manual for more information.

Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agopci: add wrapper for parse_pci
Elena Ufimtseva [Wed, 25 Jan 2017 09:37:43 +0000 (10:37 +0100)]
pci: add wrapper for parse_pci

For sbdf's parsing in RMRR command line, add parse_pci_seg with additional
parameter def_seg. parse_pci_seg will help to identify if segment was
found in string being parsed or default segment was used.
Make a wrapper parse_pci so the rest of the callers are not affected.

Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
8 years agoVT-d: separate rmrr addition function
Elena Ufimtseva [Wed, 25 Jan 2017 09:37:14 +0000 (10:37 +0100)]
VT-d: separate rmrr addition function

In preparation for auxiliary RMRR data provided on Xen command line,
make RMRR adding a separate function.
Also free memery for rmrr device scope in error path.

Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
8 years agoConfig.mk: update OVMF changeset
Wei Liu [Tue, 24 Jan 2017 17:24:56 +0000 (17:24 +0000)]
Config.mk: update OVMF changeset

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
8 years agoxen: sched: simplify ACPI S3 resume path.
Dario Faggioli [Tue, 17 Jan 2017 17:27:10 +0000 (18:27 +0100)]
xen: sched: simplify ACPI S3 resume path.

In fact, when domains are being unpaused:
 - it's not necessary to put the vcpu to sleep, as
   they are all already paused;
 - it is not necessary to call vcpu_migrate(), as
   the vcpus are still paused, and therefore won't
   wakeup anyway.

Basically, the only important thing is to call
pick_cpu, to let the scheduler run and figure out
what would be the best initial placement (i.e., the
value stored in v->processor), for the vcpus, as
they come back up, one after another.

Note that this is consistent with what was happening
before this change, as vcpu_migrate() calls pick_cpu.
But much simpler and quicker.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
8 years agoxen: sched: impove use of cpumask scratch space in Credit1.
Dario Faggioli [Tue, 17 Jan 2017 17:27:03 +0000 (18:27 +0100)]
xen: sched: impove use of cpumask scratch space in Credit1.

It is ok to use just cpumask_scratch in csched_runq_steal().
In fact, the cpu parameter comes from the cpu local variable
in csched_load_balance(), which in turn comes from cpu in
csched_schedule(), which is smp_processor_id().

While there, also:
 - move the comment about cpumask_scratch in the header
   where the scratch space is declared;
 - spell more clearly (in that same comment) what are the
   serialization rules.

No functional change intended.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
8 years agoxen: credit2: fix shutdown/suspend when playing with cpupools.
Dario Faggioli [Tue, 17 Jan 2017 17:26:55 +0000 (18:26 +0100)]
xen: credit2: fix shutdown/suspend when playing with cpupools.

In fact, during shutdown/suspend, we temporarily move all
the vCPUs to the BSP (i.e., pCPU 0, as of now). For Credit2
domains, we call csched2_vcpu_migrate(), expects to find the
target pCPU in the domain's pool

Therefore, if Credit2 is the default scheduler and we have
removed pCPU 0 from cpupool0, shutdown/suspend fails like
this:

 RIP:    e008:[<ffff82d08012906d>] sched_credit2.c#migrate+0x274/0x2d1
 Xen call trace:
    [<ffff82d08012906d>] sched_credit2.c#migrate+0x274/0x2d1
    [<ffff82d080129138>] sched_credit2.c#csched2_vcpu_migrate+0x6e/0x86
    [<ffff82d08012c468>] schedule.c#vcpu_move_locked+0x69/0x6f
    [<ffff82d08012ec14>] cpu_disable_scheduler+0x3d7/0x430
    [<ffff82d08019669b>] __cpu_disable+0x299/0x2b0
    [<ffff82d0801012f8>] cpu.c#take_cpu_down+0x2f/0x38
    [<ffff82d0801312d8>] stop_machine.c#stopmachine_action+0x7f/0x8d
    [<ffff82d0801330b8>] tasklet.c#do_tasklet_work+0x74/0xab
    [<ffff82d0801333ed>] do_tasklet+0x66/0x8b
    [<ffff82d080166a73>] domain.c#idle_loop+0x3b/0x5e

 ****************************************
 Panic on CPU 8:
 Assertion 'svc->vcpu->processor < nr_cpu_ids' failed at sched_credit2.c:1729
 ****************************************

On the other hand, if Credit2 is the scheduler of another
pool, when trying (still during shutdown/suspend) to move
the vCPUs of the Credit2 domains to pCPU 0, it figures
out that pCPU 0 is not a Credit2 pCPU, and fails like this:

 RIP:    e008:[<ffff82d08012916b>] sched_credit2.c#csched2_vcpu_migrate+0xa1/0x107
 Xen call trace:
    [<ffff82d08012916b>] sched_credit2.c#csched2_vcpu_migrate+0xa1/0x107
    [<ffff82d08012c4e9>] schedule.c#vcpu_move_locked+0x69/0x6f
    [<ffff82d08012edfc>] cpu_disable_scheduler+0x3d7/0x430
    [<ffff82d08019687b>] __cpu_disable+0x299/0x2b0
    [<ffff82d0801012f8>] cpu.c#take_cpu_down+0x2f/0x38
    [<ffff82d0801314c0>] stop_machine.c#stopmachine_action+0x7f/0x8d
    [<ffff82d0801332a0>] tasklet.c#do_tasklet_work+0x74/0xab
    [<ffff82d0801335d5>] do_tasklet+0x66/0x8b
    [<ffff82d080166c53>] domain.c#idle_loop+0x3b/0x5e

The solution is to recognise the specific situation, inside
csched2_vcpu_migrate() and, considering it is something temporary,
which only happens during shutdown/suspend, quickly deal with it.

Then, in the resume path, in restore_vcpu_affinity(), things
are set back to normal, and a new v->processor is chosen, for
each vCPU, from the proper set of pCPUs (i.e., the ones of
the proper cpupool).

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
8 years agoxen: credit2: never consider CPUs outside of our cpupool.
Dario Faggioli [Tue, 17 Jan 2017 17:26:46 +0000 (18:26 +0100)]
xen: credit2: never consider CPUs outside of our cpupool.

In fact, relying on the mask of what pCPUs belong to
which Credit2 runqueue is not enough. If we only do that,
when Credit2 is the boot scheduler, we may ASSERT() or
panic when moving a pCPU from Pool-0 to another cpupool.

This is because pCPUs outside of any pool are considered
part of cpupool0. This puts us at risk of crash when those
same pCPUs are added to another pool and something
different than the idle domain is found to be running
on them.

Note that, even if we prevent the above to happen (which
is the purpose of this patch), this is still pretty bad,
in fact, when we remove a pCPU from Pool-0:
- in Credit1, as we do *not* update prv->ncpus and
  prv->credit, which means we're considering the wrong
  total credits when doing accounting;
- in Credit2, the pCPU remains part of one runqueue,
  and is hence at least considered during load balancing,
  even if no vCPU should really run there.

In Credit1, this "only" causes skewed accounting and
no crashes because there is a lot of `cpumask_and`ing
going on with the cpumask of the domains' cpupool
(which, BTW, comes at a price).

A quick and not to involved (and easily backportable)
solution for Credit2, is to do exactly the same.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com
Acked-by: George Dunlap <george.dunlap@citrix.com>
8 years agoxen: credit2: use the correct scratch cpumask.
Dario Faggioli [Tue, 17 Jan 2017 17:26:38 +0000 (18:26 +0100)]
xen: credit2: use the correct scratch cpumask.

In fact, there is one scratch mask per each CPU. When
you use the one of a CPU, it must be true that:
 - the CPU belongs to your cpupool and scheduler,
 - you own the runqueue lock (the one you take via
   {v,p}cpu_schedule_lock()) for that CPU.

This was not the case within the following functions:

get_fallback_cpu(), csched2_cpu_pick(): as we can't be
sure we either are on, or hold the lock for, the CPU
that is in the vCPU's 'v->processor'.

migrate(): it's ok, when called from balance_load(),
because that comes from csched2_schedule(), which takes
the runqueue lock of the CPU where it executes. But it is
not ok when we come from csched2_vcpu_migrate(), which
can be called from other places.

The fix is to explicitly use the scratch space of the
CPUs for which we know we hold the runqueue lock.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reported-by: Jan Beulich <JBeulich@suse.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
8 years agotools/fuzz: remove redundant rule in x86 insn fuzzer
Wei Liu [Fri, 20 Jan 2017 10:24:36 +0000 (10:24 +0000)]
tools/fuzz: remove redundant rule in x86 insn fuzzer

The predefined pattern rule works.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>