lkml.org 
[lkml]   [1999]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: gdb strangness Under 2.3.11-pre1


    On Sun, 18 Jul 1999, Tim Waugh wrote:

    > The two bugs that seem to be caused by this (or at least, are introduced
    > with 2.3.11-pre4) are the weird things in /proc/{2,3} and the 'bad page
    > middle entry 23232323'-type messages.

    The former may be (partially) healed by the following patch. The latter...
    Are you seeing it on SMP box? Then there is a chance that the thing will
    help too. If it was on UP - it's something else.

    diff -urN linux-2.3.11-pre5/drivers/char/sysrq.c linux-bird.lazy_TLB/drivers/char/sysrq.c
    --- linux-2.3.11-pre5/drivers/char/sysrq.c Sat Jul 3 23:57:21 1999
    +++ linux-bird.lazy_TLB/drivers/char/sysrq.c Sat Jul 17 19:54:26 1999
    @@ -40,7 +40,8 @@
    struct task_struct *p;

    for_each_task(p) {
    - if (p->pid && p->mm != &init_mm) { /* Not swapper nor kernel thread */
    + if (p->pid && p->mm != &init_mm && !(p->flags & PF_LAZY_TLB)) {
    + /* Not swapper nor kernel thread */
    if (p->pid == 1 && even_init) /* Ugly hack to kill init */
    p->pid = 0x8000;
    force_sig(sig, p);
    diff -urN linux-2.3.11-pre5/fs/exec.c linux-bird.lazy_TLB/fs/exec.c
    --- linux-2.3.11-pre5/fs/exec.c Thu Jul 15 05:37:06 1999
    +++ linux-bird.lazy_TLB/fs/exec.c Sun Jul 18 07:59:33 1999
    @@ -366,9 +366,11 @@
    static int exec_mmap(void)
    {
    struct mm_struct * mm, * old_mm;
    + int was_lazy;
    int retval;

    if (atomic_read(&current->mm->count) == 1) {
    + current->flags &= ~PF_LAZY_TLB;
    flush_cache_mm(current->mm);
    mm_release();
    release_segments(current->mm);
    @@ -391,7 +393,9 @@
    copy_segments(current, mm);

    old_mm = current->mm;
    + was_lazy = current->flags & PF_LAZY_TLB;
    current->mm = mm;
    + current->flags &= ~PF_LAZY_TLB;
    retval = new_page_tables(current);
    if (retval)
    goto fail_restore;
    @@ -406,6 +410,7 @@
    */
    fail_restore:
    current->mm = old_mm;
    + current->flags |= was_lazy;
    /* restore the ldt for this task */
    copy_segments(current, NULL);
    release_segments(mm);
    diff -urN linux-2.3.11-pre5/fs/proc/array.c linux-bird.lazy_TLB/fs/proc/array.c
    --- linux-2.3.11-pre5/fs/proc/array.c Thu Jul 15 05:37:22 1999
    +++ linux-bird.lazy_TLB/fs/proc/array.c Sat Jul 17 19:53:24 1999
    @@ -742,7 +742,7 @@
    {
    struct mm_struct * mm = p->mm;

    - if (mm && mm != &init_mm) {
    + if (!(p->flags & PF_LAZY_TLB) && mm && mm != &init_mm) {
    struct vm_area_struct * vma = mm->mmap;
    unsigned long data = 0, stack = 0;
    unsigned long exec = 0, lib = 0;
    @@ -868,7 +868,7 @@
    return 0;
    state = *get_task_state(tsk);
    vsize = eip = esp = 0;
    - if (tsk->mm && tsk->mm != &init_mm) {
    + if (!(tsk->flags & PF_LAZY_TLB) && tsk->mm && tsk->mm != &init_mm) {
    struct vm_area_struct *vma = tsk->mm->mmap;
    while (vma) {
    vsize += vma->vm_end - vma->vm_start;
    @@ -1025,7 +1025,7 @@
    read_unlock(&tasklist_lock); /* FIXME!! This should be done after the last use */
    if (!tsk)
    return 0;
    - if (tsk->mm && tsk->mm != &init_mm) {
    + if (!(tsk->flags & PF_LAZY_TLB) && tsk->mm && tsk->mm != &init_mm) {
    struct vm_area_struct * vma = tsk->mm->mmap;

    while (vma) {
    @@ -1111,7 +1111,7 @@
    if (!p)
    goto freepage_out;

    - if (!p->mm || p->mm == &init_mm || count == 0)
    + if ((p->flags & PF_LAZY_TLB) || !p->mm || p->mm == &init_mm || count == 0)
    goto getlen_out;

    /* Check whether the mmaps could change if we sleep */
    diff -urN linux-2.3.11-pre5/include/asm-i386/mmu_context.h linux-bird.lazy_TLB/include/asm-i386/mmu_context.h
    --- linux-2.3.11-pre5/include/asm-i386/mmu_context.h Thu Jul 15 05:42:12 1999
    +++ linux-bird.lazy_TLB/include/asm-i386/mmu_context.h Sun Jul 18 05:44:11 1999
    @@ -16,12 +16,12 @@
    */
    #define get_mmu_context(prev, next) \
    do { if (next->flags & PF_LAZY_TLB) \
    - { mmget(prev->mm); next->mm = prev->mm; \
    + { if (next->mm) BUG(); mmget(prev->mm); next->mm = prev->mm; \
    next->thread.cr3 = prev->thread.cr3; } } while(0)

    #define put_mmu_context(prev, next) \
    do { if (prev->flags & PF_LAZY_TLB) \
    - { mmput(prev->mm); } } while(0)
    + { mmput(prev->mm); prev->mm = NULL; } } while(0)

    #define init_new_context(mm) do { } while(0)
    /*
    diff -urN linux-2.3.11-pre5/include/asm-i386/pgtable.h linux-bird.lazy_TLB/include/asm-i386/pgtable.h
    --- linux-2.3.11-pre5/include/asm-i386/pgtable.h Thu Jul 15 05:42:12 1999
    +++ linux-bird.lazy_TLB/include/asm-i386/pgtable.h Sun Jul 18 05:37:28 1999
    @@ -307,9 +307,6 @@
    do { \
    unsigned long __pgdir = __pa(pgdir); \
    (tsk)->thread.cr3 = __pgdir; \
    - /* do not inherit lazy-TLB after exec() */ \
    - if ((pgdir != swapper_pg_dir) && ((tsk)->flags & PF_LAZY_TLB)) \
    - (tsk)->flags &= ~PF_LAZY_TLB; \
    if ((tsk) == current) \
    __asm__ __volatile__("movl %0,%%cr3": :"r" (__pgdir)); \
    } while (0)
    diff -urN linux-2.3.11-pre5/kernel/fork.c linux-bird.lazy_TLB/kernel/fork.c
    --- linux-2.3.11-pre5/kernel/fork.c Thu Jul 15 05:42:50 1999
    +++ linux-bird.lazy_TLB/kernel/fork.c Sun Jul 18 05:48:47 1999
    @@ -366,6 +366,10 @@
    tsk->cmin_flt = tsk->cmaj_flt = 0;
    tsk->nswap = tsk->cnswap = 0;

    + if (clone_flags & CLONE_TLB) {
    + tsk->mm = NULL;
    + return 0;
    + }
    if (clone_flags & CLONE_VM) {
    mmget(current->mm);
    /*

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:53    [W:0.027 / U:29.748 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site