]> xenbits.xensource.com Git - xen.git/log
xen.git
9 years agoxen/x86: Improve disabling of features which have dependencies
Andrew Cooper [Wed, 18 Nov 2015 11:43:01 +0000 (11:43 +0000)]
xen/x86: Improve disabling of features which have dependencies

APIC and XSAVE have dependent features, which also need disabling if Xen
chooses to disable a feature.

Use setup_clear_cpu_cap() rather than clear_bit(), as it takes care of
dependent features as well.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <JBeulich@suse.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
9 years agoxen/x86: Clear dependent features when clearing a cpu cap
Andrew Cooper [Wed, 18 Nov 2015 12:51:20 +0000 (12:51 +0000)]
xen/x86: Clear dependent features when clearing a cpu cap

When clearing a cpu cap, clear all dependent features.  This avoids having a
featureset with intermediate features disabled, but leaf features enabled.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <JBeulich@suse.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
9 years agoxen/x86: Generate deep dependencies of features
Andrew Cooper [Sat, 30 Jan 2016 15:52:41 +0000 (15:52 +0000)]
xen/x86: Generate deep dependencies of features

Some features depend on other features.  Working out and maintaining the exact
dependency tree is complicated, so it is expressed in the automatic generation
script.

At runtime, Xen needs to be disable all features which are dependent on a
feature being disabled.  Because of the flattening performed at compile time,
runtime can use a single mask to disable all eventual features.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agox86: introduce a new VMASSIST for architectural behaviour of iopl
Andrew Cooper [Fri, 8 Apr 2016 20:34:09 +0000 (22:34 +0200)]
x86: introduce a new VMASSIST for architectural behaviour of iopl

The existing vIOPL interface is hard to use, and need not be.

Introduce a VMASSIST with which a guest can opt-in to having vIOPL behaviour
consistenly with native hardware.

Specifically:
 - virtual iopl updated from do_iret() hypercalls.
 - virtual iopl reported in bounce frames.
 - guest kernels assumed to be level 0 for the purpose of iopl checks.

v->arch.pv_vcpu.iopl is altered to store IOPL shifted as it would exist
eflags, for the benefit of the assembly code.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agox86/vMSI-X: fix qword write covering vector control field
Jan Beulich [Fri, 8 Apr 2016 20:33:17 +0000 (22:33 +0200)]
x86/vMSI-X: fix qword write covering vector control field

Along with using the upper 32 bits of the written value, the address
also needs advancing, so that msix_write_completion() will use the
correct address for re-invocation of msixtbl_write().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agomwait-idle: support for Intel Xeon Phi Processor x200 Product Family
Dasaratharaman Chandramouli [Fri, 8 Apr 2016 20:32:36 +0000 (22:32 +0200)]
mwait-idle: support for Intel Xeon Phi Processor x200 Product Family

Enables "Intel(R) Xeon Phi(TM) Processor x200 Product Family" support,
formerly code-named KNL. It is based on modified Intel Atom Silvermont
microarchitecture.

Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
[micah.barany@intel.com: adjusted values of residency and latency]
Signed-off-by: Micah Barany <micah.barany@intel.com>
[Linux commit: 281baf7a702693deaa45c98ef0c5161006b48257]
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agomwait-idle: prevent SKL-H boot failure when C8+C9+C10 enabled
Len Brown [Fri, 8 Apr 2016 20:31:47 +0000 (22:31 +0200)]
mwait-idle: prevent SKL-H boot failure when C8+C9+C10 enabled

Some SKL-H configurations require "max_cstate=7" to boot.
While that is an effective workaround, it disables C10.

This patch detects the problematic configuration,
and disables C8 and C9, keeping C10 enabled.

Note that enabling SGX in BIOS SETUP can also prevent this issue,
if the system BIOS provides that option.

https://bugzilla.kernel.org/show_bug.cgi?id=109081
"Freezes with Intel i7 6700HQ (Skylake), unless intel_idle.max_cstate=7"

Signed-off-by: Len Brown <len.brown@intel.com>
[Linux commit: d70e28f57e14a481977436695b0c9ba165472431]

Adjust to Xen infrastructure.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86: calculate maximum host and guest featuresets
Andrew Cooper [Fri, 8 Apr 2016 20:30:44 +0000 (22:30 +0200)]
x86: calculate maximum host and guest featuresets

All of this information will be used by the toolstack to make informed
levelling decisions for VMs, and by Xen to sanity check toolstack-provided
information.

The split between the shadow and hap HVM masks is necessary due to the lack of
a "get cpuid policy" hypercall.  Multi-host toolstacks (i.e. not libxl)
dealing with hap and non-hap capable hosts need to be able to calculate that
migrating a shadow guest is safe.

Future planned development work will implement proper cpuid policy handing in
Xen, including a "get policy" hypercall, but until then, the difference is
made available for toolstack use via a non-stable interface.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agox86: annotate VM applicability in featureset
Andrew Cooper [Fri, 8 Apr 2016 20:29:44 +0000 (22:29 +0200)]
x86: annotate VM applicability in featureset

Use attributes to specify whether a feature is applicable to be exposed to:
 1) All guests
 2) HVM guests
 3) HVM HAP guests
and, via absence of an attribute, to no guests.

There is no current need for other categories (e.g. PV-only features), and
such categories should not be introduced if possible.  These categories follow
from the fact that, with increased hardware support, a guest gets more
features to use.

These settings are derived from the existing code in {pv,hvm}_cpuid(), and
xc_cpuid_x86.c.  One notable exception is EXTAPIC which was previously
erroneously exposed to guests.  PV guests don't get to use the APIC and the
HVM APIC emulation doesn't support extended space.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agoRevert "xen: change the sizes of fields in the HVM start info layout to be 64bits"
Ian Jackson [Fri, 8 Apr 2016 17:07:10 +0000 (18:07 +0100)]
Revert "xen: change the sizes of fields in the HVM start info layout to be 64bits"

This reverts commit 1aee836fe2829c39775c6434bf914f752521cfa7.

This patch was nacked after commit.  Jan writes:

 And already applied as I see. I think rushing things in like this is
 not a solution, no matter that we want to freeze the tree today.
 Changes like this should be free to go in as de-facto bug fixes
 after the freeze date.

9 years agolibxl: remove code added to use the 'phy' backend with CDROM devices
Roger Pau Monne [Fri, 8 Apr 2016 16:13:39 +0000 (18:13 +0200)]
libxl: remove code added to use the 'phy' backend with CDROM devices

This is a partial revert of 612f15, that allowed CDROM devices to use the
'phy' PV backend. Due to limitations in the current implementation of the
libxl_cdrom_insert function, the PV backend used in conjunction with an
emulated CDROM device must always be Qdisk at the moment. This is due to
libxl_cdrom_insert not running disk hotplug scripts on plug and unplug of PV
CDROM backends (and possibly other yet to be identified issues).

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: only allow guests with a device model to use cd-{eject/insert}
Roger Pau Monne [Fri, 8 Apr 2016 16:13:38 +0000 (18:13 +0200)]
libxl: only allow guests with a device model to use cd-{eject/insert}

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: set the backend type to Qdisk for CDROM devices on DM HVM guests
Roger Pau Monne [Fri, 8 Apr 2016 16:13:37 +0000 (18:13 +0200)]
libxl: set the backend type to Qdisk for CDROM devices on DM HVM guests

This is needed because the cd-{insert/eject} functions are not prepared to
deal with blkback, which would be used by default if no backend was
specified.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: set the device model version earlier in xenstore
Roger Pau Monne [Fri, 8 Apr 2016 16:13:36 +0000 (18:13 +0200)]
libxl: set the device model version earlier in xenstore

