Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2028447lqa; Tue, 30 Apr 2024 06:36:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVgaJgdEHZOk84xC84T/xj1ScqV4NgU4x6mbzH2YX/dLO78IqodsKIuo5pO1prN38dJxpHC2s8IptZF7KzEF+WsXc6ImT8I1wDXvuhPXg== X-Google-Smtp-Source: AGHT+IEUr/Vnvn980KLtt2h3H3zDJCdItnKVumpVfdYksBhdzrXwPvP2aFaWABgJVdFKkcgo4gPy X-Received: by 2002:ac8:5991:0:b0:43a:d4ac:7976 with SMTP id e17-20020ac85991000000b0043ad4ac7976mr9350942qte.56.1714484196203; Tue, 30 Apr 2024 06:36:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714484196; cv=pass; d=google.com; s=arc-20160816; b=pN0D19vPCGiliWu51ChR98JZP+FuBMq/40LYpUGmYWzxzc2Teai5sx9VECW5Ri2fOx ZpE7DLb1l2+K6QMEsn3WbgbgzjahboZZCK6kljThTABaoq3U+JFbnHkC0nZHm3r2qpIu Kj5oMXZEl1vVhuB8OFH9nqYfpZxpG+vHuj8VNEf2iZtARvea/1Uzpy6n8P/EPKOGPydW COjfPImR9lAt94CLbOhVZJqw8aqW6pp46TmLdsn4sHtgSn96UQpCP1n5GGG1PXVN5bBX skF8bPkKY9ZwbUbR5TuNWVLptm8b9ovsgEMmhSvVQm7+d9BSAWoanjBX0FhHdA7I7cY7 qEIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=X39GiTLDBKMPfoBDISZFmIycGpaQv/DxiE0jSscvhBo=; fh=wqHSP9WkdG2fC47bqVSIBC52OkppwIgp5nHn14lpZR8=; b=Q9xpdZGrDKIVYCha2XGkMvdvhwwZEXbnGFxlLqcEmSfVoGXDqfKmXUHevUiGzaDg7P 3peC647R1SfNbZx0ajVrE6g3mayqOKj3TrRNn7uWKtS6XFhrj9hXdrb38Kkf7L5AiJqR Zhv19YW4PzxaVTF3qhoQaYr78hBmwaFuaJBdsSHd9RE2M5p0MF+3zeZawixJGRCtvPJE Qoz4vZvS2B/OOYOhK0d/pmjq+m/CEBXZahT32Suqyp6Uh9cW8KixQwqPg956c+nXoOW5 eV1w7KygF/4upHNS1Ie3fCjo/KTSKkNUHRhAuUusPPU10v0Pz8GugZTCv8Ncsn1RnepI BSsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=htKrw6Kf; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-164023-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164023-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h14-20020ac8584e000000b0043ab64f612dsi7119140qth.202.2024.04.30.06.36.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 06:36:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164023-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=htKrw6Kf; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-164023-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164023-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B24F61C21DE1 for ; Tue, 30 Apr 2024 13:36:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2FD71172BA6; Tue, 30 Apr 2024 13:36:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="htKrw6Kf" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 005F1171E71 for ; Tue, 30 Apr 2024 13:36:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714484173; cv=none; b=MppBgQitRSj9vvtAOHxmlwkpUAEN02AdgAfEDV2KSjikNbK78MVXKsasUgU50iYq9dsmQcxCzs3OIN6SenrmJ7wR0rn0S4Ma5A57u9Tr4it47ZujGHKws+8FSee2Ul5/7q9qV8S6yWraLYiAjV7leYZjKMFWh7qBYUmoLyEAHSU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714484173; c=relaxed/simple; bh=BT6nfyV4uk8xm25Isa+tjRkP93nsj9rWL3ISJtY6I4E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cU9iFQGddbUxC3/ttxg2aibB+ZbK9rVg/J+v4vGLczZeMc24xg+3zsb6OsDwyzu9/TjYBNd3O3ury87zmMB7e6kd3UNyqMATZQWP2+biSg9qtLI08nxNRP+bPU+ojYFr0+BN1JD2g13isfdT9+driwRoU4tftL8DfGqqtH3V7RY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=htKrw6Kf; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714484170; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=X39GiTLDBKMPfoBDISZFmIycGpaQv/DxiE0jSscvhBo=; b=htKrw6KftzhZqDpiBybpbWsF4ZiVbeQbUieHM6x57g7io6DDbsBG6Og//9/OEWqn1AKz+Y IGTW1v6UJCf5sjTTMWQKu1+dDVJiyjxcBGmUluiLFjIdZ10xTjRgmcAl9XilyR2BoDK3af 3DTjeCg+JSbRQseoKDtp4n4543yAMUg= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-140-pzfCSVaINmuEwHVJ-KAbFw-1; Tue, 30 Apr 2024 09:36:09 -0400 X-MC-Unique: pzfCSVaINmuEwHVJ-KAbFw-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-69b6e12ea63so22190086d6.1 for ; Tue, 30 Apr 2024 06:36:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714484169; x=1715088969; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=X39GiTLDBKMPfoBDISZFmIycGpaQv/DxiE0jSscvhBo=; b=qNYC7fQmwzN9/revIyYsvsm19Co8MVPniRt5pfb+FJp9QJxjoXVJ0ieI2Hjhd5giNK A8ijWCn8AH2HaR/2RQJ3mXNHXclhp717Vt8N1g01c+TJ8R9choUDS6PbnjJZ3v6iZrLS iFRjQT+WO9Sf0UUAOSU7R/cLKao0GF2J200D5H9Dqj0l5qSg1mwAYRR1+Y/2OS3WKsKU Czq2xKsbj+8cyP/XFhDOaUkNqOtDtSS1jSR5uLqlyWsy04TsMv+cPdbQ8/UnMLxSd/hC 4xz9PNW2l3jEOG6Sc7EXRNpCPswTqcD4drJ9RHSynahh4IMKO1LtkuHojO5vSW/fe2oo 3Ayw== X-Gm-Message-State: AOJu0YwrEzFM3qX+B+snPFREFtILFqDUTVQL4QymO4YVpSzckCPpszf4 CN1QJ1A8paz2rSJVQEGRnK3KivSVFHF+RjhZ+TFhVSF+wjgpGYNlQCzuMrKQvH7OqrlP4I4pv38 bq6YD1kR0bNZi5Lp4TZ53NYPkqQNBvj7QssRcSD7PQcKc21XE3bSqld0CFDos9w== X-Received: by 2002:a05:6214:411b:b0:699:dfe:6015 with SMTP id kc27-20020a056214411b00b006990dfe6015mr14696152qvb.5.1714484168652; Tue, 30 Apr 2024 06:36:08 -0700 (PDT) X-Received: by 2002:a05:6214:411b:b0:699:dfe:6015 with SMTP id kc27-20020a056214411b00b006990dfe6015mr14696112qvb.5.1714484167928; Tue, 30 Apr 2024 06:36:07 -0700 (PDT) Received: from x1n (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id z15-20020a0cf00f000000b0069942e76d99sm11384559qvk.48.2024.04.30.06.36.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 06:36:07 -0700 (PDT) Date: Tue, 30 Apr 2024 09:36:05 -0400 From: Peter Xu To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Andrew Morton , Shuah Khan Subject: Re: [PATCH v1] selftests: mm: gup_longterm: test unsharing logic when R/O pinning Message-ID: References: <20240430131508.86924-1-david@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240430131508.86924-1-david@redhat.com> On Tue, Apr 30, 2024 at 03:15:08PM +0200, David Hildenbrand wrote: > In our FOLL_LONGTERM tests, we prefault the page tables for the GUP-fast > test cases to be able to find a PTE and exercise the "longterm pinning > allowed" logic on the GUP-fast path where possible. > > For now, we always prefault the page tables writable, resulting in PTEs > that are writable. > > Let's cover more cases to also test if our unsharing logic works as > expected (and is able to make progress when there is nothing to unshare) > by mprotect'ing the range R/O when R/O-pinning, so we don't get PTEs > that are writable. > > This change would have found an issue introduced by commit a12083d721d7 > ("mm/gup: handle hugepd for follow_page()"), whereby R/O pinning was not > able to make progress in all cases, because unsharing logic was not > provided with the VMA to decide at some point that long-term R/O pinning > a !anon page is fine. > > Cc: Andrew Morton > Cc: Shuah Khan > Cc: Peter Xu > Signed-off-by: David Hildenbrand Acked-by: Peter Xu Thanks, -- Peter Xu