[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1524781764.2693.503.camel@hpe.com>
Date: Thu, 26 Apr 2018 22:30:14 +0000
From: "Kani, Toshi" <toshi.kani@....com>
To: "joro@...tes.org" <joro@...tes.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"bp@...e.de" <bp@...e.de>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"guohanjun@...wei.com" <guohanjun@...wei.com>,
"wxf.wang@...ilicon.com" <wxf.wang@...ilicon.com>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"willy@...radead.org" <willy@...radead.org>,
"hpa@...or.com" <hpa@...or.com>,
"catalin.marinas@....com" <catalin.marinas@....com>,
"mingo@...hat.com" <mingo@...hat.com>,
"will.deacon@....com" <will.deacon@....com>,
"Hocko, Michal" <MHocko@...e.com>,
"cpandya@...eaurora.org" <cpandya@...eaurora.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v2 2/2] x86/mm: implement free pmd/pte page interfaces
On Thu, 2018-04-26 at 22:07 +0200, joro@...tes.org wrote:
> On Thu, Apr 26, 2018 at 05:49:58PM +0000, Kani, Toshi wrote:
> > On Thu, 2018-04-26 at 19:23 +0200, joro@...tes.org wrote:
> > > So the PMD entry you clear can still be in a page-walk cache and this
> > > needs to be flushed too before you can free the PTE page. Otherwise
> > > page-walks might still go to the page you just freed. That is especially
> > > bad when the page is already reallocated and filled with other data.
> >
> > I do not understand why we need to flush processor caches here. x86
> > processor caches are coherent with MESI. So, clearing an PMD entry
> > modifies a cache entry on the processor associated with the address,
> > which in turn invalidates all stale cache entries on other processors.
>
> A page walk cache is not about the processors data cache, its a cache
> similar to the TLB to speed up page-walks by caching intermediate
> results of previous page walks.
Thanks for the clarification. After reading through SDM one more time, I
agree that we need a TLB purge here. Here is my current understanding.
- INVLPG purges both TLB and paging-structure caches. So, PMD cache was
purged once.
- However, processor may cache this PMD entry later in speculation
since it has p-bit set. (This is where my misunderstanding was.
Speculation is not allowed to access a target address, but it may still
cache this PMD entry.)
- A single INVLPG on each processor purges this PMD cache. It does not
need a range purge (which was already done).
Does it sound right to you?
As for the BUG_ON issue, are you able to reproduce this issue? If so,
would you be able to test the fix?
Regards,
-Toshi
Powered by blists - more mailing lists