[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YFh1fabrBok74F8X@hirez.programming.kicks-ass.net>
Date: Mon, 22 Mar 2021 11:46:21 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: "Kirill A. Shutemov" <kirill@...temov.name>
Cc: Yu-cheng Yu <yu-cheng.yu@...el.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, linux-mm@...ck.org,
linux-arch@...r.kernel.org, linux-api@...r.kernel.org,
Arnd Bergmann <arnd@...db.de>,
Andy Lutomirski <luto@...nel.org>,
Balbir Singh <bsingharora@...il.com>,
Borislav Petkov <bp@...en8.de>,
Cyrill Gorcunov <gorcunov@...il.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Eugene Syromiatnikov <esyr@...hat.com>,
Florian Weimer <fweimer@...hat.com>,
"H.J. Lu" <hjl.tools@...il.com>, Jann Horn <jannh@...gle.com>,
Jonathan Corbet <corbet@....net>,
Kees Cook <keescook@...omium.org>,
Mike Kravetz <mike.kravetz@...cle.com>,
Nadav Amit <nadav.amit@...il.com>,
Oleg Nesterov <oleg@...hat.com>, Pavel Machek <pavel@....cz>,
Randy Dunlap <rdunlap@...radead.org>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
Vedvyas Shanbhogue <vedvyas.shanbhogue@...el.com>,
Dave Martin <Dave.Martin@....com>,
Weijiang Yang <weijiang.yang@...el.com>,
Pengfei Xu <pengfei.xu@...el.com>,
Haitao Huang <haitao.huang@...el.com>
Subject: Re: [PATCH v23 12/28] x86/mm: Update ptep_set_wrprotect() and
pmdp_set_wrprotect() for transition from _PAGE_DIRTY to _PAGE_COW
On Mon, Mar 22, 2021 at 01:15:02PM +0300, Kirill A. Shutemov wrote:
> On Tue, Mar 16, 2021 at 08:10:38AM -0700, Yu-cheng Yu wrote:
> > + pte_t old_pte, new_pte;
> > +
> > + old_pte = READ_ONCE(*ptep);
> > + do {
> > + new_pte = pte_wrprotect(old_pte);
> > + } while (!try_cmpxchg(&ptep->pte, &old_pte.pte, new_pte.pte));
>
> I think this is wrong. You need to update old_pte on every loop iteration,
> otherwise you can get in to endless loop.
It is correct, please consider why the old argument is a pointer.
Powered by blists - more mailing lists