1. 17 1月, 2018 3 次提交
    • D
      spapr: Validate capabilities on migration · be85537d
      David Gibson 提交于
      Now that the "pseries" machine type implements optional capabilities (well,
      one so far) there's the possibility of having different capabilities
      available at either end of a migration.  Although arguably a user error,
      it would be nice to catch this situation and fail as gracefully as we can.
      
      This adds code to migrate the capabilities flags.  These aren't pulled
      directly into the destination's configuration since what the user has
      specified on the destination command line should take precedence.  However,
      they are checked against the destination capabilities.
      
      If the source was using a capability which is absent on the destination,
      we fail the migration, since that could easily cause a guest crash or other
      bad behaviour.  If the source lacked a capability which is present on the
      destination we warn, but allow the migration to proceed.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      be85537d
    • D
      spapr: Treat Hardware Transactional Memory (HTM) as an optional capability · ee76a09f
      David Gibson 提交于
      This adds an spapr capability bit for Hardware Transactional Memory.  It is
      enabled by default for pseries-2.11 and earlier machine types. with POWER8
      or later CPUs (as it must be, since earlier qemu versions would implicitly
      allow it).  However it is disabled by default for the latest pseries-2.12
      machine type.
      
      This means that with the latest machine type, HTM will not be available,
      regardless of CPU, unless it is explicitly enabled on the command line.
      That change is made on the basis that:
      
       * This way running with -M pseries,accel=tcg will start with whatever cpu
         and will provide the same guest visible model as with accel=kvm.
           - More specifically, this means existing make check tests don't have
             to be modified to use cap-htm=off in order to run with TCG
      
       * We hope to add a new "HTM without suspend" feature in the not too
         distant future which could work on both POWER8 and POWER9 cpus, and
         could be enabled by default.
      
       * Best guesses suggest that future POWER cpus may well only support the
         HTM-without-suspend model, not the (frankly, horribly overcomplicated)
         POWER8 style HTM with suspend.
      
       * Anecdotal evidence suggests problems with HTM being enabled when it
         wasn't wanted are more common than being missing when it was.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      ee76a09f
    • D
      spapr: Capabilities infrastructure · 33face6b
      David Gibson 提交于
      Because PAPR is a paravirtual environment access to certain CPU (or other)
      facilities can be blocked by the hypervisor.  PAPR provides ways to
      advertise in the device tree whether or not those features are available to
      the guest.
      
      In some places we automatically determine whether to make a feature
      available based on whether our host can support it, in most cases this is
      based on limitations in the available KVM implementation.
      
      Although we correctly advertise this to the guest, it means that host
      factors might make changes to the guest visible environment which is bad:
      as well as generaly reducing reproducibility, it means that a migration
      between different host environments can easily go bad.
      
      We've mostly gotten away with it because the environments considered mature
      enough to be well supported (basically, KVM on POWER8) have had consistent
      feature availability.  But, it's still not right and some limitations on
      POWER9 is going to make it more of an issue in future.
      
      This introduces an infrastructure for defining "sPAPR capabilities".  These
      are set by default based on the machine version, masked by the capabilities
      of the chosen cpu, but can be overriden with machine properties.
      
      The intention is at reset time we verify that the requested capabilities
      can be supported on the host (considering TCG, KVM and/or host cpu
      limitations).  If not we simply fail, rather than silently modifying the
      advertised featureset to the guest.
      
      This does mean that certain configurations that "worked" may now fail, but
      such configurations were already more subtly broken.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      33face6b