public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@sous-sol.org>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	Chris Wedgwood <reviews@ml.cw.f00f.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	Chuck Ebbert <cebbert@redhat.com>,
	Domenico Andreoli <cavokz@gmail.com>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, David Miller <davem@davemloft.net>,
	bunk@stusta.de
Subject: [patch 26/32] SPARC64: Fix two bugs wrt. kernel 4MB TSB.
Date: Fri, 08 Jun 2007 00:15:37 -0700	[thread overview]
Message-ID: <20070608071555.156243000@sous-sol.org> (raw)
In-Reply-To: 20070608071511.159309000@sous-sol.org

[-- Attachment #1: sparc64-fix-two-bugs-wrt.-kernel-4mb-tsb.patch --]
[-- Type: text/plain, Size: 3444 bytes --]

-stable review patch.  If anyone has any objections, please let us know.
---------------------

From: David Miller <davem@davemloft.net>

1) The TSB lookup was not using the correct hash mask.

2) It was not aligned on a boundary equal to it's size,
   which is required by the sun4v Hypervisor.

wasn't having it's return value checked, and that bug will be fixed up
as well in a subsequent changeset.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>

---
 arch/sparc64/kernel/head.S |   31 ++++++++++++++++++++++++++-----
 arch/sparc64/mm/init.c     |    7 +++++--
 include/asm-sparc64/tsb.h  |    2 +-
 3 files changed, 32 insertions(+), 8 deletions(-)

--- linux-2.6.20.13.orig/arch/sparc64/kernel/head.S
+++ linux-2.6.20.13/arch/sparc64/kernel/head.S
@@ -653,33 +653,54 @@ setup_tba:
 	 restore
 sparc64_boot_end:
 
-#include "ktlb.S"
-#include "tsb.S"
 #include "etrap.S"
 #include "rtrap.S"
 #include "winfixup.S"
 #include "entry.S"
 #include "sun4v_tlb_miss.S"
 #include "sun4v_ivec.S"
+#include "ktlb.S"
+#include "tsb.S"
 
 /*
  * The following skip makes sure the trap table in ttable.S is aligned
  * on a 32K boundary as required by the v9 specs for TBA register.
  *
  * We align to a 32K boundary, then we have the 32K kernel TSB,
- * then the 32K aligned trap table.
+ * the 64K kernel 4MB TSB, and then the 32K aligned trap table.
  */
 1:
 	.skip	0x4000 + _start - 1b
 
+! 0x0000000000408000
+
 	.globl	swapper_tsb
 swapper_tsb:
 	.skip	(32 * 1024)
 
-! 0x0000000000408000
-
+	.globl	swapper_4m_tsb
+swapper_4m_tsb:
+	.skip	(64 * 1024)
+
+! 0x0000000000420000
+
+	/* Some care needs to be exercised if you try to move the
+	 * location of the trap table relative to other things.  For
+	 * one thing there are br* instructions in some of the
+	 * trap table entires which branch back to code in ktlb.S
+	 * Those instructions can only handle a signed 16-bit
+	 * displacement.
+	 *
+	 * There is a binutils bug (bugzilla #4558) which causes
+	 * the relocation overflow checks for such instructions to
+	 * not be done correctly.  So bintuils will not notice the
+	 * error and will instead write junk into the relocation and
+	 * you'll have an unbootable kernel.
+	 */
 #include "ttable.S"
 
+! 0x0000000000428000
+
 #include "systbls.S"
 
 	.data
--- linux-2.6.20.13.orig/arch/sparc64/mm/init.c
+++ linux-2.6.20.13/arch/sparc64/mm/init.c
@@ -60,8 +60,11 @@ unsigned long kern_linear_pte_xor[2] __r
 unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)];
 
 #ifndef CONFIG_DEBUG_PAGEALLOC
-/* A special kernel TSB for 4MB and 256MB linear mappings.  */
-struct tsb swapper_4m_tsb[KERNEL_TSB4M_NENTRIES];
+/* A special kernel TSB for 4MB and 256MB linear mappings.
+ * Space is allocated for this right after the trap table
+ * in arch/sparc64/kernel/head.S
+ */
+extern struct tsb swapper_4m_tsb[KERNEL_TSB4M_NENTRIES];
 #endif
 
 #define MAX_BANKS	32
--- linux-2.6.20.13.orig/include/asm-sparc64/tsb.h
+++ linux-2.6.20.13/include/asm-sparc64/tsb.h
@@ -271,7 +271,7 @@ extern struct tsb_phys_patch_entry __tsb
 #define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
 	sethi		%hi(swapper_4m_tsb), REG1; \
 	or		REG1, %lo(swapper_4m_tsb), REG1; \
-	and		TAG, (KERNEL_TSB_NENTRIES - 1), REG2; \
+	and		TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \
 	sllx		REG2, 4, REG2; \
 	add		REG1, REG2, REG2; \
 	KTSB_LOAD_QUAD(REG2, REG3); \

