1. 08 Mar, 2012 33 commits
  2. 05 Mar, 2012 7 commits
    • Marcelo Tosatti's avatar
      KVM: x86: increase recommended max vcpus to 160 · a59cb29e
      Marcelo Tosatti authored
      Increase recommended max vcpus from 64 to 160 (tested internally
      at Red Hat).
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      a59cb29e
    • Igor Mammedov's avatar
      x86: Introduce x86_cpuinit.early_percpu_clock_init hook · df156f90
      Igor Mammedov authored
      When kvm guest uses kvmclock, it may hang on vcpu hot-plug.
      This is caused by an overflow in pvclock_get_nsec_offset,
      
          u64 delta = tsc - shadow->tsc_timestamp;
      
      which in turn is caused by an undefined values from percpu
      hv_clock that hasn't been initialized yet.
      Uninitialized clock on being booted cpu is accessed from
         start_secondary
          -> smp_callin
            ->  smp_store_cpu_info
              -> identify_secondary_cpu
                -> mtrr_ap_init
                  -> mtrr_restore
                    -> stop_machine_from_inactive_cpu
                      -> queue_stop_cpus_work
                        ...
                          -> sched_clock
                            -> kvm_clock_read
      which is well before x86_cpuinit.setup_percpu_clockev call in
      start_secondary, where percpu clock is initialized.
      
      This patch introduces a hook that allows to setup/initialize
      per_cpu clock early and avoid overflow due to reading
        - undefined values
        - old values if cpu was offlined and then onlined again
      
      Another possible early user of this clock source is ftrace that
      accesses it to get timestamps for ring buffer entries. So if
      mtrr_ap_init is moved from identify_secondary_cpu to past
      x86_cpuinit.setup_percpu_clockev in start_secondary, ftrace
      may cause the same overflow/hang on cpu hot-plug anyway.
      
      More complete description of the problem:
        https://lkml.org/lkml/2012/2/2/101
      
      Credits to Marcelo Tosatti <mtosatti@redhat.com> for hook idea.
      Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      df156f90
    • Gleb Natapov's avatar
      KVM: x86: reset edge sense circuit of i8259 on init · 242ec97c
      Gleb Natapov authored
      The spec says that during initialization "The edge sense circuit is
      reset which means that following initialization an interrupt request
      (IR) input must make a low-to-high transition to generate an interrupt",
      but currently if edge triggered interrupt is in IRR it is delivered
      after i8259 initialization.
      Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      242ec97c
    • Alexander Graf's avatar
      KVM: PPC: Add HPT preallocator · d2a1b483
      Alexander Graf authored
      We're currently allocating 16MB of linear memory on demand when creating
      a guest. That does work some times, but finding 16MB of linear memory
      available in the system at runtime is definitely not a given.
      
      So let's add another command line option similar to the RMA preallocator,
      that we can use to keep a pool of page tables around. Now, when a guest
      gets created it has a pretty low chance of receiving an OOM.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      d2a1b483
    • Alexander Graf's avatar
      KVM: PPC: Initialize linears with zeros · b7f5d011
      Alexander Graf authored
      RMAs and HPT preallocated spaces should be zeroed, so we don't accidently
      leak information from previous VM executions.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Acked-by: default avatarPaul Mackerras <paulus@samba.org>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      b7f5d011
    • Alexander Graf's avatar
      KVM: PPC: Convert RMA allocation into generic code · b4e70611
      Alexander Graf authored
      We have code to allocate big chunks of linear memory on bootup for later use.
      This code is currently used for RMA allocation, but can be useful beyond that
      extent.
      
      Make it generic so we can reuse it for other stuff later.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Acked-by: default avatarPaul Mackerras <paulus@samba.org>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      b4e70611
    • Alexander Graf's avatar
      KVM: PPC: E500: Fail init when not on e500v2 · 9cf7c0e4
      Alexander Graf authored
      When enabling the current KVM code on e500mc, I get the following oops:
      
          Oops: Exception in kernel mode, sig: 4 [#1]
          SMP NR_CPUS=8 P2041 RDB
          Modules linked in:
          NIP: c067df4c LR: c067df44 CTR: 00000000
          REGS: ee055ed0 TRAP: 0700   Not tainted  (3.2.0-10391-g36c5afe)
          MSR: 00029002 <CE,EE,ME>  CR: 24042022  XER: 00000000
          TASK = ee0429b0[1] 'swapper/0' THREAD: ee054000 CPU: 2
          GPR00: c067df44 ee055f80 ee0429b0 00000000 00000058 0000003f ee211600 60c6b864
          GPR08: 7cc903a6 0000002c 00000000 00000001 44042082 2d180088 00000000 00000000
          GPR16: c0000a00 00000014 3fffffff 03fe9000 00000015 7ff3be68 c06e0000 00000000
          GPR24: 00000000 00000000 00001720 c067df1c c06e0000 00000000 ee054000 c06ab51c
          NIP [c067df4c] kvmppc_e500_init+0x30/0xf8
          LR [c067df44] kvmppc_e500_init+0x28/0xf8
          Call Trace:
          [ee055f80] [c067df44] kvmppc_e500_init+0x28/0xf8 (unreliable)
          [ee055fb0] [c0001d30] do_one_initcall+0x50/0x1f0
          [ee055fe0] [c06721dc] kernel_init+0xa4/0x14c
          [ee055ff0] [c000e910] kernel_thread+0x4c/0x68
          Instruction dump:
          9421ffd0 7c0802a6 93410018 9361001c 90010034 93810020 93a10024 93c10028
          93e1002c 4bfffe7d 2c030000 408200a4 <7c1082a6> 90010008 7c1182a6 9001000c
          ---[ end trace b8ef4903fcbf9dd3 ]---
      
      Since it doesn't make sense to run the init function on any non-supported
      platform, we can just call our "is this platform supported?" function and
      bail out of init() if it's not.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      9cf7c0e4