Re: [Xen-devel] [PATCH v2 00/13] "Non-shared" IOMMU support on ARM

2017-07-30 Thread Tian, Kevin
> From: Oleksandr Tyshchenko
> Sent: Wednesday, July 26, 2017 1:27 AM
> 
> From: Oleksandr Tyshchenko 
> 
> Hi, all.
> 
> The purpose of this patch series is to create a base for porting
> any "Non-shared" IOMMUs to Xen on ARM. Saying "Non-shared" IOMMU I
> mean
> the IOMMU that can't share the page table with the CPU.

Is "non-shared" IOMMU a standard terminology in ARM side? I quickly 
searched to find it mostly used in this thread...

On the other hand, all IOMMUs support a basic DMA remapping 
mechanism with page table not shared with CPU. Then some IOMMUs
may optional support Shared Virtual Memory (SVM) through page
sharing with CPU. Then I'm not sure why need to highlight the
"non-shared" manner in this thread, instead of just saying 
IPMMU-VMSA support...

> Primarily, we are interested in IPMMU-VMSA and I hope that it will be the
> first candidate.
> It is VMSA-compatible IOMMU that integrated in the newest Renesas R-Car
> Gen3 SoCs (ARM).
> I am about to push IPMMU-VMSA support in a while.
> 
> With regard to the patch series, it was rebased on Xen 4.9.0 release and
> tested on Renesas R-Car Gen3
> H3/M3 based boards with applied IPMMU-VMSA support:
> - Patches 1 and 3 have Julien's Rb.
> - Patch 2 has Jan's Rb but only for x86 and generic parts.
> - Patch 4 has Julien's Ab.
> - Patches 5,6,9,10 were slightly reworked.
> - Patch 7 was significantly reworked. The previous patch -> iommu: Split
> iommu_hwdom_init() into arch specific parts
> - Patches 8,11,12,13 are new.
> 
> Not really sure about x86-related changes since I had no possibility to check.
> So, compile-tested on x86.
> 
> You can find current patch series here:
> repo: https://github.com/otyshchenko1/xen.git branch:
> non_shared_iommu_v2
> 
> Previous patch series here:
> [PATCH v1 00/10] "Non-shared" IOMMU support on ARM
> https://www.mail-archive.com/xen-devel@lists.xen.org/msg107532.html
> 
> [RFC PATCH 0/9] "Non-shared" IOMMU support on ARM
> https://www.mail-archive.com/xen-devel@lists.xen.org/msg100468.html
> 
> Thank you.
> 
> Oleksandr Tyshchenko (13):
>   xen/device-tree: Add dt_count_phandle_with_args helper
>   iommu: Add extra order argument to the IOMMU APIs and platform
> callbacks
>   xen/arm: p2m: Add helper to convert p2m type to IOMMU flags
>   xen/arm: p2m: Update IOMMU mapping whenever possible if page table is
> not shared
>   iommu/arm: Re-define iommu_use_hap_pt(d) as iommu_hap_pt_share
>   iommu: Add extra use_iommu argument to iommu_domain_init()
>   iommu: Make decision about needing IOMMU for hardware domains in
> advance
>   iommu/arm: Misc fixes for arch specific part
>   xen/arm: Add use_iommu flag to xen_arch_domainconfig
>   xen/arm: domain_build: Don't expose IOMMU specific properties to the
> guest
>   iommu/arm: smmu: Squash map_pages/unmap_pages with
> map_page/unmap_page
>   [RFC] iommu: VT-d: Squash map_pages/unmap_pages with
> map_page/unmap_page
>   [RFC] iommu: AMD-Vi: Squash map_pages/unmap_pages with
> map_page/unmap_page
> 
>  tools/libxl/libxl_arm.c   |   8 +
>  xen/arch/arm/domain.c |   2 +-
>  xen/arch/arm/domain_build.c   |  10 ++
>  xen/arch/arm/p2m.c|  10 +-
>  xen/arch/x86/domain.c |   2 +-
>  xen/arch/x86/mm.c |  11 +-
>  xen/arch/x86/mm/p2m-ept.c |  21 +--
>  xen/arch/x86/mm/p2m-pt.c  |  26 +---
>  xen/arch/x86/mm/p2m.c |  38 +
>  xen/arch/x86/x86_64/mm.c  |   5 +-
>  xen/common/device_tree.c  |   7 +
>  xen/common/grant_table.c  |  10 +-
>  xen/drivers/passthrough/amd/iommu_map.c   | 212 +++
> ---
>  xen/drivers/passthrough/amd/pci_amd_iommu.c   |  10 +-
>  xen/drivers/passthrough/arm/iommu.c   |   7 +-
>  xen/drivers/passthrough/arm/smmu.c|  23 ++-
>  xen/drivers/passthrough/iommu.c   |  73 -
>  xen/drivers/passthrough/vtd/iommu.c   | 116 +-
>  xen/drivers/passthrough/vtd/x86/vtd.c |   4 +-
>  xen/drivers/passthrough/x86/iommu.c   |   6 +-
>  xen/include/asm-arm/iommu.h   |   4 +-
>  xen/include/asm-arm/p2m.h |  34 +
>  xen/include/asm-x86/hvm/svm/amd-iommu-proto.h |   8 +-
>  xen/include/public/arch-arm.h |   5 +
>  xen/include/xen/device_tree.h |  19 +++
>  xen/include/xen/iommu.h   |  24 +--
>  26 files changed, 402 insertions(+), 293 deletions(-)
> 
> --
> 2.7.4
> 
> 
> ___
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [xen-unstable test] 112384: regressions - trouble: blocked/broken/fail/pass

2017-07-30 Thread osstest service owner
flight 112384 xen-unstable real [real]
http://logs.test-lab.xenproject.org/osstest/logs/112384/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-arm64-xsm   2 hosts-allocate broken REGR. vs. 112286
 build-arm64-pvops 2 hosts-allocate broken REGR. vs. 112286
 build-arm64   2 hosts-allocate broken REGR. vs. 112286
 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-localmigrate/x10 fail REGR. vs. 
112286

Tests which did not succeed, but are not blocking:
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl   1 build-check(1)   blocked  n/a
 build-arm64-libvirt   1 build-check(1)   blocked  n/a
 test-arm64-arm64-examine  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit2   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-xsm   1 build-check(1)   blocked  n/a
 build-arm64-xsm   3 capture-logs  broken blocked in 112286
 build-arm64-pvops 3 capture-logs  broken blocked in 112286
 build-arm64   3 capture-logs  broken blocked in 112286
 test-amd64-amd64-xl-qemut-win7-amd64 18 guest-start/win.repeat fail blocked in 
112286
 test-amd64-i386-xl-qemut-win7-amd64 17 guest-stop   fail blocked in 112286
 test-armhf-armhf-xl-rtds 16 guest-start/debian.repeatfail  like 112274
 test-amd64-i386-xl-qemuu-win7-amd64 17 guest-stop fail like 112286
 test-armhf-armhf-libvirt 14 saverestore-support-checkfail  like 112286
 test-armhf-armhf-libvirt-xsm 14 saverestore-support-checkfail  like 112286
 test-amd64-amd64-xl-rtds 10 debian-install   fail  like 112286
 test-armhf-armhf-libvirt-raw 13 saverestore-support-checkfail  like 112286
 test-amd64-amd64-xl-qemuu-ws16-amd64 10 windows-installfail never pass
 test-amd64-i386-libvirt-xsm  13 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt 13 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-amd64-amd64-libvirt-vhd 12 migrate-support-checkfail   never pass
 test-amd64-i386-xl-qemuu-ws16-amd64 13 guest-saverestore   fail never pass
 test-amd64-amd64-qemuu-nested-amd 17 debian-hvm-install/l1/l2  fail never pass
 test-armhf-armhf-xl  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-cubietruck 13 migrate-support-checkfail never pass
 test-armhf-armhf-xl-cubietruck 14 saverestore-support-checkfail never pass
 test-armhf-armhf-xl-xsm  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  14 saverestore-support-checkfail   never pass
 test-amd64-i386-xl-qemut-ws16-amd64 13 guest-saverestore   fail never pass
 test-armhf-armhf-xl-multivcpu 13 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 14 saverestore-support-checkfail  never pass
 test-amd64-i386-libvirt  13 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-qemut-ws16-amd64 10 windows-installfail never pass
 test-armhf-armhf-xl-rtds 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 14 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  13 saverestore-support-checkfail   never pass
 test-amd64-i386-xl-qemuu-win10-i386 10 windows-install fail never pass
 test-amd64-amd64-xl-qemuu-win10-i386 10 windows-installfail never pass
 test-amd64-amd64-xl-qemut-win10-i386 10 windows-installfail never pass
 test-amd64-i386-xl-qemut-win10-i386 10 windows-install fail never pass

version targeted for testing:
 xen  aa4eb460bcf77ea87b9209bb136efc8142a1a512
baseline version:
 xen  55924baf2211ddcf5ba8f702c9a4c07730e0c8e8

Last test of basis   112286  2017-07-25 10:59:15 Z5 days
Failing since 

[Xen-devel] [linux-linus test] 112382: regressions - trouble: blocked/broken/fail/pass

2017-07-30 Thread osstest service owner
flight 112382 linux-linus real [real]
http://logs.test-lab.xenproject.org/osstest/logs/112382/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-arm64   2 hosts-allocate broken REGR. vs. 110515
 build-arm64-pvops 2 hosts-allocate broken REGR. vs. 110515
 build-arm64-xsm   2 hosts-allocate broken REGR. vs. 110515
 test-amd64-amd64-examine  7 reboot   fail REGR. vs. 110515
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 7 xen-boot fail REGR. vs. 
110515
 test-amd64-amd64-libvirt-pair 10 xen-boot/src_host   fail REGR. vs. 110515
 test-amd64-amd64-rumprun-amd64  7 xen-boot   fail REGR. vs. 110515
 test-amd64-amd64-libvirt-pair 11 xen-boot/dst_host   fail REGR. vs. 110515
 test-amd64-amd64-libvirt  7 xen-boot fail REGR. vs. 110515
 test-amd64-amd64-qemuu-nested-intel  7 xen-boot  fail REGR. vs. 110515
 test-amd64-amd64-xl-pvh-intel  7 xen-bootfail REGR. vs. 110515
 test-amd64-amd64-pygrub   7 xen-boot fail REGR. vs. 110515
 test-amd64-amd64-xl-qemut-stubdom-debianhvm-amd64-xsm 7 xen-boot fail REGR. 
vs. 110515
 test-amd64-amd64-xl-qcow2 7 xen-boot fail REGR. vs. 110515
 test-amd64-amd64-xl-qemut-debianhvm-amd64  7 xen-bootfail REGR. vs. 110515
 test-amd64-amd64-i386-pvgrub  7 xen-boot fail REGR. vs. 110515
 test-amd64-amd64-xl-qemut-win7-amd64 16 guest-localmigrate/x10 fail REGR. vs. 
110515
 test-amd64-amd64-amd64-pvgrub  7 xen-bootfail REGR. vs. 110515

Tests which are failing intermittently (not blocking):
 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-localmigrate/x10 fail in 112375 
pass in 112382
 test-armhf-armhf-xl-vhd 10 debian-di-install fail in 112375 pass in 112382
 test-amd64-amd64-libvirt-vhd  7 xen-boot   fail pass in 112375