-- 

  parent reply	other threads:[~2007-06-08  7:21 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-08  7:15 [patch 00/32] 2.6.20-stable review Chris Wright
2007-06-08  7:15 ` [patch 01/32] pv6: track device renames in snmp6 Chris Wright
2007-06-08  7:15 ` [patch 02/32] oom: kill all threads that share mm with killed task Chris Wright
2007-06-08  7:15 ` [patch 03/32] x86-64: Always flush all pages in change_page_attr Chris Wright
2007-06-08  7:15 ` [patch 04/32] smc911x: fix compilation breakage wjen debug is on Chris Wright
2007-06-08  7:15 ` [patch 05/32] iop13xx: fix i/o address translation Chris Wright
2007-06-08  7:15 ` [patch 06/32] [NETFILTER]: {ip, nf}_nat_proto_gre: do not modify/corrupt GREv0 packets through NAT Chris Wright
2007-06-08  7:15 ` [patch 07/32] sata_via: add missing PM hooks Chris Wright
2007-06-08  7:15 ` [patch 08/32] driver-core: dont free devt_attr till the device is released Chris Wright
2007-06-08  7:15 ` [patch 09/32] JFS: Fix race waking up jfsIO kernel thread Chris Wright
2007-06-08  7:15 ` [patch 10/32] CRYPTO: api: Read module pointer before freeing algorithm Chris Wright
2007-06-08  7:15 ` [patch 11/32] fuse: fix mknod of regular file Chris Wright
2007-06-08  7:15 ` [patch 12/32] acpi-thermal: fix mod_timer() interval Chris Wright
2007-06-08  7:15 ` [patch 13/32] ALSA: usb-audio: explicitly match Logitech QuickCam Chris Wright
2007-06-08  7:15 ` [patch 14/32] s390: Fix TCP/UDP pseudo header checksum computation Chris Wright
2007-06-08  7:15 ` [patch 15/32] s390: page_mkclean data corruption Chris Wright
2007-06-08  7:15 ` [patch 16/32] V4L/DVB (5593): Budget-ci: Fix tuning for TDM 1316 (160..200 MHz) Chris Wright
2007-06-08  7:15 ` [patch 17/32] kbuild: fixdep segfault on pathological string-o-death Chris Wright
2007-06-08  7:15 ` [patch 18/32] ntfs_init_locked_inode(): fix array indexing Chris Wright
2007-06-08  7:15 ` [patch 19/32] ICMP: Fix icmp_errors_use_inbound_ifaddr sysctl Chris Wright
2007-06-08  7:15 ` [patch 20/32] NET: parse ip:port strings correctly in in4_pton Chris Wright
2007-06-08  7:15 ` [patch 21/32] IPSEC: Fix panic when using inter address familiy IPsec on loopback Chris Wright
2007-06-08  7:15 ` [patch 22/32] NET: Fix BMSR_100{HALF,FULL}2 defines in linux/mii.h Chris Wright
2007-06-08  7:15 ` [patch 23/32] IPV4: Correct rp_filter help text Chris Wright
2007-06-09  1:20   ` Herbert Xu
2007-06-09  1:22     ` Herbert Xu
2007-06-08  7:15 ` [patch 24/32] SPARC: Linux always started with 9600 8N1 Chris Wright
2007-06-08  7:15 ` [patch 25/32] NET: "wrong timeout value" in sk_wait_data() v2 Chris Wright
2007-06-08  7:15 ` Chris Wright [this message]
2007-06-08  7:15 ` [patch 27/32] SPARC64: Fix _PAGE_EXEC_4U check in sun4u I-TLB miss handler Chris Wright
2007-06-08  7:15 ` [patch 28/32] TCP: Use default 32768-61000 outgoing port range in all cases Chris Wright
2007-06-08  7:15 ` [patch 29/32] NET: Fix race condition about network device name allocation Chris Wright
2007-06-08  7:15 ` [patch 30/32] Fix AF_UNIX OOPS Chris Wright
2007-06-08  7:15 ` [patch 31/32] IPV6 ROUTE: No longer handle ::/0 specially Chris Wright
2007-06-08  7:15 ` [patch 32/32] SPARC64: Dont be picky about virtual-dma values on sun4v Chris Wright
2007-06-08  7:29 ` [stable] [patch 00/32] 2.6.20-stable review Chris Wright
2007-06-08 16:51   ` Chris Wright
2007-06-08 12:21 ` Fortier,Vincent [Montreal]
2007-06-08 15:45   ` Chris Wright
2007-06-08 20:56     ` Chuck Ebbert

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=20070608071555.156243000@sous-sol.org \
    --to=chrisw@sous-sol.org \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bunk@stusta.de \
    --cc=cavokz@gmail.com \
    --cc=cebbert@redhat.com \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=davem@davemloft.net \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkrufky@linuxtv.org \
    --cc=rdunlap@xenotime.net \
    --cc=reviews@ml.cw.f00f.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=zwane@arm.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox