1. 15 7月, 2014 1 次提交
    • K
      xen: Introduce 'xen_nopv' to disable PV extensions for HVM guests. · 8d693b91
      Konrad Rzeszutek Wilk 提交于
      By default when CONFIG_XEN and CONFIG_XEN_PVHVM kernels are
      run, they will enable the PV extensions (drivers, interrupts, timers,
      etc) - which is the best option for the majority of use cases.
      
      However, in some cases (kexec not fully working, benchmarking)
      we want to disable Xen PV extensions. As such introduce the
      'xen_nopv' parameter that will do it.
      
      This parameter is intended only for HVM guests as the Xen PV
      guests MUST boot with PV extensions. However, even if you use
      'xen_nopv' on Xen PV guests it will be ignored.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NDavid Vrabel <david.vrabel@citrix.com>
      ---
      [v2: s/off/xen_nopv/ per Boris Ostrovsky recommendation.]
      [v3: Add Reviewed-by]
      [v4: Clarify that this is only for HVM guests]
      8d693b91
  2. 18 6月, 2014 1 次提交
  3. 05 6月, 2014 2 次提交
  4. 27 5月, 2014 1 次提交
  5. 15 5月, 2014 7 次提交
  6. 13 5月, 2014 1 次提交
  7. 06 5月, 2014 3 次提交
  8. 16 4月, 2014 1 次提交
  9. 15 4月, 2014 1 次提交
    • B
      x86/xen: Fix 32-bit PV guests's usage of kernel_stack · 4461bbc0
      Boris Ostrovsky 提交于
      Commit 198d208d ("x86: Keep
      thread_info on thread stack in x86_32") made 32-bit kernels use
      kernel_stack to point to thread_info. That change missed a couple of
      updates needed by Xen's 32-bit PV guests:
      
      1. kernel_stack needs to be initialized for secondary CPUs
      
      2. GET_THREAD_INFO() now uses %fs register which may not be the
         kernel's version when executing xen_iret().
      
      With respect to the second issue, we don't need GET_THREAD_INFO()
      anymore: we used it as an intermediate step to get to per_cpu xen_vcpu
      and avoid referencing %fs. Now that we are going to use %fs anyway we
      may as well go directly to xen_vcpu.
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      4461bbc0
  10. 25 3月, 2014 1 次提交
    • D
      Revert "xen: properly account for _PAGE_NUMA during xen pte translations" · 5926f87f
      David Vrabel 提交于
      This reverts commit a9c8e4be.
      
      PTEs in Xen PV guests must contain machine addresses if _PAGE_PRESENT
      is set and pseudo-physical addresses is _PAGE_PRESENT is clear.
      
      This is because during a domain save/restore (migration) the page
      table entries are "canonicalised" and uncanonicalised". i.e., MFNs are
      converted to PFNs during domain save so that on a restore the page
      table entries may be rewritten with the new MFNs on the destination.
      This canonicalisation is only done for PTEs that are present.
      
      This change resulted in writing PTEs with MFNs if _PAGE_PROTNONE (or
      _PAGE_NUMA) was set but _PAGE_PRESENT was clear.  These PTEs would be
      migrated as-is which would result in unexpected behaviour in the
      destination domain.  Either a) the MFN would be translated to the
      wrong PFN/page; b) setting the _PAGE_PRESENT bit would clear the PTE
      because the MFN is no longer owned by the domain; or c) the present
      bit would not get set.
      
      Symptoms include "Bad page" reports when munmapping after migrating a
      domain.
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      Acked-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: <stable@vger.kernel.org>        [3.12+]
      5926f87f
  11. 18 3月, 2014 2 次提交
  12. 14 3月, 2014 1 次提交
  13. 05 3月, 2014 1 次提交
  14. 28 2月, 2014 1 次提交
  15. 11 2月, 2014 1 次提交
    • M
      xen: properly account for _PAGE_NUMA during xen pte translations · a9c8e4be
      Mel Gorman 提交于
      Steven Noonan forwarded a users report where they had a problem starting
      vsftpd on a Xen paravirtualized guest, with this in dmesg:
      
        BUG: Bad page map in process vsftpd  pte:8000000493b88165 pmd:e9cc01067
        page:ffffea00124ee200 count:0 mapcount:-1 mapping:     (null) index:0x0
        page flags: 0x2ffc0000000014(referenced|dirty)
        addr:00007f97eea74000 vm_flags:00100071 anon_vma:ffff880e98f80380 mapping:          (null) index:7f97eea74
        CPU: 4 PID: 587 Comm: vsftpd Not tainted 3.12.7-1-ec2 #1
        Call Trace:
          dump_stack+0x45/0x56
          print_bad_pte+0x22e/0x250
          unmap_single_vma+0x583/0x890
          unmap_vmas+0x65/0x90
          exit_mmap+0xc5/0x170
          mmput+0x65/0x100
          do_exit+0x393/0x9e0
          do_group_exit+0xcc/0x140
          SyS_exit_group+0x14/0x20
          system_call_fastpath+0x1a/0x1f
        Disabling lock debugging due to kernel taint
        BUG: Bad rss-counter state mm:ffff880e9ca60580 idx:0 val:-1
        BUG: Bad rss-counter state mm:ffff880e9ca60580 idx:1 val:1
      
      The issue could not be reproduced under an HVM instance with the same
      kernel, so it appears to be exclusive to paravirtual Xen guests.  He
      bisected the problem to commit 1667918b ("mm: numa: clear numa
      hinting information on mprotect") that was also included in 3.12-stable.
      
      The problem was related to how xen translates ptes because it was not
      accounting for the _PAGE_NUMA bit.  This patch splits pte_present to add
      a pteval_present helper for use by xen so both bare metal and xen use
      the same code when checking if a PTE is present.
      
      [mgorman@suse.de: wrote changelog, proposed minor modifications]
      [akpm@linux-foundation.org: fix typo in comment]
      Reported-by: NSteven Noonan <steven@uplinklabs.net>
      Tested-by: NSteven Noonan <steven@uplinklabs.net>
      Signed-off-by: NElena Ufimtseva <ufimtseva@gmail.com>
      Signed-off-by: NMel Gorman <mgorman@suse.de>
      Reviewed-by: NDavid Vrabel <david.vrabel@citrix.com>
      Acked-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: <stable@vger.kernel.org>	[3.12+]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a9c8e4be
  16. 04 2月, 2014 1 次提交
  17. 03 2月, 2014 1 次提交
  18. 31 1月, 2014 2 次提交
    • D
      xen/pvh: Fix misplaced kfree from xlated_setup_gnttab_pages · f93576e1
      Dave Jones 提交于
      Passing a freed 'pages' to free_xenballooned_pages will end badly
      on kernels with slub debug enabled.
      
      This looks out of place between the rc assign and the check, but
      we do want to kfree pages regardless of which path we take.
      Signed-off-by: NDave Jones <davej@fedoraproject.org>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      f93576e1
    • Z
      xen/grant-table: Avoid m2p_override during mapping · 08ece5bb
      Zoltan Kiss 提交于
      The grant mapping API does m2p_override unnecessarily: only gntdev needs it,
      for blkback and future netback patches it just cause a lock contention, as
      those pages never go to userspace. Therefore this series does the following:
      - the original functions were renamed to __gnttab_[un]map_refs, with a new
        parameter m2p_override
      - based on m2p_override either they follow the original behaviour, or just set
        the private flag and call set_phys_to_machine
      - gnttab_[un]map_refs are now a wrapper to call __gnttab_[un]map_refs with
        m2p_override false
      - a new function gnttab_[un]map_refs_userspace provides the old behaviour
      
      It also removes a stray space from page.h and change ret to 0 if
      XENFEAT_auto_translated_physmap, as that is the only possible return value
      there.
      
      v2:
      - move the storing of the old mfn in page->index to gnttab_map_refs
      - move the function header update to a separate patch
      
      v3:
      - a new approach to retain old behaviour where it needed
      - squash the patches into one
      
      v4:
      - move out the common bits from m2p* functions, and pass pfn/mfn as parameter
      - clear page->private before doing anything with the page, so m2p_find_override
        won't race with this
      
      v5:
      - change return value handling in __gnttab_[un]map_refs
      - remove a stray space in page.h
      - add detail why ret = 0 now at some places
      
      v6:
      - don't pass pfn to m2p* functions, just get it locally
      Signed-off-by: NZoltan Kiss <zoltan.kiss@citrix.com>
      Suggested-by: NDavid Vrabel <david.vrabel@citrix.com>
      Acked-by: NDavid Vrabel <david.vrabel@citrix.com>
      Acked-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      08ece5bb
  19. 30 1月, 2014 3 次提交
  20. 22 1月, 2014 1 次提交
    • R
      xen/pvh: Set X86_CR0_WP and others in CR0 (v2) · c9f6e997
      Roger Pau Monne 提交于
      otherwise we will get for some user-space applications
      that use 'clone' with CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID
      end up hitting an assert in glibc manifested by:
      
      general protection ip:7f80720d364c sp:7fff98fd8a80 error:0 in
      libc-2.13.so[7f807209e000+180000]
      
      This is due to the nature of said operations which sets and clears
      the PID.  "In the successful one I can see that the page table of
      the parent process has been updated successfully to use a
      different physical page, so the write of the tid on
      that page only affects the child...
      
      On the other hand, in the failed case, the write seems to happen before
      the copy of the original page is done, so both the parent and the child
      end up with the same value (because the parent copies the page after
      the write of the child tid has already happened)."
      (Roger's analysis). The nature of this is due to the Xen's commit
      of 51e2cac257ec8b4080d89f0855c498cbbd76a5e5
      "x86/pvh: set only minimal cr0 and cr4 flags in order to use paging"
      the CR0_WP was removed so COW features of the Linux kernel were not
      operating properly.
      
      While doing that also update the rest of the CR0 flags to be inline
      with what a baremetal Linux kernel would set them to.
      
      In 'secondary_startup_64' (baremetal Linux) sets:
      
      X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | X86_CR0_NE | X86_CR0_WP |
      X86_CR0_AM | X86_CR0_PG
      
      The hypervisor for HVM type guests (which PVH is a bit) sets:
      X86_CR0_PE | X86_CR0_ET | X86_CR0_TS
      For PVH it specifically sets:
      X86_CR0_PG
      
      Which means we need to set the rest: X86_CR0_MP | X86_CR0_NE  |
      X86_CR0_WP | X86_CR0_AM to have full parity.
      Signed-off-by: NRoger Pau Monne <roger.pau@citrix.com>
      Signed-off-by: NMukesh Rathor <mukesh.rathor@oracle.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      [v1: Took out the cr4 writes to be a seperate patch]
      [v2: 0-DAY kernel found xen_setup_gdt to be missing a static]
      c9f6e997
  21. 10 1月, 2014 1 次提交
  22. 07 1月, 2014 2 次提交
  23. 06 1月, 2014 4 次提交
    • M
      xen/pvh: Support ParaVirtualized Hardware extensions (v3). · 4e903a20
      Mukesh Rathor 提交于
      PVH allows PV linux guest to utilize hardware extended capabilities,
      such as running MMU updates in a HVM container.
      
      The Xen side defines PVH as (from docs/misc/pvh-readme.txt,
      with modifications):
      
      "* the guest uses auto translate:
       - p2m is managed by Xen
       - pagetables are owned by the guest
       - mmu_update hypercall not available
      * it uses event callback and not vlapic emulation,
      * IDT is native, so set_trap_table hcall is also N/A for a PVH guest.
      
      For a full list of hcalls supported for PVH, see pvh_hypercall64_table
      in arch/x86/hvm/hvm.c in xen.  From the ABI prespective, it's mostly a
      PV guest with auto translate, although it does use hvm_op for setting
      callback vector."
      
      Use .ascii and .asciz to define xen feature string. Note, the PVH
      string must be in a single line (not multiple lines with \) to keep the
      assembler from putting null char after each string before \.
      This patch allows it to be configured and enabled.
      
      We also use introduce the 'XEN_ELFNOTE_SUPPORTED_FEATURES' ELF note to
      tell the hypervisor that 'hvm_callback_vector' is what the kernel
      needs. We can not put it in 'XEN_ELFNOTE_FEATURES' as older hypervisor
      parse fields they don't understand as errors and refuse to load
      the kernel. This work-around fixes the problem.
      Signed-off-by: NMukesh Rathor <mukesh.rathor@oracle.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Acked-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      4e903a20
    • K
      xen/pvh: Piggyback on PVHVM for grant driver (v4) · 6926f6d6
      Konrad Rzeszutek Wilk 提交于
      In PVH the shared grant frame is the PFN and not MFN,
      hence its mapped via the same code path as HVM.
      
      The allocation of the grant frame is done differently - we
      do not use the early platform-pci driver and have an
      ioremap area - instead we use balloon memory and stitch
      all of the non-contingous pages in a virtualized area.
      
      That means when we call the hypervisor to replace the GMFN
      with a XENMAPSPACE_grant_table type, we need to lookup the
      old PFN for every iteration instead of assuming a flat
      contingous PFN allocation.
      
      Lastly, we only use v1 for grants. This is because PVHVM
      is not able to use v2 due to no XENMEM_add_to_physmap
      calls on the error status page (see commit
      69e8f430
       xen/granttable: Disable grant v2 for HVM domains.)
      
      Until that is implemented this workaround has to
      be in place.
      
      Also per suggestions by Stefano utilize the PVHVM paths
      as they share common functionality.
      
      v2 of this patch moves most of the PVH code out in the
      arch/x86/xen/grant-table driver and touches only minimally
      the generic driver.
      
      v3, v4: fixes us some of the code due to earlier patches.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Acked-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      6926f6d6
    • M
      xen/pvh: Piggyback on PVHVM for event channels (v2) · 2771374d
      Mukesh Rathor 提交于
      PVH is a PV guest with a twist - there are certain things
      that work in it like HVM and some like PV. There is
      a similar mode - PVHVM where we run in HVM mode with
      PV code enabled - and this patch explores that.
      
      The most notable PV interfaces are the XenBus and event channels.
      
      We will piggyback on how the event channel mechanism is
      used in PVHVM - that is we want the normal native IRQ mechanism
      and we will install a vector (hvm callback) for which we
      will call the event channel mechanism.
      
      This means that from a pvops perspective, we can use
      native_irq_ops instead of the Xen PV specific. Albeit in the
      future we could support pirq_eoi_map. But that is
      a feature request that can be shared with PVHVM.
      Signed-off-by: NMukesh Rathor <mukesh.rathor@oracle.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NDavid Vrabel <david.vrabel@citrix.com>
      Acked-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      2771374d
    • M
      xen/pvh: Update E820 to work with PVH (v2) · 9103bb0f
      Mukesh Rathor 提交于
      In xen_add_extra_mem() we can skip updating P2M as it's managed
      by Xen. PVH maps the entire IO space, but only RAM pages need
      to be repopulated.
      Signed-off-by: NMukesh Rathor <mukesh.rathor@oracle.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NDavid Vrabel <david.vrabel@citrix.com>
      Acked-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      9103bb0f