All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	mbligh@google.com
Subject: Re: Problem with global_flush_tlb() on i386 in 2.6.22-rc4-mm2
Date: Tue, 19 Jun 2007 21:32:31 -0400	[thread overview]
Message-ID: <20070620013231.GA18305@Krystal> (raw)
In-Reply-To: <46788188.1040403@codemonkey.ws>

* Anthony Liguori (anthony@codemonkey.ws) wrote:
> Mathieu Desnoyers wrote:
> >Hi,
> >
> >Trying to test my "Text Edit Lock" patches, I ran into a problem related
> >to global_flush_tlb() not doing its job at updating the page flags when,
> >it seems, the page has been recently accessed. Therefore, it can only be
> >reproduced by doing a couple of iterations.
> >
....
> >This is clearly the memory write I am trying to do in the page of
> >which I just changed the attributes to RWX.
> >
> >If I remove the variable read before I change the flags, it starts
> >working correctly (as far as I have tested...).
> >
> >If I use my own my_local_tlb_flush() function (not SMP aware) instead of
> >global_flush_tlb(), it works correctly.
> >
> 
> What is your my_local_tlb_flush() and are you calling with preemption 
> disabled?
> 

The implementation was below in the email. Full preemption was enabled.

> >I also tried just calling clflush on the modified page just after the
> >global_flush_tlb(), and the problem was still there.
> >
> >I therefore suspect that
> >
> >include/asm-i386/tlbflush.h:
> >#define __native_flush_tlb_global()                                     \
> >        do {                                                            \
> >                unsigned int tmpreg, cr4, cr4_orig;                     \
> >                                                                        \
> >                __asm__ __volatile__(                                   \
> >                        "movl %%cr4, %2;  # turn off PGE     \n"        \
> >                        "movl %2, %1;                        \n"        \
> >                        "andl %3, %1;                        \n"        \
> >                        "movl %1, %%cr4;                     \n"        \
> >                        "movl %%cr3, %0;                     \n"        \
> >                        "movl %0, %%cr3;  # flush TLB        \n"        \
> >                        "movl %2, %%cr4;  # turn PGE back on \n"        \
> >                        : "=&r" (tmpreg), "=&r" (cr4), "=&r" (cr4_orig) \
> >                        : "i" (~X86_CR4_PGE)                            \
> >                        : "memory");                                    \
> >        } while (0)
> >
> >is not doing its job correctly. The problem does not seem to be caused
> >by PARAVIRT, because it is still buggy even if I disable the PARAVIRT
> >config option.
> 
> This is actually very conservative seeing as how disabling CR4.PGE 
> should be sufficient to flush global pages on modern processors.  I 
> suspect you're getting preempted while it's running.
> 

Thanks for the advice, but please have a look at my follow-up on the
issue, where I spotted the problem more precisely. It also affects
ioremap, which also uses global_flush_tlb(). I guess this bug is worth
being fixed quickly, even if it is just by applying my workaround (which
is _really_ conservative).

Regards,

Mathieu

> Regards,
> 
> Anthony Liguori

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  reply	other threads:[~2007-06-20  1:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-19 17:09 Problem with global_flush_tlb() on i386 in 2.6.22-rc4-mm2 Mathieu Desnoyers
2007-06-19 20:01 ` Problem with global_flush_tlb() on i386 (x86_64? too) " Mathieu Desnoyers
2007-06-19 21:10   ` [PATCH] Workaround change_page_attr() and global_flush_tlb() df_list inconsistency on i386 Mathieu Desnoyers
2007-06-20  9:01   ` Problem with global_flush_tlb() on i386 (x86_64? too) in 2.6.22-rc4-mm2 Andi Kleen
2007-06-20 16:46     ` Mathieu Desnoyers
2007-06-20 17:53       ` Andi Kleen
2007-06-20 18:14         ` Mathieu Desnoyers
2007-06-20 19:39         ` [PATCH] fix x86_64-mm-cpa-cache-flush.patch " Mathieu Desnoyers
     [not found]           ` <20070625212553.ec2caba9.akpm@linux-foundation.org>
2007-06-29  4:20             ` Mathieu Desnoyers
2007-06-20  1:23 ` Problem with global_flush_tlb() on i386 " Anthony Liguori
2007-06-20  1:32   ` Mathieu Desnoyers [this message]
2007-06-20  1:49   ` Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070620013231.GA18305@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=akpm@linux-foundation.org \
    --cc=anthony@codemonkey.ws \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.