From: Mike Rapoport <rppt@linux.ibm.com>
To: Bibo Mao <maobibo@loongson.cn>
Cc: "Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Paul Burton" <paulburton@kernel.org>,
"Dmitry Korotin" <dkorotin@wavecomp.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Stafford Horne" <shorne@gmail.com>,
"Steven Price" <steven.price@arm.com>,
"Anshuman Khandual" <anshuman.khandual@arm.com>,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] MIPS: update tlb even if pte entry has no change
Date: Thu, 14 May 2020 12:33:59 +0300 [thread overview]
Message-ID: <20200514093359.GB1059226@linux.ibm.com> (raw)
In-Reply-To: <1589422677-11455-1-git-send-email-maobibo@loongson.cn>
On Thu, May 14, 2020 at 10:17:57AM +0800, Bibo Mao wrote:
> From: bibo mao <maobibo@loongson.cn>
>
> If there are two threads reading the same memory and tlb miss happens,
> one thread fills pte entry, the other reads new pte value during page fault
> handling. PTE value may be updated before page faul, so the process need
> need update tlb still.
>
> Also this patch define flush_tlb_fix_spurious_fault as empty, since it not
> necessary to flush the page for all CPUs
I'm not familiar enough with MIPS TLB workings, but it seems that adding
a MIPS version of ptep_set_access_flags() and relaxing
flush_tlb_fix_spurious_fault() are two separate patches.
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
> arch/mips/include/asm/pgtable.h | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
> index aab0ec1..d0a4940 100644
> --- a/arch/mips/include/asm/pgtable.h
> +++ b/arch/mips/include/asm/pgtable.h
> @@ -635,6 +635,26 @@ static inline pmd_t pmd_mknotpresent(pmd_t pmd)
> return pmd;
> }
>
> +#define flush_tlb_fix_spurious_fault(vma, address) do { } while (0)
> +
> +#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
> +int ptep_set_access_flags(struct vm_area_struct *vma,
> + unsigned long address, pte_t *ptep,
> + pte_t entry, int dirty)
> +{
> + int changed = !pte_same(*ptep, entry);
> +
> + if (changed)
> + set_pte_at(vma->vm_mm, address, ptep, entry);
> + else
> + /* update tlb with latest pte entry still, tlb entry is old
> + * since there is page fault
> + */
> + update_mmu_cache(vma, address, ptep);
> +
> + return changed;
> +}
> +
> /*
> * The generic version pmdp_huge_get_and_clear uses a version of pmd_clear() with a
> * different prototype.
> --
> 1.8.3.1
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2020-05-14 9:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-14 2:17 [PATCH] MIPS: update tlb even if pte entry has no change Bibo Mao
2020-05-14 9:33 ` Mike Rapoport [this message]
2020-05-14 11:40 ` maobibo
2020-05-14 9:35 ` Sergei Shtylyov
2020-05-14 9:37 ` Sergei Shtylyov
2020-05-14 11:41 ` maobibo
2020-05-14 13:34 ` Maciej W. Rozycki
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=20200514093359.GB1059226@linux.ibm.com \
--to=rppt@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=dkorotin@wavecomp.com \
--cc=f4bug@amsat.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=maobibo@loongson.cn \
--cc=paulburton@kernel.org \
--cc=shorne@gmail.com \
--cc=steven.price@arm.com \
--cc=tsbogend@alpha.franken.de \
/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).