Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2659640pxb; Sun, 24 Jan 2021 15:46:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJw4h0K5X80u153LXtIKzWtPL2gknoGeXR3a8maDappEDRz8IjYk5CHhstk2pJYSLcQ4YQge X-Received: by 2002:a17:906:4985:: with SMTP id p5mr381388eju.513.1611531976823; Sun, 24 Jan 2021 15:46:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611531976; cv=none; d=google.com; s=arc-20160816; b=FiotpgCiTepEOeRpp1kld4ocGOJCDnic5WeujJbOCAXSlkiZfpBaERnyNsx+atKx53 GTEHggjcSvKjkmnAcCluTRZYNM/G975VxjmmRnSKxKRtZuFyDR8Q5Ebi/CAizDfMcoEr S1aVnEVnp618Xg0Uemh0RXMxgrocth9kx6wVEV8PEfCH0GS7mmZJ6NuD+Gp/g8IXOtCB /1z6Hp+QSVF4EFD+2/qeajyXF/joGfZBXZnFT8x2SF/LMhHYcj43W8nbBwC+/Xn+Inqc SAZQTHUkeoiKztCUuDQwbfI5Pq6Bmj8c60blCWviUCpSWCLsZjnjKJI3zdw+ppkf6Rr6 tEfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:to:from:subject; bh=XQkygBxScpEBU48fVqAKT3kv/XOnxlp9Av6ePwDWzF0=; b=K/GunyQLHGzZa9ykkwFhMpnoHWlnmCaJzw8sdEhxMuFlK4I58eCXxvYSxdCF8A4ErJ PeX0aCXDoH4Rfbj8IOmITeV3utwmM/lWQ2wjpJKjQz0nuJLeHO7MTF6Dx/tmwaiA0PyF aVz2u9XLaFzA+g34JBtZuYFLAxmojbhwMetussCHtYigMtFMJ3zDyq0IrVtvMe7P+v/Y RQ+sGUsHTfuHhD5TaO1jVeUqJYNu0ttRdHXXRJ7upBLt5jmotr9Qhunozgr2WAhKsPG7 lO9HhtfAMTzzipTSFAXiQzWcgDmz3dW4vcMlR5EGCQar5koDz1vLGCizd1YLmHh03ijk rKVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=JpsR9osU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si5360541ejr.548.2021.01.24.15.45.41; Sun, 24 Jan 2021 15:46:16 -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=@nvidia.com header.s=n1 header.b=JpsR9osU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726261AbhAXXlS (ORCPT + 99 others); Sun, 24 Jan 2021 18:41:18 -0500 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:14642 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725986AbhAXXlR (ORCPT ); Sun, 24 Jan 2021 18:41:17 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Sun, 24 Jan 2021 15:40:35 -0800 Received: from [10.2.52.243] (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 24 Jan 2021 23:40:29 +0000 Subject: Re: [PATCH v7 14/14] selftests/vm: test faulting in kernel, and verify pinnable pages From: John Hubbard To: Pavel Tatashin , , , , , , , , , , , , , , , , , , , , , , References: <20210122033748.924330-1-pasha.tatashin@soleen.com> <20210122033748.924330-15-pasha.tatashin@soleen.com> <532b1927-1b5d-83e8-f1f9-50cd5e72435f@nvidia.com> Message-ID: <27b83f2b-19ae-ca9c-3bf4-4c975610c9de@nvidia.com> Date: Sun, 24 Jan 2021 15:40:29 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:85.0) Gecko/20100101 Thunderbird/85.0 MIME-Version: 1.0 In-Reply-To: <532b1927-1b5d-83e8-f1f9-50cd5e72435f@nvidia.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1611531635; bh=XQkygBxScpEBU48fVqAKT3kv/XOnxlp9Av6ePwDWzF0=; h=Subject:From:To:References:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=JpsR9osUItkg8YBRzflqVwZXgcV5gn47CeJtsDWvz/KtkQDh51LykLqWxLoVfbbQM WSQPfeju4Hk2GzTi6nHT7Q20M1YcpnWAwCetFuDjM/GUZHiMrnZ5umMw8+f+j0mcRq lyQjEEp1UgTircf4W3OPAD6WiUgWEc6u16pMruHQqZ1UBg05KVpQoks1FvJJDmGZXI bo/URk/s0d/bNjtMPzRQwAc/Net7ZmMRiFEhT/X0idQ85xYfjvvV9LzHc33L3QaCVw WeQrTkGNeN5brJ94iVbwgWiX0VnyDkqikqtTNiILcXXkRGe1xCmPNry/FQBJwXPj5V Oh41PMqIUCe/A== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/24/21 3:18 PM, John Hubbard wrote: > On 1/21/21 7:37 PM, Pavel Tatashin wrote: >> When pages are pinned they can be faulted in userland and migrated, and >> they can be faulted right in kernel without migration. >> >> In either case, the pinned pages must end-up being pinnable (not movable= ). >> >> Add a new test to gup_test, to help verify that the gup/pup >> (get_user_pages() / pin_user_pages()) behavior with respect to pinnable >> and movable pages is reasonable and correct. Specifically, provide a >> way to: >> >> 1) Verify that only "pinnable" pages are pinned. This is checked >> automatically for you. >> >> 2) Verify that gup/pup performance is reasonable. This requires >> comparing benchmarks between doing gup/pup on pages that have been >> pre-faulted in from user space, vs. doing gup/pup on pages that are not >> faulted in until gup/pup time (via FOLL_TOUCH). This decision is >> controlled with the new -z command line option. >> >> Signed-off-by: Pavel Tatashin >> --- >> =C2=A0 mm/gup_test.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 |=C2=A0 6 ++++++ >> =C2=A0 tools/testing/selftests/vm/gup_test.c | 23 +++++++++++++++++++---= - >> =C2=A0 2 files changed, 25 insertions(+), 4 deletions(-) >> >=20 > This also looks good. I do see the WARN_ON_ONCE firing in > internal_get_user_pages_fast(), when running with *only* the new -z > option. >=20 > I'll poke around the rest of the patchset and see if that is expected > and normal, but either way the test code itself looks correct and seems The warning that is firing in internal_get_user_pages_fast() is: if (WARN_ON_ONCE(gup_flags & ~(FOLL_WRITE | FOLL_LONGTERM | FOLL_FORCE | FOLL_PIN | FOLL_GET | FOLL_FAST_ONLY))) return -EINVAL; ...OK, so this is because "./gup_test -z" invokes get_user_pages_fast(), which so far does not allow passing in FOLL_TOUCH. Probably because there is nothing "fast" about touching and possibly faulting in pages. :) So, again, the test code still looks correct, even though it's possible to pass in options that run into things that are rejected by gup.c thanks, --=20 John Hubbard NVIDIA