linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: xen@randonwebstuff.com
Cc: Laura Abbott <labbott@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, bugzilla-daemon@bugzilla.kernel.org
Subject: Re: [Bug 198497] New: handle_mm_fault / xen_pmd_val / radix_tree_lookup_slot Null pointer
Date: Fri, 9 Feb 2018 06:47:26 -0800	[thread overview]
Message-ID: <20180209144726.GD16666@bombadil.infradead.org> (raw)
In-Reply-To: <20180131105456.GC28275@bombadil.infradead.org>


ping?

On Wed, Jan 31, 2018 at 02:54:56AM -0800, Matthew Wilcox wrote:
> On Tue, Jan 30, 2018 at 11:26:42AM +1300, xen@randonwebstuff.com wrote:
> > After, received this stack.
> > 
> > Have not tried memtest86.  These are production hosts.  This has occurred on
> > multiple hosts.  I can only recall this occurring on 32 bit kernels.  I
> > cannot recall issues with other VMs not running that kernel on the same
> > hosts.
> > 
> > [  125.329163] Bad swp_entry: e000000
> 
> Mixed news here then ... 'e' is 8 | 4 | 2, so it's not a single bitflip.
> So no point in running memtest86.
> 
> I should have made the printk produce leading zeroes, because that's
> 0x0e00'0000.  ptes use the top 5 bits to encode the swapfile, so
> this swap entry is decoded as swapfile 1, page number 0x0600'0000.
> That's clearly ludicrous because you don't have a swapfile 1, and if
> you did, it wouldn't be so large as a terabyte.
> 
> I think the next step in debugging this is printing the PTE which gave
> us this swp_entry.  If you can drop the patch I asked you to try, and
> apply this patch instead, we'll have more idea about what's going on.
> 
> Thanks!
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index 403934297a3d..8caaddb07747 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -2892,6 +2892,10 @@ int do_swap_page(struct vm_fault *vmf)
>  	if (!page)
>  		page = lookup_swap_cache(entry, vma_readahead ? vma : NULL,
>  					 vmf->address);
> +	if (IS_ERR(page)) {
> +		pte_ERROR(vmf->orig_pte);
> +		page = NULL;
> +	}
>  	if (!page) {
>  		struct swap_info_struct *si = swp_swap_info(entry);
>  
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 7fbe67be86fa..905fa34e022a 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -1651,6 +1651,10 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
>  	if (swap.val) {
>  		/* Look it up and read it in.. */
>  		page = lookup_swap_cache(swap, NULL, 0);
> +		if (IS_ERR(page)) {
> +			pte_ERROR(vmf->orig_pte);
> +			page = NULL;
> +		}
>  		if (!page) {
>  			/* Or update major stats only when swapin succeeds?? */
>  			if (fault_type) {
> diff --git a/mm/swap_state.c b/mm/swap_state.c
> index 39ae7cfad90f..7ee594c8eadd 100644
> --- a/mm/swap_state.c
> +++ b/mm/swap_state.c
> @@ -334,8 +334,14 @@ struct page *lookup_swap_cache(swp_entry_t entry, struct vm_area_struct *vma,
>  	struct page *page;
>  	unsigned long ra_info;
>  	int win, hits, readahead;
> +	struct address_space *swapper_space = swap_address_space(entry);
> +
> +	if (!swapper_space) {
> +		pr_err("Bad swp_entry: %lx\n", entry.val);
> +		return ERR_PTR(-EFAULT);
> +	}
>  
> -	page = find_get_page(swap_address_space(entry), swp_offset(entry));
> +	page = find_get_page(swapper_space, swp_offset(entry));
>  
>  	INC_CACHE_INFO(find_total);
>  	if (page) {
> @@ -676,6 +682,10 @@ struct page *swap_readahead_detect(struct vm_fault *vmf,
>  	if ((unlikely(non_swap_entry(entry))))
>  		return NULL;
>  	page = lookup_swap_cache(entry, vma, faddr);
> +	if (IS_ERR(page)) {
> +		pte_ERROR(vmf->orig_pte);
> +		page = NULL;
> +	}
>  	if (page)
>  		return page;
>  
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2018-02-09 14:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-198497-27@https.bugzilla.kernel.org/>
2018-01-18 21:55 ` [Bug 198497] New: handle_mm_fault / xen_pmd_val / radix_tree_lookup_slot Null pointer Andrew Morton
2018-01-18 22:18   ` Laura Abbott
2018-01-19  3:04     ` Matthew Wilcox
2018-01-19  3:14       ` xen
2018-01-19 13:21         ` Matthew Wilcox
2018-01-19 17:30           ` Laura Abbott
2018-01-26  6:54             ` xen
2018-01-26 19:40               ` Matthew Wilcox
2018-01-29 22:26                 ` xen
2018-01-31 10:54                   ` Matthew Wilcox
2018-01-31 23:02                     ` Tetsuo Handa
2018-02-01  9:48                       ` Matthew Wilcox
2018-02-09 14:47                     ` Matthew Wilcox [this message]
2018-04-12 17:12                       ` Andrew Morton
2018-04-12 17:28                         ` Matthew Wilcox
2018-01-19 13:33     ` Matthew Wilcox

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=20180209144726.GD16666@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=bugzilla-daemon@bugzilla.kernel.org \
    --cc=labbott@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=xen@randonwebstuff.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).