Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1397273rwd; Sat, 27 May 2023 17:07:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7E95n0Mn3abhK/G9rgy9eW69ii0Ot870G7mM7CSCTLXWgZkNu7OjpIg2InUH5pqqNOZtVj X-Received: by 2002:a17:903:2094:b0:1ac:946e:468e with SMTP id d20-20020a170903209400b001ac946e468emr6226516plc.57.1685232463996; Sat, 27 May 2023 17:07:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685232463; cv=pass; d=google.com; s=arc-20160816; b=Y/Y/FOoBclHSrPp4dhEScSpY76zSwXZ9BTtEbTASy4gZkT6w9VbtALw2ISV0mHrGBY P8i2Yt79oQSUYSGoNPYdn7xpTmtSH97mvuWqywnciUEEIL39iJBo/eEjO5lrZx27oCq8 1iyMlvSugSntczTujy41/yHUbZQUcGp6dkAZnqh94/sqiKAlseuHHSFNd5ceyLf0fJPl z5qzE0xmbYmGJEHDxGXVbuIn+9JfiNp6Hc4MT8OPGHfJsym6ZQdCnKzdAiKcIuZXEquv idVZ9qDDXyZBrf5ZyGqOBfUmo40z+89vImaBnnkCrL/sy3MgmXzqbjGrViLXlVb/zQ6+ Vzdg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XmAEx+cqMmhdq4g4e1XqUP33UszhnkQmwwCX5+N6ffI=; b=0UK46WmY1q/LQdMwlVlOpViHdduUtXSRx8BUN+1FJhcVMKlCEbf6lTVBpyfQkyb0qr Hynr5y44ER9eqI31gFSqz3aIkl/arbdXa14uglYVvh3o711K4M67IQ/g311kycs3vmrE 1bBRL14HsI4nkschg5Y+FHulZCPB/yC2txisfQimkBmbnuJH9HQp3zzWngEoRZ7yQpwz Ck6m4wk6zIGh8NS6E7HGvKPu1q/LhmVHyCJ8sgzHlkYjqiP+IWVzmg2nqZswK88NR8NB FCrzZiNk1pZoWn0S+NteKR+OvVU8gIBIh2BlDRS4aYqR0f96TAkFMz5oY6Wo4/EWoiEe II3A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=t81A7V7S; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a170902c38c00b001adec0d4391si4666428plg.48.2023.05.27.17.07.28; Sat, 27 May 2023 17:07:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=t81A7V7S; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229487AbjE0X4Q (ORCPT + 99 others); Sat, 27 May 2023 19:56:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjE0X4P (ORCPT ); Sat, 27 May 2023 19:56:15 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2055.outbound.protection.outlook.com [40.107.100.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97EBFD8; Sat, 27 May 2023 16:56:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O5NAbfel1Ryz+7EObSEcvJ6X7AZ8+My+Vnrm+7P2qWt4pQqhKx6OHEU22wJScWr4hQSBGFrnUxMnk8U7ZEWsD15x5/digHcs+NYF+CnImWQ4TFs1nf2kHLMgz1mti2rxAu79Q1ne5gmPhZ8vroC0iQ3whpLwkowBoRQR+GCsVNsXEEV1vnI94GNCJRuHZvcfbiW0lYWBjwYYI0XJXKvQl1C0MlHZgiFaJlMJZY1zlwN4RIFP4llRVY2+NY7e+2IFZoR36CgtOYmCSyWPXUEuuYRMCI1xh8R4MlUQdZprP6pRKOFzIMBdE+gg3JLGjTHGWM9X+ZMlGdbzHLtUd8pi3g== 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=XmAEx+cqMmhdq4g4e1XqUP33UszhnkQmwwCX5+N6ffI=; b=SPEihRWIGQHq9dTkTDrx+WooxzoTJzDi8AF1UUZC6xmmcDRFPQAPER5NE6uvWjeSYwYdAIjilIBpd0zb1OHo6I/Xn3/WoN5J/B1BLveuMI3+da8b7bNazoIP0GgUSCe8baWXHyme8duXYmcgKv/cmjma/izohlAD7qOvVkANJZa51LY+CodUOwKRw7RHrFLEQgEm9uN46uCJGNW0WbTe4MNmZ8LT3Ch780qxs2IR9An99tnhWWFN/QC2CLMjZ9d8oWdf7G8sJs7ezo5k6cP1C3+eG7DbApDWp/YL5fPM3iNusmz6dzahtDaLTqt3uLe5rJvS2Y+lkDtofquR/qb4Ug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XmAEx+cqMmhdq4g4e1XqUP33UszhnkQmwwCX5+N6ffI=; b=t81A7V7SVhEiUe7urkaArG7It7+LvlSL8Xn4cz3tMsQ/vrJnaZ6pm9VPITZ7ur+91dbB5aaIA+4qqnT3+eLX61jwpem64FNjQzEAsH7gq9CrDd2Ew9y0IFsDNre5KP/h/mSQkDmosOWz4nASFsWiRR+OqRFhdrc+HjkoqZpdrio2WTA61g8sEjqZHHHMnqEALZBqkGPhOMTJ3jdV+PoLEf9Dsi2gQTA3rGbRGOdf3MHJvVs4PK5MkE7UySCQwFMlkskux/iZC1EgV1a8ws/rX742APAPaiFMbXrQv4zhdurrt6pvsj85G+UEac6b8Le+7C/5zwtF5Lr4ACbDghYgvg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by SN7PR12MB6692.namprd12.prod.outlook.com (2603:10b6:806:270::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Sat, 27 May 2023 23:56:11 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab%6]) with mapi id 15.20.6433.017; Sat, 27 May 2023 23:56:11 +0000 Date: Sat, 27 May 2023 20:56:08 -0300 From: Jason Gunthorpe To: John Hubbard Cc: Alistair Popple , Andrew Morton , will@kernel.org, catalin.marinas@arm.com, David Rientjes , linux-mm@kvack.org, linux-kernel@vger.kernel.org, robin.murphy@arm.com, nicolinc@nvidia.com, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, zhi.wang.linux@gmail.com, Sean Christopherson Subject: Re: [PATCH 1/2] mmu_notifiers: Restore documentation for .invalidate_range() Message-ID: References: <3cece716fc09724793aa832e755abfc9d70a8bb3.1684892404.git-series.apopple@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: BL1PR13CA0145.namprd13.prod.outlook.com (2603:10b6:208:2bb::30) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|SN7PR12MB6692:EE_ X-MS-Office365-Filtering-Correlation-Id: e4178ea1-0505-4e46-715c-08db5f0df2a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tr4H4sdeQCnmLupINX3r2xX2p/wk0i79CitwmWhDdHXglHY3W3OMDVK9ljJdcLCp4auPehR2W3xxP3OQhtg88b8zki+eYMF2PeaNjXwlSJQCUiHkcxpVoZfZ1XM8POOb/xObsV64md3xLqtnq/DxiuWlzwQRPEsBroJBN9rJ5FlJhbGhLaunoDxzbxXAG/JT/kfLnli2mfVhLiUiJ6z5KYu/XYcMQ+G9vC4w1uVQyQxcue4W9U5Eunk7w9Zh36wZjgd/d2negz5Kvbfamup/hooP8DABf8B3q86l3FPiO1McbDtsBrejimo9EiYORo8gMCiw1YoBaGUHqOpLsFNVhrlx6BuXnu95GFjf8nzVkR449So963GbOeUi4B4JzFw7NPUa384760YLYdn6UrtnQOrsIuUC4d4ZGQMYUct5wmrgFHZugfpxOJKydASctAcaL68j9DFkJJMyn1W12DFvCKh0Vz166RsMc7MxMMCJP7gdhtOtMEOt6LaXWHdaoHzth00H+ySrV0REBPskj1GSuX2HbkBavyHvGCuoSmATPLDwy/hlsqg5f9IVsHF7atlsIm/r/yN+hx5lOogjuolfr5oEsZjymWkNLmFSgt5o1WAPgZoyZxh019tgWcKR7AX3 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(39860400002)(136003)(396003)(366004)(451199021)(2616005)(83380400001)(2906002)(186003)(36756003)(38100700002)(86362001)(37006003)(6486002)(6666004)(316002)(41300700001)(8936002)(7416002)(8676002)(5660300002)(6862004)(478600001)(54906003)(6636002)(66946007)(66556008)(26005)(53546011)(6506007)(6512007)(66476007)(4326008)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?H8a118EZulG665EjGKET8lrljgLqGdjROFfrlG14wAQzAZ/cqx63siD3b8uN?= =?us-ascii?Q?yZsor5AJedRB9QOFUmQ9vwNy2k4gC3Ng3nBvdAfaGnvF99DtSq2R5FJa/APg?= =?us-ascii?Q?YbMVb8j2gv4/mZ+NrjJxcvqcOyn31jMZyKMoAhu6nPO+dGndbizDtLHdVOBz?= =?us-ascii?Q?Gdl7wBmCsrcjtSquXa5fZr+tkARlpC8YrlQsSFfQy2qi0Ag09JQv6rvDbALQ?= =?us-ascii?Q?XNVdxIL+JpBsy1EC59l9OnNlwA4hDzZ0P/13WcdbdRDktoG0tmaUzitvY6Ce?= =?us-ascii?Q?1XIIzxsTCeX1wfyGbb3fG25oYf9SVbl2SoRrk1LNLwy/j3eFDz/g+7XSeG96?= =?us-ascii?Q?jPb607C6i8eHdOFVWK+c7ar9ErBS/QFrUF4I0yFnuKBzZSk23MFKVubMSwVb?= =?us-ascii?Q?ArppKr6PvOtQ4k2OtWEJ8zCh/+sDOwg3t1L0PsjrmrQ+LkXatlliyYInrTJM?= =?us-ascii?Q?6ATS6ue1aoJBPaX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ascii?Q?+++07jklvqOyDaZgr9NF7LuKqJ03sabpStPbHjmWa9UOkjK2d3TPoA6lUKgK?= =?us-ascii?Q?0XEPXc4ujm99RNo0FKP0emgjEP4+bOMRIS0EgMrcdStmDCoMsHr84oNS522R?= =?us-ascii?Q?9jHZIyIArcSGHKcsIuSRvvpG5gOCj8tcXVAbvxQrHOcKRb1e78wLw1EaT705?= =?us-ascii?Q?VOahJ8MebC+dt0pyx9o=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: e4178ea1-0505-4e46-715c-08db5f0df2a3 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 May 2023 23:56:11.5172 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xS6d4zE1ctTU9ls1A4G56OD5Q5FC/+vTszLplnASE5VYnWq0UXsoacUZVOF8P1cV X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6692 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 23, 2023 at 07:20:31PM -0700, John Hubbard wrote: > On 5/23/23 18:47, Alistair Popple wrote: > > The .invalidate_range() callback is called by > > mmu_notifier_invalidate_range() which is often called while holding > > the ptl spin-lock. Therefore any implementations of this callback must > > not sleep. This was originally documented when the call back was added > > in commit 0f0a327fa12c ("mmu_notifier: add the callback for > > mmu_notifier_invalidate_range()") but appears to have been > > Thanks for digging into this. I expect that you're on the right > track, I'm just wondering about something still: > > > inadvertently removed by commit 5ff7091f5a2c ("mm, mmu_notifier: > > annotate mmu notifiers with blockable invalidate callbacks"). > > Was it really inadvertent, though? The initial patch proposed said this: > > "Also remove a bogus comment about invalidate_range() always being called > under the ptl spinlock." [1] Right, it is not always called under PTL spinlocks and the implementation cannot assume it, but that doesn't mean the implementation is allowed to block. That was one of the main motivating reasons to have both the invalidate_start/end and invalidate_range variations, start/end are allowed to block and range is not. invalidate_range really only exists for the iommu drivers to use it for SVA designs, there are a few other weird users, but iommu was the motivation to create it in the first place. So the comment should just clarify that it is not allowed to sleep and can't assume anything about its locking environment. Jason