Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1931718rdb; Wed, 31 Jan 2024 13:44:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEno41dyrKlyxzZMfrtbdcaO/Gjv04d+JuF4Tu3puns8NY8tBsmId6KLq70setMJeKMASmN X-Received: by 2002:aa7:c1c9:0:b0:55e:f6c5:4e44 with SMTP id d9-20020aa7c1c9000000b0055ef6c54e44mr1651221edp.40.1706737454481; Wed, 31 Jan 2024 13:44:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWhENRA93jT5P6ycP5HvdtYa+l4Y4OxAv7L/CmaLq+9h3hzJ+EFJyB+LridYL1cCkhREprT+RmDnEuPujIKPSU7ol1ldluK/x/uJWXNmg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id el15-20020a056402360f00b0055f49c505f8si1946463edb.433.2024.01.31.13.44.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 13:44:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47187-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@oracle.com header.s=corp-2023-11-20 header.b=f0Zu+RuT; dkim=neutral (body hash did not verify) header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=xxY6Ru8S; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-47187-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47187-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1383B1F21338 for ; Wed, 31 Jan 2024 21:44:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D21939AF1; Wed, 31 Jan 2024 21:44:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="f0Zu+RuT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="xxY6Ru8S" Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 4459B39ACA; Wed, 31 Jan 2024 21:43:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706737440; cv=fail; b=pmZXDlVuO+sNa3Yo2PfLb3vVDVvYkEOBGMki81Anq1yQ6Dv7j3e2U8iqNGhq9VRFLod/6Ttt+UF4Yych72E2liAA0ND1UsVpdEy8j3IL+aM+dyE+Z7JgMe0hJEfRkRlsMTuP2iSR/esqh4HPNIA5Jp/JbKI5Qb0Slw3OFKCZFEs= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706737440; c=relaxed/simple; bh=yAww3gInc5TCLniyKmSoh2EVGnrcv/9j4aoMlA9Wiss=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=FxIGnlFLwSWs7+89UDaQmxQCtqtqAuNh3Q90rlWTWyAfVqH08T66X8tSQyswRn6Cnc8rSVHrJFXAg1KzLwtLD4yRUP2co5vC5S10/I4Gl9cTPMh5v0v47/QPzjXPw5qY7vFgxQhY4HM2pHHZ5AmLLNT33huaMZwoAhYoENxXM8s= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=Oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=f0Zu+RuT; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=xxY6Ru8S; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=Oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40VHBswE029067; Wed, 31 Jan 2024 21:43:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : content-type : content-transfer-encoding : in-reply-to : mime-version; s=corp-2023-11-20; bh=8yxQj7MEQIDNJw7X0m/AhfJuk9Ltub/0IP3/TEU4g4w=; b=f0Zu+RuTaCpfFw8yn/erdUgYT7TQrIcZ6gYE8J2z8RpP4kRf0Q6HHq9k44yuMU3RfpUX 6hKgEuEBNeXPs8I1xNU42bijrvlOl4J9sPk7v+SjO3EwJXnaHfuZOXSu324hD6/GhWt0 3f++mDCRuHz+Z38Ld0v5nXqF8be05gX0GJoUHyl6ZMjGRCuGy+Iub7z2kRfRqWZwi0xX 5vA9UMYO6ZwilPFp/cH9L24YBDmDmzQS8EwGLb0KM4jRfM5m4PPt2KNovhFiPKBg6apB eBT4S7vqbLpg1tpYTyXSxk3mDNoGTkrOLg2Lx7Zbf84PB44sJcoaMVoZLM/5S7kmFN6M DA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vvrrck61r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 31 Jan 2024 21:43:34 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 40VKBGJ2028423; Wed, 31 Jan 2024 21:43:33 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vvr99n4ds-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 31 Jan 2024 21:43:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N5XDYGcKs6JAaRo+ExTMtvQbTFl7ex71nIwQ0KC/kXFUzT2naXbZ85jej7ycFkr0gw8Z25Kr4qcpVpP/EOdaB1JSKcWuVV8OtcRHNQ1M01SfELFw3cXCpTP42excJ2GdkXDnRcL5Uw+THA1yHUXP3kq1RsyMqp6GhXo9TS0Q7jaKJWBBKWgUumwROb1VSTNs/Nue1NAsM5gnbOUUQMXi+h6SZgbnpKiHlt/7QPjpdGb7Ba83sS00IaO8D8zjrvsUoDcbxiriWN0Myq0YEBaDmANnoSu5XaYiLm7Lp2TsALSBKXwibsDsSVt66LKqJR8uMWzEMdIerbLhqV7V6v6zAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8yxQj7MEQIDNJw7X0m/AhfJuk9Ltub/0IP3/TEU4g4w=; b=c8dIvTn2VxQUGUXr3cC8YRXAo+XiXWtEEnJhrWuQ5OVPuqp69vl04XRmck7jVk30XKlyn4rVBQqMXjMW4k+fmpeCMAu93mqv2U+zt4ulwtYwkXkCv0YytXrmQdp92XEvhgXBIfNbUrimI24Dxv7MQVPpt+3TKl/WGTzECEPe6bYZkVAYr+BGz5RHvxl844dskdq4IjS4VlrvnOiW7GfRKZsoTf4nFrh1D/xTl+jIwtXKHAzi9GvLuhSi4DRuZXONT+Z2q0GBNNThJfvLBgH5zKHj/B4/CWjaAFxm500m9CZDjmzOHXmN6fFQV4BN6aOXjayDRvEXc8IE45ZyJzrn/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8yxQj7MEQIDNJw7X0m/AhfJuk9Ltub/0IP3/TEU4g4w=; b=xxY6Ru8SD4tiyEyPw9zdpelE7n7pvo/LThE8KWNfOan0co5V56gKR+M1jVHmq7rNBZO7lCnmdRwwcnBuYOvKvHshE+h5wjQGBJ02S+FTyNGG3BYyaZZJ2mUHVMHwGzNwEh6EUxOk9mdfYtzMdMHbVBdvk8N7AyUMHST+dgwCI9U= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by SJ0PR10MB5671.namprd10.prod.outlook.com (2603:10b6:a03:3ee::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.37; Wed, 31 Jan 2024 21:43:19 +0000 Received: from DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::20c8:7efa:f9a8:7606]) by DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::20c8:7efa:f9a8:7606%4]) with mapi id 15.20.7249.017; Wed, 31 Jan 2024 21:43:19 +0000 Date: Wed, 31 Jan 2024 16:43:16 -0500 From: "Liam R. Howlett" To: Suren Baghdasaryan Cc: Lokesh Gidra , akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, selinux@vger.kernel.org, kernel-team@android.com, aarcange@redhat.com, peterx@redhat.com, david@redhat.com, axelrasmussen@google.com, bgeffon@google.com, willy@infradead.org, jannh@google.com, kaleshsingh@google.com, ngeoffray@google.com, timmurray@google.com, rppt@kernel.org Subject: Re: [PATCH v2 3/3] userfaultfd: use per-vma locks in userfaultfd operations Message-ID: <20240131214316.vteh6vzbb3ubdzqf@revolver> Mail-Followup-To: "Liam R. Howlett" , Suren Baghdasaryan , Lokesh Gidra , akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, selinux@vger.kernel.org, kernel-team@android.com, aarcange@redhat.com, peterx@redhat.com, david@redhat.com, axelrasmussen@google.com, bgeffon@google.com, willy@infradead.org, jannh@google.com, kaleshsingh@google.com, ngeoffray@google.com, timmurray@google.com, rppt@kernel.org References: <20240129193512.123145-1-lokeshgidra@google.com> <20240129193512.123145-4-lokeshgidra@google.com> <20240129203626.uq5tdic4z5qua5qy@revolver> <20240130025803.2go3xekza5qubxgz@revolver> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: User-Agent: NeoMutt/20220429 X-ClientProxiedBy: YT4P288CA0045.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:d3::18) To DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7933:EE_|SJ0PR10MB5671:EE_ X-MS-Office365-Filtering-Correlation-Id: d11f6c60-f05c-4f27-b1c0-08dc22a5a37d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OxxGdSaJlPNyvlbpvwYtgb17YQBxb+UJ87cST1qnmM2AdIs/ObFXnGxPJZ3o7zpN2GhZzRgS7dC8T31ivsyjw937xr2veH9/p0GPprN9y5EeUB5m6fouZ3NnOy9wKN+MRuUDrLPptML57apfyCDk8SwvgCGGn2sw7a4eMwDo8Pzbl4v6Rq5VThTIP1dKKf7HOvWJZdf4XI3VJKqD99h2bjUpxL3hE9S57Of5ASgODCP4ErSzeNWuA7GxgQsf/1BepD5ZSYjyMU8tUgGpzs1uQbcszlf530Tl68vy3ih/a0gFoVhgJPHDAoRNZxhkvCcQ4R7MDHJe7kZRLlWrlkzG502WW6XxZL0HnjOl69Jk/aWpIntVxUsqx8uQfesKDFhNlGxrgLX30+jUBdeie9WpaGRR6Sq01pZIuQKBYw4n3SCM0eEcml4ckSLW0ePYAPv2gT/hLpRVEng9FNUlLttZdqJOaaS4pVHvy7myDP0VL0ljMKzhc1yHVCjgPK3DmG0rQ7GBiquR2RSEEh97cBjHmguaSvxNf7QOJ9F4nKFb3Sj2d/4uK1q6O6T/3yYfo0vr X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR10MB7933.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7916004)(366004)(396003)(346002)(39860400002)(136003)(376002)(230922051799003)(64100799003)(1800799012)(451199024)(186009)(66476007)(66556008)(66946007)(6486002)(53546011)(6512007)(9686003)(478600001)(316002)(6916009)(8936002)(4326008)(6666004)(8676002)(6506007)(26005)(1076003)(83380400001)(2906002)(38100700002)(7416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eWSvtYFO6Zj4+SRulBWHH8DeYVElF01SR4NEPA9KkMG8T83CBT9sXbaDT47XRswPeV37om/E/Lp495OlSnmEE7Lnmon+gV755pHqND8O8VJQsbnPBC7cThNIqF7cN4+iNK0BbsRtNbhlF8lNiVSAX5FnYjSLyFqv4O98= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d11f6c60-f05c-4f27-b1c0-08dc22a5a37d X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7933.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2024 21:43:18.9108 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qlysWkEeZ+J6YLvuqpLST3uvNNDq+8B9vWH5h4oSW3hs1PDYvcIWI8ls2uKBDVGWZZ8rFaP8vQYMkqX7TKzFIw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5671 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-31_10,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 spamscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401310169 X-Proofpoint-ORIG-GUID: TxjNT9A8cChat4JaGh6re1rbjpdGoaay X-Proofpoint-GUID: TxjNT9A8cChat4JaGh6re1rbjpdGoaay * Suren Baghdasaryan [240130 22:03]: > On Mon, Jan 29, 2024 at 6:58=E2=80=AFPM Liam R. Howlett wrote: .. > > > > > > @@ -730,7 +759,7 @@ static __always_inline ssize_t mfill_atomic= (struct userfaultfd_ctx *ctx, > > > > > > > > > > > > out_unlock: > > > > > > up_read(&ctx->map_changing_lock); > > > > > > - mmap_read_unlock(dst_mm); > > > > > > + unpin_vma(dst_mm, dst_vma, &mmap_locked); > > > > > > out: > > > > > > if (folio) > > > > > > folio_put(folio); > > > > > > @@ -1285,8 +1314,6 @@ static int validate_move_areas(struct use= rfaultfd_ctx *ctx, > > > > > > * @len: length of the virtual memory range > > > > > > * @mode: flags from uffdio_move.mode > > > > > > * > > > > > > - * Must be called with mmap_lock held for read. > > > > > > - * > > > > > > * move_pages() remaps arbitrary anonymous pages atomically in= zero > > > > > > * copy. It only works on non shared anonymous pages because t= hose can > > > > > > * be relocated without generating non linear anon_vmas in the= rmap > > > > > > @@ -1353,15 +1380,16 @@ static int validate_move_areas(struct u= serfaultfd_ctx *ctx, > > > > > > * could be obtained. This is the only additional complexity a= dded to > > > > > > * the rmap code to provide this anonymous page remapping func= tionality. > > > > > > */ > > > > > > -ssize_t move_pages(struct userfaultfd_ctx *ctx, struct mm_stru= ct *mm, > > > > > > - unsigned long dst_start, unsigned long src_sta= rt, > > > > > > - unsigned long len, __u64 mode) > > > > > > +ssize_t move_pages(struct userfaultfd_ctx *ctx, unsigned long = dst_start, > > > > > > + unsigned long src_start, unsigned long len, __= u64 mode) > > > > > > { > > > > > > + struct mm_struct *mm =3D ctx->mm; > > > > > > struct vm_area_struct *src_vma, *dst_vma; > > > > > > unsigned long src_addr, dst_addr; > > > > > > pmd_t *src_pmd, *dst_pmd; > > > > > > long err =3D -EINVAL; > > > > > > ssize_t moved =3D 0; > > > > > > + bool mmap_locked =3D false; > > > > > > > > > > > > /* Sanitize the command parameters. */ > > > > > > if (WARN_ON_ONCE(src_start & ~PAGE_MASK) || > > > > > > @@ -1374,28 +1402,52 @@ ssize_t move_pages(struct userfaultfd_c= tx *ctx, struct mm_struct *mm, > > > > > > WARN_ON_ONCE(dst_start + len <=3D dst_start)) > > > > > > goto out; > > > > > > > > > > Ah, is this safe for rmap? I think you need to leave this read l= ock. > > > > > > > > I didn't fully understand you here. > > > > Sorry, I'm confused on how your locking scheme avoids rmap from trying > > to use the VMA with the atomic increment part. >=20 > I'm also a bit confused. Which atomic increment are you referring to? > AFAIU move_pages() will lock both src_vma and dst_vma, so even if rmap > finds them it can't modify them, no? The uffd atomic, mmap_changing. ..