LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Peter Rival <frival@zk3.dec.com>
Cc: paulus@samba.org, "Martin J. Bligh" <Martin.Bligh@us.ibm.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	torvalds@transmeta.com, linux-kernel@vger.kernel.org,
	jay.estabrook@compaq.com, rth@twiddle.net
Subject: Re: [PATCH] change name of rep_nop
Date: Mon, 08 Oct 2001 23:36:26 +0100	[thread overview]
Message-ID: <13962.1002580586@redhat.com> (raw)
In-Reply-To: <3BC1FE35.2050704@zk3.dec.com>
In-Reply-To: <3BC1FE35.2050704@zk3.dec.com>  <15294.16913.2117.383987@cargo.ozlabs.ibm.com> <1573466920.1002300846@mbligh.des.sequent.com> <15294.24873.866942.423260@cargo.ozlabs.ibm.com>


While we're on the subject of stupidly named routines and x86-isms, I'm 
having trouble reconciling this text in Documentation/cachetlb.txt:

	1) void flush_cache_all(void)

	        The most severe flush of all.  After this interface runs,
	        the entire cpu cache is flushed.

... with this implementation in include/asm-i386/pgtable.h:

	#define flush_cache_all()			do { } while (0)

That really doesn't seem to be doing what it says on the tin.

Some people have asserted, falsely, that it's never sane to want an i386 to
flush its cache. Even if that were true, it wouldn't really be an excuse for
the above discrepancy.

It's probably too late to fix it - this function seems to have evolved
completely undocumented and different semantics, and many architectures now
have a NOP implementation of it. Maybe we need to introduce a new call which
actually _does_ flush the cache, called simon_says_flush_cache_all() ?


Index: Documentation/cachetlb.txt
===================================================================
RCS file: /inst/cvs/linux/Documentation/Attic/cachetlb.txt,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 cachetlb.txt
--- Documentation/cachetlb.txt	2001/04/05 14:06:40	1.1.2.6
+++ Documentation/cachetlb.txt	2001/10/08 22:29:25
@@ -163,6 +163,11 @@
 	This is usually invoked when the kernel page tables are
 	changed, since such translations are "global" in nature.
 
+	NB. Some architecture maintainers have decided that their
+	architecture should treat this call as a NOP. Those 
+	architectures may implement simon_says_flush_cache_all()
+	which actually does as it's told. YMMV.
+
 2) void flush_cache_mm(struct mm_struct *mm)
 
 	This interface flushes an entire user address space from
Index: arch/i386/kernel/mtrr.c
===================================================================
RCS file: /inst/cvs/linux/arch/i386/kernel/mtrr.c,v
retrieving revision 1.2.2.30
diff -u -r1.2.2.30 mtrr.c
--- arch/i386/kernel/mtrr.c	2001/09/22 17:36:09	1.2.2.30
+++ arch/i386/kernel/mtrr.c	2001/10/08 22:29:25
@@ -394,13 +394,13 @@
 	write_cr4(ctxt->cr4val & (unsigned char) ~(1<<7));
     }
 
-    /*  Disable and flush caches. Note that wbinvd flushes the TLBs as
-	a side-effect  */
+    /*  Disable and flush caches. Note that simon_says_flush_cache_all
+	flushes the TLBs as a side-effect  */
     {
 	unsigned int cr0 = read_cr0() | 0x40000000;
-	wbinvd();
+	simon_says_flush_cache_all();
 	write_cr0( cr0 );
-	wbinvd();
+	simon_says_flush_cache_all();
     }
 
     if ( mtrr_if == MTRR_IF_INTEL ) {
@@ -424,7 +424,7 @@
     }
 
     /*  Flush caches and TLBs  */
-    wbinvd();
+    simon_says_flush_cache_all();
 
     /*  Restore MTRRdefType  */
     if ( mtrr_if == MTRR_IF_INTEL ) {
@@ -784,7 +784,7 @@
      *	The writeback rule is quite specific. See the manual. Its
      *	disable local interrupts, write back the cache, set the mtrr
      */
-	wbinvd();
+	simon_says_flush_cache_all();
 	wrmsr (MSR_K6_UWCCR, regs[0], regs[1]);
     if (do_safe) set_mtrr_done (&ctxt);
 }   /*  End Function amd_set_mtrr_up  */
Index: arch/i386/kernel/setup.c
===================================================================
RCS file: /inst/cvs/linux/arch/i386/kernel/setup.c,v
retrieving revision 1.4.2.70
diff -u -r1.4.2.70 setup.c
--- arch/i386/kernel/setup.c	2001/10/08 16:25:04	1.4.2.70
+++ arch/i386/kernel/setup.c	2001/10/08 22:29:25
@@ -1213,7 +1213,7 @@
 					unsigned long flags;
 					l=(1<<0)|((mbytes/4)<<1);
 					local_irq_save(flags);
