Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp3095324rdb; Tue, 6 Feb 2024 07:07:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFy1I/Fy7wY6Urjq1yeKgi9ca5NnuklY34/0RUfOWqZrkaAnXIr2UY6RbCRSG8QZVtLuZ6t X-Received: by 2002:a17:90b:4a42:b0:296:68c4:9348 with SMTP id lb2-20020a17090b4a4200b0029668c49348mr2727324pjb.37.1707232041235; Tue, 06 Feb 2024 07:07:21 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU+t6/QQpRtXrjPu9L56FkE0IPovYMt2MGSAEk35ueXl25T0GRGbtMp9QvFBh3Z/7RTiv0khi+HHmOSctZ8dJxM1sk/aIHuJ59NJJAO/A== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id m6-20020a17090a34c600b002906b739813si1230129pjf.151.2024.02.06.07.07.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 07:07:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55123-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b="WNY/O714"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=cWJzBEYQ; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-55123-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55123-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (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 sy.mirrors.kernel.org (Postfix) with ESMTPS id AC092B2B81F for ; Tue, 6 Feb 2024 14:35:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C5FE1E500; Tue, 6 Feb 2024 14:35:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="WNY/O714"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="cWJzBEYQ" 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 4ECA222F1C; Tue, 6 Feb 2024 14:35:32 +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=1707230135; cv=fail; b=aAQHkYDKMmUKury3VY1zOy3XJMsH8RO9Far/rcu907z4qg2jkhFlTpE3Xj3Iz+BQM8z20Rf/0aM/X7RwS5IbXHrGuJWp5cWHjWsea42my51BHrMEraWRJwqPjZvWTYo/r74WnmOtOM5/O7LKSGLU+RG8AQg37hW4vbmvFVOF3vo= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707230135; c=relaxed/simple; bh=pf1iQyeMthLpfhNS4cdCjd08JVkWSjUMR5NzMWyrFxY=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=ljgpTdypMkp3tv3R6a1Qh4R2Qp7YdDFMPe7gKUVHdKImqN7+Q+thVmYA0uCT95DrvSuopT1UDRj4KKJFFP/54KnaVVVdLsT2WR7hHXw3R6vdrzGDIljBcUZ3rZwEkBNEfwPMb7JQ/Np8hXIFzhoVP0I/d61hVdf9cfhWTUixyzA= 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=WNY/O714; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=cWJzBEYQ; 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 416ARa9T002551; Tue, 6 Feb 2024 14:35:13 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=pdzakK67/3gRh0Rcbhrqgtig5Cqm9XthBW6tCOPo70Y=; b=WNY/O714PWIDFdelatX2iVbje2JwyWMuoTWMapaakdufs7d4pXBTBLDIiOOlLMYMH8lW kPkDbyH0nBXhzUmPVN8JJZTlvNxI+ftKoKcG6Ac/uSivPWGtxGt4wlAKAVKfmGymUiR7 cTP3FrfqRcGqlxzz9ABo3Ivy0qDAaGZs0wFnsCwrLiFlx52uN4bSzQKXMPCqKyitd+1L 0JTMXxLCKmn16c74Z7+iQ+gRHz5kcbcD7K85kfxk6lNJXlNs1cueYfoR0kmxP6HFupof 8FPReAMeu50TJaVu0RZecqpdvo6GHjzOLq2hf5Z/dykjLwyL2avIPy4Qljs8TRY7ZFsO /A== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w1cdcy1vb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Feb 2024 14:35:13 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 416DWEO7038324; Tue, 6 Feb 2024 14:35:11 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2169.outbound.protection.outlook.com [104.47.59.169]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3w1bx76912-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Feb 2024 14:35:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ey00k43gumn1qZLsIm9CKw5RMVwli6LZJEFq2rAU8+5OSe+ng89EnHIITpRmsZZQcohwTgqDQUM/dgps5LyKfr5wEyzkb70mfP0e/fWnPcbylTQr+xearuJEOgIDvURV/bbh6gxw5yoAtc6Cwgb0ZKzjkQ1gwrMD7HKdrVlQYX6wV/9xgXlWHRXOYp01dmhcif2PmwbnTZUy5mwnoU+VTGImhmeBzc3U6FvT9wJG9yXI5XsylvvOuyBLwCJnS/mozNnGF6pwq2bei/9BjuGsDR0mhaAARTeuhPBVsRzDkIskp0CBH4RVqVfjcusobSECaBba7Z9gZXJMai6Pi1qH7A== 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=pdzakK67/3gRh0Rcbhrqgtig5Cqm9XthBW6tCOPo70Y=; b=KIlk+T6HO6d9yQpU1QIJzq68B/k0eR/IiaHgmPLDYpJDTHnPQCQ3dsx5p/774PADX2y/gXde1VqnDbRldb7uVqPO/i/K4uvAlS4AhvCHguciXmWqfvOGvYx2VFx4Jluaw9D1O6+VyaAGyo3dY6KaVQGC8SuW6WyKXNqEXLI3UMXEszAJayqUiVNb8kQAGuJpFm3owieQfL5wi25fpCOOHrG0vaT0hic9RpCG/aOKOh44v4VbR286AhWM32VcbMBwLZznQJxYAYKKllHeoeYXsk2XQ8kpLKZGSjZTV+20QMGBKhNrBVR4qdJ8LOixVHKoHlKku4X4ztmCyL/nT/4KSg== 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=pdzakK67/3gRh0Rcbhrqgtig5Cqm9XthBW6tCOPo70Y=; b=cWJzBEYQGufF4Twj38KzqU4AmyGKOMZZTV34Wl5yHmdFViS5XmxPi73LWXlrr5PRWn9fFChX+FxXbwrglzW4dJ8xfjvISgAqXdTieQp5m5mW3anL4tkfosC/xGZzCMgG7ZEKupGWBRs7GZ//eCsBj1K2kLXoDKstWI1NJMq+KvM= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by IA1PR10MB7447.namprd10.prod.outlook.com (2603:10b6:208:44c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36; Tue, 6 Feb 2024 14:35:08 +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.035; Tue, 6 Feb 2024 14:35:08 +0000 Date: Tue, 6 Feb 2024 09:35:06 -0500 From: "Liam R. Howlett" To: Lokesh Gidra Cc: Suren Baghdasaryan , 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: <20240206143506.6zsj2gktu754gvl6@revolver> Mail-Followup-To: "Liam R. Howlett" , Lokesh Gidra , Suren Baghdasaryan , 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: <20240129203626.uq5tdic4z5qua5qy@revolver> <20240130025803.2go3xekza5qubxgz@revolver> <20240131214104.rgw3x5vuap43xubi@revolver> <20240205220022.a4qy7xlv6jpcsnh7@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: YTBP288CA0019.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:14::32) 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_|IA1PR10MB7447:EE_ X-MS-Office365-Filtering-Correlation-Id: 996c907f-7f15-41ef-359e-08dc2720d15b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aR3zvMC3FyGV0pMGijsLHxpU2dqb77Tvl6Xc8cMzfaVZK4zZXpEvtakF3ZM9CKxqKCUO37VjtwhFj+JzJ5qLMo5FwGKhyO+4SAg3o8usFmTRtqlaN3ZIiNvXlIF40+R9iR6YGHDS7Fz6a84N90+VVOJ54Jc0FZjWrblYdBTwWyg5N08xyVwT6o/KYqeJqRNZnj/nvSdfdkvHD5novUOIdOefNxy9j0Np4og14OnIBjTepbMU4Q/fJhN9H/FfL/toKMd4Idn/ANmBC2KCpTNrd6cLcCALCoW53ZZ724OmThkaYIfk+zNtsXVwle5nemBBqYj108lUkIEx7FPJdZX9d7LxrSHK8LJdYcIpF7RH6C1f9KC8x09yi/ntTojjCZIHBA6p5BszOmM375hklQHKxpC4nhwQSPWtYeAwsrHrvV9iQyZ2pEzN4gcvhA3KmliAfY8mzRqljRa5KqAlL8M4cZMPoH98PpVsQuaOemrnUpzAe8A7P6pnLLTNnwOFI8KuiO6hU1jtLMfORaZW3CiiFT3hNHHWK+tF/mOSsIwLbc+DKMDN5r4gcvz9IrfOFxKb 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)(136003)(346002)(39860400002)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(2906002)(316002)(6916009)(66476007)(66946007)(66556008)(8936002)(4326008)(8676002)(38100700002)(86362001)(33716001)(41300700001)(6512007)(9686003)(26005)(83380400001)(7416002)(1076003)(5660300002)(6486002)(478600001)(53546011)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8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Y4pVlBzbi4vOR6lkGfJNrpDXKULVSOuHHgMPTmTI9ZkAcqNjyA97Hoql128jwU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 996c907f-7f15-41ef-359e-08dc2720d15b X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7933.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2024 14:35:08.6181 (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: EaMTVqJ+xUFkP7hVhEIC03A2wVo9J0RK5QXVBan7Vv+LYPzZUhzDKRJOln3TfMa/3uBetMrP0M7IZtasFNSdVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB7447 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-02-06_08,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402060102 X-Proofpoint-GUID: blVphmwaddQEX6dT4iK19uLpHVxWXE8n X-Proofpoint-ORIG-GUID: blVphmwaddQEX6dT4iK19uLpHVxWXE8n * Lokesh Gidra [240205 17:24]: > On Mon, Feb 5, 2024 at 2:00=E2=80=AFPM Liam R. Howlett wrote: > > > > * Lokesh Gidra [240205 16:55]: > > ... > > > > > > > > We can take care of anon_vma as well here right? I can take a b= ool > > > > > > parameter ('prepare_anon' or something) and then: > > > > > > > > > > > > if (vma) { > > > > > > if (prepare_anon && vma_is_anonymous(vma)) = && > > > > > > !anon_vma_prepare(vma)) { > > > > > > vma =3D ERR_PTR(-ENOMEM); > > > > > > goto out_unlock; > > > > > > } > > > > > > > vma_aquire_read_lock(vma); > > > > > > } > > > > > > out_unlock: > > > > > > > mmap_read_unlock(mm); > > > > > > > return vma; > > > > > > > } > > > > > > > > > > Do you need this? I didn't think this was happening in the code = as > > > > > written? If you need it I would suggest making it happen always = and > > > > > ditch the flag until a user needs this variant, but document what= 's > > > > > going on in here or even have a better name. > > > > > > > > I think yes, you do need this. I can see calls to anon_vma_prepare(= ) > > > > under mmap_read_lock() protection in both mfill_atomic_hugetlb() an= d > > > > in mfill_atomic(). This means, just like in the pagefault path, we > > > > modify vma->anon_vma under mmap_read_lock protection which guarante= es > > > > that adjacent VMAs won't change. This is important because > > > > __anon_vma_prepare() uses find_mergeable_anon_vma() that needs the > > > > neighboring VMAs to be stable. Per-VMA lock guarantees stability of > > > > the VMA we locked but not of its neighbors, therefore holding per-V= MA > > > > lock while calling anon_vma_prepare() is not enough. The solution > > > > Lokesh suggests would call anon_vma_prepare() under mmap_read_lock = and > > > > therefore would avoid the issue. > > > > > > > > ... > > > > > anon_vma_prepare() is also called in validate_move_areas() via move_p= ages(). > > > > Probably worth doing it unconditionally and have a comment as to why it > > is necessary. > > > The src_vma (in case of move_pages()) doesn't need to have it. >=20 > The only reason I'm not inclined to make it unconditional is what if > some future user of lock_vma() doesn't need it for their purpose? Why > allocate anon_vma in that case. Because there isn't a user and it'll add a flag that's a constant. If there is a need for the flag later then it can be added at that time. Maybe there will never be a user and we've just complicated the code for no reason. Don't implement features that aren't necessary, especially if there is no intent to use them. >=20 > > Does this avoid your locking workaround? >=20 > Not sure which workaround you are referring to. I am almost done > implementing your suggestion. Very soon will share the next version of > the patch-set. The locking dance with the flags indicating if it's per-vma lock or mmap_lock.