Tests which did not succeed, but are not blocking:
 build-arm64-libvirt   1 build-check(1)   blocked  n/a
 test-arm64-arm64-examine  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit2   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-xsm   1 build-check(1)   blocked  n/a
 build-arm64-xsm   3 capture-logs  broken blocked in 110515
 build-arm64-pvops 3 capture-logs  broken blocked in 110515
 build-arm64   3 capture-logs  broken blocked in 110515
 test-amd64-amd64-libvirt-vhd 12 migrate-support-check fail in 112375 never pass
 test-armhf-armhf-libvirt 14 saverestore-support-checkfail  like 110515
 test-armhf-armhf-libvirt-xsm 14 saverestore-support-checkfail  like 110515
 test-armhf-armhf-xl-rtds 16 guest-start/debian.repeatfail  like 110515
 test-amd64-amd64-xl-qemuu-win7-amd64 17 guest-stopfail like 110515
 test-amd64-i386-xl-qemuu-win7-amd64 17 guest-stop fail like 110515
 test-amd64-i386-xl-qemut-win7-amd64 17 guest-stop fail like 110515
 test-amd64-amd64-xl-rtds 10 debian-install   fail  like 110515
 test-armhf-armhf-libvirt-raw 13 saverestore-support-checkfail  like 110515
 test-amd64-amd64-xl-qemuu-ws16-amd64 10 windows-installfail never pass
 test-amd64-i386-libvirt  13 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-xsm  13 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-amd64-amd64-qemuu-nested-amd 17 debian-hvm-install/l1/l2  fail never pass
 test-armhf-armhf-xl-rtds 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 14 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 13 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 14 saverestore-support-checkfail  never pass
 test-amd64-amd64-xl-qemut-ws16-amd64 10 windows-installfail never pass
 test-amd64-i386-xl-qemuu-ws16-amd64 13 guest-saverestore   fail never pass
 test-amd64-i386-xl-qemut-ws16-amd64 13 guest-saverestore   fail never pass
 test-armhf-armhf-xl  

Re: [Xen-devel] xen-blkfront hang

2017-07-30 Thread Dongli Zhang
CCed xen-devel so that more people would be able to help.

Dongli Zhang

On 07/31/2017 09:09 AM, Dongli Zhang wrote:
> Hi Valentin,
> 
> On 07/30/2017 03:42 PM, Valentin Vidic wrote:
>> I'm having a problem with a domU hang in disk IO, described here:
>>
>> https://lists.xen.org/archives/html/xen-users/2017-07/msg00057.html
>>
>> Do you think this is a multi-queue issue and applying one of these
>> latest changes would help?
>>
>> xen/blkfront: always allocate grants first from per-queue persistent grants
>> https://github.com/torvalds/linux/commit/bd912ef3e46b6edb51bb8af4b73fd2be7817e305
> 
> This patch is not able to fix the lack of grant issue permanently. It is used 
> to
> optimize the utilization of grant table entires.
> 
> To verify whether the above patch would help, please check the nr_grant_frames
> value in guest domU. If this value is exactly the same of maximum grant frames
> (by default, xen mainline uses 32) and the number of free grant references is
> very small, the above patch might help.
> 
> The best way is to increase the gnttab_max_frames to larger value (e.g.,  256)
> in dom0 xen.gz grub.
> 
> Dongli Zhang
> 
>>
>> xen-blkfront: fix mq start/stop race
>> https://github.com/torvalds/linux/commit/4b422cb99836de3d261faec20a0329385bdec43d
>>

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] xen/link: Move .data.rel.ro sections into .rodata for final link

2017-07-30 Thread David Woodhouse
On Sun, 2017-07-30 at 13:50 +0100, Andrew Cooper wrote:
> On 30/07/17 07:16, Jan Beulich wrote:
> > 
> > > 
> > > > 
> > > > > 
> > > > > David Woodhouse  07/20/17 5:22 PM >>>
> > > This includes stuff lke the hypercall tables which we really want
> > > to be read-only. And they were going into .data.read-mostly.
> > Yes, we'd like them to be read-only, but what if EFI properly assigned r/o
> > permissions to the .rodata section when loading xen.efi? We'd then be
> > unable to apply relocations when switching from 1:1 to virtual mappings
> > (see efi_arch_relocate_image()).
> Ah yes.  I'd overlooked that point when considering the ramifications of
> this change.
> 
> efi_arch_relocate_image() should probably do the same as what we do with
> livepatching, and temporarily clear CR0.WP for the duration of the patching.

Hm, efi/mkreloc.c was already emitting relocations in the .rodata
section before this change. Are you saying that was already broken?

smime.p7s
Description: S/MIME cryptographic signature
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [qemu-mainline test] 112380: regressions - trouble: blocked/broken/fail/pass

2017-07-30 Thread osstest service owner
flight 112380 qemu-mainline real [real]
http://logs.test-lab.xenproject.org/osstest/logs/112380/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-arm64-pvops 2 hosts-allocate broken REGR. vs. 111765
 build-arm64-xsm   2 hosts-allocate broken REGR. vs. 111765
 build-arm64   2 hosts-allocate broken REGR. vs. 111765
 test-amd64-i386-xl-qemuu-ws16-amd64 10 windows-install   fail REGR. vs. 111765
 test-amd64-i386-xl-qemuu-win7-amd64 10 windows-install   fail REGR. vs. 111765
 test-amd64-amd64-xl-qemuu-win7-amd64 10 windows-install  fail REGR. vs. 111765

Tests which did not succeed, but are not blocking:
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl   1 build-check(1)   blocked  n/a
 build-arm64-libvirt   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit2   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-xsm   1 build-check(1)   blocked  n/a
 build-arm64   3 capture-logs  broken blocked in 111765
 build-arm64-pvops 3 capture-logs  broken blocked in 111765
 build-arm64-xsm   3 capture-logs  broken blocked in 111765
 test-armhf-armhf-libvirt-xsm 14 saverestore-support-checkfail  like 111765
 test-armhf-armhf-libvirt 14 saverestore-support-checkfail  like 111765
 test-armhf-armhf-xl-rtds 16 guest-start/debian.repeatfail  like 111765
 test-armhf-armhf-libvirt-raw 13 saverestore-support-checkfail  like 111765
 test-amd64-amd64-xl-rtds 10 debian-install   fail  like 111765
 test-amd64-amd64-xl-qemuu-ws16-amd64 10 windows-installfail never pass
 test-amd64-i386-libvirt  13 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-xsm  13 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-amd64-amd64-libvirt-vhd 12 migrate-support-checkfail   never pass
 test-amd64-amd64-qemuu-nested-amd 17 debian-hvm-install/l1/l2  fail never pass
 test-armhf-armhf-xl  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-cubietruck 13 migrate-support-checkfail never pass
 test-armhf-armhf-libvirt 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-cubietruck 14 saverestore-support-checkfail never pass
 test-armhf-armhf-xl-rtds 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  14 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 13 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 14 saverestore-support-checkfail  never pass
 test-armhf-armhf-xl-xsm  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 12 migrate-support-checkfail   never pass
 test-amd64-i386-xl-qemuu-win10-i386 10 windows-install fail never pass
 test-amd64-amd64-xl-qemuu-win10-i386 10 windows-installfail never pass

version targeted for testing:
 qemuua588c4985eff363154d65aee8607d0a4601655f7
baseline version:
 qemuu31fe1c414501047cbb91b695bdccc0068496dcf6

Last test of basis   111765  2017-07-13 10:20:16 Z   17 days
Failing since111790  2017-07-14 04:20:46 Z   16 days   24 attempts
Testing same since   112366  2017-07-28 18:48:13 Z2 days3 attempts


People who touched revisions under test:
  Alex Bennée 
  Alex Williamson 
  Alexander Graf 
  Alexey G 
  Alexey Gerasimenko 
  Alexey Kardashevskiy 
  Alistair Francis 
  Anthony PERARD 
  Anton 

[Xen-devel] [linux-4.9 test] 112379: trouble: blocked/broken/fail/pass

2017-07-30 Thread osstest service owner
flight 112379 linux-4.9 real [real]
http://logs.test-lab.xenproject.org/osstest/logs/112379/

Failures and problems with tests :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-arm64-xsm   2 hosts-allocate broken REGR. vs. 112193
 build-arm64-pvops 2 hosts-allocate broken REGR. vs. 112193
 build-arm64   2 hosts-allocate broken REGR. vs. 112193

Tests which are failing intermittently (not blocking):
 test-amd64-i386-rumprun-i386 17 rumprun-demo-xenstorels/xenstorels.repeat fail 
pass in 112373
 test-armhf-armhf-xl-credit2  17 guest-start.2  fail pass in 112373

Tests which did not succeed, but are not blocking:
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl   1 build-check(1)   blocked  n/a
 build-arm64-libvirt   1 build-check(1)   blocked  n/a
 test-arm64-arm64-examine  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit2   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-xsm   1 build-check(1)   blocked  n/a
 build-arm64-pvops 3 capture-logs  broken blocked in 112193
 build-arm64   3 capture-logs  broken blocked in 112193
 build-arm64-xsm   3 capture-logs broken never pass
 test-amd64-i386-xl-qemuu-win7-amd64 16 guest-localmigrate/x10 fail in 112373 
like 112117
 test-armhf-armhf-xl-rtds 16 guest-start/debian.repeat fail in 112373 like 
112193
 test-amd64-amd64-xl-qemuu-win7-amd64 17 guest-stopfail like 112086
 test-amd64-amd64-xl-qemut-win7-amd64 16 guest-localmigrate/x10 fail like 112117
 test-amd64-i386-xl-qemut-win7-amd64 16 guest-localmigrate/x10 fail like 112193
 test-amd64-i386-xl-qemuu-win7-amd64 17 guest-stop fail like 112193
 test-amd64-amd64-xl-rtds 10 debian-install   fail  like 112193
 test-amd64-amd64-libvirt 13 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-qemuu-ws16-amd64 10 windows-installfail never pass
 test-amd64-i386-libvirt-xsm  13 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt  13 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-qemut-ws16-amd64 10 windows-installfail never pass
 test-amd64-amd64-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-armhf-armhf-xl-arndale  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  14 saverestore-support-checkfail   never pass
 test-amd64-amd64-qemuu-nested-amd 17 debian-hvm-install/l1/l2  fail never pass
 test-amd64-amd64-libvirt-vhd 12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-cubietruck 13 migrate-support-checkfail never pass
 test-armhf-armhf-libvirt-xsm 14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-cubietruck 14 saverestore-support-checkfail never pass
 test-armhf-armhf-libvirt 13 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt 14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 13 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 14 saverestore-support-checkfail  never pass
 test-amd64-i386-xl-qemuu-ws16-amd64 13 guest-saverestore   fail never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-amd64-i386-xl-qemut-ws16-amd64 13 guest-saverestore   fail never pass
 test-armhf-armhf-libvirt-raw 12 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  13 saverestore-support-checkfail   never pass
 test-amd64-i386-xl-qemut-win10-i386 10 windows-install fail never pass
 test-amd64-amd64-xl-qemut-win10-i386 10 windows-installfail never pass
 test-amd64-i386-xl-qemuu-win10-i386 10 windows-install fail never pass
 

[Xen-devel] [libvirt test] 112381: trouble: blocked/broken/pass

2017-07-30 Thread osstest service owner
flight 112381 libvirt real [real]
http://logs.test-lab.xenproject.org/osstest/logs/112381/

Failures and problems with tests :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-arm64-pvops 2 hosts-allocate broken REGR. vs. 112276
 build-arm64-xsm   2 hosts-allocate broken REGR. vs. 112276
 build-arm64   2 hosts-allocate broken REGR. vs. 112276

Tests which did not succeed, but are not blocking:
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 build-arm64-libvirt   1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-qcow2  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt  1 build-check(1)   blocked  n/a
 build-arm64   3 capture-logs  broken blocked in 112276
 build-arm64-xsm   3 capture-logs  broken blocked in 112276
 build-arm64-pvops 3 capture-logs  broken blocked in 112276
 test-armhf-armhf-libvirt 14 saverestore-support-checkfail  like 112276
 test-armhf-armhf-libvirt-xsm 14 saverestore-support-checkfail  like 112276
 test-armhf-armhf-libvirt-raw 13 saverestore-support-checkfail  like 112276
 test-amd64-amd64-libvirt 13 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt  13 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-xsm  13 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-amd64-amd64-libvirt-vhd 12 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt 13 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 12 migrate-support-checkfail   never pass

version targeted for testing:
 libvirt  772a6e36a5cbed4992315c4a8325947020f7ec70
baseline version:
 libvirt  f7237d63e8f02f3689f9b63b413fae7d4221faa9

Last test of basis   112276  2017-07-25 04:21:09 Z5 days
Failing since112310  2017-07-26 04:21:38 Z4 days5 attempts
Testing same since   112370  2017-07-29 04:23:27 Z1 days2 attempts


