18 Jun, 2010

1 commit

  • After every iounmap mmiotrace has to free kmmio_fault_pages, but
    it can't do it directly, so it defers freeing by RCU.

    It usually works, but when mmiotraced code calls ioremap-iounmap
    multiple times without sleeping between (so RCU won't kick in
    and start freeing) it can be given the same virtual address, so
    at every iounmap mmiotrace will schedule the same pages for
    release. Obviously it will explode on second free.

    Fix it by marking kmmio_fault_pages which are scheduled for
    release and not adding them second time.

    Signed-off-by: Marcin Slusarz
    Tested-by: Marcin Kocielnicki
    Tested-by: Shinpei KATO
    Acked-by: Pekka Paalanen
    Cc: Stuart Bennett
    Cc: Marcin Kocielnicki
    Cc: nouveau@lists.freedesktop.org
    Cc:
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Marcin Slusarz
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

17 Jan, 2010

1 commit

  • Commit 62edab9056a6cf0c9207339c8892c923a5217e45 (from June 2009
    but merged in 2.6.33) changes notify_die to pass dr6 by
    reference.

    However, it forgets to fix the check for DR_STEP in kmmio.c,
    breaking mmiotrace. It also passes a wrong value to the post
    handler.

    This simple fix makes mmiotrace work again.

    Signed-off-by: Luca Barbieri
    Acked-by: K.Prasad
    Cc: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Luca Barbieri
     

12 Dec, 2009

1 commit

  • …git/tip/linux-2.6-tip

    * 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    x86/amd-iommu: Fix PCI hotplug with passthrough mode
    x86/amd-iommu: Fix passthrough mode
    x86: mmio-mod.c: Use pr_fmt
    x86: kmmio.c: Add and use pr_fmt(fmt)
    x86: i8254.c: Add pr_fmt(fmt)
    x86: setup_percpu.c: Use pr_<level> and add pr_fmt(fmt)
    x86: es7000_32.c: Use pr_<level> and add pr_fmt(fmt)
    x86: Print DMI_BOARD_NAME as well as DMI_PRODUCT_NAME from __show_regs()
    x86: Factor duplicated code out of __show_regs() into show_regs_common()
    arch/x86/kernel/microcode*: Use pr_fmt() and remove duplicated KERN_ERR prefix
    x86, mce: fix confusion between bank attributes and mce attributes
    x86/mce: Set up timer unconditionally
    x86: Fix bogus warning in apic_noop.apic_write()
    x86: Fix typo in arch/x86/mm/kmmio.c
    x86: ASUS P4S800 reboot=bios quirk

    Linus Torvalds
     

10 Dec, 2009

1 commit


08 Dec, 2009

1 commit


07 Dec, 2009

1 commit


06 Dec, 2009

1 commit


04 Dec, 2009

1 commit

  • That is "success", "unknown", "through", "performance", "[re|un]mapping"
    , "access", "default", "reasonable", "[con]currently", "temperature"
    , "channel", "[un]used", "application", "example","hierarchy", "therefore"
    , "[over|under]flow", "contiguous", "threshold", "enough" and others.

    Signed-off-by: André Goddard Rosa
    Signed-off-by: Jiri Kosina

    André Goddard Rosa
     

03 Jun, 2009

1 commit


07 May, 2009

1 commit


29 Apr, 2009

4 commits

  • Follow up to afcfe024aebd74b0984a41af9a34e009cf5badaf in Linus' tree
    ("x86: mmiotrace: quieten spurious warning message")

    Signed-off-by: Stuart Bennett
    Acked-by: Pekka Paalanen
    Cc: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Stuart Bennett
     
  • * change function names to clear_* from set_*: in reality we only clear
    and restore page presence, and never unconditionally set present.
    Using clear_*({true, false}, ...) is therefore more honest than
    set_*({false, true}, ...)

    * upgrade presence storage to pteval_t: doing user-space tracing will
    require saving and manipulation of the _PAGE_PROTNONE bit, in addition
    to the existing _PAGE_PRESENT changes, and having multiple bools stored
    and passed around does not seem optimal

    [ Impact: refactor, clean up mmiotrace code ]

    Signed-off-by: Stuart Bennett
    Acked-by: Pekka Paalanen
    Cc: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Stuart Bennett
     
  • kmmio_probe being *p and kmmio_fault_page being sometimes *f and
    sometimes *p is not helpful.

    [ Impact: cleanup ]

    Signed-off-by: Stuart Bennett
    Acked-by: Pekka Paalanen
    Cc: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Stuart Bennett
     
  • Matching on (addr == (p->addr + p->len)) causes problems when mappings
    are adjacent.

    [ Impact: fix mmiotrace confusion on adjacent iomaps ]

    Signed-off-by: Stuart Bennett
    Acked-by: Pekka Paalanen
    Cc: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Stuart Bennett
     