So libxl doesn't have to pass the build info around just to get the device
model used by the guest. This allows to simplify
libxl__device_nic_setdefault.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agoMerge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging
Ian Jackson [Fri, 8 Apr 2016 16:06:36 +0000 (17:06 +0100)]
Merge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging

9 years agoxen/arm64: correctly emulate the {w, x}zr registers
Julien Grall [Thu, 7 Apr 2016 10:53:58 +0000 (11:53 +0100)]
xen/arm64: correctly emulate the {w, x}zr registers

On AArch64, encoding 31 for an R<n> in the HSR is used to represent
either {w,x}sp or {w,x}zr (See C1.2.4 in ARM DDI 0486A.d) depending on
how the register field is interpreted by the instruction.

All the instructions trapped by Xen (either via a sysreg access or
data abort) interpret encoding 31 as {w,x}zr. Therefore we don't have
to worry about the possibility that a trap could refer to sp or about
decoding the instruction.

For example AArch64 LDR and STR can have zr in the source/target
register <Xt>, but never sp. sp can be present in the destination
pointer( i.e.  "[sp]"), but that would be represented by the value of
FAR_EL2, not in the HSR.

For AArch32 it is possible for a LDR to target the PC, but this would
not result in a valid ISS in the HSR register. However this could only
occur if loading or storing the PC to MMIO, which we simply choose not
to support for now.

Finally, features such as xenaccess can lead to us trapping on
arbitrary instructions accessing RAM and not just for MMIO. However in
many such cases HSR.ISS is not valid and in general features such as
xenaccess do not rely on the nature of the specific instruction, they
resolve the fault (via information found elsewhere e.g. FAR_EL2)
without needing to know anything about the instruction which triggered
the trap.

The register zr represents the zero register, i.e it will always
return 0 and write to it is ignored. To properly handle this property,
2 new helpers have been introduced {get,set}_user_reg to read/write a
value from/to a register. All the calls to select_user_reg have been
replaced by these 2 helpers.

Furthermore, the code to emulate encoding 31 in select_user_reg has been
dropped because it was invalid. For Aarch64 context, the encoding is
used for sp or zr. For AArch32 context, the ISS won't be valid for data
abort from AArch32 using r15 (i.e pc) as source/destination (See D7-1881
ARM DDI 0487A.d, note the validity is more restrictive than on ARMv7).
It's also not possible to use r15 in co-processor instructions.

This patch fixes setting MMIO register and sysreg to a random value
(actually PC) instead of zero by something like:

*((volatile int*)reg) = 0;

compilers tend to generate "str wzr, [xx]" here.

[ian: added BUG_ON to select_user_reg and clarified bits of the commit message]
Reported-by: Marc Zyngier <Marc.Zyngier@arm.com>
Signed-off-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoxen/arm64: check XSM Magic from the second unknown module.
Fu Wei [Tue, 5 Apr 2016 16:46:36 +0000 (00:46 +0800)]
xen/arm64: check XSM Magic from the second unknown module.

This patch adds a has_xsm_magic helper function for detecting XSM
from the second unknown module.

If Xen can't get the kind of module from compatible, we guess the kind of
these unknowns respectively:
    (1) The first unknown must be kernel.
    (2) Detect the XSM Magic from the 2nd unknown:
        a. If it's XSM, set the kind as XSM, and that also means we
won't load ramdisk;
b. if it's not XSM, set the kind as ramdisk.
So if user want to load ramdisk, it must be the 2nd unknown.
We also detect the XSM Magic for the following unknowns, then set its kind
according to the return value of has_xsm_magic.

By this way, arm64 behavior can be compatible to x86 and can simplify
multi-arch bootloader such as GRUB.

Signed-off-by: Fu Wei <fu.wei@linaro.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Julien Grall <julien.grall@arm.com>
9 years agoxen: change the sizes of fields in the HVM start info layout to be 64bits
Roger Pau Monne [Fri, 8 Apr 2016 15:47:36 +0000 (17:47 +0200)]
xen: change the sizes of fields in the HVM start info layout to be 64bits

At the moment the only consumer of this structure is x86, but other arches
might also use it, so make all the fields 64bits. On x86 Xen will still try
to place everything below the 4GiB boundary, but that might not be feasible
in other arches.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Requested-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoxen/arm: map_dev_mmio_region: printk should be ratelimited
Shannon Zhao [Thu, 7 Apr 2016 06:28:14 +0000 (14:28 +0800)]
xen/arm: map_dev_mmio_region: printk should be ratelimited

The function map_dev_mmio_region is used in a hypercall. Therefore all
printks should be ratelimited to avoid a malicious guest flooding the
console.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Julien Grall <julien.grall@arm.com>
9 years agoflask: change default state to enforcing
Daniel De Graaf [Wed, 6 Apr 2016 19:35:59 +0000 (15:35 -0400)]
flask: change default state to enforcing

The previous default of "permissive" is meant for developing or
debugging a disaggregated system.  However, this default makes it too
easy to accidentally boot a machine in this state, which does not place
any restrictions on guests.  This is not suitable for normal systems
because any guest can perform any operation (including operations like
rebooting the machine, kexec, and reading or writing another domain's
memory).

This change will cause the boot to fail if you do not specify an XSM
policy during boot; if you need to load a policy from dom0, use the
"flask=late" boot parameter.

Original patch by Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>; modified
to also change the default value of flask_enforcing so that the policy
is not still in permissive mode.  This also removes the (no longer
documented) command line argument directly changing that variable since
it has been superseded by the flask= parameter.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
9 years agoarm: Fix asynchronous aborts (SError exceptions) due to bogus PTEs
Vikram Sethi [Tue, 29 Mar 2016 04:46:12 +0000 (23:46 -0500)]
arm: Fix asynchronous aborts (SError exceptions) due to bogus PTEs

ARMv8 architecture allows performing prefetch data/instructions
from memory locations marked as normal memory. Prefetch does not
mean that the data/instruction has to be used/executed in code
flow. All PTEs that appear to be valid to MMU must contain valid
physical address with proper attributes otherwise MMU table walk
might cause imprecise asynchronous aborts.

The way current XEN code is preparing page tables for frametable
and xenheap memory can create bogus PTEs. This patch fixes the
issue by clearing page table memory before populating EL2 L0/L1
PTEs. Without this patch XEN crashes on Qualcomm Technologies
server chips due to asynchronous aborts.

The speculative/prefetch feature explanation is scattered everywhere
in ARM specification but below two sections have useful information.

E2.8 Memory types and attributes (ver DDI0487A_h)
G4.12.6 External abort on a translation table walk (ver DDI0487A_h)

Signed-off-by: Vikram Sethi <vikrams@codeaurora.org>
Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
Acked-by: Julien Grall <julien.grall@arm.com>
9 years agoxen: sched: implement vcpu hard affinity in Credit2
Justin Weaver [Fri, 18 Mar 2016 15:40:09 +0000 (16:40 +0100)]
xen: sched: implement vcpu hard affinity in Credit2

as it was still missing.

Note that this patch "only" implements hard affinity,
i.e., the possibility of specifying on what pCPUs a
certain vCPU can run. Soft affinity (which express a
preference for vCPUs to run on certain pCPUs) is still
not supported by Credit2, even after this patch.

Signed-off-by: Justin Weaver <jtweaver@hawaii.edu>
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
9 years agoxen: sched: provide some scratch space for not putting cpumasks on stack
Dario Faggioli [Fri, 18 Mar 2016 16:03:51 +0000 (17:03 +0100)]
xen: sched: provide some scratch space for not putting cpumasks on stack

directly, from schedule.c, for any scheduler that needs
it to use it.