People who touched revisions under test:
  Andrea Bolognani 
  Daniel P. Berrange 
  Erik Skultety 
  John Ferlan 
  Ján Tomko 
  Martin Kletzander 
  Michal Privoznik 
  Nitesh Konkar 
  Nitesh Konkar 
  Pavel Hrdina 
  Peter Krempa 
  Scott Garfinkle 

jobs:
 build-amd64-xsm  pass
 build-arm64-xsm  broken  
 build-armhf-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-arm64  broken  
 build-armhf  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-arm64-libvirt  blocked 
 build-armhf-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-arm64-pvopsbroken  
 build-armhf-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm   pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsmpass
 test-amd64-amd64-libvirt-xsm pass
 test-arm64-arm64-libvirt-xsm blocked 
 test-armhf-armhf-libvirt-xsm pass
 test-amd64-i386-libvirt-xsm  pass
 test-amd64-amd64-libvirt pass
 test-arm64-arm64-libvirt blocked 
 test-armhf-armhf-libvirt pass
 test-amd64-i386-libvirt  pass
 test-amd64-amd64-libvirt-pair

Re: [Xen-devel] [PATCH v4 06/13] libxl: change p9 to use generec add function

2017-07-30 Thread Oleksandr Grytsov
On Fri, Jul 28, 2017 at 7:23 PM, Wei Liu  wrote:
> On Fri, Jul 28, 2017 at 03:11:34PM +0100, Wei Liu wrote:
>> On Tue, Jul 18, 2017 at 05:25:23PM +0300, Oleksandr Grytsov wrote:
>> [...]
>> >  /* Waits for the passed device to reach state XenbusStateInitWait.
>> >   * This is not really useful by itself, but is important when executing
>> >   * hotplug scripts, since we need to be sure the device is in the correct
>> > @@ -3565,6 +3559,7 @@ extern const struct libxl_device_type 
>> > libxl__usbctrl_devtype;
>> >  extern const struct libxl_device_type libxl__usbdev_devtype;
>> >  extern const struct libxl_device_type libxl__pcidev_devtype;
>> >  extern const struct libxl_device_type libxl__vdispl_devtype;
>> > +extern const struct libxl_device_type libxl__p9_devtype;
>> >
>> >  extern const struct libxl_device_type *device_type_tbl[];
>> >
>> > diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
>> > index 25563cf..96dbaed 100644
>> > --- a/tools/libxl/libxl_types.idl
>> > +++ b/tools/libxl/libxl_types.idl
>> > @@ -804,7 +804,7 @@ libxl_domain_config = Struct("domain_config", [
>> >  ("vfbs", Array(libxl_device_vfb, "num_vfbs")),
>> >  ("vkbs", Array(libxl_device_vkb, "num_vkbs")),
>> >  ("vtpms", Array(libxl_device_vtpm, "num_vtpms")),
>> > -("p9", Array(libxl_device_p9, "num_p9s")),
>> > +("p9s", Array(libxl_device_p9, "num_p9s")),
>>
>> Oh, no, please don't do this. We can't change the name of the fields.
>>
>> There is already on irregular device type -- the PCI device. I suppose
>> you probably need another hook somewhere. And please convert PCI devices
>> if you can.
>
> OK, going through the code I think we need to come to a conclusion if we
> want an extra callback to handle the irregular device names first
> because that's likely to affect the code of the framework in previous
> patch.

Actually creating new callback to handle irregular device name looks
not so good.
There is the pattern which all namings should follow. May be it has to
be documented
somewhere. p9 was added recently we can ask the author to review this rename.
From other side this rename touches only internals changes: no changes
in config file
or CLI interface.

-- 
Best Regards,
Oleksandr Grytsov.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [RFC v4]Proposal to allow setting up shared memory areas between VMs from xl config file

2017-07-30 Thread Zhongze Liu
I'm extremely sorry that I mistakenly copied and pasted an immediate
version of the proposal here. As you might have already noticed, some
of the content obviously conflicts with itself. Please see the new one below.
And some typo's and indentation issues are also fixed. Sorry again for my
mistake.

The revisited proposal:


1. Motivation and Description

Virtual machines use grant table hypercalls to setup a share page for
inter-VMs communications. These hypercalls are used by all PV
protocols today. However, very simple guests, such as baremetal
applications, might not have the infrastructure to handle the grant table.
This project is about setting up several shared memory areas for inter-VMs
communications directly from the VM config file.
So that the guest kernel doesn't have to have grant table support (in the
embedded space, this is not unusual) to be able to communicate with
other guests.


2. Implementation Plan:


==
2.1 Introduce a new VM config option in xl:
==

2.1.1 Design Goals
~~~

The shared areas should be shareable among several (>=2) VMs, so every shared
physical memory area is assigned to a set of VMs. Therefore, a “token” or
“identifier” should be used here to uniquely identify a backing memory area.
A string no longer than 128 bytes is used here to serve the purpose.

The backing area would be taken from one domain, which we will regard
as the "master domain", and this domain should be created prior to any
other "slave domain"s. Again, we have to use some kind of tag to tell who
is the "master domain".

And the ability to specify the permissions and cacheability (and shareability
for ARM guest's) of the pages to be shared should also be given to the user.

2.2.2 Syntax and Behavior
~
The following example illustrates the syntax of the proposed config entry
(suppose that we're on x86):

In xl config file of vm1:
  static_shm = [ 'id=ID1, begin=0x10, end=0x20, role=master,\
  cache_policy=x86_normal, prot=rw',\
\
 'id=ID2, begin=0x30, end=0x40, role=master' ]

In xl config file of vm2:
  static_shm = [ 'id=ID1, offset = 0, begin=0x50, end=0x60, \
  role=slave, prot=rw' ]

In xl config file of vm3:
  static_shm = [ 'id=ID2, offset = 0x1, begin=0x69, \
  end=0x80, role=slave' ]

where:
  @id  The identifier of the backing memory area.
   Can be any string that matches the regexp "[_a-zA-Z0-9]+"
   and no longer than 128 characters

  @offset  Can only appear when @role = slave. The sharing will
   start from the beginning of backing memory area plus
   this offset. If not set, it defaults to zero.
   Can be decimals or hexadecimals of the form "0x2",
   and should be the multiple of the hypervisor page
   granularity (currently 4K on both ARM and x86).

  @begin/end   The boundaries of the shared memory area. The format
   requirements are the same with @offset.

  @roleCan only be 'master' or 'slave', it defaults to 'slave'.

  @protWhen @role = master, this means the largest set of
   stage-2 permission flags that can be granted to the
   slave domains.
   When @role = slave, this means the stage-2 permission
   flags of the shared memory area.
   Currently only 'rw' is supported. If not set. it
   defaults to 'rw'.

  @cache_policyCan only appear when @role = master.
   The stage-2 cacheability/shareability attributes of the
   shared memory area. Currently, only two policies are
   supported:
 * ARM_normal: Only applicable to ARM guests. This
   would mean Inner and Outer Write-Back
   Cacheable, and Inner Shareable.
 * x86_normal: Only applicable to x86 HVM guests. This
   would mean Write-Back Cacheable.
   If not set, it defaults to the *_normal policy for the
   corresponding platform.

Note:
  The sizes of the areas specified by @begin and @end in the slave
  domain's config file should be smaller than the corresponding sizes specified
  in its master's domain. And @offset should always be within the backing
  memory region. Overlapping backing memory areas 

[Xen-devel] [linux-3.18 test] 112378: trouble: blocked/broken/fail/pass

2017-07-30 Thread osstest service owner
flight 112378 linux-3.18 real [real]
http://logs.test-lab.xenproject.org/osstest/logs/112378/

Failures and problems with tests :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-arm64-xsm   2 hosts-allocate broken REGR. vs. 112102
 build-arm64-pvops 2 hosts-allocate broken REGR. vs. 112102
 build-arm64   2 hosts-allocate broken REGR. vs. 112102
 build-arm64-pvops 3 capture-logs   broken REGR. vs. 112102

Tests which did not succeed, but are not blocking:
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl   1 build-check(1)   blocked  n/a
 build-arm64-libvirt   1 build-check(1)   blocked  n/a
 test-arm64-arm64-examine  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit2   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-xsm   1 build-check(1)   blocked  n/a
 build-arm64-xsm   3 capture-logs  broken blocked in 112102
 build-arm64   3 capture-logs  broken blocked in 112102
 test-amd64-i386-xl-qemuu-win7-amd64 18 guest-start/win.repeat fail blocked in 
112102
 test-amd64-amd64-xl-qemuu-win7-amd64 17 guest-stop  fail blocked in 112102
 test-amd64-i386-xl-qemut-win7-amd64 17 guest-stop   fail blocked in 112102
 test-amd64-amd64-xl-qemut-win7-amd64 17 guest-stopfail like 112085
 test-armhf-armhf-libvirt 14 saverestore-support-checkfail  like 112102
 test-armhf-armhf-libvirt-xsm 14 saverestore-support-checkfail  like 112102
 test-armhf-armhf-libvirt-raw 13 saverestore-support-checkfail  like 112102
 test-amd64-amd64-xl-rtds 10 debian-install   fail  like 112102
 test-amd64-amd64-xl-qemut-ws16-amd64 10 windows-installfail never pass
 test-amd64-i386-libvirt-xsm  13 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt  13 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt 13 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-qemuu-ws16-amd64 10 windows-installfail never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-armhf-armhf-xl-arndale  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  14 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-vhd 12 migrate-support-checkfail   never pass
 test-amd64-i386-xl-qemuu-ws16-amd64 13 guest-saverestore   fail never pass
 test-amd64-amd64-qemuu-nested-amd 17 debian-hvm-install/l1/l2  fail never pass
 test-armhf-armhf-libvirt 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 13 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 14 saverestore-support-checkfail  never pass
 test-amd64-i386-xl-qemut-ws16-amd64 13 guest-saverestore   fail never pass
 test-armhf-armhf-xl-cubietruck 13 migrate-support-checkfail never pass
 test-armhf-armhf-xl-cubietruck 14 saverestore-support-checkfail never pass
 test-armhf-armhf-xl-xsm  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 14 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-armhf-armhf-xl-vhd  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  13 saverestore-support-checkfail   never pass
 test-amd64-i386-xl-qemuu-win10-i386 10 windows-install fail never pass
 test-amd64-amd64-xl-qemuu-win10-i386 10 windows-installfail never pass
 test-amd64-i386-xl-qemut-win10-i386 10 windows-install fail never pass
 test-amd64-amd64-xl-qemut-win10-i386 10 windows-installfail never pass

version targeted for testing:
 linux8c13fcce2c663b37c1134a3302b43e514961b5fa
baseline version:
 linuxdd8b674caeef9381345a6369fba29d425ff433f3

Last test of basis   112102  2017-07-21 17:53:24 Z8 days
Testing same since   112351  2017-07-27 22:26:55 Z2 days4 attempts


[Xen-devel] [PATCH v3 extra 10/11] x86/mm: move {get, put}_page_from_l{2, 3, 4}e

2017-07-30 Thread Wei Liu
They are only used by PV code.

Fix coding style issues while moving. Move declarations to PV specific
header file.

Signed-off-by: Wei Liu 
---
 xen/arch/x86/mm.c   | 253 
 xen/arch/x86/pv/mm.c| 246 ++
 xen/include/asm-x86/mm.h|  10 --
 xen/include/asm-x86/pv/mm.h |  29 +
 4 files changed, 275 insertions(+), 263 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 40fb761d08..ade3ed2c48 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -511,72 +511,6 @@ int get_page_and_type_from_mfn(mfn_t mfn, unsigned long 
type, struct domain *d,
 return rc;
 }
 
-static void put_data_page(
-struct page_info *page, int writeable)
-{
-if ( writeable )
-put_page_and_type(page);
-else
-put_page(page);
-}
-
-/*
- * We allow root tables to map each other (a.k.a. linear page tables). It
- * needs some special care with reference counts and access permissions:
- *  1. The mapping entry must be read-only, or the guest may get write access
- * to its own PTEs.
- *  2. We must only bump the reference counts for an *already validated*
- * L2 table, or we can end up in a deadlock in get_page_type() by waiting
- * on a validation that is required to complete that validation.
- *  3. We only need to increment the reference counts for the mapped page
- * frame if it is mapped by a different root table. This is sufficient and
- * also necessary to allow validation of a root table mapping itself.
- */
-#define define_get_linear_pagetable(level)  \
-static int  \
-get_##level##_linear_pagetable( \
-level##_pgentry_t pde, unsigned long pde_pfn, struct domain *d) \
-{   \
-unsigned long x, y; \
-struct page_info *page; \
-unsigned long pfn;  \
-\
-if ( (level##e_get_flags(pde) & _PAGE_RW) ) \
-{   \
-gdprintk(XENLOG_WARNING,\
- "Attempt to create linear p.t. with write perms\n");   \
-return 0;   \
-}   \
-\
-if ( (pfn = level##e_get_pfn(pde)) != pde_pfn ) \
-{   \
-/* Make sure the mapped frame belongs to the correct domain. */ \
-if ( unlikely(!get_page_from_mfn(_mfn(pfn), d)) )   \
-return 0;   \
-\
-/*  \
- * Ensure that the mapped frame is an already-validated page table. \
- * If so, atomically increment the count (checking for overflow).   \
- */ \
-page = mfn_to_page(pfn);\
-y = page->u.inuse.type_info;\
-do {\
-x = y;  \
-if ( unlikely((x & PGT_count_mask) == PGT_count_mask) ||\
- unlikely((x & (PGT_type_mask|PGT_validated)) !=\
-  (PGT_##level##_page_table|PGT_validated)) )   \
-{   \
-put_page(page); \
-return 0;   \
-}   \
-}   \
-while ( (y = cmpxchg(>u.inuse.type_info, x, x + 1)) != x );   \
-}   \
-\
-return 1;   \
-}
-
-
 bool is_iomem_page(mfn_t mfn)
 {
 struct page_info *page;
@@ -866,108 

[Xen-devel] [PATCH v3 extra 11/11] x86/mm: move description of x86 page table API to pv/mm.c

2017-07-30 Thread Wei Liu
Signed-off-by: Wei Liu 
---
 xen/arch/x86/mm.c| 65 
 xen/arch/x86/pv/mm.c | 65 
 2 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index ade3ed2c48..75c84d2275 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -18,71 +18,6 @@
  * along with this program; If not, see .
  */
 
-/*
- * A description of the x86 page table API:
- *
- * Domains trap to do_mmu_update with a list of update requests.
- * This is a list of (ptr, val) pairs, where the requested operation
- * is *ptr = val.
- *
- * Reference counting of pages:
- * 
- * Each page has two refcounts: tot_count and type_count.
- *
- * TOT_COUNT is the obvious reference count. It counts all uses of a
- * physical page frame by a domain, including uses as a page directory,
- * a page table, or simple mappings via a PTE. This count prevents a
- * domain from releasing a frame back to the free pool when it still holds
- * a reference to it.
- *
- * TYPE_COUNT is more subtle. A frame can be put to one of three
- * mutually-exclusive uses: it might be used as a page directory, or a
- * page table, or it may be mapped writable by the domain [of course, a
- * frame may not be used in any of these three ways!].
- * So, type_count is a count of the number of times a frame is being
- * referred to in its current incarnation. Therefore, a page can only
- * change its type when its type count is zero.
- *
- * Pinning the page type:
- * --
- * The type of a page can be pinned/unpinned with the commands
- * MMUEXT_[UN]PIN_L?_TABLE. Each page can be pinned exactly once (that is,
- * pinning is not reference counted, so it can't be nested).
- * This is useful to prevent a page's type count falling to zero, at which
- * point safety checks would need to be carried out next time the count
- * is increased again.
- *
- * A further note on writable page mappings:
- * -
- * For simplicity, the count of writable mappings for a page may not
- * correspond to reality. The 'writable count' is incremented for every
- * PTE which maps the page with the _PAGE_RW flag set. However, for
- * write access to be possible the page directory entry must also have
- * its _PAGE_RW bit set. We do not check this as it complicates the
- * reference counting considerably [consider the case of multiple
- * directory entries referencing a single page table, some with the RW
- * bit set, others not -- it starts getting a bit messy].
- * In normal use, this simplification shouldn't be a problem.
- * However, the logic can be added if required.
- *
- * One more note on read-only page mappings:
- * -
- * We want domains to be able to map pages for read-only access. The
- * main reason is that page tables and directories should be readable
- * by a domain, but it would not be safe for them to be writable.
- * However, domains have free access to rings 1 & 2 of the Intel
- * privilege model. In terms of page protection, these are considered
- * to be part of 'supervisor mode'. The WP bit in CR0 controls whether
- * read-only restrictions are respected in supervisor mode -- if the
- * bit is clear then any mapped page is writable.
- *
- * We get round this by always setting the WP bit and disallowing
- * updates to it. This is very unlikely to cause a problem for guest
- * OS's, which will generally use the WP bit to simplify copy-on-write
- * implementation (in that case, OS wants a fault when it writes to
- * an application-supplied buffer).
- */
-
 #include 
 #include 
 #include 
diff --git a/xen/arch/x86/pv/mm.c b/xen/arch/x86/pv/mm.c
index ad35808c51..39e6a3bc9a 100644
--- a/xen/arch/x86/pv/mm.c
+++ b/xen/arch/x86/pv/mm.c
@@ -20,6 +20,71 @@
  * along with this program; If not, see .
  */
 
+/*
+ * A description of the x86 page table API:
+ *
+ * Domains trap to do_mmu_update with a list of update requests.
+ * This is a list of (ptr, val) pairs, where the requested operation
+ * is *ptr = val.
+ *
+ * Reference counting of pages:
+ * 
+ * Each page has two refcounts: tot_count and type_count.
+ *
+ * TOT_COUNT is the obvious reference count. It counts all uses of a
+ * physical page frame by a domain, including uses as a page directory,
+ * a page table, or simple mappings via a PTE. This count prevents a
+ * domain from releasing a frame back to the free pool when it still holds
+ * a reference to it.
+ *
+ * TYPE_COUNT is more subtle. A frame can be put to one of three
+ * mutually-exclusive uses: it might be used as a page directory, or a
+ * page table, or it may be mapped writable by the domain [of course, a
+ * frame may not be used in any of these three ways!].
+ * So, type_count is a count of 

[Xen-devel] [PATCH v3 extra 09/11] x86/mm: use put_page_type_preemptible in put_page_from_l{2, 3}e

2017-07-30 Thread Wei Liu
No functional change.

Signed-off-by: Wei Liu 
---
 xen/arch/x86/mm.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 167b318260..40fb761d08 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1050,8 +1050,6 @@ int put_page_from_l2e(l2_pgentry_t l2e, unsigned long pfn)
 return 0;
 }
 
-static int __put_page_type(struct page_info *, int preemptible);
-
 int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn, int partial,
   bool defer)
 {
@@ -1078,7 +1076,7 @@ int put_page_from_l3e(l3_pgentry_t l3e, unsigned long 
pfn, int partial,
 if ( unlikely(partial > 0) )
 {
 ASSERT(!defer);
-return __put_page_type(pg, 1);
+return put_page_type_preemptible(pg);
 }
 
 if ( defer )
@@ -1101,7 +1099,7 @@ int put_page_from_l4e(l4_pgentry_t l4e, unsigned long 
pfn, int partial,
 if ( unlikely(partial > 0) )
 {
 ASSERT(!defer);
-return __put_page_type(pg, 1);
+return put_page_type_preemptible(pg);
 }
 
 if ( defer )
-- 
2.11.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v3 extra 06/11] x86/mm: move and add pv_ prefix to invalidate_shadow_ldt

2017-07-30 Thread Wei Liu
Move the code to pv/mm.c and export it via pv/mm.h. Use bool for flush.

Signed-off-by: Wei Liu 
---
 xen/arch/x86/mm.c   | 44 
 xen/arch/x86/pv/mm.c| 35 +++
 xen/include/asm-x86/pv/mm.h |  4 
 3 files changed, 43 insertions(+), 40 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index ac0e0ba346..76ce5aef68 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -478,42 +478,6 @@ static inline void page_set_tlbflush_timestamp(struct 
page_info *page)
 const char __section(".bss.page_aligned.const") __aligned(PAGE_SIZE)
 zero_page[PAGE_SIZE];
 
-static void invalidate_shadow_ldt(struct vcpu *v, int flush)
-{
-l1_pgentry_t *pl1e;
-unsigned int i;
-struct page_info *page;
-
-BUG_ON(unlikely(in_irq()));
-
-spin_lock(>arch.pv_vcpu.shadow_ldt_lock);
-
-if ( v->arch.pv_vcpu.shadow_ldt_mapcnt == 0 )
-goto out;
-
-v->arch.pv_vcpu.shadow_ldt_mapcnt = 0;
-pl1e = gdt_ldt_ptes(v->domain, v);
-
-for ( i = 16; i < 32; i++ )
-{
-if ( !(l1e_get_flags(pl1e[i]) & _PAGE_PRESENT) )
-continue;
-page = l1e_get_page(pl1e[i]);
-l1e_write([i], l1e_empty());
-ASSERT_PAGE_IS_TYPE(page, PGT_seg_desc_page);
-ASSERT_PAGE_IS_DOMAIN(page, v->domain);
-put_page_and_type(page);
-}
-
-/* Rid TLBs of stale mappings (guest mappings and shadow mappings). */
-if ( flush )
-flush_tlb_mask(v->vcpu_dirty_cpumask);
-
- out:
-spin_unlock(>arch.pv_vcpu.shadow_ldt_lock);
-}
-
-
 bool get_page_from_mfn(mfn_t mfn, struct domain *d)
 {
 struct page_info *page = mfn_to_page(mfn_x(mfn));
@@ -1059,7 +1023,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain 
*l1e_owner)
  (l1e_owner == pg_owner) )
 {
 for_each_vcpu ( pg_owner, v )
-invalidate_shadow_ldt(v, 1);
+pv_invalidate_shadow_ldt(v, true);
 }
 put_page(page);
 }
@@ -1958,7 +1922,7 @@ int pv_new_guest_cr3(unsigned long mfn)
 return rc;
 }
 
-invalidate_shadow_ldt(curr, 0);
+pv_invalidate_shadow_ldt(curr, false);
 write_ptbase(curr);
 
 return 0;
@@ -1996,7 +1960,7 @@ int pv_new_guest_cr3(unsigned long mfn)
 return rc;
 }
 
-invalidate_shadow_ldt(curr, 0);
+pv_invalidate_shadow_ldt(curr, false);
 
 if ( !VM_ASSIST(currd, m2p_strict) && !paging_mode_refcounts(currd) )
 fill_ro_mpt(mfn);
@@ -2496,7 +2460,7 @@ long do_mmuext_op(
 else if ( (curr->arch.pv_vcpu.ldt_ents != ents) ||
   (curr->arch.pv_vcpu.ldt_base != ptr) )
 {
-invalidate_shadow_ldt(curr, 0);
+pv_invalidate_shadow_ldt(curr, false);
 flush_tlb_local();
 curr->arch.pv_vcpu.ldt_base = ptr;
 curr->arch.pv_vcpu.ldt_ents = ents;
diff --git a/xen/arch/x86/pv/mm.c b/xen/arch/x86/pv/mm.c
index f0393b9e3c..19b2ae588e 100644
--- a/xen/arch/x86/pv/mm.c
+++ b/xen/arch/x86/pv/mm.c
@@ -742,6 +742,41 @@ int pv_free_page_type(struct page_info *page, unsigned 
long type,
 return rc;
 }
 
+void pv_invalidate_shadow_ldt(struct vcpu *v, bool flush)
+{
+l1_pgentry_t *pl1e;
+unsigned int i;
+struct page_info *page;
+
+BUG_ON(unlikely(in_irq()));
+
+spin_lock(>arch.pv_vcpu.shadow_ldt_lock);
+
+if ( v->arch.pv_vcpu.shadow_ldt_mapcnt == 0 )
+goto out;
+
+v->arch.pv_vcpu.shadow_ldt_mapcnt = 0;
+pl1e = gdt_ldt_ptes(v->domain, v);
+
+for ( i = 16; i < 32; i++ )
+{
+if ( !(l1e_get_flags(pl1e[i]) & _PAGE_PRESENT) )
+continue;
+page = l1e_get_page(pl1e[i]);
+l1e_write([i], l1e_empty());
+ASSERT_PAGE_IS_TYPE(page, PGT_seg_desc_page);
+ASSERT_PAGE_IS_DOMAIN(page, v->domain);
+put_page_and_type(page);
+}
+
+/* Rid TLBs of stale mappings (guest mappings and shadow mappings). */
+if ( flush )
+flush_tlb_mask(v->vcpu_dirty_cpumask);
+
+ out:
+spin_unlock(>arch.pv_vcpu.shadow_ldt_lock);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/asm-x86/pv/mm.h b/xen/include/asm-x86/pv/mm.h
index 841666e7a0..664d7c3868 100644
--- a/xen/include/asm-x86/pv/mm.h
+++ b/xen/include/asm-x86/pv/mm.h
@@ -101,6 +101,8 @@ int pv_alloc_page_type(struct page_info *page, unsigned 
long type,
 int pv_free_page_type(struct page_info *page, unsigned long type,
   bool preemptible);
 
+void pv_invalidate_shadow_ldt(struct vcpu *v, bool flush);
+
 #else
 
 #include 
@@ -138,6 +140,8 @@ static inline int pv_free_page_type(struct page_info *page, 
unsigned long type,
   bool preemptible)
 { return -EINVAL; }
 
+static inline void pv_invalidate_shadow_ldt(struct vcpu *v, bool flush) {}
+
 #endif
 
 #endif /* __X86_PV_MM_H__ */
-- 
2.11.0



[Xen-devel] [PATCH v3 extra 01/11] x86: add pv_ prefix to {alloc, free}_page_type

2017-07-30 Thread Wei Liu
They are only useful for PV guests. Also change preemptible to bool.

Signed-off-by: Wei Liu 
---
 xen/arch/x86/domain.c|  2 +-
 xen/arch/x86/mm.c| 12 ++--
 xen/include/asm-x86/mm.h |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 93014d9bbc..d92a930d29 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1807,7 +1807,7 @@ static int relinquish_memory(
 if ( likely(y == x) )
 {
 /* No need for atomic update of type_info here: noone else 
updates it. */
-switch ( ret = free_page_type(page, x, 1) )
+switch ( ret = pv_free_page_type(page, x, true) )
 {
 case 0:
 break;
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 9b6871ab04..a908d70dea 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2010,8 +2010,8 @@ static void get_page_light(struct page_info *page)
 while ( unlikely(y != x) );
 }
 
-static int alloc_page_type(struct page_info *page, unsigned long type,
-   int preemptible)
+static int pv_alloc_page_type(struct page_info *page, unsigned long type,
+  bool preemptible)
 {
 struct domain *owner = page_get_owner(page);
 int rc;
@@ -2083,8 +2083,8 @@ static int alloc_page_type(struct page_info *page, 
unsigned long type,
 }
 
 
-int free_page_type(struct page_info *page, unsigned long type,
-   int preemptible)
+int pv_free_page_type(struct page_info *page, unsigned long type,
+  bool preemptible)
 {
 struct domain *owner = page_get_owner(page);
 unsigned long gmfn;
@@ -2141,7 +2141,7 @@ int free_page_type(struct page_info *page, unsigned long 
type,
 static int __put_final_page_type(
 struct page_info *page, unsigned long type, int preemptible)
 {
-int rc = free_page_type(page, type, preemptible);
+int rc = pv_free_page_type(page, type, preemptible);
 
 /* No need for atomic update of type_info here: noone else updates it. */
 if ( rc == 0 )
@@ -2357,7 +2357,7 @@ static int __get_page_type(struct page_info *page, 
unsigned long type,
 page->nr_validated_ptes = 0;
 page->partial_pte = 0;
 }
-rc = alloc_page_type(page, type, preemptible);
+rc = pv_alloc_page_type(page, type, preemptible);
 }
 
 if ( (x & PGT_partial) && !(nx & PGT_partial) )
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 521a8b1b7b..a5662f327b 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -302,8 +302,8 @@ static inline void *__page_to_virt(const struct page_info 
*pg)
 (PAGE_SIZE / (sizeof(*pg) & -sizeof(*pg;
 }
 
-int free_page_type(struct page_info *page, unsigned long type,
-   int preemptible);
+int pv_free_page_type(struct page_info *page, unsigned long type,
+  bool preemptible);
 
 bool_t fill_ro_mpt(unsigned long mfn);
 void zap_ro_mpt(unsigned long mfn);
-- 
2.11.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v3 extra 07/11] x86/mm: move PV hypercalls to pv/mm-hypercalls.c

2017-07-30 Thread Wei Liu
Also move pv_new_guest_cr3 there so that we don't have to export
mod_l1_entry.

Fix coding style issues. Change v to curr and d to currd where
appropriate.

Signed-off-by: Wei Liu 
---
I can't convince git diff to produce sensible diff for donate_page and
steal_page.  Those functions aren't changed.
---
 xen/arch/x86/mm.c   | 1565 ++-
 xen/arch/x86/pv/Makefile|1 +
 xen/arch/x86/pv/mm-hypercalls.c | 1461 
 3 files changed, 1531 insertions(+), 1496 deletions(-)
 create mode 100644 xen/arch/x86/pv/mm-hypercalls.c

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 76ce5aef68..d232076459 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1168,290 +1168,6 @@ void page_unlock(struct page_info *page)
 } while ( (y = cmpxchg(>u.inuse.type_info, x, nx)) != x );
 }
 
-/*
- * PTE flags that a guest may change without re-validating the PTE.
- * All other bits affect translation, caching, or Xen's safety.
- */
-#define FASTPATH_FLAG_WHITELIST \
-(_PAGE_NX_BIT | _PAGE_AVAIL_HIGH | _PAGE_AVAIL | _PAGE_GLOBAL | \
- _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_USER)
-
-/* Update the L1 entry at pl1e to new value nl1e. */
-static int mod_l1_entry(l1_pgentry_t *pl1e, l1_pgentry_t nl1e,
-unsigned long gl1mfn, int preserve_ad,
-struct vcpu *pt_vcpu, struct domain *pg_dom)
-{
-l1_pgentry_t ol1e;
-struct domain *pt_dom = pt_vcpu->domain;
-int rc = 0;
-
-if ( unlikely(__copy_from_user(, pl1e, sizeof(ol1e)) != 0) )
-return -EFAULT;
-
-ASSERT(!paging_mode_refcounts(pt_dom));
-
-if ( l1e_get_flags(nl1e) & _PAGE_PRESENT )
-{
-/* Translate foreign guest addresses. */
-struct page_info *page = NULL;
-
-if ( unlikely(l1e_get_flags(nl1e) & l1_disallow_mask(pt_dom)) )
-{
-gdprintk(XENLOG_WARNING, "Bad L1 flags %x\n",
-l1e_get_flags(nl1e) & l1_disallow_mask(pt_dom));
-return -EINVAL;
-}
-
-if ( paging_mode_translate(pg_dom) )
-{
-page = get_page_from_gfn(pg_dom, l1e_get_pfn(nl1e), NULL, 
P2M_ALLOC);
-if ( !page )
-return -EINVAL;
-nl1e = l1e_from_pfn(page_to_mfn(page), l1e_get_flags(nl1e));
-}
-
-/* Fast path for sufficiently-similar mappings. */
-if ( !l1e_has_changed(ol1e, nl1e, ~FASTPATH_FLAG_WHITELIST) )
-{
-adjust_guest_l1e(nl1e, pt_dom);
-rc = UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, pt_vcpu,
-  preserve_ad);
-if ( page )
-put_page(page);
-return rc ? 0 : -EBUSY;
-}
-
-switch ( rc = get_page_from_l1e(nl1e, pt_dom, pg_dom) )
-{
-default:
-if ( page )
-put_page(page);
-return rc;
-case 0:
-break;
-case _PAGE_RW ... _PAGE_RW | PAGE_CACHE_ATTRS:
-ASSERT(!(rc & ~(_PAGE_RW | PAGE_CACHE_ATTRS)));
-l1e_flip_flags(nl1e, rc);
-rc = 0;
-break;
-}
-if ( page )
-put_page(page);
-
-adjust_guest_l1e(nl1e, pt_dom);
-if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, pt_vcpu,
-preserve_ad)) )
-{
-ol1e = nl1e;
-rc = -EBUSY;
-}
-}
-else if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, pt_vcpu,
- preserve_ad)) )
-{
-return -EBUSY;
-}
-
-put_page_from_l1e(ol1e, pt_dom);
-return rc;
-}
-
-
-/* Update the L2 entry at pl2e to new value nl2e. pl2e is within frame pfn. */
-static int mod_l2_entry(l2_pgentry_t *pl2e,
-l2_pgentry_t nl2e,
-unsigned long pfn,
-int preserve_ad,
-struct vcpu *vcpu)
-{
-l2_pgentry_t ol2e;
-struct domain *d = vcpu->domain;
-struct page_info *l2pg = mfn_to_page(pfn);
-unsigned long type = l2pg->u.inuse.type_info;
-int rc = 0;
-
-if ( unlikely(!is_guest_l2_slot(d, type, pgentry_ptr_to_slot(pl2e))) )
-{
-gdprintk(XENLOG_WARNING, "L2 update in Xen-private area, slot %#lx\n",
- pgentry_ptr_to_slot(pl2e));
-return -EPERM;
-}
-
-if ( unlikely(__copy_from_user(, pl2e, sizeof(ol2e)) != 0) )
-return -EFAULT;
-
-if ( l2e_get_flags(nl2e) & _PAGE_PRESENT )
-{
-if ( unlikely(l2e_get_flags(nl2e) & L2_DISALLOW_MASK) )
-{
-gdprintk(XENLOG_WARNING, "Bad L2 flags %x\n",
-l2e_get_flags(nl2e) & L2_DISALLOW_MASK);
-return -EINVAL;
-}
-
-/* Fast path for sufficiently-similar mappings. */
-if ( !l2e_has_changed(ol2e, nl2e, 

[Xen-devel] [PATCH v3 extra 00/11] x86: refactor mm.c: page APIs and hypercalls

2017-07-30 Thread Wei Liu
This series is built on top of the "easy part" [0] (and rebased on top of
current staging).

After discussing with George and Andrew on IRC, it is clear that
alloc_page_type and free_page_type are only useful for PV guests. This
immediately enables us to move them and the supporting code to PV directory.

Note that in the stubs I choose to return EINVAL but maybe we should just BUG()
there because those paths aren't supposed to be taken when !CONFIG_PV. And I'm
sure common code will BUG_ON() or BUG() sooner or later. Thoughts?

PV MMU hypercalls are moved to mm-hypercalls.c to avoid having a very huge
pv/mm.c.

Cc: Jan Beulich 
Cc: Andrew Cooper 
Cc: George Dunlap 

Wei Liu (11):
  x86: add pv_ prefix to {alloc,free}_page_type
  x86/mm: export more get/put page functions
  x86/mm: move and add pv_ prefix to create_pae_xen_mappings
  x86/mm: move disallow_mask variable and macros
  x86/mm: move pv_{alloc,free}_page_type
  x86/mm: move and add pv_ prefix to invalidate_shadow_ldt
  x86/mm: move PV hypercalls to pv/mm-hypercalls.c
  x86/mm: remove the now unused inclusion of pv/mm.h
  x86/mm: use put_page_type_preemptible in put_page_from_l{2,3}e
  x86/mm: move {get,put}_page_from_l{2,3,4}e
  x86/mm: move description of x86 page table API to pv/mm.c

 xen/arch/x86/domain.c   |3 +-
 xen/arch/x86/mm.c   | 3018 +--
 xen/arch/x86/pv/Makefile|1 +
 xen/arch/x86/pv/mm-hypercalls.c | 1461 +++
 xen/arch/x86/pv/mm.c|  877 
 xen/arch/x86/pv/mm.h|6 +
 xen/include/asm-x86/mm.h|   29 +-
 xen/include/asm-x86/pv/mm.h |   45 +
 8 files changed, 2759 insertions(+), 2681 deletions(-)
 create mode 100644 xen/arch/x86/pv/mm-hypercalls.c
 create mode 100644 xen/arch/x86/pv/mm.h

-- 
2.11.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v3 extra 04/11] x86/mm: move disallow_mask variable and macros

2017-07-30 Thread Wei Liu
They will be used by both common mm code and PV mm code in the next
few patches. Note that they might be moved again later if they aren't
needed by common mm code any more.

Signed-off-by: Wei Liu 
---
 xen/arch/x86/mm.c| 19 +--
 xen/include/asm-x86/mm.h | 19 +++
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 0c6a6de1a9..5545a6f4de 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -146,24 +146,7 @@ bool __read_mostly machine_to_phys_mapping_valid;
 
 struct rangeset *__read_mostly mmio_ro_ranges;
 
-static uint32_t base_disallow_mask;
-/* Global bit is allowed to be set on L1 PTEs. Intended for user mappings. */
-#define L1_DISALLOW_MASK ((base_disallow_mask | _PAGE_GNTTAB) & ~_PAGE_GLOBAL)
-
-#define L2_DISALLOW_MASK base_disallow_mask
-
-#define l3_disallow_mask(d) (!is_pv_32bit_domain(d) ? \
- base_disallow_mask : 0xF198U)
-
-#define L4_DISALLOW_MASK (base_disallow_mask)
-
-#define l1_disallow_mask(d) \
-((d != dom_io) &&   \
- (rangeset_is_empty((d)->iomem_caps) && \
-  rangeset_is_empty((d)->arch.ioport_caps) &&   \
-  !has_arch_pdevs(d) && \
-  is_pv_domain(d)) ?\
- L1_DISALLOW_MASK : (L1_DISALLOW_MASK & ~PAGE_CACHE_ATTRS))
+uint32_t base_disallow_mask;
 
 static s8 __read_mostly opt_mmio_relax;
 static void __init parse_mmio_relax(const char *s)
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 07d4c06fc3..6857651db1 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -334,6 +334,25 @@ const unsigned long *get_platform_badpages(unsigned int 
*array_size);
 int page_lock(struct page_info *page);
 void page_unlock(struct page_info *page);
 
+extern uint32_t base_disallow_mask;
+/* Global bit is allowed to be set on L1 PTEs. Intended for user mappings. */
+#define L1_DISALLOW_MASK ((base_disallow_mask | _PAGE_GNTTAB) & ~_PAGE_GLOBAL)
+
+#define L2_DISALLOW_MASK base_disallow_mask
+
+#define l3_disallow_mask(d) (!is_pv_32bit_domain(d) ? \
+ base_disallow_mask : 0xF198U)
+
+#define L4_DISALLOW_MASK (base_disallow_mask)
+
+#define l1_disallow_mask(d) \
+((d != dom_io) &&   \
+ (rangeset_is_empty((d)->iomem_caps) && \
+  rangeset_is_empty((d)->arch.ioport_caps) &&   \
+  !has_arch_pdevs(d) && \
+  is_pv_domain(d)) ?\
+ L1_DISALLOW_MASK : (L1_DISALLOW_MASK & ~PAGE_CACHE_ATTRS))
+
 void put_page_type(struct page_info *page);
 int  get_page_type(struct page_info *page, unsigned long type);
 int  put_page_type_preemptible(struct page_info *page);
-- 
2.11.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v3 extra 03/11] x86/mm: move and add pv_ prefix to create_pae_xen_mappings

2017-07-30 Thread Wei Liu
And export it via a local header because it is going to be used by
several PV specific files.

Take the chance to change its return type to bool.

Signed-off-by: Wei Liu 
---
 xen/arch/x86/mm.c| 46 --
 xen/arch/x86/pv/mm.c | 40 
 xen/arch/x86/pv/mm.h |  6 ++
 3 files changed, 50 insertions(+), 42 deletions(-)
 create mode 100644 xen/arch/x86/pv/mm.h

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 40f9ad9c98..0c6a6de1a9 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -127,6 +127,8 @@
 #include 
 #include 
 
+#include "pv/mm.h"
+
 /* Mapping of the fixmap space needed early. */
 l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
 l1_fixmap[L1_PAGETABLE_ENTRIES];
@@ -1223,46 +1225,6 @@ static int alloc_l1_table(struct page_info *page)
 return ret;
 }
 
-static int create_pae_xen_mappings(struct domain *d, l3_pgentry_t *pl3e)
-{
-struct page_info *page;
-l3_pgentry_t l3e3;
-
-if ( !is_pv_32bit_domain(d) )
-return 1;
-
-pl3e = (l3_pgentry_t *)((unsigned long)pl3e & PAGE_MASK);
-
-/* 3rd L3 slot contains L2 with Xen-private mappings. It *must* exist. */
-l3e3 = pl3e[3];
-if ( !(l3e_get_flags(l3e3) & _PAGE_PRESENT) )
-{
-gdprintk(XENLOG_WARNING, "PAE L3 3rd slot is empty\n");
-return 0;
-}
-
-/*
- * The Xen-private mappings include linear mappings. The L2 thus cannot
- * be shared by multiple L3 tables. The test here is adequate because:
- *  1. Cannot appear in slots != 3 because get_page_type() checks the
- * PGT_pae_xen_l2 flag, which is asserted iff the L2 appears in slot 3
- *  2. Cannot appear in another page table's L3:
- * a. alloc_l3_table() calls this function and this check will fail
- * b. mod_l3_entry() disallows updates to slot 3 in an existing table
- */
-page = l3e_get_page(l3e3);
-BUG_ON(page->u.inuse.type_info & PGT_pinned);
-BUG_ON((page->u.inuse.type_info & PGT_count_mask) == 0);
-BUG_ON(!(page->u.inuse.type_info & PGT_pae_xen_l2));
-if ( (page->u.inuse.type_info & PGT_count_mask) != 1 )
-{
-gdprintk(XENLOG_WARNING, "PAE L3 3rd slot is shared\n");
-return 0;
-}
-
-return 1;
-}
-
 static int alloc_l2_table(struct page_info *page, unsigned long type,
   int preemptible)
 {
@@ -1367,7 +1329,7 @@ static int alloc_l3_table(struct page_info *page)
 adjust_guest_l3e(pl3e[i], d);
 }
 
-if ( rc >= 0 && !create_pae_xen_mappings(d, pl3e) )
+if ( rc >= 0 && !pv_create_pae_xen_mappings(d, pl3e) )
 rc = -EINVAL;
 if ( rc < 0 && rc != -ERESTART && rc != -EINTR )
 {
@@ -1839,7 +1801,7 @@ static int mod_l3_entry(l3_pgentry_t *pl3e,
 }
 
 if ( likely(rc == 0) )
-if ( !create_pae_xen_mappings(d, pl3e) )
+if ( !pv_create_pae_xen_mappings(d, pl3e) )
 BUG();
 
 put_page_from_l3e(ol3e, pfn, 0, 1);
diff --git a/xen/arch/x86/pv/mm.c b/xen/arch/x86/pv/mm.c
index 0f4303cef2..46e1fcf4e5 100644
--- a/xen/arch/x86/pv/mm.c
+++ b/xen/arch/x86/pv/mm.c
@@ -211,6 +211,46 @@ bool pv_update_intpte(intpte_t *p, intpte_t old, intpte_t 
new,
 return rv;
 }
 
+bool pv_create_pae_xen_mappings(struct domain *d, l3_pgentry_t *pl3e)
+{
+struct page_info *page;
+l3_pgentry_t l3e3;
+
+if ( !is_pv_32bit_domain(d) )
+return true;
+
+pl3e = (l3_pgentry_t *)((unsigned long)pl3e & PAGE_MASK);
+
+/* 3rd L3 slot contains L2 with Xen-private mappings. It *must* exist. */
+l3e3 = pl3e[3];
+if ( !(l3e_get_flags(l3e3) & _PAGE_PRESENT) )
+{
+gdprintk(XENLOG_WARNING, "PAE L3 3rd slot is empty\n");
+return false;
+}
+
+/*
+ * The Xen-private mappings include linear mappings. The L2 thus cannot
+ * be shared by multiple L3 tables. The test here is adequate because:
+ *  1. Cannot appear in slots != 3 because get_page_type() checks the
+ * PGT_pae_xen_l2 flag, which is asserted iff the L2 appears in slot 3
+ *  2. Cannot appear in another page table's L3:
+ * a. alloc_l3_table() calls this function and this check will fail
+ * b. mod_l3_entry() disallows updates to slot 3 in an existing table
+ */
+page = l3e_get_page(l3e3);
+BUG_ON(page->u.inuse.type_info & PGT_pinned);
+BUG_ON((page->u.inuse.type_info & PGT_count_mask) == 0);
+BUG_ON(!(page->u.inuse.type_info & PGT_pae_xen_l2));
+if ( (page->u.inuse.type_info & PGT_count_mask) != 1 )
+{
+gdprintk(XENLOG_WARNING, "PAE L3 3rd slot is shared\n");
+return false;
+}
+
+return true;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/pv/mm.h b/xen/arch/x86/pv/mm.h
new file mode 100644
index 00..bafc2b6116
--- /dev/null
+++ b/xen/arch/x86/pv/mm.h
@@ -0,0 +1,6 @@
+#ifndef __PV_MM_H__
+#define __PV_MM_H__
+
+bool 

[Xen-devel] [PATCH v3 extra 05/11] x86/mm: move pv_{alloc, free}_page_type

2017-07-30 Thread Wei Liu
Move them and the helper functions to pv/mm.c.  Use bool in the moved
code where appropriate.

Signed-off-by: Wei Liu 
---
 xen/arch/x86/domain.c   |   1 +
 xen/arch/x86/mm.c   | 492 
 xen/arch/x86/pv/mm.c| 491 +++
 xen/include/asm-x86/mm.h|   3 -
 xen/include/asm-x86/pv/mm.h |  12 ++
 5 files changed, 504 insertions(+), 495 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index d92a930d29..36225631eb 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -64,6 +64,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 5545a6f4de..ac0e0ba346 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -514,21 +514,6 @@ static void invalidate_shadow_ldt(struct vcpu *v, int 
flush)
 }
 
 
-static int alloc_segdesc_page(struct page_info *page)
-{
-const struct domain *owner = page_get_owner(page);
-struct desc_struct *descs = __map_domain_page(page);
-unsigned i;
-
-for ( i = 0; i < 512; i++ )
-if ( unlikely(!check_descriptor(owner, [i])) )
-break;
-
-unmap_domain_page(descs);
-
-return i == 512 ? 0 : -EINVAL;
-}
-
 bool get_page_from_mfn(mfn_t mfn, struct domain *d)
 {
 struct page_info *page = mfn_to_page(mfn_x(mfn));
@@ -543,7 +528,6 @@ bool get_page_from_mfn(mfn_t mfn, struct domain *d)
 return true;
 }
 
-
 int get_page_and_type_from_mfn(mfn_t mfn, unsigned long type, struct domain *d,
int partial, bool preemptible)
 {
@@ -1169,172 +1153,6 @@ int put_page_from_l4e(l4_pgentry_t l4e, unsigned long 
pfn, int partial,
 return 1;
 }
 
-static int alloc_l1_table(struct page_info *page)
-{
-struct domain *d = page_get_owner(page);
-unsigned long  pfn = page_to_mfn(page);
-l1_pgentry_t  *pl1e;
-unsigned int   i;
-intret = 0;
-
-pl1e = map_domain_page(_mfn(pfn));
-
-for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
-{
-switch ( ret = get_page_from_l1e(pl1e[i], d, d) )
-{
-default:
-goto fail;
-case 0:
-break;
-case _PAGE_RW ... _PAGE_RW | PAGE_CACHE_ATTRS:
-ASSERT(!(ret & ~(_PAGE_RW | PAGE_CACHE_ATTRS)));
-l1e_flip_flags(pl1e[i], ret);
-break;
-}
-
-adjust_guest_l1e(pl1e[i], d);
-}
-
-unmap_domain_page(pl1e);
-return 0;
-
- fail:
-gdprintk(XENLOG_WARNING, "Failure in alloc_l1_table: slot %#x\n", i);
-while ( i-- > 0 )
-put_page_from_l1e(pl1e[i], d);
-
-unmap_domain_page(pl1e);
-return ret;
-}
-
-static int alloc_l2_table(struct page_info *page, unsigned long type,
-  int preemptible)
-{
-struct domain *d = page_get_owner(page);
-unsigned long  pfn = page_to_mfn(page);
-l2_pgentry_t  *pl2e;
-unsigned int   i;
-intrc = 0;
-
-pl2e = map_domain_page(_mfn(pfn));
-
-for ( i = page->nr_validated_ptes; i < L2_PAGETABLE_ENTRIES; i++ )
-{
-if ( preemptible && i > page->nr_validated_ptes
- && hypercall_preempt_check() )
-{
-page->nr_validated_ptes = i;
-rc = -ERESTART;
-break;
-}
-
-if ( !is_guest_l2_slot(d, type, i) ||
- (rc = get_page_from_l2e(pl2e[i], pfn, d)) > 0 )
-continue;
-
-if ( rc < 0 )
-{
-gdprintk(XENLOG_WARNING, "Failure in alloc_l2_table: slot %#x\n", 
i);
-while ( i-- > 0 )
-if ( is_guest_l2_slot(d, type, i) )
-put_page_from_l2e(pl2e[i], pfn);
-break;
-}
-
-adjust_guest_l2e(pl2e[i], d);
-}
-
-if ( rc >= 0 && (type & PGT_pae_xen_l2) )
-{
-/* Xen private mappings. */
-memcpy([COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(d)],
-   _idle_pg_table_l2[
-   l2_table_offset(HIRO_COMPAT_MPT_VIRT_START)],
-   COMPAT_L2_PAGETABLE_XEN_SLOTS(d) * sizeof(*pl2e));
-}
-
-unmap_domain_page(pl2e);
-return rc > 0 ? 0 : rc;
-}
-
-static int alloc_l3_table(struct page_info *page)
-{
-struct domain *d = page_get_owner(page);
-unsigned long  pfn = page_to_mfn(page);
-l3_pgentry_t  *pl3e;
-unsigned int   i;
-intrc = 0, partial = page->partial_pte;
-
-pl3e = map_domain_page(_mfn(pfn));
-
-/*
- * PAE guests allocate full pages, but aren't required to initialize
- * more than the first four entries; when running in compatibility
- * mode, however, the full page is visible to the MMU, and hence all
- * 512 entries must be valid/verified, which is most easily achieved
- * by clearing them out.
- */
-if ( is_pv_32bit_domain(d) )
-memset(pl3e + 4, 0, (L3_PAGETABLE_ENTRIES - 4) * 

[Xen-devel] [PATCH v3 extra 08/11] x86/mm: remove the now unused inclusion of pv/mm.h

2017-07-30 Thread Wei Liu
Signed-off-by: Wei Liu 
---
 xen/arch/x86/mm.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index d232076459..167b318260 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -127,8 +127,6 @@
 #include 
 #include 
 
-#include "pv/mm.h"
-
 /* Mapping of the fixmap space needed early. */
 l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
 l1_fixmap[L1_PAGETABLE_ENTRIES];
-- 
2.11.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v3 extra 02/11] x86/mm: export more get/put page functions

2017-07-30 Thread Wei Liu
Export some of the get/put functions so that we can move PV mm code
trunk by trunk.

When moving code is done some of the functions might be made static
again.

Also fix coding style issues and use bool when appropriate.

Signed-off-by: Wei Liu 
---
 xen/arch/x86/mm.c| 40 
 xen/include/asm-x86/mm.h | 17 +++--
 2 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index a908d70dea..40f9ad9c98 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -559,9 +559,8 @@ bool get_page_from_mfn(mfn_t mfn, struct domain *d)
 }
 
 
-static int get_page_and_type_from_mfn(
-mfn_t mfn, unsigned long type, struct domain *d,
-int partial, int preemptible)
+int get_page_and_type_from_mfn(mfn_t mfn, unsigned long type, struct domain *d,
+   int partial, bool preemptible)
 {
 struct page_info *page = mfn_to_page(mfn_x(mfn));
 int rc;
@@ -944,7 +943,7 @@ get_page_from_l1e(
  *  <0 => error code
  */
 define_get_linear_pagetable(l2);
-static int
+int
 get_page_from_l2e(
 l2_pgentry_t l2e, unsigned long pfn, struct domain *d)
 {
@@ -963,7 +962,8 @@ get_page_from_l2e(
 
 if ( !(l2e_get_flags(l2e) & _PAGE_PSE) )
 {
-rc = get_page_and_type_from_mfn(_mfn(mfn), PGT_l1_page_table, d, 0, 0);
+rc = get_page_and_type_from_mfn(_mfn(mfn), PGT_l1_page_table, d, 0,
+false);
 if ( unlikely(rc == -EINVAL) && get_l2_linear_pagetable(l2e, pfn, d) )
 rc = 0;
 return rc;
@@ -980,7 +980,7 @@ get_page_from_l2e(
  *  <0 => error code
  */
 define_get_linear_pagetable(l3);
-static int
+int
 get_page_from_l3e(
 l3_pgentry_t l3e, unsigned long pfn, struct domain *d, int partial)
 {
@@ -996,8 +996,8 @@ get_page_from_l3e(
 return -EINVAL;
 }
 
-rc = get_page_and_type_from_mfn(
-_mfn(l3e_get_pfn(l3e)), PGT_l2_page_table, d, partial, 1);
+rc = get_page_and_type_from_mfn(_mfn(l3e_get_pfn(l3e)), PGT_l2_page_table,
+d, partial, true);
 if ( unlikely(rc == -EINVAL) &&
  !is_pv_32bit_domain(d) &&
  get_l3_linear_pagetable(l3e, pfn, d) )
@@ -1013,7 +1013,7 @@ get_page_from_l3e(
  *  <0 => error code
  */
 define_get_linear_pagetable(l4);
-static int
+int
 get_page_from_l4e(
 l4_pgentry_t l4e, unsigned long pfn, struct domain *d, int partial)
 {
@@ -1029,8 +1029,8 @@ get_page_from_l4e(
 return -EINVAL;
 }
 
-rc = get_page_and_type_from_mfn(
-_mfn(l4e_get_pfn(l4e)), PGT_l3_page_table, d, partial, 1);
+rc = get_page_and_type_from_mfn(_mfn(l4e_get_pfn(l4e)), PGT_l3_page_table,
+d, partial, true);
 if ( unlikely(rc == -EINVAL) && get_l4_linear_pagetable(l4e, pfn, d) )
 rc = 0;
 
@@ -1101,7 +1101,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain 
*l1e_owner)
  * NB. Virtual address 'l2e' maps to a machine address within frame 'pfn'.
  * Note also that this automatically deals correctly with linear p.t.'s.
  */
-static int put_page_from_l2e(l2_pgentry_t l2e, unsigned long pfn)
+int put_page_from_l2e(l2_pgentry_t l2e, unsigned long pfn)
 {
 if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) || (l2e_get_pfn(l2e) == pfn) )
 return 1;
@@ -1121,8 +1121,8 @@ static int put_page_from_l2e(l2_pgentry_t l2e, unsigned 
long pfn)
 
 static int __put_page_type(struct page_info *, int preemptible);
 
-static int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn,
- int partial, bool defer)
+int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn, int partial,
+  bool defer)
 {
 struct page_info *pg;
 
@@ -1159,8 +1159,8 @@ static int put_page_from_l3e(l3_pgentry_t l3e, unsigned 
long pfn,
 return put_page_and_type_preemptible(pg);
 }
 
-static int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn,
- int partial, bool defer)
+int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn, int partial,
+  bool defer)
 {
 if ( (l4e_get_flags(l4e) & _PAGE_PRESENT) &&
  (l4e_get_pfn(l4e) != pfn) )
@@ -1344,7 +1344,7 @@ static int alloc_l3_table(struct page_info *page)
 else
 rc = get_page_and_type_from_mfn(
 _mfn(l3e_get_pfn(pl3e[i])),
-PGT_l2_page_table | PGT_pae_xen_l2, d, partial, 1);
+PGT_l2_page_table | PGT_pae_xen_l2, d, partial, true);
 }
 else if ( !is_guest_l3_slot(i) ||
   (rc = get_page_from_l3e(pl3e[i], pfn, d, partial)) > 0 )
@@ -1996,7 +1996,7 @@ int get_page(struct page_info *page, struct domain 
*domain)
  *   acquired reference again.
  * Due to get_page() reserving one reference, this call cannot fail.
  */
-static void get_page_light(struct page_info *page)
+void get_page_light(struct 

Re: [Xen-devel] xen/link: Move .data.rel.ro sections into .rodata for final link

2017-07-30 Thread Andrew Cooper
On 30/07/17 07:16, Jan Beulich wrote:
 David Woodhouse  07/20/17 5:22 PM >>>
>> This includes stuff lke the hypercall tables which we really want
>> to be read-only. And they were going into .data.read-mostly.
> Yes, we'd like them to be read-only, but what if EFI properly assigned r/o
> permissions to the .rodata section when loading xen.efi? We'd then be
> unable to apply relocations when switching from 1:1 to virtual mappings
> (see efi_arch_relocate_image()).

Ah yes.  I'd overlooked that point when considering the ramifications of
this change.

efi_arch_relocate_image() should probably do the same as what we do with
livepatching, and temporarily clear CR0.WP for the duration of the patching.

~Andrew

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH] xen-blkback: reset flush counter for log_stats

2017-07-30 Thread Valentin Vidic
All the other counters get reset to 0 when printing stats,
while the flush counter keeps incrementing:

[ 2118.107554] xen-blkback: (5.xvda-0): oo   0  |  rd 1748  |  wr6 |  f 
3424  |  ds0 | pg:  161/1056
[ 2128.147524] xen-blkback: (5.xvda-0): oo   0  |  rd 5705  |  wr9 |  f 
3429  |  ds0 | pg:  161/1056
[ 2138.179507] xen-blkback: (5.xvda-0): oo   0  |  rd  137  |  wr   16 |  f 
3433  |  ds0 | pg:  161/1056
[ 2148.187460] xen-blkback: (5.xvda-0): oo   0  |  rd0  |  wr   25 |  f 
3448  |  ds0 | pg:  161/1056

Signed-off-by: Valentin Vidic 
---
 drivers/block/xen-blkback/blkback.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/block/xen-blkback/blkback.c 
b/drivers/block/xen-blkback/blkback.c
index fe7cd58c43d0..fe96219a533e 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -598,6 +598,7 @@ static void print_stats(struct xen_blkif_ring *ring)
ring->st_rd_req = 0;
ring->st_wr_req = 0;
ring->st_oo_req = 0;
+   ring->st_f_req  = 0;
ring->st_ds_req = 0;
 }
 
-- 
2.13.3


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [xen-unstable test] 112376: regressions - trouble: blocked/broken/fail/pass

2017-07-30 Thread osstest service owner
flight 112376 xen-unstable real [real]
http://logs.test-lab.xenproject.org/osstest/logs/112376/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-arm64-xsm   2 hosts-allocate broken REGR. vs. 112286
 build-arm64-pvops 2 hosts-allocate broken REGR. vs. 112286
 build-arm64   2 hosts-allocate broken REGR. vs. 112286
 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-localmigrate/x10 fail REGR. vs. 
112286
 test-amd64-amd64-xl-qemut-win7-amd64 16 guest-localmigrate/x10 fail REGR. vs. 
112286
 build-armhf-pvops 6 kernel-build   fail in 112369 REGR. vs. 112286

Tests which are failing intermittently (not blocking):
 test-amd64-i386-migrupgrade   5 host-install/dst_host(5) broken pass in 112369
 test-amd64-amd64-rumprun-amd64 17 rumprun-demo-xenstorels/xenstorels.repeat 
fail pass in 112369

Tests which did not succeed, but are not blocking:
 test-armhf-armhf-xl-multivcpu  1 build-check(1)  blocked in 112369 n/a
 test-armhf-armhf-libvirt  1 build-check(1)   blocked in 112369 n/a
 test-armhf-armhf-libvirt-raw  1 build-check(1)   blocked in 112369 n/a
 test-armhf-armhf-examine  1 build-check(1)   blocked in 112369 n/a
 test-armhf-armhf-xl   1 build-check(1)   blocked in 112369 n/a
 test-armhf-armhf-xl-vhd   1 build-check(1)   blocked in 112369 n/a
 test-armhf-armhf-xl-credit2   1 build-check(1)   blocked in 112369 n/a
 test-armhf-armhf-xl-cubietruck  1 build-check(1) blocked in 112369 n/a
 test-armhf-armhf-xl-rtds  1 build-check(1)   blocked in 112369 n/a
 test-armhf-armhf-xl-arndale   1 build-check(1)   blocked in 112369 n/a
 test-armhf-armhf-libvirt-xsm  1 build-check(1)   blocked in 112369 n/a
 test-armhf-armhf-xl-xsm   1 build-check(1)   blocked in 112369 n/a
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl   1 build-check(1)   blocked  n/a
 build-arm64-libvirt   1 build-check(1)   blocked  n/a
 test-arm64-arm64-examine  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit2   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-xsm   1 build-check(1)   blocked  n/a
 build-arm64-xsm   3 capture-logs  broken blocked in 112286
 build-arm64-pvops 3 capture-logs  broken blocked in 112286
 build-arm64   3 capture-logs  broken blocked in 112286
 test-armhf-armhf-xl-rtds 16 guest-start/debian.repeatfail  like 112274
 test-amd64-i386-xl-qemuu-win7-amd64 17 guest-stop fail like 112286
 test-amd64-i386-xl-qemut-win7-amd64 16 guest-localmigrate/x10 fail like 112286
 test-armhf-armhf-libvirt 14 saverestore-support-checkfail  like 112286
 test-armhf-armhf-libvirt-xsm 14 saverestore-support-checkfail  like 112286
 test-amd64-amd64-xl-rtds 10 debian-install   fail  like 112286
 test-armhf-armhf-libvirt-raw 13 saverestore-support-checkfail  like 112286
 test-amd64-amd64-xl-qemuu-ws16-amd64 10 windows-installfail never pass
 test-amd64-i386-libvirt-xsm  13 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt 13 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-amd64-amd64-libvirt-vhd 12 migrate-support-checkfail   never pass
 test-amd64-i386-xl-qemuu-ws16-amd64 13 guest-saverestore   fail never pass
 test-amd64-amd64-qemuu-nested-amd 17 debian-hvm-install/l1/l2  fail never pass
 test-armhf-armhf-xl  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-cubietruck 13 migrate-support-checkfail never pass
 test-armhf-armhf-xl-cubietruck 14 saverestore-support-checkfail never pass
 test-armhf-armhf-xl-xsm  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  14 saverestore-support-checkfail   never pass
 test-amd64-i386-xl-qemut-ws16-amd64 13 guest-saverestore   fail never pass
 test-armhf-armhf-xl-multivcpu 13 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 14 saverestore-support-checkfail  never pass
 test-amd64-i386-libvirt  13 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-qemut-ws16-amd64 10 windows-installfail never pass
 

Re: [Xen-devel] [PATCH v2 5/5] x86/vvmx: add per domain vmx msr policy

2017-07-30 Thread Jan Beulich
>>> Sergey Dyasli  07/24/17 3:48 PM >>>
>@@ -470,6 +471,9 @@ int arch_domain_create(struct domain *d, unsigned int 
>domcr_flags,
>if ( (rc = init_domain_cpuid_policy(d)) )
>goto fail;
 >
>+if ( (rc = init_domain_vmx_msr_policy(d)) )
>+goto fail;

There should not be a direct call from here to VMX-specific code - an
intermediate HVM layer is needed.

Jan


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [xen-unstable-coverity test] 112383: regressions - ALL FAIL

2017-07-30 Thread osstest service owner
flight 112383 xen-unstable-coverity real [real]
http://logs.test-lab.xenproject.org/osstest/logs/112383/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 coverity-amd646 coverity-build   fail REGR. vs. 40

version targeted for testing:
 xen  aa4eb460bcf77ea87b9209bb136efc8142a1a512
baseline version:
 xen  8b9793bfe614ee53029d2b1672e1080170809dcd

Last test of basis   40  2017-06-28 10:06:03 Z   31 days
Failing since111315  2017-07-02 09:22:26 Z   28 days9 attempts
Testing same since   112383  2017-07-30 09:20:32 Z0 days1 attempts


People who touched revisions under test:
  Andrew Cooper 
  Andrii Anisov 
  Chao Gao 
  Dario Faggioli 
  David Woodhouse 
  Dongli Zhang 
  Felix Schmoll 
  George Dunlap 
  Haozhong Zhang 
  Ian Jackson 
  Igor Druzhinin 
  Jan Beulich 
  Julien Grall 
  Justin T. Weaver 
  Kevin Tian 
  Konrad Rzeszutek Wilk 
  Konrad Rzeszutek Wilk 
  Marek Marczykowski-Górecki 
  Olaf Hering 
  Owen Smith 
  Petre Pircalabu 
  Praveen Kumar 
  Razvan Cojocaru 
  Sergej Proskurin 
  Sergey Dyasli 
  Stefano Stabellini 
  Thomas Sanders 
  Tim Deegan 
  Wei Liu 
  Xiong Zhang 
  Zhongze Liu 

jobs:
 coverity-amd64   fail



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Not pushing.

(No revision log; it would be 2130 lines long.)

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v3 00/21] x86: refactor mm.c (the easy part)

2017-07-30 Thread Wei Liu
On Sun, Jul 30, 2017 at 12:26:59AM -0600, Jan Beulich wrote:
> >>> Wei Liu  07/20/17 6:04 PM >>>
> >What is left is mostly PV MMU hypercall functions and their supporting code.
> >I'm still thinking about how to refactor those because the helper functions 
> >are
> >a bit convulted. The helper functions are both used by PV MMU code and the
> >common get / put functions. I think I need to refactor the get / put 
> >functions.
> >If you think there is a better approach please let me know.
> 
> Wouldn't it, for example, be possible to simply move {alloc,free}_page_type()
> to pv-specific code, providing stubs for the !PV case?
> 

Yes, that's one of the easier ways of doing it. And I'm inclined at this
point to do that.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [linux-linus test] 112375: regressions - trouble: blocked/broken/fail/pass

2017-07-30 Thread osstest service owner
flight 112375 linux-linus real [real]
http://logs.test-lab.xenproject.org/osstest/logs/112375/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-arm64   2 hosts-allocate broken REGR. vs. 110515
 build-arm64-pvops 2 hosts-allocate broken REGR. vs. 110515
 build-arm64-xsm   2 hosts-allocate broken REGR. vs. 110515
 test-amd64-amd64-examine  7 reboot   fail REGR. vs. 110515
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 7 xen-boot fail REGR. vs. 
110515
 test-amd64-amd64-libvirt-pair 10 xen-boot/src_host   fail REGR. vs. 110515
 test-amd64-amd64-rumprun-amd64  7 xen-boot   fail REGR. vs. 110515
 test-amd64-amd64-libvirt-pair 11 xen-boot/dst_host   fail REGR. vs. 110515
 test-amd64-amd64-libvirt  7 xen-boot fail REGR. vs. 110515
 test-amd64-amd64-qemuu-nested-intel  7 xen-boot  fail REGR. vs. 110515
 test-amd64-amd64-xl-pvh-intel  7 xen-bootfail REGR. vs. 110515
 test-amd64-amd64-pygrub   7 xen-boot fail REGR. vs. 110515
 test-amd64-amd64-amd64-pvgrub  7 xen-bootfail REGR. vs. 110515
 test-amd64-amd64-xl-qemut-stubdom-debianhvm-amd64-xsm 7 xen-boot fail REGR. 
vs. 110515
 test-amd64-amd64-xl-qcow2 7 xen-boot fail REGR. vs. 110515
 test-amd64-amd64-xl-qemut-debianhvm-amd64  7 xen-bootfail REGR. vs. 110515
 test-amd64-amd64-i386-pvgrub  7 xen-boot fail REGR. vs. 110515
 test-amd64-amd64-xl-qemut-win7-amd64 16 guest-localmigrate/x10 fail REGR. vs. 
110515
 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-localmigrate/x10 fail REGR. vs. 
110515
 test-armhf-armhf-xl-vhd  10 debian-di-installfail REGR. vs. 110515

Tests which did not succeed, but are not blocking:
 build-arm64-libvirt   1 build-check(1)   blocked  n/a
 test-arm64-arm64-examine  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit2   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-xsm   1 build-check(1)   blocked  n/a
 build-arm64-xsm   3 capture-logs  broken blocked in 110515
 build-arm64-pvops 3 capture-logs  broken blocked in 110515
 build-arm64   3 capture-logs  broken blocked in 110515
 test-armhf-armhf-libvirt 14 saverestore-support-checkfail  like 110515
 test-armhf-armhf-libvirt-xsm 14 saverestore-support-checkfail  like 110515
 test-armhf-armhf-xl-rtds 16 guest-start/debian.repeatfail  like 110515
 test-amd64-i386-xl-qemuu-win7-amd64 17 guest-stop fail like 110515
 test-amd64-i386-xl-qemut-win7-amd64 17 guest-stop fail like 110515
 test-amd64-amd64-xl-rtds 10 debian-install   fail  like 110515
 test-armhf-armhf-libvirt-raw 13 saverestore-support-checkfail  like 110515
 test-amd64-amd64-xl-qemuu-ws16-amd64 10 windows-installfail never pass
 test-amd64-i386-libvirt  13 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-xsm  13 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check 
fail never pass
 test-amd64-amd64-qemuu-nested-amd 17 debian-hvm-install/l1/l2  fail never pass
 test-armhf-armhf-xl-rtds 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt 13 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-xsm 13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 13 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 14 saverestore-support-checkfail  never pass
 test-amd64-amd64-xl-qemut-ws16-amd64 10 windows-installfail never pass
 test-amd64-i386-xl-qemuu-ws16-amd64 13 guest-saverestore   fail never pass
 test-amd64-i386-xl-qemut-ws16-amd64 13 guest-saverestore   fail never pass
 test-armhf-armhf-xl-arndale  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  14 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl  13 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  14 saverestore-support-checkfail   never pass
 

Re: [Xen-devel] [PATCH] x86/hvm: Fix boundary check in hvmemul_insn_fetch()

2017-07-30 Thread Jan Beulich
>>> Andrew Cooper  07/25/17 8:55 PM >>>
>--- a/xen/arch/x86/hvm/emulate.c
>+++ b/xen/arch/x86/hvm/emulate.c
>@@ -958,8 +958,8 @@ int hvmemul_insn_fetch(
>* Will we overflow insn_buf[]?  This shouldn't be able to happen,
>* which means something went wrong with instruction decoding...
>*/
>- if ( insn_off > sizeof(hvmemul_ctxt->insn_buf) ||
>- (insn_off + bytes) > sizeof(hvmemul_ctxt->insn_buf) )
>+if ( insn_off >= sizeof(hvmemul_ctxt->insn_buf) ||
>+ (insn_off + bytes) >= sizeof(hvmemul_ctxt->insn_buf) )

I agree with the change to the first line, but are you sure about the
second one? At the example of insn_off == 0, surely
bytes == sizeof() is fine?

Jan


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v3 00/21] x86: refactor mm.c (the easy part)

2017-07-30 Thread Jan Beulich
>>> Wei Liu  07/20/17 6:04 PM >>>
>What is left is mostly PV MMU hypercall functions and their supporting code.
>I'm still thinking about how to refactor those because the helper functions are
>a bit convulted. The helper functions are both used by PV MMU code and the
>common get / put functions. I think I need to refactor the get / put functions.
>If you think there is a better approach please let me know.

Wouldn't it, for example, be possible to simply move {alloc,free}_page_type()
to pv-specific code, providing stubs for the !PV case?

Jan


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] xen/link: Move .data.rel.ro sections into .rodata for final link

2017-07-30 Thread Jan Beulich
>>> David Woodhouse  07/20/17 5:22 PM >>>
>This includes stuff lke the hypercall tables which we really want
>to be read-only. And they were going into .data.read-mostly.

Yes, we'd like them to be read-only, but what if EFI properly assigned r/o
permissions to the .rodata section when loading xen.efi? We'd then be
unable to apply relocations when switching from 1:1 to virtual mappings
(see efi_arch_relocate_image()).

Jan


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel