stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Mike Qiu <qiudayu@linux.vnet.ibm.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: [ 01/34] powerpc/mm: Fix hash computation function
Date: Thu,  7 Feb 2013 16:56:57 -0800	[thread overview]
Message-ID: <20130208004627.594117876@linuxfoundation.org> (raw)
In-Reply-To: <20130208004627.375461662@linuxfoundation.org>

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

------------------

From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>

commit eda8eebdd153c48a4e2a3a3ac3cd9e2e31f5c6b3 upstream.

The ASM version of hash computation function was truncating the upper bit.
Make the ASM version similar to hpt_hash function. Remove masking vsid bits.
Without this patch, we observed hang during bootup due to not satisfying page
fault request correctly. The fault handler used wrong hash values to update
the HPTE. Hence we kept looping with page fault.

hash_page(ea=000001003e260008, access=203, trap=300 ip=3fff91787134 dsisr 42000000
The computed value of hash 000000000f22f390
update: avpnv=4003e46054003e00, hash=000000000722f390, f=80000006, psize: 2 ...

BenH: The over-masking has been there for ever but only hurts with the
new 64T support introduced in 3.7

Reported-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Tested-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/mm/hash_low_64.S |   62 +++++++++++++++++++++++-------------------
 1 file changed, 35 insertions(+), 27 deletions(-)

--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -115,11 +115,13 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEG
 	sldi	r29,r5,SID_SHIFT - VPN_SHIFT
 	rldicl  r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT - VPN_SHIFT)
 	or	r29,r28,r29
-
-	/* Calculate hash value for primary slot and store it in r28 */
-	rldicl	r5,r5,0,25		/* vsid & 0x0000007fffffffff */
-	rldicl	r0,r3,64-12,48		/* (ea >> 12) & 0xffff */
-	xor	r28,r5,r0
+	/*
+	 * Calculate hash value for primary slot and store it in r28
+	 * r3 = va, r5 = vsid
+	 * r0 = (va >> 12) & ((1ul << (28 - 12)) -1)
+	 */
+	rldicl	r0,r3,64-12,48
+	xor	r28,r5,r0		/* hash */
 	b	4f
 
 3:	/* Calc vpn and put it in r29 */
@@ -130,11 +132,12 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEG
 	/*
 	 * calculate hash value for primary slot and
 	 * store it in r28 for 1T segment
+	 * r3 = va, r5 = vsid
 	 */
-	rldic	r28,r5,25,25		/* (vsid << 25) & 0x7fffffffff */
-	clrldi	r5,r5,40		/* vsid & 0xffffff */
-	rldicl	r0,r3,64-12,36		/* (ea >> 12) & 0xfffffff */
-	xor	r28,r28,r5
+	sldi	r28,r5,25		/* vsid << 25 */
+	/* r0 =  (va >> 12) & ((1ul << (40 - 12)) -1) */
+	rldicl	r0,r3,64-12,36
+	xor	r28,r28,r5		/* vsid ^ ( vsid << 25) */
 	xor	r28,r28,r0		/* hash */
 
 	/* Convert linux PTE bits into HW equivalents */
@@ -407,11 +410,13 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEG
 	 */
 	rldicl  r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT - VPN_SHIFT)
 	or	r29,r28,r29
-
-	/* Calculate hash value for primary slot and store it in r28 */
-	rldicl	r5,r5,0,25		/* vsid & 0x0000007fffffffff */
-	rldicl	r0,r3,64-12,48		/* (ea >> 12) & 0xffff */
-	xor	r28,r5,r0
+	/*
+	 * Calculate hash value for primary slot and store it in r28
+	 * r3 = va, r5 = vsid
+	 * r0 = (va >> 12) & ((1ul << (28 - 12)) -1)
+	 */
+	rldicl	r0,r3,64-12,48
+	xor	r28,r5,r0		/* hash */
 	b	4f
 
 3:	/* Calc vpn and put it in r29 */
