]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
13 years agoxen: constify all instances of "struct attribute_group"
Jan Beulich [Wed, 14 Mar 2012 16:34:19 +0000 (12:34 -0400)]
xen: constify all instances of "struct attribute_group"

The functions these get passed to have been taking pointers to const
since at least 2.6.16.

[upstream git commit ead1d01]
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoMerge branch 'stable/xen-pciback-0.6.3.bugfixes' into uek2-merge
Konrad Rzeszutek Wilk [Thu, 19 Apr 2012 21:08:38 +0000 (17:08 -0400)]
Merge branch 'stable/xen-pciback-0.6.3.bugfixes' into uek2-merge

* stable/xen-pciback-0.6.3.bugfixes:
  xen/pcifront: avoid pci_frontend_enable_msix() falsely returning success
  xen/pciback: fix XEN_PCI_OP_enable_msix result
  xen/pciback: Support pci_reset_function, aka FLR or D3 support.
  PCI: Introduce __pci_reset_function_locked to be used when holding device_lock.

13 years agoxen/pcifront: avoid pci_frontend_enable_msix() falsely returning success
Jan Beulich [Mon, 2 Apr 2012 14:22:39 +0000 (15:22 +0100)]
xen/pcifront: avoid pci_frontend_enable_msix() falsely returning success

The original XenoLinux code has always had things this way, and for
compatibility reasons (in particular with a subsequent pciback
adjustment) upstream Linux should behave the same way (allowing for two
distinct error indications to be returned by the backend).

[upstream git commit f09d843]
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/pciback: fix XEN_PCI_OP_enable_msix result
Jan Beulich [Mon, 2 Apr 2012 14:32:22 +0000 (15:32 +0100)]
xen/pciback: fix XEN_PCI_OP_enable_msix result

Prior to 2.6.19 and as of 2.6.31, pci_enable_msix() can return a
positive value to indicate the number of vectors (less than the amount
requested) that can be set up for a given device. Returning this as an
operation value (secondary result) is fine, but (primary) operation
results are expected to be negative (error) or zero (success) according
to the protocol. With the frontend fixed to match the XenoLinux
behavior, the backend can now validly return zero (success) here,
passing the upper limit on the number of vectors in op->value.

[upstream git commit 0ee46ec]
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/pciback: Support pci_reset_function, aka FLR or D3 support.
Konrad Rzeszutek Wilk [Thu, 12 Jan 2012 17:06:47 +0000 (12:06 -0500)]
xen/pciback: Support pci_reset_function, aka FLR or D3 support.

We use the __pci_reset_function_locked to perform the action.
Also on attaching ("bind") and detaching ("unbind") we save and
restore the configuration states. When the device is disconnected
from a guest we use the "pci_reset_function" to also reset the
device before being passed to another guest.

[upstream git commit 1160831]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
13 years agoPCI: Introduce __pci_reset_function_locked to be used when holding device_lock.
Konrad Rzeszutek Wilk [Thu, 12 Jan 2012 17:06:46 +0000 (12:06 -0500)]
PCI: Introduce __pci_reset_function_locked to be used when holding device_lock.

The use case of this is when a driver wants to call FLR when a device
is attached to it using the SysFS "bind" or "unbind" functionality.

The call chain when a user does "bind" looks as so:

 echo "0000:01.07.0" > /sys/bus/pci/drivers/XXXX/bind

and ends up calling:
  driver_bind:
    device_lock(dev);  <=== TAKES LOCK
    XXXX_probe:
         .. pci_enable_device()
         ...__pci_reset_function(), which calls
                 pci_dev_reset(dev, 0):
                        if (!0) {
                                device_lock(dev) <==== DEADLOCK

The __pci_reset_function_locked function allows the the drivers
'probe' function to call the "pci_reset_function" while still holding
the driver mutex lock.

[git commit 6fbf9e7]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
13 years agoxen/acpi: Fix Kconfig dependency on CPU_FREQ
Konrad Rzeszutek Wilk [Sat, 24 Mar 2012 13:18:57 +0000 (09:18 -0400)]
xen/acpi: Fix Kconfig dependency on CPU_FREQ

The functions: "acpi_processor_*" sound like they depend on CONFIG_ACPI_PROCESSOR
but in reality they are exposed when CONFIG_CPU_FREQ=[y|m]. As such
update the Kconfig to have this dependency and fix compile issues:

ERROR: "acpi_processor_unregister_performance" [drivers/xen/xen-acpi-processor.ko] undefined!
ERROR: "acpi_processor_notify_smm" [drivers/xen/xen-acpi-processor.ko] undefined!
ERROR: "acpi_processor_register_performance" [drivers/xen/xen-acpi-processor.ko] undefined!
ERROR: "acpi_processor_preregister_performance" [drivers/xen/xen-acpi-processor.ko] undefined!

Note: We still need the CONFIG_ACPI
Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/acpi-processor: Do not depend on CPU frequency scaling drivers.
Konrad Rzeszutek Wilk [Tue, 13 Mar 2012 17:28:12 +0000 (13:28 -0400)]
xen/acpi-processor: Do not depend on CPU frequency scaling drivers.

With patch "xen/cpufreq: Disable the cpu frequency scaling drivers
from loading." we do not have to worry about said drivers loading
themselves before the xen-acpi-processor driver. Hence we can remove
the default selection (=y if CPU frequency drivers were built-in, or
=m if CPU frequency drivers were built as modules), and just
select =m for the default case.

[git commit 102b208]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/cpufreq: Disable the cpu frequency scaling drivers from loading.
Konrad Rzeszutek Wilk [Wed, 14 Mar 2012 00:06:57 +0000 (20:06 -0400)]
xen/cpufreq: Disable the cpu frequency scaling drivers from loading.

By using the functionality provided by "[CPUFREQ]: provide
disable_cpuidle() function to disable the API."

Under the Xen hypervisor we do not want the initial domain to exercise
the cpufreq scaling drivers. This is b/c the Xen hypervisor is
in charge of doing this as well and we can end up with both the
Linux kernel and the hypervisor trying to change the P-states
leading to weird performance issues.

[upstream 48cdd82]
Acked-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
[v2: Fix compile error spotted by Benjamin Schweikert <b.schweikert@googlemail.com>]

13 years agoprovide disable_cpufreq() function to disable the API.
Konrad Rzeszutek Wilk [Tue, 13 Mar 2012 23:18:39 +0000 (19:18 -0400)]
provide disable_cpufreq() function to disable the API.

useful for disabling cpufreq altogether. The cpu frequency
scaling drivers and cpu frequency governors will fail to register.

[upstream a7b422c]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Dave Jones <davej@redhat.com>
13 years agoxen/merge error: Re-introduce xen-platform-pci driver.
Konrad Rzeszutek Wilk [Thu, 22 Mar 2012 14:23:34 +0000 (10:23 -0400)]
xen/merge error: Re-introduce xen-platform-pci driver.

The merge 98687483f3918349f96697261b491ee41b824871:

    Merge branch 'stable/not-upstreamed' into uek2-merge

    * stable/not-upstreamed:
      Xen: Export host physical CPU information to dom0
      xen/mce: Change the machine check point
      Add mcelog support from xen platform

    Conflicts:
     drivers/xen/Kconfig
     drivers/xen/Makefile

mismerged the Makefile. The end result that the line
obj-$(CONFIG_XEN_PVHVM) += platform_pci.o was removed
leading to no PVonHVM driver to tell QEMU to unplug the device.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agox86/PCI: reduce severity of host bridge window conflict warnings
Bjorn Helgaas [Sat, 2 Jul 2011 16:47:12 +0000 (10:47 -0600)]
x86/PCI: reduce severity of host bridge window conflict warnings

Host bridge windows are top-level resources, so if we find a host bridge
window conflict, it's probably with a hard-coded legacy reservation.
Moving host bridge windows is theoretically possible, but we don't support
it; we just ignore windows with conflicts, and it's not worth making this
a user-visible error.

Reported-and-tested-by: Jools Wills <jools@oxfordinspire.co.uk>
References: https://bugzilla.kernel.org/show_bug.cgi?id=38522
Reported-by: Das <dasfox@gmail.com>
References: https://bugzilla.kernel.org/show_bug.cgi?id=16497
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Fixes Oracle Bug 13818972
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/acpi: Remove the WARN's as they just create noise.
Konrad Rzeszutek Wilk [Wed, 21 Mar 2012 15:43:32 +0000 (11:43 -0400)]
xen/acpi: Remove the WARN's as they just create noise.

When booting the kernel under machines that do not have P-states
we would end up with:

------------[ cut here ]------------
 WARNING: at drivers/xen/xen-acpi-processor.c:504
 xen_acpi_processor_init+0x286/0
 x2e0()
 Hardware name: ProLiant BL460c G6
 Modules linked in:
 Pid: 1, comm: swapper Not tainted 2.6.39-200.0.3.el5uek #1
 Call Trace:
  [<ffffffff8191d056>] ? xen_acpi_processor_init+0x286/0x2e0
  [<ffffffff81068300>] warn_slowpath_common+0x90/0xc0
  [<ffffffff8191cdd0>] ? check_acpi_ids+0x1e0/0x1e0
  [<ffffffff8106834a>] warn_slowpath_null+0x1a/0x20
  [<ffffffff8191d056>] xen_acpi_processor_init+0x286/0x2e0
  [<ffffffff8191cdd0>] ? check_acpi_ids+0x1e0/0x1e0
  [<ffffffff81002168>] do_one_initcall+0xe8/0x130

.. snip..

Which is OK - the machines do not have P-states, so we fail to register
to process the _PXX states. But there is no need to WARN the user
of it.

Oracle BZ# 13871288
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/blkback: Disable DISCARD support for loopback device (but leave for phy).
Konrad Rzeszutek Wilk [Tue, 13 Mar 2012 22:05:58 +0000 (18:05 -0400)]
xen/blkback: Disable DISCARD support for loopback device (but leave for phy).

Until we back-port the changes from 3.3 which alter the loopback device
to support the full gamma of discard attributes. Otherwise we have to
punch through loop device to retrieve the underlaying disk size and
do other nasty things to get the proper information.

Also there is the outstanding issue that Logical Volumes won't pass
through the DISCARD support, so in most cases we can't take advantage of
this code until that gets fixed.

Fixes Oracle BZ#13779884
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoblock: fix patch import error in max_discard_sectors check
Jens Axboe [Sat, 23 Jul 2011 18:34:59 +0000 (20:34 +0200)]
block: fix patch import error in max_discard_sectors check

A '!' snuck in before the unlikely, rendering it useless.

Reported-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
[Fixes BZ#13779884]
Signed-off-b: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

13 years agoblock: eliminate potential for infinite loop in blkdev_issue_discard
Mike Snitzer [Wed, 6 Jul 2011 19:30:50 +0000 (21:30 +0200)]
block: eliminate potential for infinite loop in blkdev_issue_discard

Due to the recently identified overflow in read_capacity_16() it was
possible for max_discard_sectors to be zero but still have discards
enabled on the associated device's queue.

Eliminate the possibility for blkdev_issue_discard to infinitely loop.

Interestingly this issue wasn't identified until a device, whose
discard_granularity was 0 due to read_capacity_16 overflow, was consumed
by blk_stack_limits() to construct limits for a higher-level DM
multipath device.  The multipath device's resulting limits never had the
discard limits stacked because blk_stack_limits() will only do so if
the bottom device's discard_granularity != 0.  This resulted in the
multipath device's limits.max_discard_sectors being 0.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
[Fixes Oracle BZ13779884]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk>
13 years agoconfig: Use the xen-acpi-processor instead of the cpufreq-xen driver.
Konrad Rzeszutek Wilk [Wed, 14 Mar 2012 00:47:44 +0000 (20:47 -0400)]
config: Use the xen-acpi-processor instead of the cpufreq-xen driver.

The xen-acpi-processor (CONFIG_XEN_ACPI_PROCESSOR=y) is a more modern
version of the cpufreq-xen driver that can automatically inhibit
the cpufreq scaling drivers.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/acpi-processor: C and P-state driver that uploads said data to hypervisor.
Konrad Rzeszutek Wilk [Fri, 3 Feb 2012 21:03:20 +0000 (16:03 -0500)]
xen/acpi-processor: C and P-state driver that uploads said data to hypervisor.

This driver solves three problems:
 1). Parse and upload ACPI0007 (or PROCESSOR_TYPE) information to the
     hypervisor - aka P-states (cpufreq data).
 2). Upload the the Cx state information (cpuidle data).
 3). Inhibit CPU frequency scaling drivers from loading.

