From patchwork Wed Jun 19 00:05:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 13703196 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C029AC27C4F for ; Wed, 19 Jun 2024 00:05:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BDD36B02B1; Tue, 18 Jun 2024 20:05:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 06DA06B02B2; Tue, 18 Jun 2024 20:05:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E50566B02B3; Tue, 18 Jun 2024 20:05:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id C4ABB6B02B1 for ; Tue, 18 Jun 2024 20:05:30 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 61C4D40B8B for ; Wed, 19 Jun 2024 00:05:30 +0000 (UTC) X-FDA: 82245694020.12.4CCE91C Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by imf07.hostedemail.com (Postfix) with ESMTP id 2188D40010 for ; Wed, 19 Jun 2024 00:05:27 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b="Ua/TTQQY"; spf=pass (imf07.hostedemail.com: domain of quic_eberman@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_eberman@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718755524; a=rsa-sha256; cv=none; b=mvVno/Lu0IRAXc3qyNQvGcJ+V2nok3n5CRv+UiGC6cBrpxHHFxSC3Y7PEQqkZhPQ8sOHJ1 h28bXVjk00sNaJCuLH8V9/fmd3vt6M+sTESPD5T5bGFm9f/fMu2aqlK15IJRh6pTQU+CR6 bX4jsk7egmFU5dlgpyvZAevk6mBPDbQ= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b="Ua/TTQQY"; spf=pass (imf07.hostedemail.com: domain of quic_eberman@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_eberman@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718755524; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fbO+Vx6FL2r30CUuolgRIrjrd/S25P9zWMEY/WMDOJw=; b=OZ42TFPvukqYgwy97TDqiR4eDykXmQGT0PPc5BT5qVZqeAhZ1oiEQ3VIQxs3fObUGUmRaS HyYQN/dZh4XROiNROZOna3DZ4bchIG42TbHw7AI3tu+ygJjR43wd6np/xj9vw956PTvyEf pW/501E6rrnTiF7/jpOFuldjIMTy8a8= Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45IMFwkH016036; Wed, 19 Jun 2024 00:05:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= fbO+Vx6FL2r30CUuolgRIrjrd/S25P9zWMEY/WMDOJw=; b=Ua/TTQQYT8glFHXW LchHycEnI/XJlu9OkuSKKkzIokPq+WYkDbm9QUpGy0LILerA0qctjtvnnsXBIG2K xS5vVGKhdEeLJVuU5ZjxobXgt6siWIs2lxCz8B2vD0HhXc1sZ3AhxaH5TxnBydem gKbCo5eOK3cx2W3bF/heGEI/tTuxELAxpjI3qAfX13yZZNW2DGDVxXOMCXWzYcYN 6jgN2CBe8mpIa1D6DVGWxlbUFFrdLUQltstDGWbuutlONHp11wj/29GjJtA6PjMK sdVzcMoJGKsdMO+apXi4QUGIDX9SqGqdQ2NTO5XvHvwvHO24ZveFByS61VBEdxxm LwXswg== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yujah877q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 00:05:19 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA05.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 45J05H2c006643 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 00:05:17 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 18 Jun 2024 17:05:17 -0700 From: Elliot Berman Date: Tue, 18 Jun 2024 17:05:10 -0700 Subject: [PATCH RFC 4/5] mm/gup-test: Verify exclusive pinned MIME-Version: 1.0 Message-ID: <20240618-exclusive-gup-v1-4-30472a19c5d1@quicinc.com> References: <20240618-exclusive-gup-v1-0-30472a19c5d1@quicinc.com> In-Reply-To: <20240618-exclusive-gup-v1-0-30472a19c5d1@quicinc.com> To: Andrew Morton , Shuah Khan , David Hildenbrand , Matthew Wilcox , CC: , , , , , , Elliot Berman X-Mailer: b4 0.13.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: Ep5_bKbxZPmtupXQY1F98ZZxOd7BDf84 X-Proofpoint-GUID: Ep5_bKbxZPmtupXQY1F98ZZxOd7BDf84 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-18_06,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=812 clxscore=1015 spamscore=0 lowpriorityscore=0 mlxscore=0 priorityscore=1501 phishscore=0 adultscore=0 suspectscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406180176 X-Stat-Signature: b969s5684fntywob8hknizct6sgijebz X-Rspamd-Queue-Id: 2188D40010 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1718755527-39355 X-HE-Meta: U2FsdGVkX194RGSoQ1wlpcUo4B7we/x0grk1KYqNLgDSgVVNBXPMgn9dtWuZFfUahxGeBUduEvZqHpd9jwZwdJB7w9rIJ/r9hvAnE2cOpmypmLGRYTu/BNpwHJObEJ2RUxSDT5vkGht5NTgxKYMVLKEe/Ot4RHLTDE9AIx/aCqFpztSVcVTga85KQwCPHS2ormkCaODHReaHktm53pWSBtOno/2dHURacTQ1XXuxy2199Vdg571dEz9uhMjOH5ymnC1Xo5OEiMh1ksaB/yMcvCq7aiCMz7HUM0Rwjzwac4tF1rp8DwvXgmyzU72RoJiTpQDw35hNSTItNLNhF16nMW9n9RDNw37bohhMnaVmLiaDMS1XCoe6q4J9lsh+DJLHfWYnIxh3DZbpFQ7UPcwA2hFUQQRbhoahT0J4+NgsCl/k2cvAr/Tmh3i3jPoj49B84KWR8OeE62+iAoO519xf87QRNhoFpihAqBmYmdVjaI8PkXCJ047FBO3/xuJTQj8mQghDyIxFX42Wzragktm+Jn0hAfze/+8ffQiDLOMRej1noDIOS3KvZo2cQEEhfFmxFoa8l0dDiGapkraoWyU2P35UQMZq3yM2hjArCOudXLuhUV7qNI2IOCO7vjQ2/aoWY5aEBQlO//3wFV+wQP/dMTj5a2sWUZtw3tCn6B9/LyJSp93mPb/wz/Kdw7FBgfdPpxTHXELiq0q/KJ5SVfvT0OKsmwf+RR2DOjaHxH3TEkL7nSRg+J9Ssw5Rr9owWMa/ymKZ12YXsLqOCAYKUCB9tMHfcDeethivTcRRWjSiUYgJS622q+Ls/gOaGT+eJfOEOiUro/Ihw3BZ9ov+EGbdjcWvmYxvyzFufx8S2O9CpJ0ad9cJ/oz4mSeADL7xMZkO0FMxhmoN1XPV/42G2Q1o9jNXol1qjuUoufe2sKsNs+KpkheWskEpaGZrh1lGH3TF7ANPTrJM3LbFdcZ8nQO nkXr9lsn U7KCPVIPb0tt2Qy6HjzKVNlfHuQgbALxArPIdrnh+XwpDYtCDM+uKY228JPxnjv31XSQ6rzwCrc6bJ9GbqtjGo8oHsdfHpSSnDZRzbjaR+DoVFaJwK4Lsn8J88PGEF9PVS0Ft6mHQ0cmdUtBeSYGdhTtoHyIgo1YHsr5+eeR3GrsbLP6c7Md98dz1lHwwAOp+i9Eq1J5IhmAZAU+agDU/dsIZimeO1Hf5fsWA1hxlzTKLw8c6en6A39C98BojpWsV/pPifxSCn1XAzV7GnC+f1L/tdrAA8UhUOgzrrE5RWInVcnEWIJaq65VhT3fJ9+HrNpvoz3Z+PbfCm70UCOsK9ZINkA== 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: List-Subscribe: List-Unsubscribe: Add test that pages have the exclusive pin bias when providing FOLL_EXCLUSIVE. Signed-off-by: Elliot Berman --- mm/gup_test.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mm/gup_test.c b/mm/gup_test.c index eeb3f4d87c510..9c6b8c93e44a7 100644 --- a/mm/gup_test.c +++ b/mm/gup_test.c @@ -66,6 +66,26 @@ static void verify_dma_pinned(unsigned int cmd, struct page **pages, } } +static void verify_exclusive_pinned(unsigned int gup_flags, struct page **pages, + unsigned long nr_pages) +{ + unsigned long i; + const struct folio *folio; + + if (!(gup_flags & FOLL_EXCLUSIVE)) + return; + + for (i = 0; i < nr_pages; i++) { + folio = page_folio(pages[i]); + + if (WARN(!folio_maybe_exclusive_pinned(folio), + "pages[%lu] is not exclusive pinned\n", i)) { + dump_page(&folio->page, "gup_test failure"); + break; + } + } +} + static void dump_pages_test(struct gup_test *gup, struct page **pages, unsigned long nr_pages) { @@ -185,6 +205,8 @@ static int __gup_test_ioctl(unsigned int cmd, */ verify_dma_pinned(cmd, pages, nr_pages); + verify_exclusive_pinned(gup->gup_flags, pages, nr_pages); + if (cmd == DUMP_USER_PAGES_TEST) dump_pages_test(gup, pages, nr_pages);