@@ -426,11 +431,12 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEG
 	/*
 	 * Calculate hash value for primary slot and
 	 * store it in r28  for 1T segment
+	 * r3 = va, r5 = vsid
 	 */
-	rldic	r28,r5,25,25		/* (vsid << 25) & 0x7fffffffff */
-	clrldi	r5,r5,40		/* vsid & 0xffffff */
-	rldicl	r0,r3,64-12,36		/* (ea >> 12) & 0xfffffff */
-	xor	r28,r28,r5
+	sldi	r28,r5,25		/* vsid << 25 */
+	/* r0 = (va >> 12) & ((1ul << (40 - 12)) -1) */
+	rldicl	r0,r3,64-12,36
+	xor	r28,r28,r5		/* vsid ^ ( vsid << 25) */
 	xor	r28,r28,r0		/* hash */
 
 	/* Convert linux PTE bits into HW equivalents */
@@ -752,25 +758,27 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEG
 	rldicl  r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT - VPN_SHIFT)
 	or	r29,r28,r29
 
-	/* Calculate hash value for primary slot and store it in r28 */
-	rldicl	r5,r5,0,25		/* vsid & 0x0000007fffffffff */
-	rldicl	r0,r3,64-16,52		/* (ea >> 16) & 0xfff */
-	xor	r28,r5,r0
+	/* Calculate hash value for primary slot and store it in r28
+	 * r3 = va, r5 = vsid
+	 * r0 = (va >> 16) & ((1ul << (28 - 16)) -1)
+	 */
+	rldicl	r0,r3,64-16,52
+	xor	r28,r5,r0		/* hash */
 	b	4f
 
 3:	/* Calc vpn and put it in r29 */
 	sldi	r29,r5,SID_SHIFT_1T - VPN_SHIFT
 	rldicl  r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT_1T - VPN_SHIFT)
 	or	r29,r28,r29
-
 	/*
 	 * calculate hash value for primary slot and
 	 * store it in r28 for 1T segment
+	 * r3 = va, r5 = vsid
 	 */