In fact, Credit1 and RTDS needs this already. Credit2 is
also going to need it, for supporting hard affinity
(which is, typically, what requires a lot of cpumask
manipulations, inside various functions).

Therefore, let's define the scratch space at a broader
scope, to limit code duplication in handling it.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
9 years agoxen: sched: per-core runqueues as default in credit2
Dario Faggioli [Tue, 29 Sep 2015 12:05:16 +0000 (14:05 +0200)]
xen: sched: per-core runqueues as default in credit2

Experiments have shown that arranging the scheduing
runqueues on a per-core basis yields better results,
in most cases.

Such evaluation has been done, for the first time,
by Uma Sharma, during her participation to OPW. Some
of the results she got are summarized here:

 http://lists.xen.org/archives/html/xen-devel/2015-03/msg01499.html

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Signed-off-by: Uma Sharma <uma.sharma523@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
9 years agoxen: sched: allow for choosing credit2 runqueues configuration at boot
Dario Faggioli [Tue, 29 Sep 2015 12:05:09 +0000 (14:05 +0200)]
xen: sched: allow for choosing credit2 runqueues configuration at boot

In fact, credit2 uses CPU topology to decide how to arrange
its internal runqueues. Before this change, only 'one runqueue
per socket' was allowed. However, experiments have shown that,
for instance, having one runqueue per physical core improves
performance, especially in case hyperthreading is available.

In general, it makes sense to allow users to pick one runqueue
arrangement at boot time, so that:
 - more experiments can be easily performed to even better
   assess and improve performance;
 - one can select the best configuration for his specific
   use case and/or hardware.

This patch enables the above.

Note that, for correctly arranging runqueues to be per-core,
just checking cpu_to_core() on the host CPUs is not enough.
In fact, cores (and hyperthreads) on different sockets, can
have the same core (and thread) IDs! We, therefore, need to
check whether the full topology of two CPUs matches, for
them to be put in the same runqueue.

Note also that the default (although not functional) for
credit2, since now, has been per-socket runqueue. This patch
leaves things that way, to avoid mixing policy and technical
changes.

Finally, it would be a nice feature to be able to select
a particular runqueue arrangement, even when creating a
Credit2 cpupool. This is left as future work.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Signed-off-by: Uma Sharma <uma.sharma523@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
9 years agoxen: sched: fix per-socket runqueue creation in credit2
Dario Faggioli [Tue, 29 Sep 2015 12:04:55 +0000 (14:04 +0200)]
xen: sched: fix per-socket runqueue creation in credit2

The credit2 scheduler tries to setup runqueues in such
a way that there is one of them per each socket. However,
that does not work. The issue is described in bug #36
"credit2 only uses one runqueue instead of one runq per
socket" (http://bugs.xenproject.org/xen/bug/36), and a
solution has been attempted by an old patch series:

 http://lists.xen.org/archives/html/xen-devel/2014-08/msg02168.html

Here, we take advantage of the fact that now initialization
happens (for all schedulers) during CPU_STARTING, so we
have all the topology information available when necessary.

This is true for all the pCPUs _except_ the boot CPU. That
is not an issue, though. In fact, no runqueue exists yet
when the boot CPU is initialized, so we can just create
one and put the boot CPU in there.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
9 years agoxen: sched: on credit2, don't reprogram the timer if idle
Dario Faggioli [Fri, 18 Mar 2016 17:32:50 +0000 (18:32 +0100)]
xen: sched: on credit2, don't reprogram the timer if idle

As other schedulers are doing already: if the idle vcpu
is picked and scheduled, there is no need to reprogram the
scheduler timer to fire and invoke csched2_schedule()
again in future.

Tickling or external events will serve as pokes, when
necessary, but until we can, we should just stay idle.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reported-by: Tianyang Chen <tiche@seas.upenn.edu>
Suggested-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
9 years agoxen: sched: improve credit2 bootparams' scope, placement and signedness
Uma Sharma [Tue, 29 Sep 2015 12:01:32 +0000 (14:01 +0200)]
xen: sched: improve credit2 bootparams' scope, placement and signedness

and, while we are adjusting signedness of opt_load_window_shift,
make also prv->load_window_shift unsigned, as approapriate.

Signed-off-by: Uma Sharma <uma.sharma523@gmail.com>
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
9 years agoxen: sched: close potential races when switching scheduler to CPUs
Dario Faggioli [Wed, 6 Apr 2016 13:40:53 +0000 (15:40 +0200)]
xen: sched: close potential races when switching scheduler to CPUs

In short, the point is making sure that the actual switch
of scheduler and the remapping of the scheduler's runqueue
lock occur in the same critical section, protected by the
"old" scheduler's lock (and not, e.g., in the free_pdata
hook, as it is now for Credit2 and RTDS).

Not doing  so, is (at least) racy. In fact, for instance,
if we switch cpu X from, Credit2 to Credit, we do:

 schedule_cpu_switch(x, csched2 --> csched):
   //scheduler[x] is csched2
   //schedule_lock[x] is csched2_lock
   csched_alloc_pdata(x)
   csched_init_pdata(x)
   pcpu_schedule_lock(x) ----> takes csched2_lock
   scheduler[X] = csched
   pcpu_schedule_unlock(x) --> unlocks csched2_lock
   [1]
   csched2_free_pdata(x)
     pcpu_schedule_lock(x) --> takes csched2_lock
     schedule_lock[x] = csched_lock
     spin_unlock(csched2_lock)

While, if we switch cpu X from, Credit to Credit2, we do:

 schedule_cpu_switch(X, csched --> csched2):
   //scheduler[x] is csched
   //schedule_lock[x] is csched_lock
   csched2_alloc_pdata(x)
   csched2_init_pdata(x)
     pcpu_schedule_lock(x) --> takes csched_lock
     schedule_lock[x] = csched2_lock
     spin_unlock(csched_lock)
   [2]
   pcpu_schedule_lock(x) ----> takes csched2_lock
   scheduler[X] = csched2
   pcpu_schedule_unlock(x) --> unlocks csched2_lock
   csched_free_pdata(x)

And if we switch cpu X from RTDS to Credit2, we do:

 schedule_cpu_switch(X, RTDS --> csched2):
   //scheduler[x] is rtds
   //schedule_lock[x] is rtds_lock
   csched2_alloc_pdata(x)
   csched2_init_pdata(x)
     pcpu_schedule_lock(x) --> takes rtds_lock
     schedule_lock[x] = csched2_lock
     spin_unlock(rtds_lock)
   pcpu_schedule_lock(x) ----> takes csched2_lock
   scheduler[x] = csched2
   pcpu_schedule_unlock(x) --> unlocks csched2_lock
   rtds_free_pdata(x)
     spin_lock(rtds_lock)
     ASSERT(schedule_lock[x] == rtds_lock) [3]
     schedule_lock[x] = DEFAULT_SCHEDULE_LOCK [4]
     spin_unlock(rtds_lock)

So, the first problem is that, if anything related to
scheduling, and involving CPU, happens at [1] or [2], we:
 - take csched2_lock,
 - operate on Credit1 functions and data structures,
which is no good!

The second problem is that the ASSERT at [3] triggers, and
the third that at [4], we screw up the lock remapping we've
done for ourself in csched2_init_pdata()!

The first problem arises because there is a window during
which the lock is already the new one, but the scheduler is
still the old one. The other two, becase we let schedulers
mess with the lock (re)mapping done by others.