12 Mar, 2009

1 commit


09 Mar, 2009

1 commit

  • Impact: fix race+crash in mmiotrace

    The list manipulation in remove_kmmio_fault_pages() was broken. If more
    than one consecutive kmmio_fault_page was re-added during the grace
    period between unregister_kmmio_probe() and remove_kmmio_fault_pages(),
    the list manipulation failed to remove pages from the release list.

    After a second grace period the pages get into rcu_free_kmmio_fault_pages()
    and raise a BUG_ON() kernel crash.

    The list manipulation is fixed to properly remove pages from the release
    list.

    This bug has been present from the very beginning of mmiotrace in the
    mainline kernel. It was introduced in 0fd0e3da ("x86: mmiotrace full
    patch, preview 1");

    An urgent fix for Linus. Tested by Stuart (on 32-bit) and Pekka
    (on amd and intel 64-bit systems, nouveau and nvidia proprietary).

    Signed-off-by: Stuart Bennett
    Signed-off-by: Pekka Paalanen
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Stuart Bennett
     

02 Mar, 2009

5 commits

  • There was a theoretical possibility to a race between arming a page in
    post_kmmio_handler() and disarming the page in
    release_kmmio_fault_page():

    cpu0 cpu1
    ------------------------------------------------------------------
    mmiotrace shutdown
    enter release_kmmio_fault_page
    fault on the page
    disarm the page
    disarm the page
    handle the MMIO access
    re-arm the page
    put the page on release list
    remove_kmmio_fault_pages()
    fault on the page
    page not known to mmiotrace
    fall back to do_page_fault()
    *KABOOM*

    (This scenario also shows the double disarm case which is allowed.)

    Fixed by acquiring kmmio_lock in post_kmmio_handler() and checking
    if the page is being released from mmiotrace.

    Signed-off-by: Pekka Paalanen
    Cc: Stuart Bennett
    Cc: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Pekka Paalanen
     
  • Upgrade some kmmio.c debug messages to warnings.
    Allow secondary faults on probed pages to fall through, and only log
    secondary faults that are not due to non-present pages.

    Patch edited by Pekka Paalanen.

    Signed-off-by: Stuart Bennett
    Signed-off-by: Pekka Paalanen
    Cc: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Stuart Bennett
     
  • From 36772dcb6ffbbb68254cbfc379a103acd2fbfefc Mon Sep 17 00:00:00 2001
    From: Pekka Paalanen
    Date: Sat, 28 Feb 2009 21:34:59 +0200

    Split set_page_presence() in kmmio.c into two more functions set_pmd_presence()
    and set_pte_presence(). Purely code reorganization, no functional changes.

    Signed-off-by: Pekka Paalanen
    Cc: Stuart Bennett
    Cc: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Pekka Paalanen
     
  • From baa99e2b32449ec7bf147c234adfa444caecac8a Mon Sep 17 00:00:00 2001
    From: Pekka Paalanen
    Date: Sun, 22 Feb 2009 20:02:43 +0200

    Blindly setting _PAGE_PRESENT in disarm_kmmio_fault_page() overlooks the
    possibility, that the page was not present when it was armed.

    Make arm_kmmio_fault_page() store the previous page presence in struct
    kmmio_fault_page and use it on disarm.

    This patch was originally written by Stuart Bennett, but Pekka Paalanen
    rewrote it a little different.

    Signed-off-by: Pekka Paalanen
    Cc: Stuart Bennett
    Cc: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Pekka Paalanen
     
  • Print a full warning once, if arming or disarming a page fails.

    Also, if initial arming fails, do not handle the page further. This
    avoids the possibility of a page failing to arm and then later claiming
    to have handled any fault on that page.

    WARN_ONCE added by Pekka Paalanen.

    Signed-off-by: Stuart Bennett
    Signed-off-by: Pekka Paalanen
    Cc: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Stuart Bennett
     

25 May, 2008

1 commit


24 May, 2008

4 commits