The reason for wanting to solve 1) and 2) is such that the Xen hypervisor
is the only one that knows the CPU usage of different guests and can
make the proper decision of when to put CPUs and packages in proper states.
Unfortunately the hypervisor has no support to parse ACPI DSDT tables, hence it
needs help from the initial domain to provide this information. The reason
for 3) is that we do not want the initial domain to change P-states while the
hypervisor is doing it as well - it causes rather some funny cases of P-states
transitions.

For this to work, the driver parses the Power Management data and uploads said
information to the Xen hypervisor. It also calls acpi_processor_notify_smm()
to inhibit the other CPU frequency scaling drivers from being loaded.

Everything revolves around the 'struct acpi_processor' structure which
gets updated during the bootup cycle in different stages. At the startup, when
the ACPI parser starts, the C-state information is processed (processor_idle)
and saved in said structure as 'power' element. Later on, the CPU frequency
scaling driver (powernow-k8 or acpi_cpufreq), would call the the
acpi_processor_* (processor_perflib functions) to parse P-states information
and populate in the said structure the 'performance' element.

Since we do not want the CPU frequency scaling drivers from loading
we have to call the acpi_processor_* functions to parse the P-states and
call "acpi_processor_notify_smm" to stop them from loading.

There is also one oddity in this driver which is that under Xen, the
physical online CPU count can be different from the virtual online CPU count.
Meaning that the macros 'for_[online|possible]_cpu' would process only
up to virtual online CPU count. We on the other hand want to process
the full amount of physical CPUs. For that, the driver checks if the ACPI IDs
count is different from the APIC ID count - which can happen if the user
choose to use dom0_max_vcpu argument. In such a case a backup of the PM
structure is used and uploaded to the hypervisor.

[v1-v2: Initial RFC implementations that were posted]
[v3: Changed the name to passthru suggested by Pasi Kärkkäinen <pasik@iki.fi>]
[v4: Added vCPU != pCPU support - aka dom0_max_vcpus support]
[v5: Cleaned up the driver, fix bug under Athlon XP]
[v6: Changed the driver to a CPU frequency governor]
[v7: Jan Beulich <jbeulich@suse.com> suggestion to make it a cpufreq scaling driver
     made me rework it as driver that inhibits cpufreq scaling driver]
