linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Jia He <justin.he@arm.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	"Jérôme Glisse" <jglisse@redhat.com>,
	"Ralph Campbell" <rcampbell@nvidia.com>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Dave Airlie" <airlied@redhat.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	"Thomas Hellstrom" <thellstrom@vmware.com>,
	"Souptick Joarder" <jrdr.linux@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	"Catalin Marinas" <Catalin.Marinas@arm.com>
Subject: Re: [PATCH v2] mm: fix double page fault on arm64 if PTE_AF is cleared
Date: Fri, 6 Sep 2019 07:57:42 -0700	[thread overview]
Message-ID: <20190906145742.GX29434@bombadil.infradead.org> (raw)
In-Reply-To: <20190906135747.211836-1-justin.he@arm.com>

On Fri, Sep 06, 2019 at 09:57:47PM +0800, Jia He wrote:
>  		 * This really shouldn't fail, because the page is there
>  		 * in the page tables. But it might just be unreadable,
>  		 * in which case we just give up and fill the result with
> -		 * zeroes.
> +		 * zeroes. If PTE_AF is cleared on arm64, it might
> +		 * cause double page fault. So makes pte young here

How about:
		 * zeroes. On architectures with software "accessed" bits,
		 * we would take a double page fault here, so mark it
		 * accessed here.

>  		 */
> +		if (!pte_young(vmf->orig_pte)) {

Let's guard this with:

		if (arch_sw_access_bit && !pte_young(vmf->orig_pte)) {

#define arch_sw_access_bit	0
by default and have arm64 override it (either to a variable or a constant
... your choice).  Also, please somebody decide on a better name than
arch_sw_access_bit.

> +			entry = pte_mkyoung(vmf->orig_pte);
> +			if (ptep_set_access_flags(vmf->vma, vmf->address,
> +				vmf->pte, entry, 0))

This indentation is wrong; it makes vmf->pte look like part of the subsequent
statement instead of part of the condition.

> +				update_mmu_cache(vmf->vma, vmf->address,
> +						vmf->pte);
> +		}
> +


  reply	other threads:[~2019-09-06 14:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 13:57 Jia He
2019-09-06 14:57 ` Matthew Wilcox [this message]
2019-09-10  9:15   ` Catalin Marinas
2019-09-09 21:27 ` Matthew Wilcox
2019-09-10  9:08   ` Catalin Marinas
2019-09-10  9:29 ` Kirill A. Shutemov

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=20190906145742.GX29434@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=Catalin.Marinas@arm.com \
    --cc=airlied@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=jgg@ziepe.ca \
    --cc=jglisse@redhat.com \
    --cc=jrdr.linux@gmail.com \
    --cc=justin.he@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=peterz@infradead.org \
    --cc=rcampbell@nvidia.com \
    --cc=thellstrom@vmware.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