From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60E26ECE58E for ; Tue, 8 Oct 2019 14:32:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 176B92070B for ; Tue, 8 Oct 2019 14:32:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="L3eytFXD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 176B92070B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AC5A68E0006; Tue, 8 Oct 2019 10:32:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A76D18E0003; Tue, 8 Oct 2019 10:32:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 965EA8E0006; Tue, 8 Oct 2019 10:32:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0134.hostedemail.com [216.40.44.134]) by kanga.kvack.org (Postfix) with ESMTP id 74E528E0003 for ; Tue, 8 Oct 2019 10:32:36 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 139F6180AD804 for ; Tue, 8 Oct 2019 14:32:36 +0000 (UTC) X-FDA: 76020858312.08.star55_16998f223dd21 X-HE-Tag: star55_16998f223dd21 X-Filterd-Recvd-Size: 8378 Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Tue, 8 Oct 2019 14:32:35 +0000 (UTC) Received: by mail-ed1-f66.google.com with SMTP id y91so15789172ede.9 for ; Tue, 08 Oct 2019 07:32:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=njSAfvEWqpgoU0gYs1bEj0p7fhAAPMVQsZ7cyfhOXFg=; b=L3eytFXDAeIwpwarvxe0IxbMkPQ+dIYA4tTHLo5Yw8fOEGweyFLbK2Xr3UlZMWoFhY VG9gE0gzprlJFzonnB3Dj922G288bBaQNi7WJHMg876FS4rT/+T8mkW9ZotgP09VZW+f TGcxwNXlIBtuKmQf7Wjg4Iwn73QP4qB8NuZqeiPQ8W8FK/7sYS6bN8fUjhS4+IsgfQUN 1Gl3s5FqC/FQE5etDdbLM/iBAuhJE6VXrajmBUr/OO4vI8ScKNYDniM2Yks0vck5VNTa EEuIYW09UqkOTc3dzF1TuYOzFbJAOoiRZ64sW2/mMcJHn+v4yPrZlC+RN5Y+wkwLYq6/ Hh+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=njSAfvEWqpgoU0gYs1bEj0p7fhAAPMVQsZ7cyfhOXFg=; b=LXNm0s7Ws/a3Jvpk++c7R3hyFAZT4+fYpLwZGxdbTBaKKBqfQPHqCx9ru3hkKATCcj COQie8VmQKD2Rv7oUKc6r0bKkEUhHs+LwtuOkF2l2OE9/5Eeps6U6asdmTKdWW6UKHs5 YqZ4ZgCGDH5mJWeK7TV9yqXORBU8Aaf6EuRdbcqSICqtm4JV5q95b36Kqi1m492vRZMF Bme1b1b8Mph9yGlaiNiM7BMbvExEt7GWpqzH97UqPfuiO1Rhm+amzR3fXTPpwaMx6U92 gS/ABLvyMt1jNCYCkE0xS2pSP0JHJUavQ3oUEnIPbiypMoZr6v58aeWQygD0HDJrRdn0 0S/w== X-Gm-Message-State: APjAAAUjpjzPjdK9EJXL6/OwGHX1w6CfSvFutC3iFaL3XygG1b3jr/y9 iFTosQ8Ov1YWPvOJ3c8Z9YaosQ== X-Google-Smtp-Source: APXvYqz6cvRMCxdLmtCQ2khfDe1iPEqAmLGkZ2CXZc2kazAbmaHM4vhnZ63e2XgGI3JqNjExeBFVDw== X-Received: by 2002:aa7:d995:: with SMTP id u21mr34410415eds.271.1570545153868; Tue, 08 Oct 2019 07:32:33 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id i30sm3938992ede.32.2019.10.08.07.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2019 07:32:32 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 5440710170F; Tue, 8 Oct 2019 17:32:32 +0300 (+03) Date: Tue, 8 Oct 2019 17:32:32 +0300 From: "Kirill A. Shutemov" To: "Justin He (Arm Technology China)" Cc: Will Deacon , "Kirill A. Shutemov" , Catalin Marinas , Mark Rutland , James Morse , Marc Zyngier , Matthew Wilcox , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , Punit Agrawal , Thomas Gleixner , Andrew Morton , "hejianet@gmail.com" , "Kaly Xin (Arm Technology China)" , nd Subject: Re: [PATCH v10 3/3] mm: fix double page fault on arm64 if PTE_AF is cleared Message-ID: <20191008143232.e7r4auxwlcllvlqh@box> References: <20190930015740.84362-1-justin.he@arm.com> <20190930015740.84362-4-justin.he@arm.com> <20191001125413.mhxa6qszwnuhglky@willie-the-truck> <20191008123943.j7q6dlu2qb2az6xa@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Oct 08, 2019 at 12:58:57PM +0000, Justin He (Arm Technology China= ) wrote: > Hi Will >=20 > > -----Original Message----- > > From: Will Deacon > > Sent: 2019=E5=B9=B410=E6=9C=888=E6=97=A5 20:40 > > To: Justin He (Arm Technology China) > > Cc: Catalin Marinas ; Mark Rutland > > ; James Morse ; Marc > > Zyngier ; Matthew Wilcox ; Kiril= l A. > > Shutemov ; linux-arm- > > kernel@lists.infradead.org; linux-kernel@vger.kernel.org; linux- > > mm@kvack.org; Punit Agrawal ; Thomas > > Gleixner ; Andrew Morton > foundation.org>; hejianet@gmail.com; Kaly Xin (Arm Technology China) > > ; nd > > Subject: Re: [PATCH v10 3/3] mm: fix double page fault on arm64 if PT= E_AF > > is cleared > >=20 > > On Tue, Oct 08, 2019 at 02:19:05AM +0000, Justin He (Arm Technology > > China) wrote: > > > > -----Original Message----- > > > > From: Will Deacon > > > > Sent: 2019=E5=B9=B410=E6=9C=881=E6=97=A5 20:54 > > > > To: Justin He (Arm Technology China) > > > > Cc: Catalin Marinas ; Mark Rutland > > > > ; James Morse ; > > Marc > > > > Zyngier ; Matthew Wilcox ; > > Kirill A. > > > > Shutemov ; linux-arm- > > > > kernel@lists.infradead.org; linux-kernel@vger.kernel.org; linux- > > > > mm@kvack.org; Punit Agrawal ; Thomas > > > > Gleixner ; Andrew Morton > > > foundation.org>; hejianet@gmail.com; Kaly Xin (Arm Technology Chi= na) > > > > > > > > Subject: Re: [PATCH v10 3/3] mm: fix double page fault on arm64 i= f > > PTE_AF > > > > is cleared > > > > > > > > On Mon, Sep 30, 2019 at 09:57:40AM +0800, Jia He wrote: > > > > > diff --git a/mm/memory.c b/mm/memory.c > > > > > index b1ca51a079f2..1f56b0118ef5 100644 > > > > > --- a/mm/memory.c > > > > > +++ b/mm/memory.c > > > > > @@ -118,6 +118,13 @@ int randomize_va_space __read_mostly =3D > > > > > 2; > > > > > #endif > > > > > > > > > > +#ifndef arch_faults_on_old_pte > > > > > +static inline bool arch_faults_on_old_pte(void) > > > > > +{ > > > > > + return false; > > > > > +} > > > > > +#endif > > > > > > > > Kirill has acked this, so I'm happy to take the patch as-is, howe= ver isn't > > > > it the case that /most/ architectures will want to return true fo= r > > > > arch_faults_on_old_pte()? In which case, wouldn't it make more se= nse > > for > > > > that to be the default, and have x86 and arm64 provide an overrid= e? > > For > > > > example, aren't most architectures still going to hit the double = fault > > > > scenario even with your patch applied? > > > > > > No, after applying my patch series, only those architectures which = don't > > provide > > > setting access flag by hardware AND don't implement their > > arch_faults_on_old_pte > > > will hit the double page fault. > > > > > > The meaning of true for arch_faults_on_old_pte() is "this arch does= n't > > have the hardware > > > setting access flag way, it might cause page fault on an old pte" > > > I don't want to change other architectures' default behavior here. = So by > > default, > > > arch_faults_on_old_pte() is false. > >=20 > > ...and my complaint is that this is the majority of supported archite= ctures, > > so you're fixing something for arm64 which also affects arm, powerpc, > > alpha, mips, riscv, ... >=20 > So, IIUC, you suggested that: > 1. by default, arch_faults_on_old_pte() return true > 2. on X86, let arch_faults_on_old_pte() be overrided as returning false > 3. on arm64, let it be as-is my patch set. > 4. let other architectures decide the behavior. (But by default, it wil= l set > pte_young) >=20 > I am ok with that if no objections from others. >=20 > @Kirill A. Shutemov Do you have any comments? Thanks Sounds sane to me. --=20 Kirill A. Shutemov