This patch, therefore, introduces a new hook in the scheduler
interface, called switch_sched, meant at being used when
switching scheduler on a CPU, and implements it for the
various schedulers, so that things are done in the proper
order and under the protection of the best suited (set of)
lock(s). It is necessary to add the hook (as compared to
keep doing things in generic code), because different
schedulers may have different locking schemes.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Robert VanVossen <robert.vanvossen@dornerworks.com>
9 years agoxl: make return type of create_domain() more consistent.
Dario Faggioli [Thu, 7 Apr 2016 15:32:13 +0000 (17:32 +0200)]
xl: make return type of create_domain() more consistent.

create_domain() is of uint32_t return type, because on
success it returns the domid of the new domain, and
uint32_t is what we typically use for domid-s.

However, on failure, it returns ERROR_FAIL or ERROR_INVAL,
which are -3 and -6. Callers assign the return value to an
'int rc' variable and then check for '(rc < 0)'.

Although things work, and no tool (compiler, Coverity, ecc.)
is complaining, using 'int' as return type seems better.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agoxl: improve exit codes of debug related functions
Harmandeep Kaur [Thu, 7 Apr 2016 16:24:52 +0000 (18:24 +0200)]
xl: improve exit codes of debug related functions

by making them more consistent with other examples in xl.

Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agoxl: improve exit codes of some of the domain handling functions
Harmandeep Kaur [Thu, 7 Apr 2016 11:19:50 +0000 (13:19 +0200)]
xl: improve exit codes of some of the domain handling functions

by making them more consistent with other examples in xl.

Affected functions are the ones related to console, vnc,
dump, destroy, shutdown, list, domid and domname.

Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
Signed-off-by: Dario Fagggioli <dario.faggioli@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agoxl: improve exit codes of save/restore and migration functions
Harmandeep Kaur [Thu, 7 Apr 2016 11:02:31 +0000 (13:02 +0200)]
xl: improve exit codes of save/restore and migration functions

by making them more consistent with other examples in xl.

Macros CHK_ERRNOVAL, CHK_SYSCALL, MUST are also updated.

Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agoxl: improve return and exit codes of memory related functions
Harmandeep Kaur [Thu, 7 Apr 2016 10:38:09 +0000 (12:38 +0200)]
xl: improve return and exit codes of memory related functions

by making them more consistent with other examples in xl.

While there, make freemem() of boolean return type, which
looks more natural, and add comment explaining why
parse_mem_size_kb() needs to diverge from the pattern.

Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: replace the usage of uuid_t with a char array
Roger Pau Monne [Fri, 8 Apr 2016 14:00:16 +0000 (16:00 +0200)]
libxl: replace the usage of uuid_t with a char array

The internals of the uuid_t struct don't match a big endian octet stream on
*BSD systems, which means that it cannot be directly casted to a
uint8_t[16].

In order to solve that change the type to be an unsigned char[16], which
doesn't imply any other change on Linux. On *BSDs change the helpers so that
the uuid is always stored as a big endian byte stream.

NB: tested on FreeBSD and Linux only.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Discussed-with: Ian Jackson <Ian.Jackson@eu.citrix.com>
Discussed-with: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agotools: handle xl migrate --debug in legacy stream
Olaf Hering [Thu, 7 Apr 2016 16:31:01 +0000 (18:31 +0200)]
tools: handle xl migrate --debug in legacy stream

Doing a 'xl migrate --debug domU host' on xen-4.5 adds a
XC_SAVE_ID_ENABLE_VERIFY_MODE marker, which is not handled.
Since using --debug is valid usage, handle it by logging the fact
instead of aborting the migration.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: bind_usbintf: do not reuse 'path'
Chunyan Liu [Fri, 8 Apr 2016 04:12:27 +0000 (12:12 +0800)]
libxl: bind_usbintf: do not reuse 'path'

To avoid confusion, use "intf_path" to indicate driver/interface path,
and "bind_path" indicate driver/bind path.

CID: 1358111

Signed-off-by: Chunyan Liu <cyliu@suse.com>
CC: Simon Cao <caobosimon@gmail.com>
CC: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agolibxl: Set rc on failure of usbdev_busaddr_to_busid
Ian Jackson [Mon, 4 Apr 2016 14:18:03 +0000 (15:18 +0100)]
libxl: Set rc on failure of usbdev_busaddr_to_busid

