)]}'
{
  "commit": "371fefd6f2dc46668e00871930dde613b88d4bde",
  "tree": "35fe799343861405914d27873eb175eb04d6dce5",
  "parents": [
    "54738c097163c3f01e67ccc85462b78d4d4f495f"
  ],
  "author": {
    "name": "Paul Mackerras",
    "email": "paulus@samba.org",
    "time": "Wed Jun 29 00:23:08 2011 +0000"
  },
  "committer": {
    "name": "Avi Kivity",
    "email": "avi@redhat.com",
    "time": "Tue Jul 12 13:16:57 2011 +0300"
  },
  "message": "KVM: PPC: Allow book3s_hv guests to use SMT processor modes\n\nThis lifts the restriction that book3s_hv guests can only run one\nhardware thread per core, and allows them to use up to 4 threads\nper core on POWER7.  The host still has to run single-threaded.\n\nThis capability is advertised to qemu through a new KVM_CAP_PPC_SMT\ncapability.  The return value of the ioctl querying this capability\nis the number of vcpus per virtual CPU core (vcore), currently 4.\n\nTo use this, the host kernel should be booted with all threads\nactive, and then all the secondary threads should be offlined.\nThis will put the secondary threads into nap mode.  KVM will then\nwake them from nap mode and use them for running guest code (while\nthey are still offline).  To wake the secondary threads, we send\nthem an IPI using a new xics_wake_cpu() function, implemented in\narch/powerpc/sysdev/xics/icp-native.c.  In other words, at this stage\nwe assume that the platform has a XICS interrupt controller and\nwe are using icp-native.c to drive it.  Since the woken thread will\nneed to acknowledge and clear the IPI, we also export the base\nphysical address of the XICS registers using kvmppc_set_xics_phys()\nfor use in the low-level KVM book3s code.\n\nWhen a vcpu is created, it is assigned to a virtual CPU core.\nThe vcore number is obtained by dividing the vcpu number by the\nnumber of threads per core in the host.  This number is exported\nto userspace via the KVM_CAP_PPC_SMT capability.  If qemu wishes\nto run the guest in single-threaded mode, it should make all vcpu\nnumbers be multiples of the number of threads per core.\n\nWe distinguish three states of a vcpu: runnable (i.e., ready to execute\nthe guest), blocked (that is, idle), and busy in host.  We currently\nimplement a policy that the vcore can run only when all its threads\nare runnable or blocked.  This way, if a vcpu needs to execute elsewhere\nin the kernel or in qemu, it can do so without being starved of CPU\nby the other vcpus.\n\nWhen a vcore starts to run, it executes in the context of one of the\nvcpu threads.  The other vcpu threads all go to sleep and stay asleep\nuntil something happens requiring the vcpu thread to return to qemu,\nor to wake up to run the vcore (this can happen when another vcpu\nthread goes from busy in host state to blocked).\n\nIt can happen that a vcpu goes from blocked to runnable state (e.g.\nbecause of an interrupt), and the vcore it belongs to is already\nrunning.  In that case it can start to run immediately as long as\nthe none of the vcpus in the vcore have started to exit the guest.\nWe send the next free thread in the vcore an IPI to get it to start\nto execute the guest.  It synchronizes with the other threads via\nthe vcore-\u003eentry_exit_count field to make sure that it doesn\u0027t go\ninto the guest if the other vcpus are exiting by the time that it\nis ready to actually enter the guest.\n\nNote that there is no fixed relationship between the hardware thread\nnumber and the vcpu number.  Hardware threads are assigned to vcpus\nas they become runnable, so we will always use the lower-numbered\nhardware threads in preference to higher-numbered threads if not all\nthe vcpus in the vcore are runnable, regardless of which vcpus are\nrunnable.\n\nSigned-off-by: Paul Mackerras \u003cpaulus@samba.org\u003e\nSigned-off-by: Alexander Graf \u003cagraf@suse.de\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "a1d344d5ff4cafe7e2ecc97ec31a549cef1185ff",
      "old_mode": 33188,
      "old_path": "Documentation/virtual/kvm/api.txt",
      "new_id": "681871311d3ebbbe42429cf251e2a96d4687e633",
      "new_mode": 33188,
      "new_path": "Documentation/virtual/kvm/api.txt"
    },
    {
      "type": "modify",
      "old_id": "c3ec990daf459720648ef32a677e9fffad4fc42b",
      "old_mode": 33188,
      "old_path": "arch/powerpc/include/asm/kvm.h",
      "new_id": "471bb3d85e0bbbb52ef7b9bd3a25c70ae26c6987",
      "new_mode": 33188,
      "new_path": "arch/powerpc/include/asm/kvm.h"
    },
    {
      "type": "modify",
      "old_id": "b7b039532fbc16c4993262aec9693a8dd6d3e549",
      "old_mode": 33188,
      "old_path": "arch/powerpc/include/asm/kvm_book3s_asm.h",
      "new_id": "9cfd5436782d7a95a161a4268f1ad9e06ec94b52",
      "new_mode": 33188,
      "new_path": "arch/powerpc/include/asm/kvm_book3s_asm.h"
    },
    {
      "type": "modify",
      "old_id": "5616e39a7fa4bd60fdee73585fe3a1b80d1a1931",
      "old_mode": 33188,
      "old_path": "arch/powerpc/include/asm/kvm_host.h",
      "new_id": "0d6d569e19c73958ed15ea8cde888547390b996b",
      "new_mode": 33188,
      "new_path": "arch/powerpc/include/asm/kvm_host.h"
    },
    {
      "type": "modify",
      "old_id": "99f6fcf4cf88726a043dff670c6f6a83d73aba0c",
      "old_mode": 33188,
      "old_path": "arch/powerpc/include/asm/kvm_ppc.h",
      "new_id": "6ef734428634ba157a809fd21f39a54b56f7c681",
      "new_mode": 33188,
      "new_path": "arch/powerpc/include/asm/kvm_ppc.h"
    },
    {
      "type": "modify",
      "old_id": "c70d106bf1a400dfd0eb271158c6a3a625653d0c",
      "old_mode": 33188,
      "old_path": "arch/powerpc/kernel/asm-offsets.c",
      "new_id": "d0f2387fd792b23c27321bef9096d4823ea4aa1e",
      "new_mode": 33188,
      "new_path": "arch/powerpc/kernel/asm-offsets.c"
    },
    {
      "type": "modify",
      "old_id": "163c041cec248779f51c1858371d358dcd9bd1e7",
      "old_mode": 33188,
      "old_path": "arch/powerpc/kernel/exceptions-64s.S",
      "new_id": "5bc06fdfa6c0436f1093fbbbdcc88d9849534c28",
      "new_mode": 33188,
      "new_path": "arch/powerpc/kernel/exceptions-64s.S"
    },
    {
      "type": "modify",
      "old_id": "f8f0bc7f1d4fde10a1edbe39fb0d0667f51f6e2a",
      "old_mode": 33188,
      "old_path": "arch/powerpc/kernel/idle_power7.S",
      "new_id": "3a70845a51c7be063dc90c77b194f95a69afd4f6",
      "new_mode": 33188,
      "new_path": "arch/powerpc/kernel/idle_power7.S"
    },
    {
      "type": "modify",
      "old_id": "6fe469eabce8f4938e6d6e263233a20df73432af",
      "old_mode": 33188,
      "old_path": "arch/powerpc/kvm/book3s_hv.c",
      "new_id": "36b6d98f11970b42cf96678ba6abcc14ba84052e",
      "new_mode": 33188,
      "new_path": "arch/powerpc/kvm/book3s_hv.c"
    },
    {
      "type": "modify",
      "old_id": "e6adaadcdff2e4c5ed8dad64ebd11f61c81cce79",
      "old_mode": 33188,
      "old_path": "arch/powerpc/kvm/book3s_hv_rmhandlers.S",
      "new_id": "c9bf177b7cf2957f709f9bca4b07ba86ef78aceb",
      "new_mode": 33188,
      "new_path": "arch/powerpc/kvm/book3s_hv_rmhandlers.S"
    },
    {
      "type": "modify",
      "old_id": "c78ceb9d5605a1d2fc66441f686e1052148e137d",
      "old_mode": 33188,
      "old_path": "arch/powerpc/kvm/powerpc.c",
      "new_id": "4c549664c9874e481186b8bbaeaef12ffbfc6692",
      "new_mode": 33188,
      "new_path": "arch/powerpc/kvm/powerpc.c"
    },
    {
      "type": "modify",
      "old_id": "1f15ad43614011a3bf4f395335ad5649b9dc41ec",
      "old_mode": 33188,
      "old_path": "arch/powerpc/sysdev/xics/icp-native.c",
      "new_id": "ba382b59b926defaa81e02046df2bbf8498689fc",
      "new_mode": 33188,
      "new_path": "arch/powerpc/sysdev/xics/icp-native.c"
    },
    {
      "type": "modify",
      "old_id": "61f56502732e0d5aeff5b2621c6dd23182747c2d",
      "old_mode": 33188,
      "old_path": "include/linux/kvm.h",
      "new_id": "e2a378d9716032ee6c8cee4e71ca139917368744",
      "new_mode": 33188,
      "new_path": "include/linux/kvm.h"
    }
  ]
}