[v8: Per Jan's review comments, fixed up the driver]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Conflicts:

drivers/xen/Kconfig
drivers/xen/Makefile
include/xen/interface/platform.h

13 years agoRevert "Merge branch 'stable/cpufreq-xen.v6.rebased' into uek2-merge"
Konrad Rzeszutek Wilk [Wed, 14 Mar 2012 00:43:38 +0000 (20:43 -0400)]
Revert "Merge branch 'stable/cpufreq-xen.v6.rebased' into uek2-merge"

This reverts commit 2fa5344c95525da55cd6896af85541fc23c1bdc0, reversing
changes made to d696e467d97b748cab14eb1b9910bf45f2044033.

As the upstream version has changed course..

and also remove xen/processor-passthru.c which the git commit:
 696e467d97b748cab14eb1b9910bf45f2044033 should have done.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoconfig: Enable Xen's PV USB, SCSI, MCE and Xen CPU freq driver
Konrad Rzeszutek Wilk [Mon, 27 Feb 2012 01:10:59 +0000 (20:10 -0500)]
config: Enable Xen's PV USB, SCSI, MCE and Xen CPU freq driver

drivers and modules. For both OL5 and OL6

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoMerge branch 'stable/cpufreq-xen.v6.rebased' into uek2-merge
Konrad Rzeszutek Wilk [Mon, 27 Feb 2012 01:08:48 +0000 (20:08 -0500)]
Merge branch 'stable/cpufreq-xen.v6.rebased' into uek2-merge

* stable/cpufreq-xen.v6.rebased:
  [CPUFREQ] xen: governor for Xen hypervisor frequency scaling.
  xen/enlighten: Expose MWAIT and MWAIT_LEAF if hypervisor OKs it.

Conflicts:
drivers/xen/Kconfig
drivers/xen/Makefile

13 years ago[CPUFREQ] xen: governor for Xen hypervisor frequency scaling.
Konrad Rzeszutek Wilk [Fri, 3 Feb 2012 21:03:20 +0000 (16:03 -0500)]
[CPUFREQ] xen: governor for Xen hypervisor frequency scaling.

This CPU freq governor leaves the frequency decision to the Xen hypervisor.

To do that the driver parses the Power Management data and uploads said
information to the Xen hypervisor. Then the Xen hypervisor can select the
proper Cx and Pxx states for the initial domain and all other domains.

To upload the information, this CPU frequency driver reads Power Management (PM)
(_Pxx and _Cx) which are populated in the 'struct acpi_processor' structure.
It simply reads the contents of that structure and pass it up the Xen hypervisor.
For that to work we depend on the appropriate CPU frequency scaling driver
to do the heavy-lifting - so that the contents is correct.

The CPU frequency governor it has been loaded also sets up a timer
to check if the ACPI IDs count is different from the APIC ID count - which
can happen if the user choose to use dom0_max_vcpu argument. In such a case
a backup of the PM structure is used and uploaded to the hypervisor.

[v1-v2: Initial RFC implementations that were posted]
[v3: Changed the name to passthru suggested by Pasi Kärkkäinen <pasik@iki.fi>]
[v4: Added vCPU != pCPU support - aka dom0_max_vcpus support]
[v5: Cleaned up the driver, fix bug under Athlon XP]
[v6: Changed the driver to a CPU frequency governor]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Conflicts:

drivers/xen/Kconfig
drivers/xen/Makefile

13 years agoxen/enlighten: Expose MWAIT and MWAIT_LEAF if hypervisor OKs it.
Konrad Rzeszutek Wilk [Tue, 14 Feb 2012 03:26:32 +0000 (22:26 -0500)]
xen/enlighten: Expose MWAIT and MWAIT_LEAF if hypervisor OKs it.

For the hypervisor to take advantage of the MWAIT support it needs
to extract from the ACPI _CST the register address. But the
hypervisor does not have the support to parse DSDT so it relies on
the initial domain (dom0) to parse the ACPI Power Management information
and push it up to the hypervisor. The pushing of the data is done
by the processor_harveset_xen module which parses the information that
the ACPI parser has graciously exposed in 'struct acpi_processor'.

For the ACPI parser to also expose the Cx states for MWAIT, we need
to expose the MWAIT capability (leaf 1). Furthermore we also need to
expose the MWAIT_LEAF capability (leaf 5) for cstate.c to properly
function.

The hypervisor could expose these flags when it traps the XEN_EMULATE_PREFIX
operations, but it can't do it since it needs to be backwards compatible.
Instead we choose to use the native CPUID to figure out if the MWAIT
capability exists and use the XEN_SET_PDC query hypercall to figure out
if the hypervisor wants us to expose the MWAIT_LEAF capability or not.

Note: The XEN_SET_PDC query was implemented in c/s 23783:
"ACPI: add _PDC input override mechanism".

With this in place, instead of
 C3 ACPI IOPORT 415
we get now
 C3:ACPI FFH INTEL MWAIT 0x20

Note: The cpu_idle which would be calling the mwait variants for idling
never gets set b/c we set the default pm_idle to be the hypercall variant.

Acked-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoRevert "Merge branch 'stable/processor-passthru.v5.rebased' into uek2-merge"
Konrad Rzeszutek Wilk [Mon, 27 Feb 2012 01:02:45 +0000 (20:02 -0500)]
Revert "Merge branch 'stable/processor-passthru.v5.rebased' into uek2-merge"

This reverts commit 7a1bf3f7980152408ccf3cf9d2c0fc0816a0afd8, reversing
changes made to 4b91467d57da88ca97d6a96f40d1157ca7fdd034.

The CPU freq approach is better.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoMerge branch 'stable/processor-passthru.v5.rebased' into uek2-merge
Konrad Rzeszutek Wilk [Fri, 24 Feb 2012 07:33:35 +0000 (02:33 -0500)]
Merge branch 'stable/processor-passthru.v5.rebased' into uek2-merge

* stable/processor-passthru.v5.rebased:
  xen/processor-passthru: threads aren't suppose to leave on their own.

13 years agoxen/processor-passthru: threads aren't suppose to leave on their own.
Konrad Rzeszutek Wilk [Fri, 24 Feb 2012 06:59:52 +0000 (01:59 -0500)]
xen/processor-passthru: threads aren't suppose to leave on their own.

otherwise you get this:
WARNING: at /home/konrad/ssd/linux-uek-2.6.39/kernel/workqueue.c:1217 worker_enter_idle+0xd3/0x140()
eth1: no IPv6 routers present
Hardware name: System Product Name
Modules linked in: processor_passthru xen_evtchn iscsi_boot_sysfs iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi libcrc32c crc32c nouveau mxm_wmi video sg sd_mod atl1c e1000e radeon ahci libahci libata fbcon tileblit font ttm bitblit scsi_mod softcursor drm_kms_helper wmi xen_blkfront xen_netfront fb_sys_fops sysimgblt sysfillrect syscopyarea xenfs xen_privcmd [last unloaded: dump_dma]
Pid: 525, comm: kworker/1:1 Not tainted 2.6.39 #5
Call Trace:
 [<ffffffff8107c97a>] warn_slowpath_common+0x7a/0xb0
 [<ffffffff8107c9c5>] warn_slowpath_null+0x15/0x20
 [<ffffffff810920b3>] worker_enter_idle+0xd3/0x140
 [<ffffffff81094cd0>] worker_thread+0x230/0x420
 [<ffffffff81094aa0>] ? manage_workers+0x220/0x220
 [<ffffffff81099596>] kthread+0x96/0xa0
 [<ffffffff81576d24>] kernel_thread_helper+0x4/0x10
 [<ffffffff81575e33>] ? int_ret_from_sys_call+0x7/0x1b
 [<ffffffff8156f9a1>] ? retint_restore_args+0x5/0x6
 [<ffffffff81576d20>] ? gs_change+0x13/0x13

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoconfig: Enable Xen's PV USB, SCSI, MCE and Processor-Passthru
Konrad Rzeszutek Wilk [Fri, 24 Feb 2012 05:40:29 +0000 (00:40 -0500)]
config: Enable Xen's PV USB, SCSI, MCE and Processor-Passthru

modules.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoMerge branch 'stable/not-upstreamed' into uek2-merge
Konrad Rzeszutek Wilk [Fri, 24 Feb 2012 05:35:13 +0000 (00:35 -0500)]
Merge branch 'stable/not-upstreamed' into uek2-merge

* stable/not-upstreamed:
  Xen: Export host physical CPU information to dom0
  xen/mce: Change the machine check point
  Add mcelog support from xen platform

Conflicts:
drivers/xen/Kconfig
drivers/xen/Makefile

13 years agoXen: Export host physical CPU information to dom0
Liu Jinsong [Thu, 8 Dec 2011 14:28:07 +0000 (22:28 +0800)]
Xen: Export host physical CPU information to dom0

This patch rebased from Jeremy's pvops commit
3b34cd19627c6e191b15fd6cb59f997b8db21e19 and
68320323a51c2378aca433c76157d9e66104ff1e

This patch expose host's physical CPU information to dom0 in sysfs, so
that dom0's management tools can control the physical CPU if needed.

It also provides interface in sysfs to logical online/offline a physical CPU.

Notice: The information in dom0 is synced with xen hypervisor asynchronously.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/mce: Change the machine check point
Liu Jinsong [Tue, 6 Dec 2011 21:26:16 +0000 (05:26 +0800)]
xen/mce: Change the machine check point

This patch backport from Jeremy's pvops commit
073349667402682c997394b3fcdbbeb6707f368f

Enable MCE support in dom0, so that if a MCE happen and that MCE impact
dom0, dom0 can receive a vMCE.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Ke, Liping <liping.ke@intel.com>
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoAdd mcelog support from xen platform
Liu Jinsong [Tue, 6 Dec 2011 10:08:12 +0000 (18:08 +0800)]
Add mcelog support from xen platform

This patch backport from Jeremy's pvops commit a5ed1f3dae179158e385e9371462dd65d5e125c5,
which in turn backport from previous xen DOM0(2.6.18) cs: 75e5bfa7fbdc

When a MCE/CMCI error happens (or by polling), the related error
information will be sent to privileged pv-ops domain by XEN. This
patch will help to fetch the xen-logged information by hypercall
and then convert XEN-format log into Linux format MCELOG. It makes
using current available mcelog tools for native Linux possible.

With this patch, after mce/cmci error log information is sent to
pv-ops guest, Running mcelog tools in the guest, you will get same
detailed decoded mce information as in Native Linux.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Ke, Liping <liping.ke@intel.com>
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoMerge branch 'stable/not-upstreamed.drivers' into uek2-merge
Konrad Rzeszutek Wilk [Fri, 24 Feb 2012 05:20:40 +0000 (00:20 -0500)]
Merge branch 'stable/not-upstreamed.drivers' into uek2-merge

* stable/not-upstreamed.drivers:
  usb: xen pvusb driver
  xen/scsi[front|back]: consolidate and simplify struct xenbus_driver instantiation
  xen/scsiback: allow RESERVE/RELEASE commands
  xen/scsiback: vscsi >2TB patch
  xen-scsi[front|back]: Fix warnings and bugs.
  xen/scsi[front|back]: Forgot .owner attribute.
  xen/scsi[front|back]: Initial commit from Novell SLES11SP1 2.6.32 tree.

13 years agoMerge branch 'devel/xen-scsi.v1.0' of git://git.kernel.org/pub/scm/linux/kernel/git...
Konrad Rzeszutek Wilk [Fri, 24 Feb 2012 05:15:16 +0000 (00:15 -0500)]
Merge branch 'devel/xen-scsi.v1.0' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen into stable/not-upstreamed.drivers

* 'devel/xen-scsi.v1.0' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
  xen/scsi[front|back]: consolidate and simplify struct xenbus_driver instantiation
  xen/scsiback: allow RESERVE/RELEASE commands
  xen/scsiback: vscsi >2TB patch
  xen-scsi[front|back]: Fix warnings and bugs.
  xen/scsi[front|back]: Forgot .owner attribute.
  xen/scsi[front|back]: Initial commit from Novell SLES11SP1 2.6.32 tree.

13 years agousb: xen pvusb driver
Nathanael Rensen [Tue, 7 Feb 2012 05:50:24 +0000 (13:50 +0800)]
usb: xen pvusb driver

Port the original Xen PV USB drivers developed by Noboru Iwamatsu
<n_iwamatsu@jp.fujitsu.com> to the Linux pvops kernel. The backend driver
resides in dom0 with access to the physical USB device. The frontend driver
resides in a domU to provide paravirtualised access to physical USB devices.

For usage, see http://wiki.xensource.com/xenwiki/XenUSBPassthrough.

Signed-off-by: Nathanael Rensen <nathanael@polymorpheus.com>.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Conflicts:

drivers/usb/host/Kconfig
drivers/usb/host/Makefile

13 years agoMerge branch 'stable/not-upstreamed' into uek2-merge
Konrad Rzeszutek Wilk [Fri, 24 Feb 2012 04:54:24 +0000 (23:54 -0500)]
Merge branch 'stable/not-upstreamed' into uek2-merge

* stable/not-upstreamed:
  x86/microcode: check proper return code.
  xen: add CPU microcode update driver
  xen: add dom0_op hypercall
  xen/acpi: Domain0 acpi parser related platform hypercall

Conflicts:
arch/x86/xen/Kconfig
include/xen/interface/platform.h

Note: The approach in upstream is to get rid of the microcode
driver altogether and do at early bootup. Even as early as
syslinux/pxeboot or initial kernel image. But those patches
are not yet ready.

13 years agoMerge branch 'devel/acpi-s3.v4.rebased' into uek2-merge
Konrad Rzeszutek Wilk [Fri, 24 Feb 2012 04:54:01 +0000 (23:54 -0500)]
Merge branch 'devel/acpi-s3.v4.rebased' into uek2-merge

* devel/acpi-s3.v4.rebased:
  xen/pci:use hypercall PHYSDEVOP_restore_msi_ext to restore MSI/MSI-X vectors
  xen/acpi/sleep: Register to the acpi_suspend_lowlevel a callback.
  xen/acpi/sleep: Enable ACPI sleep via the __acpi_override_sleep
  xen/acpi: Domain0 acpi parser related platform hypercall
  xen: Utilize the restore_msi_irqs hook.
  x86/acpi/sleep: Provide registration for acpi_suspend_lowlevel.
  x86, acpi, tboot: Have a ACPI sleep override instead of calling tboot_sleep.
  x86: Expand the x86_msi_ops to have a restore MSIs.

Conflicts:
drivers/xen/Makefile
include/xen/interface/physdev.h
include/xen/interface/platform.h

13 years agoMerge branch 'stable/processor-passthru.v5.rebased' into uek2-merge
Konrad Rzeszutek Wilk [Fri, 24 Feb 2012 04:49:59 +0000 (23:49 -0500)]
Merge branch 'stable/processor-passthru.v5.rebased' into uek2-merge

* stable/processor-passthru.v5.rebased:
  xen/processor-passthru: Provide an driver that passes struct acpi_processor data to the hypervisor.
  xen/enlighten: Expose MWAIT and MWAIT_LEAF if hypervisor OKs it.
  xen/setup/pm/acpi: Remove the call to boot_option_idle_override.
  xen/acpi: Domain0 acpi parser related platform hypercall
  xen/pm_idle: Make pm_idle be default_idle under Xen.
  cpuidle: stop depending on pm_idle
  cpuidle: replace xen access to x86 pm_idle and default_idle
  cpuidle: create bootparam "cpuidle.off=1"

Conflicts:
drivers/xen/Kconfig
drivers/xen/Makefile
include/xen/interface/platform.h

13 years agoxen/processor-passthru: Provide an driver that passes struct acpi_processor data...
Konrad Rzeszutek Wilk [Fri, 24 Feb 2012 04:47:20 +0000 (23:47 -0500)]
xen/processor-passthru: Provide an driver that passes struct acpi_processor data to the hypervisor.

The ACPI processor processes the _Pxx and the _Cx state information
which are populated in the 'struct acpi_processor' per-cpu structure.
We read the contents of that structure and pass it up the Xen hypervisor.

The ACPI processor along with the CPU freq driver does all the heavy-lifting
for us (filtering, calling ACPI functions, etc) so that the contents is correct.
After we are done parsing the information, we wait in case of hotplug CPUs
get loaded and then pass that information to the hypervisor.

[v1-v2: Initial RFC implementations that were posted]
[v3: Changed the name to passthru suggested by Pasi Kärkkäinen <pasik@iki.fi>]
[v4: Added vCPU != pCPU support - aka dom0_max_vcpus support]
[v5: Cleaned up the driver, fix bug under Athlon XP]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Conflicts:

drivers/xen/Kconfig
drivers/xen/Makefile

13 years agoxen/enlighten: Expose MWAIT and MWAIT_LEAF if hypervisor OKs it.
Konrad Rzeszutek Wilk [Tue, 14 Feb 2012 03:26:32 +0000 (22:26 -0500)]
xen/enlighten: Expose MWAIT and MWAIT_LEAF if hypervisor OKs it.

For the hypervisor to take advantage of the MWAIT support it needs
to extract from the ACPI _CST the register address. But the
hypervisor does not have the support to parse DSDT so it relies on
the initial domain (dom0) to parse the ACPI Power Management information
and push it up to the hypervisor. The pushing of the data is done
by the processor_harveset_xen module which parses the information that
the ACPI parser has graciously exposed in 'struct acpi_processor'.

For the ACPI parser to also expose the Cx states for MWAIT, we need
to expose the MWAIT capability (leaf 1). Furthermore we also need to
expose the MWAIT_LEAF capability (leaf 5) for cstate.c to properly
function.

The hypervisor could expose these flags when it traps the XEN_EMULATE_PREFIX
operations, but it can't do it since it needs to be backwards compatible.
Instead we choose to use the native CPUID to figure out if the MWAIT
capability exists and use the XEN_SET_PDC query hypercall to figure out
if the hypervisor wants us to expose the MWAIT_LEAF capability or not.

Note: The XEN_SET_PDC query was implemented in c/s 23783:
"ACPI: add _PDC input override mechanism".

With this in place, instead of
 C3 ACPI IOPORT 415
we get now
 C3:ACPI FFH INTEL MWAIT 0x20

Note: The cpu_idle which would be calling the mwait variants for idling
never gets set b/c we set the default pm_idle to be the hypercall variant.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/setup/pm/acpi: Remove the call to boot_option_idle_override.
Konrad Rzeszutek Wilk [Mon, 23 Jan 2012 15:53:57 +0000 (10:53 -0500)]
xen/setup/pm/acpi: Remove the call to boot_option_idle_override.

We needed that call in the past to force the kernel to use
default_idle (which called safe_halt, which called xen_safe_halt).

But set_pm_idle_to_default() does now that, so there is no need
to use this boot option operand.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/acpi: Domain0 acpi parser related platform hypercall
Yu Ke [Wed, 24 Mar 2010 18:01:13 +0000 (11:01 -0700)]
xen/acpi: Domain0 acpi parser related platform hypercall

This patches implements the xen_platform_op hypercall, to pass the parsed
ACPI info to hypervisor.

Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Tian Kevin <kevin.tian@intel.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
[v1: Added DEFINE_GUEST.. in appropiate headers]
[v2: Ripped out typedefs]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/pm_idle: Make pm_idle be default_idle under Xen.
Konrad Rzeszutek Wilk [Mon, 21 Nov 2011 23:02:02 +0000 (18:02 -0500)]
xen/pm_idle: Make pm_idle be default_idle under Xen.

The idea behind commit d91ee5863b71 ("cpuidle: replace xen access to x86
pm_idle and default_idle") was to have one call - disable_cpuidle()
which would make pm_idle not be molested by other code.  It disallows
cpuidle_idle_call to be set to pm_idle (which is excellent).

But in the select_idle_routine() and idle_setup(), the pm_idle can still
be set to either: amd_e400_idle, mwait_idle or default_idle.  This
depends on some CPU flags (MWAIT) and in AMD case on the type of CPU.

In case of mwait_idle we can hit some instances where the hypervisor
(Amazon EC2 specifically) sets the MWAIT and we get:

  Brought up 2 CPUs
  invalid opcode: 0000 [#1] SMP

  Pid: 0, comm: swapper Not tainted 3.1.0-0.rc6.git0.3.fc16.x86_64 #1
  RIP: e030:[<ffffffff81015d1d>]  [<ffffffff81015d1d>] mwait_idle+0x6f/0xb4
  ...
  Call Trace:
   [<ffffffff8100e2ed>] cpu_idle+0xae/0xe8
   [<ffffffff8149ee78>] cpu_bringup_and_idle+0xe/0x10
  RIP  [<ffffffff81015d1d>] mwait_idle+0x6f/0xb4
   RSP <ffff8801d28ddf10>

In the case of amd_e400_idle we don't get so spectacular crashes, but we
do end up making an MSR which is trapped in the hypervisor, and then
follow it up with a yield hypercall.  Meaning we end up going to
hypervisor twice instead of just once.

The previous behavior before v3.0 was that pm_idle was set to
default_idle regardless of select_idle_routine/idle_setup.

We want to do that, but only for one specific case: Xen.  This patch
does that.

Fixes RH BZ #739499 and Ubuntu #881076
Reported-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agocpuidle: stop depending on pm_idle
Len Brown [Fri, 1 Apr 2011 23:34:59 +0000 (19:34 -0400)]
cpuidle: stop depending on pm_idle

cpuidle users should call cpuidle_call_idle() directly
rather than via (pm_idle)() function pointer.

Architecture may choose to continue using (pm_idle)(),
but cpuidle need not depend on it:

  my_arch_cpu_idle()
...
if(cpuidle_call_idle())
pm_idle();

cc: Kevin Hilman <khilman@deeprootsystems.com>
cc: Paul Mundt <lethal@linux-sh.org>
cc: x86@kernel.org
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
13 years agocpuidle: replace xen access to x86 pm_idle and default_idle
Len Brown [Fri, 1 Apr 2011 22:28:35 +0000 (18:28 -0400)]
cpuidle: replace xen access to x86 pm_idle and default_idle

When a Xen Dom0 kernel boots on a hypervisor, it gets access
to the raw-hardware ACPI tables.  While it parses the idle tables
for the hypervisor's beneift, it uses HLT for its own idle.

Rather than have xen scribble on pm_idle and access default_idle,
have it simply disable_cpuidle() so acpi_idle will not load and
architecture default HLT will be used.

cc: xen-devel@lists.xensource.com
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
13 years agocpuidle: create bootparam "cpuidle.off=1"
Len Brown [Fri, 1 Apr 2011 22:13:10 +0000 (18:13 -0400)]
cpuidle: create bootparam "cpuidle.off=1"

useful for disabling cpuidle to fall back
to architecture-default idle loop

cpuidle drivers and governors will fail to register.
on x86 they'll say so:

intel_idle: intel_idle yielding to (null)
ACPI: acpi_idle yielding to (null)

Signed-off-by: Len Brown <len.brown@intel.com>
13 years agoRevert "Merge branch 'stable/acpi-cpufreq.v3.rebased' into uek2-merge"
Konrad Rzeszutek Wilk [Fri, 24 Feb 2012 04:26:17 +0000 (23:26 -0500)]
Revert "Merge branch 'stable/acpi-cpufreq.v3.rebased' into uek2-merge"

This reverts commit 3acb13af318b052c429430359fec3871b5ad2800, reversing
changes made to c1c344a8ba3c301fe799bfe82ac384e2a18b83e4.

Instead we will use the one that is going upstream.

13 years agox86/microcode: check proper return code.
Ben Guthro [Thu, 3 Nov 2011 15:06:56 +0000 (11:06 -0400)]
x86/microcode: check proper return code.

After pulling in this change from your tree, I found the following bug,
when checking an enum value, which should be considered before inclusion:

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen: add CPU microcode update driver
Jeremy Fitzhardinge [Sat, 28 Mar 2009 00:39:15 +0000 (17:39 -0700)]
xen: add CPU microcode update driver

Xen does all the hard work for us, including choosing the right update
method for this cpu type and actually doing it for all cpus.  We just
need to supply it with the firmware blob.

Because Xen updates all CPUs (and the kernel's virtual cpu numbers have
no fixed relationship with the underlying physical cpus), we only bother
doing anything for cpu "0".

[ Impact: allow CPU microcode update in Xen dom0 ]
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
13 years agoxen: add dom0_op hypercall
Jeremy Fitzhardinge [Fri, 23 Sep 2011 18:44:17 +0000 (11:44 -0700)]
xen: add dom0_op hypercall

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
13 years agoxen/acpi: Domain0 acpi parser related platform hypercall
Yu Ke [Wed, 24 Mar 2010 18:01:13 +0000 (11:01 -0700)]
xen/acpi: Domain0 acpi parser related platform hypercall

This patches implements the xen_platform_op hypercall, to pass the parsed
ACPI info to hypervisor.

Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Tian Kevin <kevin.tian@intel.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
[v1: Added DEFINE_GUEST.. in appropiate headers]
[v2: Ripped out typedefs]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoMerge branch 'stable/xen-pciback-0.6.3.bugfixes' into uek2-merge
Konrad Rzeszutek Wilk [Wed, 15 Feb 2012 16:01:35 +0000 (11:01 -0500)]
Merge branch 'stable/xen-pciback-0.6.3.bugfixes' into uek2-merge

* stable/xen-pciback-0.6.3.bugfixes:
  xen/pci[front|back]: Use %d instead of %1x for displaying PCI devfn.

13 years agoMerge branch 'stable/bug.fixes-3.3.rebased' into uek2-merge
Konrad Rzeszutek Wilk [Wed, 15 Feb 2012 15:48:39 +0000 (10:48 -0500)]
Merge branch 'stable/bug.fixes-3.3.rebased' into uek2-merge

* stable/bug.fixes-3.3.rebased:
  xen pvhvm: do not remap pirqs onto evtchns if !xen_have_vector_callback
  xen/smp: Fix CPU online/offline bug triggering a BUG: scheduling while atomic.
  xen/bootup: During bootup suppress XENBUS: Unable to read cpu state

13 years agoMerge branch 'stable/for-linus-3.3.rebased' into uek2-merge
Konrad Rzeszutek Wilk [Wed, 15 Feb 2012 15:48:24 +0000 (10:48 -0500)]
Merge branch 'stable/for-linus-3.3.rebased' into uek2-merge

* stable/for-linus-3.3.rebased:
  xenbus_dev: add missing error check to watch handling

13 years agoxenbus_dev: add missing error check to watch handling
Jan Beulich [Tue, 24 Jan 2012 13:52:42 +0000 (13:52 +0000)]
xenbus_dev: add missing error check to watch handling

So far only the watch path was checked to be zero terminated, while
the watch token was merely assumed to be.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/pci[front|back]: Use %d instead of %1x for displaying PCI devfn.
Konrad Rzeszutek Wilk [Wed, 25 Jan 2012 21:00:00 +0000 (16:00 -0500)]
xen/pci[front|back]: Use %d instead of %1x for displaying PCI devfn.

.. as the rest of the kernel is using that format.

Suggested-by: Марк Коренберг <socketpair@gmail.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen pvhvm: do not remap pirqs onto evtchns if !xen_have_vector_callback
Stefano Stabellini [Mon, 30 Jan 2012 14:31:46 +0000 (14:31 +0000)]
xen pvhvm: do not remap pirqs onto evtchns if !xen_have_vector_callback

CC: stable@kernel.org #2.6.37 and onwards
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/smp: Fix CPU online/offline bug triggering a BUG: scheduling while atomic.
Konrad Rzeszutek Wilk [Wed, 1 Feb 2012 20:56:54 +0000 (15:56 -0500)]
xen/smp: Fix CPU online/offline bug triggering a BUG: scheduling while atomic.

When a user offlines a VCPU and then onlines it, we get:

NMI watchdog disabled (cpu2): hardware events not enabled
BUG: scheduling while atomic: swapper/2/0/0x00000002
Modules linked in: dm_multipath dm_mod xen_evtchn iscsi_boot_sysfs iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi scsi_mod libcrc32c crc32c radeon fbco
 ttm bitblit softcursor drm_kms_helper xen_blkfront xen_netfront xen_fbfront fb_sys_fops sysimgblt sysfillrect syscopyarea xen_kbdfront xenfs [last unloaded:

Pid: 0, comm: swapper/2 Tainted: G           O 3.2.0phase15.1-00003-gd6f7f5b-dirty #4
Call Trace:
 [<ffffffff81070571>] __schedule_bug+0x61/0x70
 [<ffffffff8158eb78>] __schedule+0x798/0x850
 [<ffffffff8158ed6a>] schedule+0x3a/0x50
 [<ffffffff810349be>] cpu_idle+0xbe/0xe0
 [<ffffffff81583599>] cpu_bringup_and_idle+0xe/0x10

The reason for this should be obvious from this call-chain:
cpu_bringup_and_idle:
 \- cpu_bringup
  |   \-[preempt_disable]
  |
  |- cpu_idle
       \- play_dead [assuming the user offlined the VCPU]
       |     \
       |     +- (xen_play_dead)
       |          \- HYPERVISOR_VCPU_off [so VCPU is dead, once user
       |          |                       onlines it starts from here]
       |          \- cpu_bringup [preempt_disable]
       |
       +- preempt_enable_no_reschedule()
       +- schedule()
       \- preempt_enable()

So we have two preempt_disble() and one preempt_enable(). Calling
preempt_enable() after the cpu_bringup() in the xen_play_dead
fixes the imbalance.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/bootup: During bootup suppress XENBUS: Unable to read cpu state
Konrad Rzeszutek Wilk [Wed, 1 Feb 2012 21:07:41 +0000 (16:07 -0500)]
xen/bootup: During bootup suppress XENBUS: Unable to read cpu state

When the initial domain starts, it prints (depending on the
amount of CPUs) a slew of
XENBUS: Unable to read cpu state
XENBUS: Unable to read cpu state
XENBUS: Unable to read cpu state
XENBUS: Unable to read cpu state

which provide no useful information - as the error is a valid
issue - but not on the initial domain. The reason is that the
XenStore is not accessible at that time (it is after all the
first guest) so the CPU hotplug watch cannot parse "availability/cpu"
attribute.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoMerge branch 'stable/for-linus-3.3.rebased' into uek2-merge
Konrad Rzeszutek Wilk [Thu, 2 Feb 2012 20:03:05 +0000 (15:03 -0500)]
Merge branch 'stable/for-linus-3.3.rebased' into uek2-merge

* stable/for-linus-3.3.rebased: (39 commits)
  Merge conflict resolved. Somehow the letter 's' slipped in the Makefile. This fixes the compile issues.
  xen/events: BUG() when we can't allocate our event->irq array.
  xen/granttable: Disable grant v2 for HVM domains.
  xen-blkfront: Use kcalloc instead of kzalloc to allocate array
  xen/pciback: Expand the warning message to include domain id.
  xen/pciback: Fix "device has been assigned to X domain!" warning
  xen/xenbus: don't reimplement kvasprintf via a fixed size buffer
  xenbus: maximum buffer size is XENSTORE_PAYLOAD_MAX
  xen/xenbus: Reject replies with payload > XENSTORE_PAYLOAD_MAX.
  Xen: consolidate and simplify struct xenbus_driver instantiation
  xen-gntalloc: introduce missing kfree
  xen/xenbus: Fix compile error - missing header for xen_initial_domain()
  xen/netback: Enable netback on HVM guests
  xen/grant-table: Support mappings required by blkback
  xenbus: Use grant-table wrapper functions
  xenbus: Support HVM backends
  xen/xenbus-frontend: Fix compile error with randconfig
  xen/xenbus-frontend: Make error message more clear
  xen/privcmd: Remove unused support for arch specific privcmp mmap
  xen: Add xenbus_backend device
  ...

Conflicts:
drivers/xen/Kconfig
drivers/xen/balloon.c

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoMerge conflict resolved. Somehow the letter 's' slipped in
Konrad Rzeszutek Wilk [Thu, 2 Feb 2012 19:59:22 +0000 (14:59 -0500)]
Merge conflict resolved. Somehow the letter 's' slipped in
the Makefile. This fixes the compile issues.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoMerge branch 'stable/docs-for-3.3.rebase' into stable/for-linus-3.3.rebased
Konrad Rzeszutek Wilk [Thu, 2 Feb 2012 19:59:08 +0000 (14:59 -0500)]
Merge branch 'stable/docs-for-3.3.rebase' into stable/for-linus-3.3.rebased

* stable/docs-for-3.3.rebase:
  xen: document backend sysfs files
  xen: document balloon driver sysfs files

13 years agoMerge branch 'stable/bug.fixes-3.2.rebased' into stable/for-linus-3.3.rebased
Konrad Rzeszutek Wilk [Thu, 2 Feb 2012 19:36:50 +0000 (14:36 -0500)]
Merge branch 'stable/bug.fixes-3.2.rebased' into stable/for-linus-3.3.rebased

* stable/bug.fixes-3.2.rebased:
  xen/events: BUG() when we can't allocate our event->irq array.

13 years agoxen/events: BUG() when we can't allocate our event->irq array.
Konrad Rzeszutek Wilk [Thu, 29 Sep 2011 17:31:21 +0000 (13:31 -0400)]
xen/events: BUG() when we can't allocate our event->irq array.

In case we can't allocate we are doomed. We should BUG_ON
instead of trying to dereference it later on.

Acked-by: Ian Campbell <ian.campbell@citrix.com>
[v1: Use BUG_ON instead of BUG]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/granttable: Disable grant v2 for HVM domains.
Konrad Rzeszutek Wilk [Wed, 25 Jan 2012 05:13:20 +0000 (00:13 -0500)]
xen/granttable: Disable grant v2 for HVM domains.

As proper scaffolding for supporting error status is not yet
implemented.

BUG: unable to handle kernel NULL pointer dereference at 0000000000000400
IP: [<ffffffff81375ae9>] gnttab_end_foreign_access_ref_v2+0x29/0x40
PGD 32aa3067 PUD 32a87067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
CPU 0
Modules linked in: sg sr_mod cdrom ata_generic ata_piix libata scsi_mod xen_blkfront xen_netfront fb_sys_fops sysimgblt sysfillrect syscopyarea xen_kbdfront
cmd

Pid: 2307, comm: ip Not tainted 3.3.0-rc1 #1 Xen HVM domU
RIP: 0010:[<ffffffff81375ae9>]  [<ffffffff81375ae9>] gnttab_end_foreign_access_ref_v2+0x29/0x40
RSP: 0018:ffff88003be03d38  EFLAGS: 00010206
RAX: 0000000000000000 RBX: ffff880033210640 RCX: 0000000000000040
RDX: 0000000000002000 RSI: 0000000000000000 RDI: 0000000000000200
RBP: ffff88003be03d38 R08: 0000000000000101 R09: 0000000000000000
R10: dead000000100100 R11: 0000000000000000 R12: ffff88003be03e48
R13: 0000000000000001 R14: ffff880039461c00 R15: 0000000000000200
FS:  00007fb1f84ec700(0000) GS:ffff88003be00000(0000) knlGS:0000000000000000
...

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoMerge branch 'stable/xen-block.rebase' into stable/for-linus-3.3.rebased
Konrad Rzeszutek Wilk [Thu, 2 Feb 2012 19:28:10 +0000 (14:28 -0500)]
Merge branch 'stable/xen-block.rebase' into stable/for-linus-3.3.rebased

* stable/xen-block.rebase:
  xen-blkfront: Use kcalloc instead of kzalloc to allocate array

13 years agoxen-blkfront: Use kcalloc instead of kzalloc to allocate array
Thomas Meyer [Tue, 29 Nov 2011 21:08:00 +0000 (22:08 +0100)]
xen-blkfront: Use kcalloc instead of kzalloc to allocate array

The advantage of kcalloc is, that will prevent integer overflows which could
result from the multiplication of number of elements and size and it is also
a bit nicer to read.

The semantic patch that makes this change is available
in https://lkml.org/lkml/2011/11/25/107

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
[v1: Seperated the drivers/block/cciss_scsi.c out of this patch]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/pciback: Expand the warning message to include domain id.
Konrad Rzeszutek Wilk [Wed, 4 Jan 2012 19:16:45 +0000 (14:16 -0500)]
xen/pciback: Expand the warning message to include domain id.

When a PCI device is transferred to another domain and it is still
in usage (from the internal perspective), mention which other
domain is using it to aid in debugging.

[v2: Truncate the verbose message per Jan Beulich suggestion]
[v3: Suggestions from Ian Campbell on the wording]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
13 years agoxen/pciback: Fix "device has been assigned to X domain!" warning
Konrad Rzeszutek Wilk [Wed, 4 Jan 2012 20:11:02 +0000 (15:11 -0500)]
xen/pciback: Fix "device has been assigned to X domain!" warning

The full warning is:
"pciback 0000:05:00.0: device has been assigned to 2 domain! Over-writting the ownership, but beware."

which is correct - the previous domain that was using the device
forgot to unregister the ownership. This patch fixes this by
calling the unregister ownership function when the PCI device is
relinquished from the guest domain.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/xenbus: don't reimplement kvasprintf via a fixed size buffer
Ian Campbell [Wed, 4 Jan 2012 11:39:52 +0000 (11:39 +0000)]
xen/xenbus: don't reimplement kvasprintf via a fixed size buffer

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Haogang Chen <haogangchen@gmail.com>
Acked-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxenbus: maximum buffer size is XENSTORE_PAYLOAD_MAX
Ian Campbell [Wed, 4 Jan 2012 11:39:51 +0000 (11:39 +0000)]
xenbus: maximum buffer size is XENSTORE_PAYLOAD_MAX

Use this now that it is defined even though it happens to be == PAGE_SIZE.

The code which takes requests from userspace already validates against the size
of this buffer so no further checks are required to ensure that userspace
requests comply with the protocol in this respect.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Haogang Chen <haogangchen@gmail.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/xenbus: Reject replies with payload > XENSTORE_PAYLOAD_MAX.
Ian Campbell [Wed, 4 Jan 2012 09:34:49 +0000 (09:34 +0000)]
xen/xenbus: Reject replies with payload > XENSTORE_PAYLOAD_MAX.

Haogang Chen found out that:

 There is a potential integer overflow in process_msg() that could result
 in cross-domain attack.

  body = kmalloc(msg->hdr.len + 1, GFP_NOIO | __GFP_HIGH);

 When a malicious guest passes 0xffffffff in msg->hdr.len, the subsequent
 call to xb_read() would write to a zero-length buffer.

 The other end of this connection is always the xenstore backend daemon
 so there is no guest (malicious or otherwise) which can do this. The
 xenstore daemon is a trusted component in the system.

 However this seem like a reasonable robustness improvement so we should
 have it.

And Ian when read the API docs found that:
        The payload length (len field of the header) is limited to 4096
        (XENSTORE_PAYLOAD_MAX) in both directions.  If a client exceeds the
        limit, its xenstored connection will be immediately killed by
        xenstored, which is usually catastrophic from the client's point of
        view.  Clients (particularly domains, which cannot just reconnect)
        should avoid this.

so this patch checks against that instead.

This also avoids a potential integer overflow pointed out by Haogang Chen.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Haogang Chen <haogangchen@gmail.com>
CC: stable@kernel.org
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoXen: consolidate and simplify struct xenbus_driver instantiation
Jan Beulich [Thu, 22 Dec 2011 09:08:13 +0000 (09:08 +0000)]
Xen: consolidate and simplify struct xenbus_driver instantiation

The 'name', 'owner', and 'mod_name' members are redundant with the
identically named fields in the 'driver' sub-structure. Rather than
switching each instance to specify these fields explicitly, introduce
a macro to simplify this.

Eliminate further redundancy by allowing the drvname argument to
DEFINE_XENBUS_DRIVER() to be blank (in which case the first entry from
the ID table will be used for .driver.name).

Also eliminate the questionable xenbus_register_{back,front}end()
wrappers - their sole remaining purpose was the checking of the
'owner' field, proper setting of which shouldn't be an issue anymore
when the macro gets used.

v2: Restore DRV_NAME for the driver name in xen-pciback.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoMerge branch 'stable/xen-pciback-0.6.3.bugfixes' into stable/for-linus-3.3.rebased
Konrad Rzeszutek Wilk [Thu, 2 Feb 2012 19:21:59 +0000 (14:21 -0500)]
Merge branch 'stable/xen-pciback-0.6.3.bugfixes' into stable/for-linus-3.3.rebased

* stable/xen-pciback-0.6.3.bugfixes: (22 commits)
  xen/pciback: Check if the device is found instead of blindly assuming so.
  xen/pciback: Do not dereference psdev during printk when it is NULL.
  xen/pciback: double lock typo
  xen/pciback: use mutex rather than spinlock in vpci backend
  xen/pciback: Use mutexes when working with Xenbus state transitions.
  xen/pciback: miscellaneous adjustments
  xen/pciback: use mutex rather than spinlock in passthrough backend
  xen/pciback: use resource_size()
  xen/pciback: remove duplicated #include
  xen/pciback: Have 'passthrough' option instead of XEN_PCIDEV_BACKEND_PASS and XEN_PCIDEV_BACKEND_VPCI
  xen/pciback: Remove the DEBUG option.
  xen/pciback: Drop two backends, squash and cleanup some code.
  xen/pciback: Print out the MSI/MSI-X (PIRQ) values
  xen/pciback: Don't setup an fake IRQ handler for SR-IOV devices.
  xen: rename pciback module to xen-pciback.
  xen/pciback: Fine-grain the spinlocks and fix BUG: scheduling while atomic cases.
  xen/pciback: Allocate IRQ handler for device that is shared with guest.
  xen/pciback: Disable MSI/MSI-X when reseting a device
  xen/pciback: guest SR-IOV support for PV guest
  xen/pciback: Register the owner (domain) of the PCI device.
  ...

Conflicts:
drivers/xen/Kconfig
drivers/xen/Makefile

13 years agoMerge branch 'stable/xen-block.rebase' into stable/for-linus-3.3.rebased
Konrad Rzeszutek Wilk [Thu, 2 Feb 2012 19:20:07 +0000 (14:20 -0500)]
Merge branch 'stable/xen-block.rebase' into stable/for-linus-3.3.rebased

* stable/xen-block.rebase: (21 commits)
  xen-blkback: Don't disconnect backend until state switched to XenbusStateClosed.
  block: xen-blkback: use API provided by xenbus module to map rings
  xen-blkback: convert hole punching to discard request on loop devices
  xen/blkback: Move processing of BLKIF_OP_DISCARD from dispatch_rw_block_io
  xen/blk[front|back]: Enhance discard support with secure erasing support.
  xen/blk[front|back]: Squash blkif_request_rw and blkif_request_discard together
  xen/blkback: Fix two races in the handling of barrier requests.
  xen/blkback: Check for proper operation.
  xen/blkback: Fix the inhibition to map pages when discarding sector ranges.
  xen/blkback: Report VBD_WSECT (wr_sect) properly.
  xen/blkback: Support 'feature-barrier' aka old-style BARRIER requests.
  xen-blkfront: plug device number leak in xlblk_init() error path
  xen-blkfront: If no barrier or flush is supported, use invalid operation.
  xen-blkback: use kzalloc() in favor of kmalloc()+memset()
  xen-blkback: fixed indentation and comments
  xen-blkfront: fix a deadlock while handling discard response
  xen-blkfront: Handle discard requests.
  xen-blkback: Implement discard requests ('feature-discard')
  xen-blkfront: add BLKIF_OP_DISCARD and discard request struct
  xen/blkback: Add module alias for autoloading
  ...

13 years agoxen-gntalloc: introduce missing kfree
Julia Lawall [Fri, 23 Dec 2011 17:39:29 +0000 (18:39 +0100)]
xen-gntalloc: introduce missing kfree

Error handling code following a kmalloc should free the allocated data.
Out_unlock is used on both success and failure, so free vm_priv before
jumping to that label.

A simplified version of the semantic match that finds the problem is as
follows: (http://coccinelle.lip6.fr)

// <smpl>
@r exists@
local idexpression x;
statement S;
identifier f1;
position p1,p2;
expression *ptr != NULL;
@@

x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
<... when != x
     when != if (...) { <+...x...+> }
x->f1
...>
(
 return \(0\|<+...x...+>\|ptr\);
|
 return@p2 ...;
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
[v1: Altered the description a bit]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/xenbus: Fix compile error - missing header for xen_initial_domain()
Konrad Rzeszutek Wilk [Wed, 21 Dec 2011 19:19:47 +0000 (14:19 -0500)]
xen/xenbus: Fix compile error - missing header for xen_initial_domain()

drivers/xen/xenbus/xenbus_dev_backend.c:74:2: error: implicit declaration of function 'xen_initial_domain'

Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/netback: Enable netback on HVM guests
Daniel De Graaf [Wed, 14 Dec 2011 20:12:13 +0000 (15:12 -0500)]
xen/netback: Enable netback on HVM guests

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/grant-table: Support mappings required by blkback
Daniel De Graaf [Wed, 14 Dec 2011 20:12:11 +0000 (15:12 -0500)]
xen/grant-table: Support mappings required by blkback

Add support for mappings without GNTMAP_contains_pte. This was not
supported because the unmap operation assumed that this flag was being
used; adding a parameter to the unmap operation to allow the PTE
clearing to be disabled is sufficient to make unmap capable of
supporting either mapping type.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
[v1: Fix cleanpatch warnings]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxenbus: Use grant-table wrapper functions
Daniel De Graaf [Wed, 14 Dec 2011 20:12:10 +0000 (15:12 -0500)]
xenbus: Use grant-table wrapper functions

For xenbus_{map,unmap}_ring to work on HVM, the grant table operations
must be set up using the gnttab_set_{map,unmap}_op functions instead of
directly populating the fields of gnttab_map_grant_ref. These functions
simply populate the structure on paravirtualized Xen; however, on HVM
they must call __pa() on vaddr when populating op->host_addr because the
hypervisor cannot directly interpret guest-virtual addresses.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
[v1: Fixed cleanpatch error]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxenbus: Support HVM backends
Daniel De Graaf [Mon, 19 Dec 2011 19:55:14 +0000 (14:55 -0500)]
xenbus: Support HVM backends

Add HVM implementations of xenbus_(map,unmap)_ring_v(alloc,free) so
that ring mappings can be done without using GNTMAP_contains_pte which
is not supported on HVM.  This also removes the need to use vmlist_lock
on PV by tracking the allocated xenbus rings.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
[v1: Fix compile error when XENBUS_FRONTEND is defined as module]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoMerge branch 'stable/drivers-3.2.rebased' into stable/for-linus-3.3.rebased
Konrad Rzeszutek Wilk [Thu, 2 Feb 2012 19:16:32 +0000 (14:16 -0500)]
Merge branch 'stable/drivers-3.2.rebased' into stable/for-linus-3.3.rebased

* stable/drivers-3.2.rebased:
  xen: use static initializers in xen-balloon.c
  xenbus: don't rely on xen_initial_domain to detect local xenstore
  xenbus: Fix loopback event channel assuming domain 0
  xen/pv-on-hvm:kexec: Fix implicit declaration of function 'xen_hvm_domain'
  xen/pv-on-hvm kexec: add xs_reset_watches to shutdown watches from old kernel
  xen/pv-on-hvm kexec: update xs_wire.h:xsd_sockmsg_type from xen-unstable
  xen/pv-on-hvm kexec+kdump: reset PV devices in kexec or crash kernel
  xen/pv-on-hvm kexec: rebind virqs to existing eventchannel ports
  xen/pv-on-hvm kexec: prevent crash in xenwatch_thread() when stale watch events arrive

Conflicts:
drivers/xen/xenbus/xenbus_probe.c

13 years agoMerge branch 'stable/vmalloc-3.2.rebased' into stable/for-linus-3.3.rebased
Konrad Rzeszutek Wilk [Thu, 2 Feb 2012 19:12:34 +0000 (14:12 -0500)]
Merge branch 'stable/vmalloc-3.2.rebased' into stable/for-linus-3.3.rebased

* stable/vmalloc-3.2.rebased:
  xen: map foreign pages for shared rings by updating the PTEs directly
  net: xen-netback: use API provided by xenbus module to map rings
  block: xen-blkback: use API provided by xenbus module to map rings
  xen: use generic functions instead of xen_{alloc, free}_vm_area()

13 years agoMerge branch 'stable/bug.fixes-3.2.rebased' into stable/for-linus-3.3.rebased
Konrad Rzeszutek Wilk [Thu, 2 Feb 2012 19:11:52 +0000 (14:11 -0500)]
Merge branch 'stable/bug.fixes-3.2.rebased' into stable/for-linus-3.3.rebased

* stable/bug.fixes-3.2.rebased:
  xen: Remove hanging references to CONFIG_XEN_PLATFORM_PCI
  xen/irq: If we fail during msi_capability_init return proper error code.
  xen: remove XEN_PLATFORM_PCI config option
  xen: XEN_PVHVM depends on PCI
  xen/p2m/debugfs: Make type_name more obvious.
  xen/p2m/debugfs: Fix potential pointer exception.
  xen/enlighten: Fix compile warnings and set cx to known value.
  xen/xenbus: Remove the unnecessary check.
  xen/events: Don't check the info for NULL as it is already done.
  xen/pci: Use 'acpi_gsi_to_irq' value unconditionally.
  xen/pci: Remove 'xen_allocate_pirq_gsi'.
  xen/pci: Retire unnecessary #ifdef CONFIG_ACPI
  xen/pci: Move the allocation of IRQs when there are no IOAPIC's to the end
  xen/pci: Squash pci_xen_initial_domain and xen_setup_pirqs together.
  xen/pci: Use the xen_register_pirq for HVM and initial domain users
  xen/pci: In xen_register_pirq bind the GSI to the IRQ after the hypercall.
  xen/pci: Provide #ifdef CONFIG_ACPI to easy code squashing.
  xen/pci: Update comments and fix empty spaces.
  xen/pci: Shuffle code around.

Conflicts:
drivers/xen/Makefile

13 years agoxen/xenbus-frontend: Fix compile error with randconfig
Konrad Rzeszutek Wilk [Mon, 19 Dec 2011 20:08:15 +0000 (15:08 -0500)]
xen/xenbus-frontend: Fix compile error with randconfig

drivers/xen/xenbus/xenbus_dev_frontend.c: In function 'xenbus_init':
drivers/xen/xenbus/xenbus_dev_frontend.c:609:2: error: implicit declaration of function 'xen_domain'

Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/xenbus-frontend: Make error message more clear
Bastian Blank [Sat, 10 Dec 2011 18:29:50 +0000 (19:29 +0100)]
xen/xenbus-frontend: Make error message more clear

Add the work frontend to the error message because we now also have a
backend device.

Signed-off-by: Bastian Blank <waldi@debian.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/privcmd: Remove unused support for arch specific privcmp mmap
Bastian Blank [Sat, 10 Dec 2011 18:29:49 +0000 (19:29 +0100)]
xen/privcmd: Remove unused support for arch specific privcmp mmap

This was used for ia64. But there is no working ia64 support in sight,
so remove it for now.

Signed-off-by: Bastian Blank <waldi@debian.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen: Add xenbus_backend device
Bastian Blank [Sat, 10 Dec 2011 18:29:48 +0000 (19:29 +0100)]
xen: Add xenbus_backend device

Access for xenstored to the event channel and pre-allocated ring is
managed via xenfs.  This adds its own character device featuring mmap
for the ring and an ioctl for the event channel.

Signed-off-by: Bastian Blank <waldi@debian.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen: Add xenbus device driver
Bastian Blank [Sat, 10 Dec 2011 18:29:47 +0000 (19:29 +0100)]
xen: Add xenbus device driver

Access to xenbus is currently handled via xenfs. This adds a device
driver for xenbus and makes xenfs use this code.

Signed-off-by: Bastian Blank <waldi@debian.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen: Add privcmd device driver
Bastian Blank [Fri, 16 Dec 2011 16:34:33 +0000 (11:34 -0500)]
xen: Add privcmd device driver

Access to arbitrary hypercalls is currently provided via xenfs. This
adds a standard character device to handle this. The support in xenfs
remains for backward compatibility and uses the device driver code.

Signed-off-by: Bastian Blank <waldi@debian.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Conflicts:

drivers/xen/Kconfig
drivers/xen/Makefile

13 years agoxen/gntalloc: fix reference counts on multi-page mappings
Daniel De Graaf [Mon, 28 Nov 2011 16:49:11 +0000 (11:49 -0500)]
xen/gntalloc: fix reference counts on multi-page mappings

When a multi-page mapping of gntalloc is created, the reference counts
of all pages in the vma are incremented. However, the vma open/close
operations only adjusted the reference count of the first page in the
mapping, leaking the other pages. Store a struct in the vm_private_data
to track the original page count to properly free the pages when the
last reference to the vma is closed.

Reported-by: Anil Madhavapeddy <anil@recoil.org>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/gntalloc: release grant references on page free
Daniel De Graaf [Mon, 28 Nov 2011 16:49:10 +0000 (11:49 -0500)]
xen/gntalloc: release grant references on page free

gnttab_end_foreign_access_ref does not return the grant reference it is
passed to the free list; gnttab_free_grant_reference needs to be
explicitly called. While gnttab_end_foreign_access provides a wrapper
for this, it is unsuitable because it does not return errors.

Reported-by: Anil Madhavapeddy <anil@recoil.org>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/events: prevent calling evtchn_get on invalid channels
Daniel De Graaf [Mon, 28 Nov 2011 16:49:09 +0000 (11:49 -0500)]
xen/events: prevent calling evtchn_get on invalid channels

The event channel number provided to evtchn_get can be provided by
userspace, so needs to be checked against the maximum number of event
channels prior to using it to index into evtchn_to_irq.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/granttable: Support transitive grants
Annie Li [Mon, 12 Dec 2011 10:15:07 +0000 (18:15 +0800)]
xen/granttable: Support transitive grants

These allow a domain A which has been granted access on a page of domain B's
memory to issue domain C with a copy-grant on the same page.  This is useful
e.g. for forwarding packets between domains.

Signed-off-by: Annie Li <annie.li@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/granttable: Support sub-page grants
Annie Li [Mon, 12 Dec 2011 10:14:42 +0000 (18:14 +0800)]
xen/granttable: Support sub-page grants

- They can't be used to map the page (so can only be used in a GNTTABOP_copy
  hypercall).
- It's possible to grant access with a finer granularity than whole pages.
- Xen guarantees that they can be revoked quickly (a normal map grant can
  only be revoked with the cooperation of the domain which has been granted
  access).

Signed-off-by: Annie Li <annie.li@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/granttable: Improve comments for function pointers
Annie Li [Mon, 12 Dec 2011 10:13:57 +0000 (18:13 +0800)]
xen/granttable: Improve comments for function pointers

Signed-off-by: Annie Li <annie.li@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/ia64: fix build breakage because of conflicting u64 guest handles
Luck, Tony [Wed, 30 Nov 2011 18:22:37 +0000 (10:22 -0800)]
xen/ia64: fix build breakage because of conflicting u64 guest handles

include/xen/interface/xen.h:526: error: conflicting types for ‘__guest_handle_u64’
arch/ia64/include/asm/xen/interface.h:74: error: previous declaration of ‘__guest_handle_u64’ was here

Problem introduced by "xen/granttable: Introducing grant table V2 stucture"

which added a new definition to include/xen/interface/xen.h for "u64".

Fix: delete the ia64 arch specific definition.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/granttable: Keep code format clean
Annie Li [Tue, 22 Nov 2011 01:59:56 +0000 (09:59 +0800)]
xen/granttable: Keep code format clean

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Annie Li <annie.li@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/granttable: Grant tables V2 implementation
Annie Li [Tue, 22 Nov 2011 01:59:21 +0000 (09:59 +0800)]
xen/granttable: Grant tables V2 implementation

Receiver-side copying of packets is based on this implementation, it gives
better performance and better CPU accounting. It totally supports three types:
full-page, sub-page and transitive grants.

However this patch does not cover sub-page and transitive grants, it mainly
focus on Full-page part and implements grant table V2 interfaces corresponding
to what already exists in grant table V1, such as: grant table V2
initialization, mapping, releasing and exported interfaces.

Each guest can only supports one type of grant table type, every entry in grant
table should be the same version. It is necessary to set V1 or V2 version before
initializing the grant table.

Grant table exported interfaces of V2 are same with those of V1, Xen is
responsible to judge what grant table version guests are using in every grant
operation.

V2 fulfills the same role of V1, and it is totally backwards compitable with V1.
If dom0 support grant table V2, the guests runing on it can run with either V1
or V2.

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Annie Li <annie.li@oracle.com>
[v1: Modified alloc_vm_area call (new parameters), indentation, and cleanpatch
     warnings]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/granttable: Refactor some code
Annie Li [Tue, 22 Nov 2011 01:58:47 +0000 (09:58 +0800)]
xen/granttable: Refactor some code

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Annie Li <annie.li@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 years agoxen/granttable: Introducing grant table V2 stucture
Annie Li [Tue, 22 Nov 2011 01:58:06 +0000 (09:58 +0800)]
xen/granttable: Introducing grant table V2 stucture

This patch introduces new structures of grant table V2, grant table V2 is an
extension from V1. Grant table is shared between guest and Xen, and Xen is
responsible to do corresponding work for grant operations, such as: figure
out guest's grant table version, perform different actions based on
different grant table version, etc. Although full-page structure of V2
is different from V1, it play the same role as V1.

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Annie Li <annie.li@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>