-					wbinvd();
+					simon_says_flush_cache_all();
 					wrmsr(MSR_K6_WHCR, l, h);
 					local_irq_restore(flags);
 					printk(KERN_INFO "Enabling old style K6 write allocation for %d Mb\n",
@@ -1234,7 +1234,7 @@
 					unsigned long flags;
 					l=((mbytes>>2)<<22)|(1<<16);
 					local_irq_save(flags);
-					wbinvd();
+					simon_says_flush_cache_all();
 					wrmsr(MSR_K6_WHCR, l, h);
 					local_irq_restore(flags);
 					printk(KERN_INFO "Enabling new style K6 write allocation for %d Mb\n",
Index: drivers/acpi/hardware/hwsleep.c
===================================================================
RCS file: /inst/cvs/linux/drivers/acpi/hardware/Attic/hwsleep.c,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 hwsleep.c
--- drivers/acpi/hardware/hwsleep.c	2001/09/23 20:45:20	1.1.2.4
+++ drivers/acpi/hardware/hwsleep.c	2001/10/08 22:29:25
@@ -199,7 +199,7 @@
 
 	/* flush caches */
 
-	wbinvd();
+	simon_says_flush_cache_all();
 
 	/* write #2: SLP_TYP + SLP_EN */
 
Index: drivers/acpi/include/platform/acgcc.h
===================================================================
RCS file: /inst/cvs/linux/drivers/acpi/include/platform/Attic/acgcc.h,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 acgcc.h
--- drivers/acpi/include/platform/acgcc.h	2001/09/23 20:45:20	1.1.2.3
+++ drivers/acpi/include/platform/acgcc.h	2001/10/08 22:29:25
@@ -39,7 +39,6 @@
 #define BREAKPOINT3
 #define disable() __cli()
 #define enable()  __sti()
-#define wbinvd()
 
 /*! [Begin] no source code translation */
 
@@ -101,7 +100,6 @@
 #define disable() __cli()
 #define enable()  __sti()
 #define halt()    __asm__ __volatile__ ("sti; hlt":::"memory")
-#define wbinvd()  __asm__ __volatile__ ("wbinvd":::"memory")
 
 /*! [Begin] no source code translation
  *
Index: include/asm-i386/system.h
===================================================================
RCS file: /inst/cvs/linux/include/asm-i386/system.h,v
retrieving revision 1.2.2.19
diff -u -r1.2.2.19 system.h
--- include/asm-i386/system.h	2001/09/07 11:08:42	1.2.2.19
+++ include/asm-i386/system.h	2001/10/08 22:29:26
@@ -124,7 +124,7 @@
 
 #endif	/* __KERNEL__ */
 
-#define wbinvd() \
+#define simon_says_flush_cache_all() \
 	__asm__ __volatile__ ("wbinvd": : :"memory");
 
 static inline unsigned long get_limit(unsigned long segment)

--
dwmw2



  parent reply	other threads:[~2001-10-08 22:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-05 10:46 Paul Mackerras
2001-10-05 14:37 ` Alan Cox
2001-10-05 18:06   ` Peter Rival
2001-10-05 23:28   ` Paul Mackerras
2001-10-05 23:54     ` Martin J. Bligh
2001-10-06  1:40     ` Paul Mackerras
2001-10-08 19:27       ` Peter Rival
2001-10-08 22:36       ` David Woodhouse [this message]
2001-10-08 22:49         ` Alan Cox
2001-10-08 23:06         ` David Woodhouse
2001-10-08 23:42           ` David Woodhouse
2001-10-08 23:46           ` David S. Miller
2001-10-08 23:08         ` David S. Miller
2001-10-08 23:46         ` Linus Torvalds
2001-10-09  0:03           ` David Woodhouse
2001-10-08 22:46       ` David S. Miller
2001-10-08 23:16         ` Alan Cox
2001-10-08 23:24           ` Dave Jones
2001-10-08 23:33             ` Alan Cox
2001-10-09  5:01             ` George Greer
2001-10-08 23:30           ` David S. Miller
2001-10-09 10:33           ` Benjamin Herrenschmidt
2001-10-09 11:30             ` Keith Owens
2001-10-09 12:13               ` Benjamin Herrenschmidt
2001-10-09 12:15               ` Alan Cox
2001-10-09  8:51 Etienne Lorrain
2001-10-09 11:30 ` Alan Cox

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=13962.1002580586@redhat.com \
    --to=dwmw2@infradead.org \
    --cc=Martin.Bligh@us.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=frival@zk3.dec.com \
    --cc=jay.estabrook@compaq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=rth@twiddle.net \
    --cc=torvalds@transmeta.com \
    --subject='Re: [PATCH] change name of rep_nop' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).