10 Jun, 2009

32 commits

  • On SN2 do not pass down the real ITC frequency, but rather patch the
    values to match the SN2 RTC frequency.

    Signed-off-by: Jes Sorensen
    Acked-by: Xiantao Zhang
    Signed-off-by: Avi Kivity

    Jes Sorensen
     
  • Move all reading of special register 'AR_ITC' into two functions, one
    in the kernel and one in the VMM module. When running on SN2, base the
    result on the RTC rather the system ITC, as the ITC isn't
    synchronized.

    Signed-off-by: Jes Sorensen
    Acked-by: Xiantao Zhang
    Signed-off-by: Avi Kivity

    Jes Sorensen
     
  • On SN2, map in the SN2 RTC registers to the VMM module, needed for ITC
    emulation.

    Signed-off-by: Jes Sorensen
    Acked-by: Xiantao Zhang
    Signed-off-by: Avi Kivity

    Jes Sorensen
     
  • Deliver interrupt during destination matching loop.

    Signed-off-by: Gleb Natapov
    Acked-by: Xiantao Zhang
    Signed-off-by: Marcelo Tosatti

    Gleb Natapov
     
  • The new way does not require additional loop over vcpus to calculate
    the one with lowest priority as one is chosen during delivery bitmap
    construction.

    Signed-off-by: Gleb Natapov
    Signed-off-by: Marcelo Tosatti

    Gleb Natapov
     
  • Use kvm_apic_match_dest() in kvm_get_intr_delivery_bitmask() instead
    of duplicating the same code. Use kvm_get_intr_delivery_bitmask() in
    apic_send_ipi() to figure out ipi destination instead of reimplementing
    the logic.

    Signed-off-by: Gleb Natapov
    Signed-off-by: Marcelo Tosatti

    Gleb Natapov
     
  • ioapic_deliver() and kvm_set_msi() have code duplication. Move
    the code into ioapic_deliver_entry() function and call it from
    both places.

    Signed-off-by: Gleb Natapov
    Signed-off-by: Marcelo Tosatti

    Gleb Natapov
     
  • Get rid of ioapic_inj_irq() and ioapic_inj_nmi() functions.

    Signed-off-by: Gleb Natapov
    Signed-off-by: Marcelo Tosatti

    Gleb Natapov
     
  • There is no reason to update the shadow pte here because the guest pte
    is only changed to dirty state.

    Signed-off-by: Joerg Roedel
    Signed-off-by: Marcelo Tosatti

    Joerg Roedel
     
  • Gleb fixed bitmap ops usage in kvm_ioapic_get_delivery_bitmask.

    Sheng merged two functions, as well as fixed several issues in
    kvm_get_intr_delivery_bitmask
    1. deliver_bitmask is a bitmap rather than a unsigned long intereger.
    2. Lowest priority target bitmap wrong calculated by mistake.
    3. Prevent potential NULL reference.
    4. Declaration in include/kvm_host.h caused powerpc compilation warning.
    5. Add warning for guest broadcast interrupt with lowest priority delivery mode.
    6. Removed duplicate bitmap clean up in caller of kvm_get_intr_delivery_bitmask.

    Signed-off-by: Gleb Natapov
    Signed-off-by: Sheng Yang
    Signed-off-by: Marcelo Tosatti

    Sheng Yang
     
  • Modify the arg of kvm_get_lowest_prio_vcpu().
    Make it consistent with its declaration.

    Signed-off-by: Yang Zhang
    Signed-off-by: Marcelo Tosatti

    Yang Zhang
     
  • Hide the internals of vcpu awakening / injection from the in-kernel
    emulated timers. This makes future changes in this logic easier and
    decreases the distance to more generic timer handling.

    Signed-off-by: Marcelo Tosatti
    Signed-off-by: Avi Kivity

    Marcelo Tosatti
     
  • We can infer elapsed time from hrtimer_expires_remaining.

    Signed-off-by: Marcelo Tosatti
    Signed-off-by: Avi Kivity

    Marcelo Tosatti
     
  • Unused.

    Signed-off-by: Marcelo Tosatti
    Signed-off-by: Avi Kivity

    Marcelo Tosatti
     
  • Since "KVM: Unify the delivery of IOAPIC and MSI interrupts"
    I get the following warnings:

    CC [M] arch/s390/kvm/kvm-s390.o
    In file included from arch/s390/kvm/kvm-s390.c:22:
    include/linux/kvm_host.h:357: warning: 'struct kvm_ioapic' declared inside parameter list
    include/linux/kvm_host.h:357: warning: its scope is only this definition or declaration, which is probably not what you want

    This patch limits IOAPIC functions for architectures that have one.

    Signed-off-by: Christian Borntraeger
    Signed-off-by: Avi Kivity

    Christian Borntraeger
     
  • Skip the test which checks if the PIT is properly routed when
    using the IOAPIC, aimed at buggy hardware.

    Signed-off-by: Marcelo Tosatti
    Signed-off-by: Avi Kivity

    Marcelo Tosatti
     
  • This issue just appeared in kvm-84 when running on 2.6.28.7 (x86-64)
    with PREEMPT enabled.

    We're getting syslog warnings like this many (but not all) times qemu
    tells KVM to run the VCPU:

    BUG: using smp_processor_id() in preemptible [00000000] code:
    qemu-system-x86/28938
    caller is kvm_arch_vcpu_ioctl_run+0x5d1/0xc70 [kvm]
    Pid: 28938, comm: qemu-system-x86 2.6.28.7-mtyrel-64bit
    Call Trace:
    debug_smp_processor_id+0xf7/0x100
    kvm_arch_vcpu_ioctl_run+0x5d1/0xc70 [kvm]
    ? __wake_up+0x4e/0x70
    ? wake_futex+0x27/0x40
    kvm_vcpu_ioctl+0x2e9/0x5a0 [kvm]
    enqueue_hrtimer+0x8a/0x110
    _spin_unlock_irqrestore+0x27/0x50
    vfs_ioctl+0x31/0xa0
    do_vfs_ioctl+0x74/0x480
    sys_futex+0xb4/0x140
    sys_ioctl+0x99/0xa0
    system_call_fastpath+0x16/0x1b

    As it turns out, the call trace is messed up due to gcc's inlining, but
    I isolated the problem anyway: kvm_write_guest_time() is being used in a
    non-thread-safe manner on preemptable kernels.

    Basically kvm_write_guest_time()'s body needs to be surrounded by
    preempt_disable() and preempt_enable(), since the kernel won't let us
    query any per-CPU data (indirectly using smp_processor_id()) without
    preemption disabled. The attached patch fixes this issue by disabling
    preemption inside kvm_write_guest_time().

    [marcelo: surround only __get_cpu_var calls since the warning
    is harmless]

    Signed-off-by: Marcelo Tosatti
    Signed-off-by: Avi Kivity

    Matt T. Yourst
     
  • This patch finally enable MSI-X.

    What we need for MSI-X:
    1. Intercept one page in MMIO region of device. So that we can get guest desired
    MSI-X table and set up the real one. Now this have been done by guest, and
    transfer to kernel using ioctl KVM_SET_MSIX_NR and KVM_SET_MSIX_ENTRY.

    2. Information for incoming interrupt. Now one device can have more than one
    interrupt, and they are all handled by one workqueue structure. So we need to
    identify them. The previous patch enable gsi_msg_pending_bitmap get this done.

    3. Mapping from host IRQ to guest gsi as well as guest gsi to real MSI/MSI-X
    message address/data. We used same entry number for the host and guest here, so
    that it's easy to find the correlated guest gsi.

    What we lack for now:
    1. The PCI spec said nothing can existed with MSI-X table in the same page of
    MMIO region, except pending bits. The patch ignore pending bits as the first
    step (so they are always 0 - no pending).

    2. The PCI spec allowed to change MSI-X table dynamically. That means, the OS
    can enable MSI-X, then mask one MSI-X entry, modify it, and unmask it. The patch
    didn't support this, and Linux also don't work in this way.

    3. The patch didn't implement MSI-X mask all and mask single entry. I would
    implement the former in driver/pci/msi.c later. And for single entry, userspace
    should have reposibility to handle it.

    Signed-off-by: Sheng Yang
    Signed-off-by: Avi Kivity

    Sheng Yang
     
  • We have to handle more than one interrupt with one handler for MSI-X. Avi
    suggested to use a flag to indicate the pending. So here is it.

    Signed-off-by: Sheng Yang
    Signed-off-by: Avi Kivity

    Sheng Yang
     
  • Introduce KVM_SET_MSIX_NR and KVM_SET_MSIX_ENTRY two ioctls.

    This two ioctls are used by userspace to specific guest device MSI-X entry
    number and correlate MSI-X entry with GSI during the initialization stage.

    MSI-X should be well initialzed before enabling.

    Don't support change MSI-X entry number for now.

    Signed-off-by: Sheng Yang
    Signed-off-by: Avi Kivity

    Sheng Yang
     
  • It's also convenient when we extend KVM supported vcpu number in the future.

    Signed-off-by: Sheng Yang
    Signed-off-by: Avi Kivity

    Sheng Yang
     
  • Would be used with bit ops, and would be easily extended if KVM_MAX_VCPUS is
    increased.

    Signed-off-by: Sheng Yang
    Signed-off-by: Avi Kivity

    Sheng Yang
     
  • In order to use with bit ops.

    Signed-off-by: Sheng Yang
    Signed-off-by: Avi Kivity

    Sheng Yang
     
  • Signed-off-by: Sheng Yang
    Signed-off-by: Avi Kivity

    Sheng Yang
     
  • Prepared for reuse ioapic_redir_entry for MSI.

    Signed-off-by: Sheng Yang
    Signed-off-by: Avi Kivity

    Sheng Yang
     
  • Windows 2008 accesses this MSR often on context switch intensive workloads;
    since we run in guest context with the guest MSR value loaded (so swapgs can
    work correctly), we can simply disable interception of rdmsr/wrmsr for this
    MSR.

    A complication occurs since in legacy mode, we run with the host MSR value
    loaded. In this case we enable interception. This means we need two MSR
    bitmaps, one for legacy mode and one for long mode.

    Signed-off-by: Avi Kivity

    Avi Kivity
     
  • Highmem pages are a pain, and saving three lowmem pages on i386 isn't worth
    the extra code.

    Signed-off-by: Avi Kivity

    Avi Kivity
     
  • Linus Torvalds
     
  • There's a bug in the mxser kernel module that still appears in the
    2.6.29.4 kernel.

    mxser_get_ISA_conf takes a ioaddress as its first argument, by passing the
    not of the ioaddr, you're effectively passing 0 which means it won't be
    able to talk to an ISA card. I have tested this, and removing the !
    fixes the problem.

    Cc: "Peter Botha"
    Signed-off-by: Jiri Slaby
    Acked-by: Alan Cox
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Botha
     
  • In commit code, we scan buffers attached to a transaction. During this
    scan, we sometimes have to drop j_list_lock and then we recheck whether
    the journal buffer head didn't get freed by journal_try_to_free_buffers().
    But checking for buffer_jbd(bh) isn't enough because a new journal head
    could get attached to our buffer head. So add a check whether the journal
    head remained the same and whether it's still at the same transaction and
    list.

    This is a nasty bug and can cause problems like memory corruption (use after
    free) or trigger various assertions in JBD code (observed).

    Signed-off-by: Jan Kara
    Cc:
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kara
     
  • The recent ->lookup() deadlock correction required the directory inode
    mutex to be dropped while waiting for expire completion. We were
    concerned about side effects from this change and one has been identified.

    I saw several error messages.

    They cause autofs to become quite confused and don't really point to the
    actual problem.

    Things like:

    handle_packet_missing_direct:1376: can't find map entry for (43,1827932)

    which is usually totally fatal (although in this case it wouldn't be
    except that I treat is as such because it normally is).

    do_mount_direct: direct trigger not valid or already mounted
    /test/nested/g3c/s1/ss1

    which is recoverable, however if this problem is at play it can cause
    autofs to become quite confused as to the dependencies in the mount tree
    because mount triggers end up mounted multiple times. It's hard to
    accurately check for this over mounting case and automount shouldn't need
    to if the kernel module is doing its job.

    There was one other message, similar in consequence of this last one but I
    can't locate a log example just now.

    When checking if a mount has already completed prior to adding a new mount
    request to the wait queue we check if the dentry is hashed and, if so, if
    it is a mount point. But, if a mount successfully completed while we
    slept on the wait queue mutex the dentry must exist for the mount to have
    completed so the test is not really needed.

    Mounts can also be done on top of a global root dentry, so for the above
    case, where a mount request completes and the wait queue entry has already
    been removed, the hashed test returning false can cause an incorrect
    callback to the daemon. Also, d_mountpoint() is not sufficient to check
    if a mount has completed for the multi-mount case when we don't have a
    real mount at the base of the tree.

    Signed-off-by: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • The massive nommu update (8feae131) resulted in these warnings:
    ipc/shm.c: In function `sys_shmdt':
    ipc/shm.c:974: warning: unused variable `size'
    ipc/shm.c:972: warning: unused variable `next'

    Signed-off-by: Mike Frysinger
    Cc: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Frysinger
     

09 Jun, 2009

8 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus:
    kvm: fix kvm reboot crash when MAXSMP is used
    cpumask: alloc zeroed cpumask for static cpumask_var_ts
    cpumask: introduce zalloc_cpumask_var

    Linus Torvalds
     
  • * 'for-linus' of git://git.kernel.dk/linux-2.6-block:
    bsg: setting rq->bio to NULL

    Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
    cls_cgroup: Fix oops when user send improperly 'tc filter add' request
    r8169: fix crash when large packets are received

    Linus Torvalds
     
  • * 'for-linus' of git://neil.brown.name/md:
    md/raid5: fix bug in reshape code when chunk_size decreases.
    md/raid5 - avoid deadlocks in get_active_stripe during reshape
    md/raid5: use conf->raid_disks in preference to mddev->raid_disk

    Linus Torvalds
     
  • Due to commit 1cd96c242a829d52f7a5ae98f554ca9775429685 ("block: WARN
    in __blk_put_request() for potential bio leak"), BSG SMP requests get
    the false warnings:

    WARNING: at block/blk-core.c:1068 __blk_put_request+0x52/0xc0()

    This sets rq->bio to NULL to avoid that false warnings.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     
  • one system was found there is crash during reboot then kvm/MAXSMP
    Sending all processes the KILL signal... done
    Please stand by while rebooting the system...
    [ 1721.856538] md: stopping all md devices.
    [ 1722.852139] kvm: exiting hardware virtualization
    [ 1722.854601] BUG: unable to handle kernel NULL pointer dereference at (null)
    [ 1722.872219] IP: [] hardware_disable+0x4c/0xb4
    [ 1722.877955] PGD 0
    [ 1722.880042] Oops: 0000 [#1] SMP
    [ 1722.892548] last sysfs file: /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/host0/target0:2:0/0:2:0:0/vendor
    [ 1722.900977] CPU 9
    [ 1722.912606] Modules linked in:
    [ 1722.914226] Pid: 0, comm: swapper Not tainted 2.6.30-rc7-tip-01843-g2305324-dirty #299 ...
    [ 1722.932589] RIP: 0010:[] [] hardware_disable+0x4c/0xb4
    [ 1722.942709] RSP: 0018:ffffc900010b6ed8 EFLAGS: 00010046
    [ 1722.956121] RAX: 0000000000000000 RBX: ffffc9000e253140 RCX: 0000000000000009
    [ 1722.972202] RDX: 000000000000b020 RSI: ffffc900010c3220 RDI: ffffffffffffd790
    [ 1722.977399] RBP: ffffc900010b6f08 R08: 0000000000000000 R09: 0000000000000000
    [ 1722.995149] R10: 00000000000004b8 R11: 966912b6c78fddbd R12: 0000000000000009
    [ 1723.011551] R13: 000000000000b020 R14: 0000000000000009 R15: 0000000000000000
    [ 1723.019898] FS: 0000000000000000(0000) GS:ffffc900010b3000(0000) knlGS:0000000000000000
    [ 1723.034389] CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b
    [ 1723.041164] CR2: 0000000000000000 CR3: 0000000001001000 CR4: 00000000000006e0
    [ 1723.056192] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [ 1723.072546] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    [ 1723.080562] Process swapper (pid: 0, threadinfo ffff88107e464000, task ffff88047e5a2550)
    [ 1723.096144] Stack:
    [ 1723.099071] 0000000000000046 ffffc9000e253168 966912b6c78fddbd ffffc9000e253140
    [ 1723.115471] ffff880c7d4304d0 ffffc9000e253168 ffffc900010b6f28 ffffffff81011022
    [ 1723.132428] ffffc900010b6f48 966912b6c78fddbd ffffc900010b6f48 ffffffff8100b83b
    [ 1723.141973] Call Trace:
    [ 1723.142981] [] kvm_arch_hardware_disable+0x26/0x3c
    [ 1723.158153] [] hardware_disable+0x3f/0x55
    [ 1723.172168] [] generic_smp_call_function_interrupt+0x76/0x13c
    [ 1723.178836] [] smp_call_function_interrupt+0x3a/0x5e
    [ 1723.194689] [] call_function_interrupt+0x13/0x20
    [ 1723.199750] [] ? acpi_idle_enter_c1+0xd3/0xf4
    [ 1723.217508] [] ? acpi_idle_enter_c1+0xcd/0xf4
    [ 1723.232172] [] ? acpi_idle_enter_bm+0xe7/0x2ce
    [ 1723.235141] [] ? __atomic_notifier_call_chain+0x0/0xac
    [ 1723.253381] [] ? menu_select+0x58/0xd2
    [ 1723.258179] [] ? cpuidle_idle_call+0xa4/0xf3
    [ 1723.272828] [] ? cpu_idle+0xb8/0x101
    [ 1723.277085] [] ? start_secondary+0x1bc/0x1d7
    [ 1723.293708] Code: b0 00 00 65 48 8b 04 25 28 00 00 00 48 89 45 e0 31 c0 48 8b 04 cd 30 ee 27 82 49 89 cc 49 89 d5 48 8b 04 10 48 8d b8 90 d7 ff ff 8b 87 70 28 00 00 48 8d 98 90 d7 ff ff eb 16 e8 e9 fe ff ff
    [ 1723.335524] RIP [] hardware_disable+0x4c/0xb4
    [ 1723.342076] RSP
    [ 1723.352021] CR2: 0000000000000000
    [ 1723.354348] ---[ end trace e2aec53dae150aa1 ]---

    it turns out that we need clear cpus_hardware_enabled in that case.

    Reported-and-tested-by: Yinghai Lu
    Signed-off-by: Yinghai Lu
    Signed-off-by: Rusty Russell

    Avi Kivity
     
  • These are defined as static cpumask_var_t so if MAXSMP is not used,
    they are cleared already. Avoid surprises when MAXSMP is enabled.

    Signed-off-by: Yinghai Lu
    Signed-off-by: Rusty Russell

    Yinghai Lu
     
  • So can get cpumask_var with cpumask_clear

    Signed-off-by: Yinghai Lu
    Signed-off-by: Rusty Russell

    Yinghai Lu