Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5735733ybp; Tue, 8 Oct 2019 07:33:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTxQQ/aAHvvYw0akBS0xn4l1hPu0pEbgNsf7VMkDw3GGy0xbXJBrUAkZV3c6CeuevZBdzN X-Received: by 2002:a17:906:4ec2:: with SMTP id i2mr28767112ejv.83.1570545219339; Tue, 08 Oct 2019 07:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570545219; cv=none; d=google.com; s=arc-20160816; b=SVsJPTsjNNyCAxj6dc3mrMUU0VTDYQnfRNiiLyFLpuFSz75y7Zlat3FeJtKVDB/iTX a9M2FkB4+3NREEgAosL/PJnWWv7Xhxj7E6v3kOHrKiFmQ9JVASD4NnIbATaIM+0isLIA 9gvz+SRDMBTAuVH4kO12REzFPnffqVaOaRc/21zr3Cp49JOVM9akvU11EIoECw1JObzA tg7eHeKmGJcjZOhGmqzBnVEQ4i7FqzdYKg3wRho7fgY5iW+lbe8fNvnnOXCOrClZ+4aM NGvtw1t/BJ/rZ8UsvEJRYvQsYof7oiqFNEQy0hTQg1iOR/BGqvURaoBSAcCAxv4V/56/ manw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=njSAfvEWqpgoU0gYs1bEj0p7fhAAPMVQsZ7cyfhOXFg=; b=09KtJPKg06qmjIHLIHTUl6TELH2Nu1WNtpcXKm84Long8YSwGsVH0gprGzklieNl2s GIgUxcjUlC/c7LwruH5qxeJHtVpxwpT5XgITCXY1Oqje8wqz6r9JYKPq5wYVui+lG4C+ xFzABxvHfRr91DW5INW2K8r1Rgx19OBLrw3J/kjyTnZDSUGUCL09h95D+JYynu9s7I6y sbXM7Q3QKLXIgBQjinnJ3w9Te2onm++UIsoDjhleD0ReHKmx40E9SYBASCvHQpJUSP+5 ELWxwKbkM78C4D9EBbhQ6QFLw6g9EYHQfVftNdCUx36NlvI6RKxQH5icZlio1Z5ZrlcA 1WNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=L3eytFXD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x45si10277419edd.388.2019.10.08.07.33.14; Tue, 08 Oct 2019 07:33:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=L3eytFXD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726138AbfJHOcg (ORCPT + 99 others); Tue, 8 Oct 2019 10:32:36 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:35372 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725795AbfJHOcg (ORCPT ); Tue, 8 Oct 2019 10:32:36 -0400 Received: by mail-ed1-f67.google.com with SMTP id v8so15845179eds.2 for ; Tue, 08 Oct 2019 07:32:34 -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=sNZoQBnWiST2v4Ym8XWalEqXK14TKF+NRmzhHeugoVqGKjPoX9jodebm6Oy2P7nFp/ dpEiHMH5AQe+9GLMYZf6MaRfS4XD3a+udhNnXxlIJMVMqh1kV54OwFeaGuBGdLHUALmk 4WDPkABCMRD6jPsdlGkRUWR76rJng6kuWQWzLQ1jdDQ9Ug/Pg9v1kFMuXzNQWGBf4kJZ Pd9Bh/5ME9pxzbJt4DT+5mD7gJVJwLMH0gLOkWPN0EKuY5IN+47grBbMshJH++XeI33H C9dSfoTtBXY2O/zTB/LjDRhcXoquq4obMwEh44Q1LhTj4+lOvNeyjNg4kQ6Le2jEuDdN H6hg== X-Gm-Message-State: APjAAAWTPSwb0yrawg/u9NkdbO5hPv4AwDDopa+qwTAUjF+SF8ZEu7+U lM+hwbcRttRwRJB21spEowXmaw== 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 Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 08, 2019 at 12:58:57PM +0000, Justin He (Arm Technology China) wrote: > Hi Will > > > -----Original Message----- > > From: Will Deacon > > Sent: 2019年10月8日 20:40 > > 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 China) > > ; nd > > Subject: Re: [PATCH v10 3/3] mm: fix double page fault on arm64 if PTE_AF > > is cleared > > > > On Tue, Oct 08, 2019 at 02:19:05AM +0000, Justin He (Arm Technology > > China) wrote: > > > > -----Original Message----- > > > > From: Will Deacon > > > > Sent: 2019年10月1日 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 China) > > > > > > > > Subject: Re: [PATCH v10 3/3] mm: fix double page fault on arm64 if > > 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 = > > > > > 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, however isn't > > > > it the case that /most/ architectures will want to return true for > > > > arch_faults_on_old_pte()? In which case, wouldn't it make more sense > > for > > > > that to be the default, and have x86 and arm64 provide an override? > > 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 doesn'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. > > > > ...and my complaint is that this is the majority of supported architectures, > > so you're fixing something for arm64 which also affects arm, powerpc, > > alpha, mips, riscv, ... > > 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 will set > pte_young) > > I am ok with that if no objections from others. > > @Kirill A. Shutemov Do you have any comments? Thanks Sounds sane to me. -- Kirill A. Shutemov