[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230721131341.w5abuxcbohofpzwa@patel>
Date: Fri, 21 Jul 2023 18:43:41 +0530
From: Jay Patel <jaypatel@...ux.ibm.com>
To: Aneesh Kumar K V <aneesh.kumar@...ux.ibm.com>
Cc: Hugh Dickins <hughd@...gle.com>, Miaohe Lin <linmiaohe@...wei.com>,
David Hildenbrand <david@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Yang Shi <shy828301@...il.com>, Peter Xu <peterx@...hat.com>,
linux-kernel@...r.kernel.org, Song Liu <song@...nel.org>,
sparclinux@...r.kernel.org,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>,
Will Deacon <will@...nel.org>, linux-s390@...r.kernel.org,
Yu Zhao <yuzhao@...gle.com>, Ira Weiny <ira.weiny@...el.com>,
Alistair Popple <apopple@...dia.com>,
Russell King <linux@...linux.org.uk>,
Matthew Wilcox <willy@...radead.org>,
Steven Price <steven.price@....com>,
Christoph Hellwig <hch@...radead.org>,
Jason Gunthorpe <jgg@...pe.ca>,
linux-arm-kernel@...ts.infradead.org, Zi Yan <ziy@...dia.com>,
Huang Ying <ying.huang@...el.com>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Gerald Schaefer <gerald.schaefer@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Thomas Hellstrom <thomas.hellstrom@...ux.intel.com>,
Ralph Camp bell <rcampbell@...dia.com>,
Pasha Tatashin <pasha.tatashin@...een.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Anshuman Khandual <anshuman.khandual@....com>,
Heiko Carstens <hca@...ux.ibm.com>,
Qi Zheng <zhengqi.arch@...edance.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Vlastimil Babka <vbabka@...e.cz>,
SeongJae Park <sj@...nel.org>,
Lorenzo Stoakes <lstoakes@...il.com>,
Jann Horn <jannh@...gle.com>, linux-mm@...ck.org,
linuxppc-dev@...ts.ozlabs.org,
Naoya Horiguchi <naoya.horiguchi@....com>,
Zack Rusin <zackr@...are.com>,
Vishal Moola <vishal.moola@...il.com>,
Minchan Kim <minchan@...nel.org>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Mel Gorman <mgorman@...hsingularity.net>,
"David S. Miller" <davem@...emloft.net>,
Mike Rapoport <rppt@...nel.org>,
Mike Kravetz <mike.kravetz@...cle.com>
Subject: Re: [PATCH v3 04/13] powerpc: assert_pte_locked() use
pte_offset_map_nolock()
On Jul 19 2023, Aneesh Kumar K V wrote:
> On 7/19/23 10:34 AM, Hugh Dickins wrote:
> > On Tue, 18 Jul 2023, Aneesh Kumar K.V wrote:
> >> Hugh Dickins <hughd@...gle.com> writes:
> >>
> >>> Instead of pte_lockptr(), use the recently added pte_offset_map_nolock()
> >>> in assert_pte_locked(). BUG if pte_offset_map_nolock() fails: this is
> >>> stricter than the previous implementation, which skipped when pmd_none()
> >>> (with a comment on khugepaged collapse transitions): but wouldn't we want
> >>> to know, if an assert_pte_locked() caller can be racing such transitions?
> >>>
> >>
> >> The reason we had that pmd_none check there was to handle khugpaged. In
> >> case of khugepaged we do pmdp_collapse_flush and then do a ptep_clear.
> >> ppc64 had the assert_pte_locked check inside that ptep_clear.
> >>
> >> _pmd = pmdp_collapse_flush(vma, address, pmd);
> >> ..
> >> ptep_clear()
> >> -> asset_ptep_locked()
> >> ---> pmd_none
> >> -----> BUG
> >>
> >>
> >> The problem is how assert_pte_locked() verify whether we are holding
> >> ptl. It does that by walking the page table again and in this specific
> >> case by the time we call the function we already had cleared pmd .
> >
> > Aneesh, please clarify, I've spent hours on this.
> >
> > From all your use of past tense ("had"), I thought you were Acking my
> > patch; but now, after looking again at v3.11 source and today's,
> > I think you are NAKing my patch in its present form.
> >
>
> Sorry for the confusion my reply created.
>
> > You are pointing out that anon THP's __collapse_huge_page_copy_succeeded()
> > uses ptep_clear() at a point after pmdp_collapse_flush() already cleared
> > *pmd, so my patch now leads that one use of assert_pte_locked() to BUG.
> > Is that your point?
> >
>
> Yes. I haven't tested this yet to verify that it is indeed hitting that BUG.
> But a code inspection tells me we will hit that BUG on powerpc because of
> the above details.
>
Hi Aneesh,
After testing it, I can confirm that it encountered a BUG on powerpc.
Log report as attached
Thanks,
Jay Patel
> > I can easily restore that khugepaged comment (which had appeared to me
> > out of date at the time, but now looks still relevant) and pmd_none(*pmd)
> > check: but please clarify.
> >
>
> That is correct. if we add that pmd_none check back we should be good here.
>
>
> -aneesh
View attachment "report.txt" of type "text/plain" (3721 bytes)
Powered by blists - more mailing lists