We must set rc before using `goto out'.

Bug introduced in bf7628f0 "libxl: add pvusb API".

CID: 1358113
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: coverity@xenproject.org
CC: Simon Cao <caobosimon@gmail.com>
CC: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Chunyan Liu <cyliu@suse.com>
9 years agolibxl: fix rc handling in libxl_device_usbdev_list
Chunyan Liu [Thu, 7 Apr 2016 09:40:25 +0000 (17:40 +0800)]
libxl: fix rc handling in libxl_device_usbdev_list

In testing with libvirt pvusb functionality, found a rc check
error in libxl_device_usbdev_list. Correct it. This function
is not used by xl.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
CC: Simon Cao <caobosimon@gmail.com>
CC: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agox86: remove the use of vm86_mode()
Andrew Cooper [Thu, 7 Apr 2016 22:05:01 +0000 (00:05 +0200)]
x86: remove the use of vm86_mode()

Xen, being 64bit only, cannot run PV guests in vm86 mode.  HVM guests however
can be running in vm86 mode, and common codepaths need to be able to cope.

The definition of vm86_mode() in x86_64/regs.h is incorrect, as the predicate
is used by non-PV codepaths.

One buggy use is in hvm/emulate.c.  An HVM guest can be in vm86 mode, and
vm86_mode() sliently omits the check.  Luckily, due to the VEX prefix decoding
logic in x86_emulate(), there is no path to the erronious use with EFLAGS_VM
set.

Another potentially problematic use is in show_guest_stack().  In principle,
show_guest_stack() is common code called for both PV and HVM vcpus.  HVM vcpus
exit early (with no reasonable way of making the code generic), making this
part a PV-only codepath.

Open-code its use in emulate.c, matching the surrounding code.  This causes
all other uses to be in PV-only codepaths, making the code to be logically
dead.  Drop it completely, to avoid future misuse.

Part of resulting cleanup removes vm86attr from read_descriptor(), although
retaining one relevant piece of information; i.e. whether we are reading a
selector for an instruction fetch, or a data fetch.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agox86/xsaves: ebx may return wrong value using CPUID eax=0xd,ecx =1
Shuai Ruan [Thu, 7 Apr 2016 22:04:39 +0000 (00:04 +0200)]
x86/xsaves: ebx may return wrong value using CPUID eax=0xd,ecx =1

Refer to SDM Volume 1 Extended Region of an XSAVE Area. The value returned
by ecx[1] with cpuid function 0xd and sub-function i (i>1) indicates
the alignment of the state component i when the compacted format of the
extended region of an xsave area is used.

So when hvm guest using CPUID eax=0xd, ecx=1 to get the size of area
used for compacted format, we need to take alignment into consideration.

tools side is fixed by
"tools/libxc: Calculate xstate cpuid leaf from guest information"
by Andrew Cooper

Signed-off-by: Shuai Ruan <shuai.ruan@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agox86/xsaves: fix two miscellaneous issues
Shuai Ruan [Thu, 7 Apr 2016 22:04:13 +0000 (00:04 +0200)]
x86/xsaves: fix two miscellaneous issues

1. get_xsave_addr() will only be called when
xsave_area_compressed(xsave) is true. So drop the
conditional expression.

2. expand_xsave_states() will memset the area when
get NULL from get_xsave_addr().

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Shuai Ruan <shuai.ruan@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agobuild: fix build with Clang
Andrew Cooper [Thu, 7 Apr 2016 22:03:43 +0000 (00:03 +0200)]
build: fix build with Clang

c/s 607044bf9 "build: avoid putting local absolute symbols in symbol tables"
breaks the build with Clang, as the command line argument isn't understood.

Clang does not appear to have any equivielent option, and already has
outstanding issues with duplicate symbols.  Excluding this option makes the
problem no worse.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agosched: move pCPU initialization in a helper
Dario Faggioli [Thu, 7 Apr 2016 22:03:21 +0000 (00:03 +0200)]
sched: move pCPU initialization in a helper

That will turn out useful in following patches, where such
code will need to be called more than just once. Create an
helper now, and move the code there, to avoid mixing code
motion and functional changes later.

In Credit2, some style cleanup is also done.

No functional change intended.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
9 years agosched: implement .init_pdata in Credit, Credit2 and RTDS
Dario Faggioli [Thu, 7 Apr 2016 22:03:03 +0000 (00:03 +0200)]
sched: implement .init_pdata in Credit, Credit2 and RTDS

In fact, if a scheduler needs per-pCPU information,
that needs to be initialized appropriately. So, we take
the code that is performing initializations from (right
now) .alloc_pdata, and use it for .init_pdata, leaving
only actualy allocations in the former, if any (which
is the case in RTDS and Credit1).

On the other hand, in Credit2, since we don't really
need any per-pCPU data allocation, everything that was
being done in .alloc_pdata, is now done in .init_pdata.
And the fact that now .alloc_pdata can be left undefined,
allows us to just get rid of it.

Still for Credit2, the fact that .init_pdata is called
during CPU_STARTING (rather than CPU_UP_PREPARE) kills
the need for the scheduler to setup a similar callback
itself, simplifying the code.

And thanks to such simplification, it is now also ok to
move some of the logic meant at double checking that a
cpu was (or was not) initialized, into ASSERTS (rather
than an if() and a BUG_ON).

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Meng Xu <mengxu@cis.upenn.edu>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
9 years agosched: make implementing .alloc_pdata optional
Dario Faggioli [Thu, 7 Apr 2016 22:01:49 +0000 (00:01 +0200)]
sched: make implementing .alloc_pdata optional

The .alloc_pdata scheduler hook must, before this change,
be implemented by all schedulers --even those ones that
don't need to allocate anything.

Make it possible to just use the SCHED_OP(), like for
the other hooks, by using ERR_PTR() and IS_ERR() for
error reporting. This:
 - makes NULL a variant of success;
 - allows for errors other than ENOMEM to be properly
   communicated (if ever necessary).

This, in turn, means that schedulers not needing to
allocate any per-pCPU data, can avoid implementing the
hook. In fact, the artificial implementation of
.alloc_pdata in the ARINC653 is removed (and, while there,
nuke .free_pdata too, as it is equally useless).

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Meng Xu <mengxu@cis.upenn.edu>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
9 years agolibxl: pvusb: Correctly check the controller type
Chunyan Liu [Thu, 7 Apr 2016 09:40:28 +0000 (17:40 +0800)]
libxl: pvusb: Correctly check the controller type

Missing a check of controller type.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
CC: Simon Cao <caobosimon@gmail.com>
CC: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
9 years agolibxl: libxl_pvusb.c: Remove redundant lstat
Chunyan Liu [Thu, 7 Apr 2016 09:40:27 +0000 (17:40 +0800)]
libxl: libxl_pvusb.c: Remove redundant lstat

There is no harm in calling realpath, and we can handle ENOENT then.

CID: 1358112

Signed-off-by: Chunyan Liu <cyliu@suse.com>
CC: Simon Cao <caobosimon@gmail.com>
CC: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
9 years agolibxl: libxl_write_exactly: correct argument to sizeof
Chunyan Liu [Thu, 7 Apr 2016 09:40:26 +0000 (17:40 +0800)]
libxl: libxl_write_exactly: correct argument to sizeof

sizeof is wrongly used in libxl_write_exactly function, using
strlen instead.

CID: 1358110
CID: 1358109

Signed-off-by: Chunyan Liu <cyliu@suse.com>
CC: Simon Cao <caobosimon@gmail.com>
CC: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
9 years agolibxc: fix uninitialized variable when changing rtds scheduling parameters
Chong Li [Wed, 6 Apr 2016 20:30:38 +0000 (15:30 -0500)]
libxc: fix uninitialized variable when changing rtds scheduling parameters

Commit 046c2b503a89d21b41e4d555a9f75d02af00dbc6 introduces a build
failure: in some cases (e.g., num_vcpus <=0),
xc_sched_rtds_vcpu_get/set returns an uninitialized variable.

Fix it.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Chong Li <chong.li@wustl.edu>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoxl: enable per-VCPU parameter for RTDS
Chong Li [Fri, 1 Apr 2016 18:33:27 +0000 (18:33 +0000)]
xl: enable per-VCPU parameter for RTDS

Change main_sched_rtds and related output functions to support
per-VCPU settings.

Signed-off-by: Chong Li <chong.li@wustl.edu>
Signed-off-by: Meng Xu <mengxu@cis.upenn.edu>
Signed-off-by: Sisu Xi <xisisu@gmail.com>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: enable per-VCPU parameter for RTDS
Chong Li [Fri, 1 Apr 2016 14:39:05 +0000 (14:39 +0000)]
libxl: enable per-VCPU parameter for RTDS

Add libxl_vcpu_sched_params_get/set and sched_rtds_vcpu_get/set
functions to support per-VCPU settings.

Signed-off-by: Chong Li <chong.li@wustl.edu>
Signed-off-by: Meng Xu <mengxu@cis.upenn.edu>
Signed-off-by: Sisu Xi <xisisu@gmail.com>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxc: enable per-VCPU parameter for RTDS
Chong Li [Fri, 1 Apr 2016 15:14:42 +0000 (15:14 +0000)]
libxc: enable per-VCPU parameter for RTDS

Add xc_sched_rtds_vcpu_get/set functions to interact with
Xen to get/set a domain's per-VCPU parameters.

Signed-off-by: Chong Li <chong.li@wustl.edu>
Signed-off-by: Meng Xu <mengxu@cis.upenn.edu>
Signed-off-by: Sisu Xi <xisisu@gmail.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
9 years agohotplug/FreeBSD: document disk hotplug interface
Roger Pau Monne [Thu, 31 Mar 2016 13:02:33 +0000 (15:02 +0200)]
hotplug/FreeBSD: document disk hotplug interface

Add the FreeBSD disk hotplug interface details to the block-scripts.txt
document.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
9 years agolibxl: fix error message in local_device_attach_cb
Roger Pau Monne [Thu, 31 Mar 2016 12:56:42 +0000 (14:56 +0200)]
libxl: fix error message in local_device_attach_cb

The fields that are printed might not be set in the case of a failure, which
generates a segmentation fault.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: add a FreeBSD implementation of libxl__devid_to_localdev
Roger Pau Monne [Thu, 31 Mar 2016 12:56:41 +0000 (14:56 +0200)]
libxl: add a FreeBSD implementation of libxl__devid_to_localdev

This code is extracted from the FreeBSD blkfront implementation.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: properly use vdev vs local device
Roger Pau Monne [Thu, 31 Mar 2016 12:56:41 +0000 (14:56 +0200)]
libxl: properly use vdev vs local device

The current code in libxl assumed that vdev is equal to local device, but
this is only true for Linux systems. In other OSes the local device can use
a nomenclature completely different from the virtual device one.

Move the current libxl__devid_to_localdev Linux implementation out of the
OS-specific file and rename it to libxl__devid_to_vdev, and then make sure
local_device_attach_cb return the local device in the diskpath field.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: add support for disk hotplug scripts on FreeBSD
Roger Pau Monne [Thu, 31 Mar 2016 12:56:41 +0000 (14:56 +0200)]
libxl: add support for disk hotplug scripts on FreeBSD

Allow FreeBSD to execute hotplug scripts when attaching disk devices.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
9 years agolibxl: refactor the FreeBSD hotplug script code
Roger Pau Monne [Thu, 31 Mar 2016 12:56:38 +0000 (14:56 +0200)]
libxl: refactor the FreeBSD hotplug script code

This factors out the nic hotplug specific code from the common code path in
order to make it easier to add support for disk hotplug scripts. It
shouldn't include any functional change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agohotplug/FreeBSD: add block hotplug script
Roger Pau Monne [Thu, 31 Mar 2016 12:56:36 +0000 (14:56 +0200)]
hotplug/FreeBSD: add block hotplug script

This is the default hotplug script for block devices. Its only job is to
copy the "params" blkback xenstore node to "physical-device".

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agoblkif: document how FreeBSD uses the physical-device backend node
Roger Pau Monne [Thu, 31 Mar 2016 12:56:36 +0000 (14:56 +0200)]
blkif: document how FreeBSD uses the physical-device backend node

FreeBSD blkback uses the physical-device-path xenstore node in order to
fetch the path to the underlying backing storage (either a block device or
raw image). This node is set by the hotplug scripts. Also clarify the usage
of the physical-device node.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agoblktap2: Invalid logic detecting unaligned buffers in vhd_write_block
Ross Philipson [Wed, 6 Apr 2016 14:38:59 +0000 (15:38 +0100)]
blktap2: Invalid logic detecting unaligned buffers in vhd_write_block

It seems the logic is meant to detect sector unaligned buffers for block
writes. The NOTing of the logic instead masks off any unaligned bits and
also would cause the function to always fail. It seems the function is not
used in any of the tools so that is probably why the problem is not seen.
In the vhd_read_block function it is correct.

Signed-off-by: Ross Philipson <ross.philipson@ainfosec.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: colo: make it depend on availability of libnl
Wei Liu [Tue, 5 Apr 2016 19:20:53 +0000 (20:20 +0100)]
libxl: colo: make it depend on availability of libnl

Netlink is required when initialising COLO, so make sure only to compile
COLO only when netlink is available. Change the inclusion of
linux/netlink.h to netlink/netlink.h so that it doesn't use Linux kernel
header directly.

Provide necessary stub functions in case COLO is disabled. This should
fix build on FreeBSD because there is no netlink there. It would also
make libxl build properly when netlink is not present on a Linux
system.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agobuild: rename CONFIG_REMUS_NETBUF to CONFIG_LIBNL
Wei Liu [Tue, 5 Apr 2016 18:44:29 +0000 (19:44 +0100)]
build: rename CONFIG_REMUS_NETBUF to CONFIG_LIBNL

COLO and Remus net buffer support both depend on the availability of
libnl. Use a generic name.

No functional changes.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agolibxl: colo: move netlink related stuff to libxl_colo_proxy.c
Wei Liu [Tue, 5 Apr 2016 18:59:53 +0000 (19:59 +0100)]
libxl: colo: move netlink related stuff to libxl_colo_proxy.c

They are only used there, no need to expose them to other parts of
libxl.

This is necessary to make libxl build on FreeBSD again because FreeBSD
doesn't have netlink.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agolibxl: colo: rearrange things in header files
Wei Liu [Tue, 5 Apr 2016 18:15:49 +0000 (19:15 +0100)]
libxl: colo: rearrange things in header files

We need to separate COLO code from common code as clean as possible.
With this patch, all COLO structures are now in libxl_colo.h.

It does the following:
1. Move two typedefs for libxl__domain_create_state{,cb} back to
   libxl_internal.h.
2. Move libxl__colo_save_state to libxl_colo.h.
3. Include libxl_internal.h in libxl_colo.h.
4. Move a bunch of colo typedefs to the top of libxl_internal.h.
5. Move the inclusion of libxl_colo.h to the right place in
   libxl_internal.h.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agolibxl: check for dynamic device model start required
Juergen Gross [Tue, 29 Mar 2016 05:29:19 +0000 (07:29 +0200)]
libxl: check for dynamic device model start required

Add a service routine checking whether a device model must be started
after adding a device to a domain.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agolibxl: add service function to check whether device model is running
Juergen Gross [Tue, 29 Mar 2016 05:29:19 +0000 (07:29 +0200)]
libxl: add service function to check whether device model is running

Add an internal service function to check for a running device model.
This can be used later when adding devices to a domain requiring a
device model for either printing an error message or starting the
device model in case it is not already running.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: add new pvusb backend "qusb" provided by qemu
Juergen Gross [Tue, 29 Mar 2016 05:29:19 +0000 (07:29 +0200)]
libxl: add new pvusb backend "qusb" provided by qemu

Add a new pvusb backend type "qusb" which is provided by qemu. It can
be selected either by specifying the type directly in the configuration
or it is selected automatically by libxl in case there is no "usbback"
driver loaded.

The "qusb" backend is a full replacement for the kernel based backend
"vusb". The interface to the frontend is the very same including all
Xenstore paths, while the backend paths in Xenstore differ ("qusb"
instead ov "vusb").

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: add query function for backend support by device model
Juergen Gross [Wed, 30 Mar 2016 10:45:10 +0000 (12:45 +0200)]
libxl: add query function for backend support by device model

Add a function to query whether the device model is supporting a
specific backend type. The device model is writing the supported
backend types to Xenstore on startup. The new query function checks
for the appropriate entry to be present.

As not all versions of qemu are capable to indicate support of
specific backends the query function is to be called with an indicator
whether the default return value should be "supported" (in case qemu
doesn't know set any support information) or "not supported".

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: make libxl__need_xenpv_qemu() operate on domain config
Juergen Gross [Wed, 30 Mar 2016 14:46:45 +0000 (16:46 +0200)]
libxl: make libxl__need_xenpv_qemu() operate on domain config

libxl__need_xenpv_qemu() is called with configuration data for console,
vfbs, disks and channels today in order to evaluate the need for
starting a device model for a pv domain.

The console data is local to the caller and setup in a way to never
require a device model. All other data is taken from the domain config
structure.

In order to support other device backends via qemu change the interface
of libxl__need_xenpv_qemu() to take the domain config structure as
input instead of the single device arrays.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: handle error from libxl__need_xenpv_qemu() correctly
Juergen Gross [Wed, 30 Mar 2016 15:33:29 +0000 (17:33 +0200)]
libxl: handle error from libxl__need_xenpv_qemu() correctly

In case libxl__need_xenpv_qemu() returns an error let domain creation
fail.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl/CODING_STYLE: Clarify the singular statement in a conditional statement explana...
Konrad Rzeszutek Wilk [Fri, 1 Apr 2016 15:13:57 +0000 (11:13 -0400)]
libxl/CODING_STYLE: Clarify the singular statement in a conditional statement explanation.

It takes a bit of thinking to parse the original statement. It looks
like it is missing an ',' - right after the 'braced' to make it
obvious that:

if (X)
   return XYZ;

is OK, while multiple conditionals require braces.

Changing the 'apart from' with 'except' makes it more obvious
(I hope).

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agolibxl: colo: remove dead code in colo_save_setup_script_cb
Wei Liu [Mon, 4 Apr 2016 17:34:09 +0000 (18:34 +0100)]
libxl: colo: remove dead code in colo_save_setup_script_cb

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agolibxl: colo: fix indentation of abort()
Wei Liu [Mon, 4 Apr 2016 17:34:08 +0000 (18:34 +0100)]
libxl: colo: fix indentation of abort()

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agolibxl: colo: add missing break in qemu_disk_scsi_drive_string
Wei Liu [Mon, 4 Apr 2016 17:34:07 +0000 (18:34 +0100)]
libxl: colo: add missing break in qemu_disk_scsi_drive_string

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agolibxl: colo: simplify colo_proxy_async_wait_for_checkpoint
Wei Liu [Mon, 4 Apr 2016 17:34:06 +0000 (18:34 +0100)]
libxl: colo: simplify colo_proxy_async_wait_for_checkpoint

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agolibxc: colo: don't leak pfns and iov in send_checkpoint_dirty_pfn_list
Wei Liu [Mon, 4 Apr 2016 17:34:05 +0000 (18:34 +0100)]
libxc: colo: don't leak pfns and iov in send_checkpoint_dirty_pfn_list

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agolibxl: fix POLLHUP handling
Roger Pau Monne [Thu, 31 Mar 2016 12:50:07 +0000 (14:50 +0200)]
libxl: fix POLLHUP handling

The current code in bootloader_copyfail will error out on expected POLLHUPs
because of a missing "else" in the if clause.

The behaviour that triggers this bug has only been seen on FreeBSD so far.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Suggested-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: Fix uninitialized pointer when passing an empty cdrom
George Dunlap [Wed, 6 Apr 2016 11:34:06 +0000 (12:34 +0100)]
libxl: Fix uninitialized pointer when passing an empty cdrom

Commit 3fec17d4bb56567d139d7806392f4d8702d3f6a7 introduced a bug where
an empty cdrom would cause target_path to be uninitialized.  Initialize
target_path to NULL instead.

The other option here would have been to set target_path to NULL only
on the LIBXL_DISK_FORMAT_EMPTY path.  That would potentially enable
the compiler to catch future uninitialized paths, rather than having
those paths (potentially) dereference a NULL pointer.  But given that
a bunch of our compilers failed to catch *this* uninitialized path,
setting it to NULL at declaration seems the safer option for now.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agosched: fix deadlock when changing scheduling parameters
Chong Li [Tue, 5 Apr 2016 11:25:44 +0000 (13:25 +0200)]
sched: fix deadlock when changing scheduling parameters

Commit f7b87b0745b4 ("enable per-VCPU parameter for RTDS") introduced
a bug: it made it possible, in Credit and Credit2, when doing domain
or vcpu parameters' manipulation, to leave the hypervisor with a
spinlock held and interrupts disabled.

Fix it.

Signed-off-by: Chong Li <chong.li@wustl.edu>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
9 years agox86/pvh: initialize ioreq server for PVH guests
Boris Ostrovsky [Tue, 5 Apr 2016 11:25:13 +0000 (13:25 +0200)]
x86/pvh: initialize ioreq server for PVH guests

ioreq server list needs to be initialized for PVH guests. This list is
walked in handle_hvm_io_completion() by all guests in HVM containers and
leaving it uninitialized may cause PVH guests to crash there.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agox86/HVM: remove dead code
Jan Beulich [Tue, 5 Apr 2016 11:24:40 +0000 (13:24 +0200)]
x86/HVM: remove dead code

With commit 96ae556569 ("x86/HVM: fix forwarding of internally cached
requests") rc doesn't change anymore in the respective preceding
switch() statements.

Coverity ID: 1358080
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86/xsaves: fix overwriting between non-lazy/lazy xsaves
Shuai Ruan [Tue, 5 Apr 2016 11:23:41 +0000 (13:23 +0200)]
x86/xsaves: fix overwriting between non-lazy/lazy xsaves

The offset at which components xsaved by xsave[sc] are not fixed.
So when when a save with v->fpu_dirtied set is followed by one
with v->fpu_dirtied clear, non-lazy xsave[sc] may overwriting data
written by the lazy one.

The solution is when using_xsave_compact is enabled and taking xcr0_accum into
consideration, if guest has ever used XSTATE_LAZY & ~XSTATE_FP_SSE
(XSTATE_FP_SSE will be excluded beacause xsave will write XSTATE_FP_SSE
part in legacy region of xsave area which is fixed, saving XSTATE_FS_SSE
will not cause overwriting problem), vcpu_xsave_mask will return XSTATE_ALL.
Otherwise vcpu_xsave_mask will return XSTATE_NONLAZY.

This may cause overhead save on lazy states which will cause performance
impact. After doing some performance tests on xsavec and xsaveopt
(suggested by jan), the results show xsaveopt performs better than xsavec.
So hypervisor will not use xsavec anymore.

xsaves will not be used until supervised state is introduced in hypervisor.
And XSTATE_XSAVES_ONLY (indicates supervised state is understood in xen)
is introduced, the use of xsaves depend on whether XSTATE_XSAVES_ONLY is set
in xcr0_accum.

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Shuai Ruan <shuai.ruan@linux.intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agopublic/xen.h: add flags field to vcpu_time_info
Joao Martins [Tue, 5 Apr 2016 11:21:39 +0000 (13:21 +0200)]
public/xen.h: add flags field to vcpu_time_info

This field has two possible flags (as of latest pvclock ABI
shared with KVM).

flags: bits in this field indicate extended capabilities
coordinated between the guest and the hypervisor.  Specifically
on KVM, availability of specific flags has to be checked in
0x40000001 cpuid leaf. On Xen, we don't have that but we can
still check some of the flags after registering the time info
page since a force_update_vcpu_system_time is performed.

Current flags are:

 flag bit   | cpuid bit    | meaning
-------------------------------------------------------------
            |              | time measures taken across
     0      |      24      | multiple cpus are guaranteed to
            |              | be monotonic
-------------------------------------------------------------
            |              | guest vcpu has been paused by
     1      |     N/A      | the host
            |              |
-------------------------------------------------------------

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Add XEN_ prefixes to new #define-s. Make structure layout change
dependent upon __XEN_INTERFACE_VERSION__ (intentionally comparing to
4.6, as we may want to backport this at least there).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
9 years agodocs: Document block-script protocol
George Dunlap [Thu, 24 Mar 2016 17:18:35 +0000 (17:18 +0000)]
docs: Document block-script protocol

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: George Dunlap <george.dunlap@citrix.com>
9 years agolibxl: Allow local access for block devices with hotplug scripts
George Dunlap [Thu, 24 Mar 2016 17:18:34 +0000 (17:18 +0000)]
libxl: Allow local access for block devices with hotplug scripts

pygrub and qemuu need to be able to access a VM's disks locally in
order to be able to pull out the kernel and provide emulated disk
access, respectively.  This can be done either by accessing the local
disk directly, or by plugging the target disk into dom0 to allow
access.

Unfortunately, while the plugging machinery works for pygrub, it does
not yet work for qemuu; this means that at the moment, disks with
hotplug scripts or disks with non-dom0 backends cannot be provided as
emulated devices to HVM domains.

Fortunately, disks using hotplug scripts created in dom0 do create a
block device as part of set-up, which can be accessed locally; and if
they use block-common.sh:write_dev, this path will be written to
physical-device-path.

Modify libxl__device_disk_setdefault() to be able to fish this path
out of xenstore and pass it to the caller.

Unfortunately, at the time pygrub runs, the devices have not yet been
set up.  Rather than try to stash the domid somewhere to pass, we just
pass INVALID_DOMID.

This allows qemuu to emulate block devices created with custom hotplug
scripts.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: George Dunlap <george.dunlap@citrix.com>
9 years agolibxl: Share logic for finding path between qemuu and pygrub
George Dunlap [Thu, 24 Mar 2016 17:18:34 +0000 (17:18 +0000)]
libxl: Share logic for finding path between qemuu and pygrub

qemu can also access disks which will be provided with a qdisk backend
directly; add a flag to libxl__device_disk_find_local_path to indicate
whether to check for qdisk direct access.

Call libxl__device_disk_find_local_path() for most paths.  If we can't
find a local path, print an error and skip the disk, rather than using
a bogus path.

Now if there is no local access to the disk (i.e., because the disk
has a non-local backend, or relies on a custom hotplug script), libxl
will now print a warning and not provide the emulated disk, rather
than providing bogus parameters to qemu which cause it to error out.
(Such disks will still be available via the PV backend.)

I left the libxl__blktap_devpath in the qemuu-specific code rather
than sharing it with the pyrgub code because:

1) When the pygrub path runs the guest disks have not yet been set up

2) libxl__blktap_devpath() will give you the existing devpath if it
already exists, but will set one up for you if you don't.  So on the
pygrub path, this would end up setting up a new tap device.

3) There is no tap-specific teardown code on the pygrub path, and I
don't want to add any (particularly since I'm hoping to remove tapdisk
altogether soon).

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: George Dunlap <george.dunlap@citrix.com>
9 years agolibxl: Rearrange qemu upstream disk argument code
George Dunlap [Thu, 24 Mar 2016 17:18:33 +0000 (17:18 +0000)]
libxl: Rearrange qemu upstream disk argument code

Reorganize the qemuu disk argument code to make a clean separation
between finding a file to use, and constructing the parameters:

* Rename pdev_path to target_path

* Only use qemu_disk_format_string() in circumstances where qemu may
be interpreting the disk (i.e., backend==QDISK).  In all other cases,
it should use RAW.

* Share as much as possible between the is_cdrom path and the normal
path.

This is mainly prep for sharing the local path finder with the
bootloader; but it does allow cdroms to use any backend that a normal
disk can use. Previously this was limited to RAW files or things that
qemu could handle directly; as of this changeset, it now includes tap
disks; and in future changesets it will include backends with custom
block scripts.

NB that this retains an existing bug, that disks with custom block
scripts or non-dom0 backends will have the bogus pdev_path passed in
to qemu, most likely resulting in qemu exiting with an error.  This
will be fixed in follow-up patches.

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
Tested-by: George Dunlap <george.dunlap@citrix.com>
9 years agolibxl: Move check for local access to a funciton
George Dunlap [Thu, 24 Mar 2016 17:18:33 +0000 (17:18 +0000)]
libxl: Move check for local access to a funciton

Move pygrub checks for local access ability into a separate function.

Also reorganize libxl__device_disk_local_initiate_attach so that we
don't initialize dls->disk unless we actually end up doing a local
attach.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: George Dunlap <george.dunlap@citrix.com>
9 years agotools/hotplug: Write physical-device-path in addition to physical-device
George Dunlap [Thu, 24 Mar 2016 17:18:33 +0000 (17:18 +0000)]
tools/hotplug: Write physical-device-path in addition to physical-device

Change block-common.sh on Linux to write physical-device-path with the
path of the device node, in addition to physical-device with its
major:minor numbers.

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: George Dunlap <george.dunlap@citrix.com>
9 years agolibxl: Remove redundant setting of phyical-device
George Dunlap [Thu, 24 Mar 2016 17:18:32 +0000 (17:18 +0000)]
libxl: Remove redundant setting of phyical-device

Regardless of whether we're running a custom hotplug script or using
normal phy: or file:, the "block" script will be run, which will set
all the necessary xenstore nodes.

In fact, writing this value here prevents the block script from
accomplishing its only purpose: to detect duplicate physical block
devices used in different virtual devices.  The first thing the block
script does is check to see if this node is written; and if it is, it
silently exits.

Remove this, and let the block script perform its duplicate checking
function.

NOTE: It's likely that the duplicate checking for physical devices has
never been run under libxl (at least since this bug was introduced);
this may shake out some issues.

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: George Dunlap <george.dunlap@citrix.com>
9 years agotools/hotplug: Add a "dummy" hotplug script for testing
George Dunlap [Thu, 24 Mar 2016 17:18:32 +0000 (17:18 +0000)]
tools/hotplug: Add a "dummy" hotplug script for testing

Testing the hotplug external script path at the moment involves
actually setting up one of the alternate datapaths (blktap, iscsi,
&c).  Simplify testing by making a script which does a simple loopback,
but still has a target that can't be used directly.

To use:

script=block-dummy,vdev=xvda,target=dummy:<file>

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: George Dunlap <george.dunlap@citrix.com>
9 years agounmodified_drivers: enable use of register_oldmem_pfn_is_ram() API
Mike Meyer [Mon, 4 Apr 2016 13:02:59 +0000 (15:02 +0200)]
unmodified_drivers: enable use of register_oldmem_pfn_is_ram() API

During the investigation of very slow dump times of guest images in
Amazon EC2 instance, it was discovered that the
register_oldmem_pfn_is_ram() API implemented by the upstream kernel
commit 997c136f518c5debd63847e78e2a8694f56dcf90:

        fs/proc/vmcore.c: add hook to read_from_oldmem() to check
                           for non-ram pages

was not being called.  This was due to the PV driver with the call
to register_oldmem_pfn_is_ram() API was not including the
kernel header file that is used to communicate support of the API in the
kernel.  Fix the issue by including the required header file.

Signed-off-by: Mike Meyer <mike.meyer@teradata.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Olaf Hering <olaf@aepfle.de>
9 years agoMAINTAINERS: add ioreq.c and ioreq.h to x86 I/O emulation file list
Paul Durrant [Mon, 4 Apr 2016 13:02:07 +0000 (15:02 +0200)]
MAINTAINERS: add ioreq.c and ioreq.h to x86 I/O emulation file list

Commit 108788e8 "x86/hvm: separate ioreq server code from generic hvm
code" split the code supporting ioreq servers from the rest of the HVM
code. Now that this is separate, the new files can be added to the x86
I/O emulation file list in MAINTAINERS.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agolibxl: ARM build: fix type of libxl__srm_callout_callback_restore_results
Ian Jackson [Mon, 4 Apr 2016 10:41:19 +0000 (11:41 +0100)]
libxl: ARM build: fix type of libxl__srm_callout_callback_restore_results

COLO introduced a few callbacks. The original implementation used
unsigned long for a type which in fact should be xen_pfn_t. That broke
libxl compilation on ARM, because xen_pfn_t is not a synonym for
unsigned long on ARM platform.

Fixing this requires modifying the perl script: specifically now we
need to include xenctrl.h before _libxl_save_msgs_*.h, rather than
afterwards, so that we can use xen_pfn_t there.

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxc: remove second unistd.h inclusion
Wei Liu [Fri, 1 Apr 2016 16:53:56 +0000 (17:53 +0100)]
libxc: remove second unistd.h inclusion

There is already one a few lines above.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxc: xc_domain_resume_hvm is used by x86 only
Wei Liu [Fri, 1 Apr 2016 16:53:55 +0000 (17:53 +0100)]
libxc: xc_domain_resume_hvm is used by x86 only

The call site is enclosed by x86 define guards.

Without this patch:

[  334s] xc_resume.c:112:12: error: 'xc_domain_resume_hvm' defined but not used [-Werror=unused-function]
[  334s]  static int xc_domain_resume_hvm(xc_interface *xch, uint32_t domid)

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxc: use PRIx64 to print out pfn
Wei Liu [Fri, 1 Apr 2016 14:45:06 +0000 (15:45 +0100)]
libxc: use PRIx64 to print out pfn

Pfn is always 64 bit long. Use PRIx64 to avoid truncation.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agodocs: fix xl manpage compilation broken by COLO
Wei Liu [Fri, 1 Apr 2016 14:45:05 +0000 (15:45 +0100)]
docs: fix xl manpage compilation broken by COLO

Rearrange the section to conform with pod syntax. Fix some typos along
the way.

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