linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	npiggin@gmail.com, paulus@samba.org, mpe@ellerman.id.au
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [RFC PATCH 1/3] powerpc/mm: Handle page table allocation failures
Date: Tue, 14 May 2019 15:35:39 -0700	[thread overview]
Message-ID: <b633907a-453f-a96f-b23d-4981e936e885@linux.vnet.ibm.com> (raw)
In-Reply-To: <20190514145041.7836-1-aneesh.kumar@linux.ibm.com>

On 05/14/2019 07:50 AM, Aneesh Kumar K.V wrote:
> This fixes the below crash that arises due to not handling page table allocation
> failures while allocating hugetlb page table.

Was there supposed to be a oops stack trace attached here in the commit log?

-Tyrel

> 
> Fixes: e2b3d202d1db ("powerpc: Switch 16GB and 16MB explicit hugepages to a different page table format")
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
>  arch/powerpc/mm/hugetlbpage.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
> index c5c9ff2d7afc..ae9d71da5219 100644
> --- a/arch/powerpc/mm/hugetlbpage.c
> +++ b/arch/powerpc/mm/hugetlbpage.c
> @@ -130,6 +130,8 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz
>  	} else {
>  		pdshift = PUD_SHIFT;
>  		pu = pud_alloc(mm, pg, addr);
> +		if (!pu)
> +			return NULL;
>  		if (pshift == PUD_SHIFT)
>  			return (pte_t *)pu;
>  		else if (pshift > PMD_SHIFT) {
> @@ -138,6 +140,8 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz
>  		} else {
>  			pdshift = PMD_SHIFT;
>  			pm = pmd_alloc(mm, pu, addr);
> +			if (!pm)
> +				return NULL;
>  			if (pshift == PMD_SHIFT)
>  				/* 16MB hugepage */
>  				return (pte_t *)pm;
> @@ -154,12 +158,16 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz
>  	} else {
>  		pdshift = PUD_SHIFT;
>  		pu = pud_alloc(mm, pg, addr);
> +		if (!pu)
> +			return NULL;
>  		if (pshift >= PUD_SHIFT) {
>  			ptl = pud_lockptr(mm, pu);
>  			hpdp = (hugepd_t *)pu;
>  		} else {
>  			pdshift = PMD_SHIFT;
>  			pm = pmd_alloc(mm, pu, addr);
> +			if (!pm)
> +				return NULL;
>  			ptl = pmd_lockptr(mm, pm);
>  			hpdp = (hugepd_t *)pm;
>  		}
> 


      parent reply	other threads:[~2019-05-14 22:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14 14:50 [RFC PATCH 1/3] powerpc/mm: Handle page table allocation failures Aneesh Kumar K.V
2019-05-14 14:50 ` [RFC PATCH 2/3] powerpc/mm/hugetlb: Fix kernel crash if we fail to allocate page table caches Aneesh Kumar K.V
2019-05-14 14:50 ` [RFC PATCH 3/3] powerpc/mm/hugetlb: Don't enable HugeTLB if we don't have a page table cache Aneesh Kumar K.V
2019-05-16 14:47   ` Michael Ellerman
2019-05-17  3:59     ` Aneesh Kumar K.V
2019-05-17  9:32       ` Aneesh Kumar K.V
2019-05-17 11:12       ` Michael Ellerman
2019-05-14 22:35 ` Tyrel Datwyler [this message]

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=b633907a-453f-a96f-b23d-4981e936e885@linux.vnet.ibm.com \
    --to=tyreld@linux.vnet.ibm.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=paulus@samba.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).