-	rldic	r28,r5,25,25		/* (vsid << 25) & 0x7fffffffff */
-	clrldi	r5,r5,40		/* vsid & 0xffffff */
-	rldicl	r0,r3,64-16,40		/* (ea >> 16) & 0xffffff */
-	xor	r28,r28,r5
+	sldi	r28,r5,25		/* vsid << 25 */
+	/* r0 = (va >> 16) & ((1ul << (40 - 16)) -1) */
+	rldicl	r0,r3,64-16,40
+	xor	r28,r28,r5		/* vsid ^ ( vsid << 25) */
 	xor	r28,r28,r0		/* hash */
 
 	/* Convert linux PTE bits into HW equivalents */



  reply	other threads:[~2013-02-08  0:56 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-08  0:56 [ 00/34] 3.7.7-stable review Greg Kroah-Hartman
2013-02-08  0:56 ` Greg Kroah-Hartman [this message]
2013-02-08  0:56 ` [ 02/34] digsig: Fix memory leakage in digsig_verify_rsa() Greg Kroah-Hartman
2013-02-08  0:56 ` [ 03/34] drm/radeon/evergreen+: wait for the MC to settle after MC blackout Greg Kroah-Hartman
2013-02-08  0:57 ` [ 04/34] drm/radeon: add WAIT_UNTIL to the non-VM safe regs list for cayman/TN Greg Kroah-Hartman
2013-02-08  0:57 ` [ 05/34] drm/radeon: add quirk for RV100 board Greg Kroah-Hartman
2013-02-08  0:57 ` [ 06/34] drm/radeon: fix MC blackout on evergreen+ Greg Kroah-Hartman
2013-02-08  0:57 ` [ 07/34] drm/radeon: fix backend map setup on 1 RB sumo boards Greg Kroah-Hartman
2013-02-08  0:57 ` [ 08/34] drm/radeon: protect against div by 0 in backend setup Greg Kroah-Hartman
2013-02-08  0:57 ` [ 09/34] drm/radeon: prevent crash in the ring space allocation Greg Kroah-Hartman
2013-02-08  0:57 ` [ 10/34] drm/radeon: Calling object_unrefer() when creating fb failure Greg Kroah-Hartman
2013-02-08  0:57 ` [ 11/34] x86-64: Replace left over sti/cli in ia32 audit exit code Greg Kroah-Hartman
2013-02-08  0:57 ` [ 12/34] sched/rt: Use root_domain of rt_rq not current processor Greg Kroah-Hartman
2013-02-08  0:57 ` [ 13/34] mtd: davinci_nand: fix modular build with CONFIG_OF=y Greg Kroah-Hartman
2013-02-08  0:57 ` [ 14/34] nilfs2: fix fix very long mount time issue Greg Kroah-Hartman
2013-02-08  0:57 ` [ 15/34] mm/hugetlb: set PTE as huge in hugetlb_change_protection and remove_migration_pte Greg Kroah-Hartman
2013-02-08  0:57 ` [ 16/34] drivers/rtc/rtc-isl1208.c: call rtc_update_irq() from the alarm irq handler Greg Kroah-Hartman
2013-02-08  0:57 ` [ 17/34] drivers/rtc/rtc-pl031.c: fix the missing operation on enable Greg Kroah-Hartman
2013-02-08  0:57 ` [ 18/34] USB: ftdi_sio: add Zolix FTDI PID Greg Kroah-Hartman
2013-02-08  0:57 ` [ 19/34] USB: ftdi_sio: add PID/VID entries for ELV WS 300 PC II Greg Kroah-Hartman
2013-02-08  0:57 ` [ 20/34] USB: option: add support for Telit LE920 Greg Kroah-Hartman
2013-02-08  0:57 ` [ 21/34] USB: option: add Changhong CH690 Greg Kroah-Hartman
2013-02-08  0:57 ` [ 22/34] USB: qcserial: add Telit Gobi QDL device Greg Kroah-Hartman
2013-02-08  0:57 ` [ 23/34] USB: EHCI: remove ASS/PSS polling timeout Greg Kroah-Hartman
2013-02-08  0:57 ` [ 24/34] USB: EHCI: unlink one async QH at a time Greg Kroah-Hartman
2013-02-08  0:57 ` [ 25/34] USB: EHCI: fix timer bug affecting port resume Greg Kroah-Hartman
2013-02-08  0:57 ` [ 26/34] USB: EHCI: fix bug in scheduling periodic split transfers Greg Kroah-Hartman
2013-02-08  0:57 ` [ 27/34] usb: Using correct way to clear usb3.0 devices remote wakeup feature Greg Kroah-Hartman
2013-02-08  0:57 ` [ 28/34] USB: storage: Define a new macro for USB storage match rules Greg Kroah-Hartman
2013-02-08  0:57 ` [ 29/34] USB: storage: optimize to match the Huawei USB storage devices and support new switch command Greg Kroah-Hartman
2013-02-08  0:57 ` [ 30/34] drivers: xhci: fix incorrect bit test Greg Kroah-Hartman
2013-02-08  0:57 ` [ 31/34] xhci: Fix isoc TD encoding Greg Kroah-Hartman
2013-02-08  0:57 ` [ 32/34] xhci: Fix TD size for isochronous URBs Greg Kroah-Hartman
2013-02-08  0:57 ` [ 33/34] USB: XHCI: fix memory leak of URB-private data Greg Kroah-Hartman
2013-02-08  0:57 ` [ 34/34] usb: Prevent dead ports when xhci is not enabled Greg Kroah-Hartman
2013-02-08 20:29 ` [ 00/34] 3.7.7-stable review Shuah Khan
2013-02-09 12:06 ` Satoru Takeuchi

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=20130208004627.594117876@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qiudayu@linux.vnet.ibm.com \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).