linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ding Tianhong <dingtianhong@huawei.com>
To: Nicholas Piggin <npiggin@gmail.com>, <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-arch@vger.kernel.org>,
	<linuxppc-dev@lists.ozlabs.org>, Zefan Li <lizefan@huawei.com>,
	"Jonathan Cameron" <Jonathan.Cameron@Huawei.com>,
	Christoph Hellwig <hch@infradead.org>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>
Subject: Re: [PATCH v9 11/12] mm/vmalloc: Hugepage vmalloc mappings
Date: Fri, 25 Dec 2020 15:58:23 +0800	[thread overview]
Message-ID: <7db7564c-0600-33d9-68d9-61fa6fc1bc0d@huawei.com> (raw)
In-Reply-To: <20201205065725.1286370-12-npiggin@gmail.com>


> +again:
> +	size = PAGE_ALIGN(size);
> +	area = __get_vm_area_node(size, align, VM_ALLOC | VM_UNINITIALIZED |
>  				vm_flags, start, end, node, gfp_mask, caller);
>  	if (!area)
>  		goto fail;
>  
> -	addr = __vmalloc_area_node(area, gfp_mask, prot, node);
> +	addr = __vmalloc_area_node(area, gfp_mask, prot, shift, node);
>  	if (!addr)
> -		return NULL;
> +		goto fail;
>  
>  	/*
>  	 * In this function, newly allocated vm_struct has VM_UNINITIALIZED
> @@ -2788,8 +2878,19 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
>  	return addr;
>  
>  fail:
> -	warn_alloc(gfp_mask, NULL,
> +	if (shift > PAGE_SHIFT) {
> +		free_vm_area(area);
> +		shift = PAGE_SHIFT;
> +		align = real_align;
> +		size = real_size;
> +		goto again;
> +	}
> +
Hi, Nicholas:

I met a problem like this:

[   67.103584] ------------[ cut here ]------------
[   67.103884] kernel BUG at vmalloc.c:2892!
[   67.104387] Internal error: Oops - BUG: 0 [#1] SMP
[   67.104942] Process insmod (pid: 1161, stack limit = 0x(____ptrval____))
[   67.105356] CPU: 2 PID: 1161 Comm: insmod Tainted: G           O      4.19.95+ #9
[   67.105702] Hardware name: linux,dummy-virt (DT)
[   67.106006] pstate: a0000005 (NzCv daif -PAN -UAO)
[   67.106285] pc : free_vm_area+0x78/0x80
[   67.106549] lr : free_vm_area+0x58/0x80

it looks like when __vmalloc_area_node failed, the area is already released, and the free_vm_area
will release the vm area again, so trigger the problem.

3405         ret = remove_vm_area(area->addr);
3406         BUG_ON(ret != area);
3407         kfree(area);


Ding
> +	if (!area) {
> +		/* Warn for area allocation, page allocations already warn */
> +		warn_alloc(gfp_mask, NULL,
>  			  "vmalloc: allocation failure: %lu bytes", real_size);
> +	}
>  	return NULL;
>  }
>  
> 



  reply	other threads:[~2020-12-25  7:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-05  6:57 [PATCH v9 00/12] huge vmalloc mappings Nicholas Piggin
2020-12-05  6:57 ` [PATCH v9 01/12] mm/vmalloc: fix vmalloc_to_page for huge vmap mappings Nicholas Piggin
2020-12-05  6:57 ` [PATCH v9 02/12] mm: apply_to_pte_range warn and fail if a large pte is encountered Nicholas Piggin
2020-12-05  6:57 ` [PATCH v9 03/12] mm/vmalloc: rename vmap_*_range vmap_pages_*_range Nicholas Piggin
2020-12-05  6:57 ` [PATCH v9 04/12] mm/ioremap: rename ioremap_*_range to vmap_*_range Nicholas Piggin
2020-12-05  6:57 ` [PATCH v9 05/12] mm: HUGE_VMAP arch support cleanup Nicholas Piggin
2021-01-04 12:33   ` Ding Tianhong
2021-01-24  7:43     ` Nicholas Piggin
2020-12-05  6:57 ` [PATCH v9 06/12] powerpc: inline huge vmap supported functions Nicholas Piggin
2020-12-05  6:57 ` [PATCH v9 07/12] arm64: " Nicholas Piggin
2020-12-05  6:57 ` [PATCH v9 08/12] x86: " Nicholas Piggin
2020-12-05  6:57 ` [PATCH v9 09/12] mm: Move vmap_range from mm/ioremap.c to mm/vmalloc.c Nicholas Piggin
2020-12-05  6:57 ` [PATCH v9 10/12] mm/vmalloc: add vmap_range_noflush variant Nicholas Piggin
2020-12-05  6:57 ` [PATCH v9 11/12] mm/vmalloc: Hugepage vmalloc mappings Nicholas Piggin
2020-12-25  7:58   ` Ding Tianhong [this message]
2020-12-05  6:57 ` [PATCH v9 12/12] powerpc/64s/radix: Enable huge " Nicholas Piggin

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=7db7564c-0600-33d9-68d9-61fa6fc1bc0d@huawei.com \
    --to=dingtianhong@huawei.com \
    --cc=Jonathan.Cameron@Huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=hch@infradead.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lizefan@huawei.com \
    --cc=npiggin@gmail.com \
    --cc=rick.p.edgecombe@intel.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 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).