Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2510428pxb; Mon, 11 Jan 2021 11:28:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzB+PQwDs3El0hDyHV/3/pS10KaoRJbjgcawY9RAGQz+eZNUkLuToKjyLAnwsbNJNoE7MTQ X-Received: by 2002:a17:906:924a:: with SMTP id c10mr659939ejx.113.1610393330865; Mon, 11 Jan 2021 11:28:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610393330; cv=none; d=google.com; s=arc-20160816; b=FOF+84vfU9D5Nn+O4P4VFSTAlEyTdyRmCpbSCXdu4jfvaYR/L5z6L956QQyh7lIa5G r4XmfVHosxCNPNLVqgIaMMO6qlIpYvIkOYKpVJGnskuxqB2CmPx9yCNdfAn8CmSlxzkI Ew/mP+vPCDJKWI93Mf6NGIIG1wBlcTqQ2AJePWOC/GAwJmk85S7zKj6WzfvLWrAFOMTL fdindns3Q//Q4kdhi8EwGSiUNLkKmqvLoml8SPHiHl93QpwZmtwygj6elNCeR6rHTwDh 6UHDF+FRami4UppreTnpecFP/uwSnzmA+T/wUgq4JZdPY3JkKHIGgbZAh84IRFEt9IhQ A/QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=oKNFHHPFfD7wrwfuT7r81/lh6WrZWqpMnLmKMYRybYs=; b=eDauonUKJZ+/ApcN0Xc6tlRkE/FNZRZUkcd0juFKG+HGTrcd8yV9S4j4nkiMuU0uDf 3gCO4GXpe6ydmocIxUf4Pj2AvI+VIN7xAnKk6iWvxT8cEtxEJUxEO/CNrIbwc/Sx4Iv6 /q/Jn59MDwtrboZPrPUPtPTHQgSc0wjZn6c9IRKo2/eoE2pwN6lZO95Heo6EHUhSPszr a6MLAkMb6ncNl4dEqvOCml9RrT/BQdAkbuP1+K8+3nFip97/Y2H1VCBpuWwD1X14spY5 nqExd/0hDseubltWs83uFBuYp3cSBGtdFS0Ee8MFk8jSv2cLuBhrebMhUbzr4zHX+bVk QfPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=T4dW7LSW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e21si263530edv.260.2021.01.11.11.28.25; Mon, 11 Jan 2021 11:28:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=T4dW7LSW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391109AbhAKT0j (ORCPT + 99 others); Mon, 11 Jan 2021 14:26:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391030AbhAKT0i (ORCPT ); Mon, 11 Jan 2021 14:26:38 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D340C061786 for ; Mon, 11 Jan 2021 11:25:58 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id u25so1236995lfc.2 for ; Mon, 11 Jan 2021 11:25:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oKNFHHPFfD7wrwfuT7r81/lh6WrZWqpMnLmKMYRybYs=; b=T4dW7LSW7T2wg9bacwMkeXXtLd4Ok0sO57tNlnjcAH8Ux7LmYSjZ0lozL/qlAFcVMW /X7YR78gi7Ax/0lk70yZx3V9MQaMI7jS/gAfWwdp4tXVRSg+DjhZ8vv5aWsRaxJuwJRC ABafPi7lpmnzPtXbWxsMbYU5IEhVTnlyC3SEM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oKNFHHPFfD7wrwfuT7r81/lh6WrZWqpMnLmKMYRybYs=; b=YKRvL/IyVpQWh8Y//CbgmetY5UshaXlVJD0MpqTHOtlqqxRkHSW6FC3L91tr7dlyo0 seasneBLxnWoDR+N2KUxSAersK1OUyUZAtRUbtulfJs/6I1GR8LBxy5nltse9rZE5QKT RstH6rwMrNcErDOu2X+O8k1ZWcvMdGG6jgCo2fSQ9AGUvrHxZh4Zo6JdnEA+rIh/3D4o V1oHyZM1HG42z923xTdtss2BBeru68caEovN1WSAc0R1Bv3vy251C7UvFip5dGsmLzYQ U1bU87yfW+zIlsdDX8/xiC6OnyKRU740p40jxu/LdpQliUvwBT/bAPKg5eST6lAt7Udc rmKA== X-Gm-Message-State: AOAM5324YWFgiAiDuRo7x4gX0xG6Houdgk4/2I8pBaELwVolfjWUWpqg nVJmUnAPu4c9moea5gOOb44l0BbOJyIerw== X-Received: by 2002:a19:4c06:: with SMTP id z6mr502730lfa.284.1610393156097; Mon, 11 Jan 2021 11:25:56 -0800 (PST) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com. [209.85.208.180]) by smtp.gmail.com with ESMTPSA id x18sm87255lfe.36.2021.01.11.11.25.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Jan 2021 11:25:54 -0800 (PST) Received: by mail-lj1-f180.google.com with SMTP id w26so165754ljo.4 for ; Mon, 11 Jan 2021 11:25:54 -0800 (PST) X-Received: by 2002:a2e:9b13:: with SMTP id u19mr420017lji.48.1610393153712; Mon, 11 Jan 2021 11:25:53 -0800 (PST) MIME-Version: 1.0 References: <20210108171517.5290-1-will@kernel.org> <20210111142402.6euyktmcnpemanf7@box> In-Reply-To: <20210111142402.6euyktmcnpemanf7@box> From: Linus Torvalds Date: Mon, 11 Jan 2021 11:25:37 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 0/3] Create 'old' ptes for faultaround mappings on arm64 with hardware access flag To: "Kirill A. Shutemov" Cc: Will Deacon , Linux Kernel Mailing List , Linux-MM , Linux ARM , Catalin Marinas , Jan Kara , Minchan Kim , Andrew Morton , "Kirill A . Shutemov" , Vinayak Menon , Hugh Dickins , Android Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 11, 2021 at 6:24 AM Kirill A. Shutemov wrote: > > I wonder if it would be acceptable to pass down to faultaround a copy > of vmf, so it mess with it without risking to corrupt the original one? I'd almost prefer to split vmf into two parts: the 'this is the fault info' part and the 'this is the fault handling state' part. So the first one would be filled in by the actual page faulter (or GUP) - and then be 'const' during the lookup, while the second one would be set up by handle_mm_fault() and would contain that "this is the current state of my fault state machine" and contain things like that ->pte thing. And then if somebody actually needs to pass in "modified fault state" (ie that whole "I'm doing fault-around, so I'll use multiple addresses") they'd never modify the address in the fault info, they'd just pass the address as an explicit argument (like most cases already do - the "change addr or flags in vmf" is actually already _fairly_ rare). Linus