From: Catalin Marinas <catalin.marinas@arm.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Jisheng Zhang <jszhang@kernel.org>, Will Deacon <will@kernel.org>,
"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Nick Piggin <npiggin@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>, Arnd Bergmann <arnd@arndb.de>,
linux-arch@vger.kernel.org, linux-mm@kvack.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
Nadav Amit <namit@vmware.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Andy Lutomirski <luto@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>, Yu Zhao <yuzhao@google.com>,
x86@kernel.org
Subject: Re: [PATCH 1/2] mm/tlb: fix fullmm semantics
Date: Wed, 3 Jan 2024 21:54:32 +0000 [thread overview]
Message-ID: <ZZXXmFthrXO6G9OE@arm.com> (raw)
In-Reply-To: <6ee6340a-ffe2-4106-b845-47cf443558c3@intel.com>
On Wed, Jan 03, 2024 at 12:26:29PM -0800, Dave Hansen wrote:
> On 1/3/24 10:05, Catalin Marinas wrote:
> >> --- a/mm/mmu_gather.c
> >> +++ b/mm/mmu_gather.c
> >> @@ -384,7 +384,7 @@ void tlb_finish_mmu(struct mmu_gather *tlb)
> >> * On x86 non-fullmm doesn't yield significant difference
> >> * against fullmm.
> >> */
> >> - tlb->fullmm = 1;
> >> + tlb->need_flush_all = 1;
> >> __tlb_reset_range(tlb);
> >> tlb->freed_tables = 1;
> >> }
> > The optimisation here was added about a year later in commit
> > 7a30df49f63a ("mm: mmu_gather: remove __tlb_reset_range() for force
> > flush"). Do we still need to keep freed_tables = 1 here? I'd say only
> > __tlb_reset_range().
>
> I think the __tlb_reset_range() can be dangerous if it clears
> ->freed_tables. On x86 at least, it might lead to skipping the TLB IPI
> for CPUs that are in lazy TLB mode. When those wake back up they might
> start using the freed page tables.
You are right, I did not realise freed_tables is reset in
__tlb_reset_range().
--
Catalin
WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Jisheng Zhang <jszhang@kernel.org>, Will Deacon <will@kernel.org>,
"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Nick Piggin <npiggin@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>, Arnd Bergmann <arnd@arndb.de>,
linux-arch@vger.kernel.org, linux-mm@kvack.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
Nadav Amit <namit@vmware.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Andy Lutomirski <luto@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>, Yu Zhao <yuzhao@google.com>,
x86@kernel.org
Subject: Re: [PATCH 1/2] mm/tlb: fix fullmm semantics
Date: Wed, 3 Jan 2024 21:54:32 +0000 [thread overview]
Message-ID: <ZZXXmFthrXO6G9OE@arm.com> (raw)
In-Reply-To: <6ee6340a-ffe2-4106-b845-47cf443558c3@intel.com>
On Wed, Jan 03, 2024 at 12:26:29PM -0800, Dave Hansen wrote:
> On 1/3/24 10:05, Catalin Marinas wrote:
> >> --- a/mm/mmu_gather.c
> >> +++ b/mm/mmu_gather.c
> >> @@ -384,7 +384,7 @@ void tlb_finish_mmu(struct mmu_gather *tlb)
> >> * On x86 non-fullmm doesn't yield significant difference
> >> * against fullmm.
> >> */
> >> - tlb->fullmm = 1;
> >> + tlb->need_flush_all = 1;
> >> __tlb_reset_range(tlb);
> >> tlb->freed_tables = 1;
> >> }
> > The optimisation here was added about a year later in commit
> > 7a30df49f63a ("mm: mmu_gather: remove __tlb_reset_range() for force
> > flush"). Do we still need to keep freed_tables = 1 here? I'd say only
> > __tlb_reset_range().
>
> I think the __tlb_reset_range() can be dangerous if it clears
> ->freed_tables. On x86 at least, it might lead to skipping the TLB IPI
> for CPUs that are in lazy TLB mode. When those wake back up they might
> start using the freed page tables.
You are right, I did not realise freed_tables is reset in
__tlb_reset_range().
--
Catalin
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Jisheng Zhang <jszhang@kernel.org>, Will Deacon <will@kernel.org>,
"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Nick Piggin <npiggin@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>, Arnd Bergmann <arnd@arndb.de>,
linux-arch@vger.kernel.org, linux-mm@kvack.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
Nadav Amit <namit@vmware.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Andy Lutomirski <luto@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>, Yu Zhao <yuzhao@google.com>,
x86@kernel.org
Subject: Re: [PATCH 1/2] mm/tlb: fix fullmm semantics
Date: Wed, 3 Jan 2024 21:54:32 +0000 [thread overview]
Message-ID: <ZZXXmFthrXO6G9OE@arm.com> (raw)
In-Reply-To: <6ee6340a-ffe2-4106-b845-47cf443558c3@intel.com>
On Wed, Jan 03, 2024 at 12:26:29PM -0800, Dave Hansen wrote:
> On 1/3/24 10:05, Catalin Marinas wrote:
> >> --- a/mm/mmu_gather.c
> >> +++ b/mm/mmu_gather.c
> >> @@ -384,7 +384,7 @@ void tlb_finish_mmu(struct mmu_gather *tlb)
> >> * On x86 non-fullmm doesn't yield significant difference
> >> * against fullmm.
> >> */
> >> - tlb->fullmm = 1;
> >> + tlb->need_flush_all = 1;
> >> __tlb_reset_range(tlb);
> >> tlb->freed_tables = 1;
> >> }
> > The optimisation here was added about a year later in commit
> > 7a30df49f63a ("mm: mmu_gather: remove __tlb_reset_range() for force
> > flush"). Do we still need to keep freed_tables = 1 here? I'd say only
> > __tlb_reset_range().
>
> I think the __tlb_reset_range() can be dangerous if it clears
> ->freed_tables. On x86 at least, it might lead to skipping the TLB IPI
> for CPUs that are in lazy TLB mode. When those wake back up they might
> start using the freed page tables.
You are right, I did not realise freed_tables is reset in
__tlb_reset_range().
--
Catalin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-01-03 21:54 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-28 8:46 [PATCH 0/2] riscv: tlb: avoid tlb flushing on exit & execve Jisheng Zhang
2023-12-28 8:46 ` Jisheng Zhang
2023-12-28 8:46 ` Jisheng Zhang
2023-12-28 8:46 ` [PATCH 1/2] mm/tlb: fix fullmm semantics Jisheng Zhang
2023-12-28 8:46 ` Jisheng Zhang
2023-12-28 8:46 ` Jisheng Zhang
2023-12-30 9:54 ` Nadav Amit
2023-12-30 9:54 ` Nadav Amit
2023-12-30 9:54 ` Nadav Amit
2024-01-02 2:41 ` Jisheng Zhang
2024-01-02 2:41 ` Jisheng Zhang
2024-01-02 2:41 ` Jisheng Zhang
2024-01-04 13:26 ` Nadav Amit
2024-01-04 13:26 ` Nadav Amit
2024-01-04 13:26 ` Nadav Amit
2024-01-04 14:40 ` Will Deacon
2024-01-04 14:40 ` Will Deacon
2024-01-04 14:40 ` Will Deacon
2024-01-03 17:50 ` Will Deacon
2024-01-03 17:50 ` Will Deacon
2024-01-03 17:50 ` Will Deacon
2024-01-03 17:57 ` Will Deacon
2024-01-03 17:57 ` Will Deacon
2024-01-03 17:57 ` Will Deacon
2024-01-03 18:05 ` Catalin Marinas
2024-01-03 18:05 ` Catalin Marinas
2024-01-03 18:05 ` Catalin Marinas
2024-01-03 20:26 ` Dave Hansen
2024-01-03 20:26 ` Dave Hansen
2024-01-03 20:26 ` Dave Hansen
2024-01-03 21:54 ` Catalin Marinas [this message]
2024-01-03 21:54 ` Catalin Marinas
2024-01-03 21:54 ` Catalin Marinas
2023-12-28 8:46 ` [PATCH 2/2] riscv: tlb: avoid tlb flushing if fullmm == 1 Jisheng Zhang
2023-12-28 8:46 ` Jisheng Zhang
2023-12-28 8:46 ` Jisheng Zhang
2023-12-30 18:26 ` Alexandre Ghiti
2023-12-30 18:26 ` Alexandre Ghiti
2023-12-30 18:26 ` Alexandre Ghiti
2024-01-02 3:12 ` Jisheng Zhang
2024-01-02 3:12 ` Jisheng Zhang
2024-01-02 3:12 ` Jisheng Zhang
2024-01-04 13:00 ` Alexandre Ghiti
2024-01-04 13:00 ` Alexandre Ghiti
2024-01-04 13:00 ` Alexandre Ghiti
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=ZZXXmFthrXO6G9OE@arm.com \
--to=catalin.marinas@arm.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=jszhang@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-riscv@lists.infradead.org \
--cc=luto@kernel.org \
--cc=namit@vmware.com \
--cc=npiggin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--cc=x86@kernel.org \
--cc=yuzhao@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.