Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1224658rwl; Fri, 24 Mar 2023 07:50:20 -0700 (PDT) X-Google-Smtp-Source: AKy350bL95x46wLF18aO1+Sg6Muu7b5q+ZxzMJUiBC0BNWZvruKdIxowzQrE5A+79iOgg6rRAIYL X-Received: by 2002:a17:906:eb8e:b0:885:fee4:69ee with SMTP id mh14-20020a170906eb8e00b00885fee469eemr3108314ejb.59.1679669420696; Fri, 24 Mar 2023 07:50:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679669420; cv=pass; d=google.com; s=arc-20160816; b=C1niWZ0W9tOWJLlAyLGi/UD/XP1V7eRSirOPS6AWTSyMqw/2gT5/vRexZ7jV9cxBEe gH1VWujUMZMmuk4OnBdytF/E8y3SozVtqoQe/lmLB/0fB32ObL0L63NkbA7cXrXuaimQ T5QRZNrsBJdo+l5NlaWUFtpC1jGQE/fng5YLMs3naRqx9VoTriK72PmgAZiO8JMpfJnf Xc9d82ulVx2j2PuFQbuX4DRkNWNJe63fzwLO97q8ZcCIZ6xUKO68Tl9ltaPKc6dolFyI jsRhBVt/AJGngUahaC/oZp3OQobFgIM8Hi0mVJ4zBgnD4N7Ai2vPQJDMf9bi7dWaHqQX AprQ== 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=XRJVY51sfFVDIgTUzqPwz8YZcQXhngYm4rB+95fbn98=; b=wgEVECjSSDATjephaMziBWxPEy4EG/xco2WbXVLy1jJxq4vgobh4MAkx9JJueWwRMk NG18Fy3QwSxDhy5GxkxnsqExMU5NtcIyTqUCcxTZheVH3cVF5tT0a20b3q5mFHQdI5t9 7p7rl7OfBIJuSB5ByqUgKOVNZHm6BpNlnaAjdrGbGu6ojcyDKh2L0uyrTdOb6Sdks+ws sdoDtGM5eLJ8wKaNoy3Voi+ZWalKQKu3qLrUPXL2wbpUvQaWGgD6GrvRY5SECYpyZZqi /eOCErYy6+HRfv/5nZFStswdQcSUbzt08zFk08unU09eGGjRhy9MRyYHUcxFoegAmndw UZFQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=P95UKr0Q; 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 cr2-20020a170906d54200b008d6d20d1920si18714719ejc.35.2023.03.24.07.49.33; Fri, 24 Mar 2023 07:50:20 -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=P95UKr0Q; 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 S232109AbjCXOo5 (ORCPT + 99 others); Fri, 24 Mar 2023 10:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231872AbjCXOot (ORCPT ); Fri, 24 Mar 2023 10:44:49 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2080.outbound.protection.outlook.com [40.107.244.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90387F974 for ; Fri, 24 Mar 2023 07:44:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YQUBPiHlpN6mYKfVcHOKXcTve8/1PC4Whw4u1N4RctB2U3e9VG+Vgh6siaCa6jrmQpvsZGaMEbD87yijkDT2haDyku9KDXPAmTMQLU706gNppNStOTacIzIecTUTSme3OO2S89gsPU9lnrOBD+RG6Btmr5ad0N+dw8ljj7HO8DcZaQFwjrQgN9qr+Mn2IXbatQk81YR4WEOZShMwH6Hm3ijvCySog+BSYwMi41AVOkBqVwIPRfWhge5MWwxdBQ/z3HyF+hGWf3PdYCtnZ/gZ+2UoIXjdYqaxUjaUr8d8a2QQqJpPVCaXO1C5u/wrEPpQ7yMmg0qUnoBNqGyMuFYUtw== 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=XRJVY51sfFVDIgTUzqPwz8YZcQXhngYm4rB+95fbn98=; b=NjTqqI++PQDtah5QT5Y8E0vyjm8C6BCXYBi/w4yUpqt8G3A2rTVGvL8SmC1OsZ3JHsN+YU9njTnmyuEyC8KpBlE5SkLEgK/KwYHMZgYZkXCnoRPAfzmfHDuDCAr4NlUnqMrksR0ykQbnMPRbGJTGQmK7qoieWvTGp6dMQnRGgGvl+RBM7Z0HGWxDNxmc4OVDtd9wzrng/6630ez5Iy2OCnQGJyftWEXR910MtUeEnoKJ8YetGVto3H7idwAGC1oGfLKgO+4QVSvtfRvYWBkSEBo6pCud1UJpmUuX1HDZ9KDbcm8paXK34YbNY4vbRdJ9zz58F1O5CyFu67CmPwoqbA== 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=XRJVY51sfFVDIgTUzqPwz8YZcQXhngYm4rB+95fbn98=; b=P95UKr0QbeEpGjFrQCyTrPhU0SwZmO59Xm5eyw+gxCdUNnVbzIJ9+MlAwJXDTOfTO/wJuiWtq0YQ7odgxA+QKI4u915T06vsSKJGCUOvWd1k0nsigwcBNoTIhws/ZAf2GUsl71e9ebDHLNvfcxvklVAMvtwoSudjrN1o8fPdGmGbvpM+a+4dMWxtRJpkmIIRSG70RTzNHCO1T0b2BTRHjRjU9m7YoBhIjROG+oos7y4GBWbMOneJ1PeYG3968KfhYA1Rrfsu5df6b9+a8MlzsbiksRbo331OCS/lyG6Ec0TIGO7549IX/DQvueGbi3plrbi7EbJURRaw5hmvnuft1Q== 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 PH0PR12MB5608.namprd12.prod.outlook.com (2603:10b6:510:143::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38; Fri, 24 Mar 2023 14:44:43 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::ef6d:fdf6:352f:efd1]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::ef6d:fdf6:352f:efd1%3]) with mapi id 15.20.6178.037; Fri, 24 Mar 2023 14:44:43 +0000 Date: Fri, 24 Mar 2023 11:44:40 -0300 From: Jason Gunthorpe To: "Tian, Kevin" Cc: Nicolin Chen , Robin Murphy , "will@kernel.org" , "eric.auger@redhat.com" , "baolu.lu@linux.intel.com" , "joro@8bytes.org" , "shameerali.kolothum.thodi@huawei.com" , "jean-philippe@linaro.org" , "linux-arm-kernel@lists.infradead.org" , "iommu@lists.linux.dev" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v1 14/14] iommu/arm-smmu-v3: Add arm_smmu_cache_invalidate_user Message-ID: References: Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: BY5PR17CA0007.namprd17.prod.outlook.com (2603:10b6:a03:1b8::20) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|PH0PR12MB5608:EE_ X-MS-Office365-Filtering-Correlation-Id: 91cf7c2a-0a6b-4f19-fbcd-08db2c764e45 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aZA7FsHZ2Oh9YWGJM67qsiL1FfBPkGPovf1sWxV1vyXA1t7VtKOhk69EC/OP9OoAPsInrnLP/UFY1Yj9rNhWkVnwfsc5rbryFJXPZJcgf7H8BpHnHpJ5jpcettiP9hJeaglX9jxOTml8I0CcNMFk9gD0ygamXmZjKZxUVm0hAXZT8Z9Vv//f3XR+9BB0PibacXQnq1RIdKXMS6Bqs9dW5mO0vF6IOaTU46P2BuJQjeR/iOuJl+KJ+mtvDPJYCL0KmPdHfQ0Ggg4W00QZbFx7FZJ6PnDH2pIyqyaYgh0Q9qXac1RkU+68wx/CjRF+47ky3W7Y9SvOIIb67N4JSQLGfIqROSt9Y3BoOwqmf0yjFkUrBav2pcS/e1hmEonBoMbqqSTYn454p2WYfH9isZT1n6ZbPmoSBm98bem3zyZgB0tztAQ+W/vwUv7HAJvBHXkvBd83EqB6Z0vOX91YKVYeWx03/qEullfBrfglC1X352X17QYTKvdFcD01EJI6Awv4J2tmrcEzZSOO2YMqxDZW+SXYHJJ0U6mmpxYcJj+jAZI7pC84nugINTaE0KqrRjJf 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:(13230025)(4636009)(346002)(396003)(366004)(136003)(39860400002)(376002)(451199018)(8936002)(66946007)(66556008)(66476007)(41300700001)(6916009)(4326008)(86362001)(8676002)(36756003)(38100700002)(6506007)(6512007)(26005)(2616005)(83380400001)(186003)(478600001)(54906003)(316002)(6486002)(7416002)(5660300002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?k3Pms3V26pC6soAQYack+c3PII+Lf31mV1VrgHeFEqtg3svopv1RTtiUlSS1?= =?us-ascii?Q?x5kGUg8RGy+kOjfWJnwc4Azf8ybAW8ciyDJdIavVd1uG/rg/DKgIJYK1Iwez?= =?us-ascii?Q?TVQkpNyYyo1msEYkmP9VHLKs4Q5e05sF/+F8X1udykNeBzz9RBKVh2aehScx?= =?us-ascii?Q?67CAPam9s/5eVrOEcVgfjnJLTeRr1Rdt90hDgKEA9uDhceD8Ch/DIEjIL4ym?= =?us-ascii?Q?wkVbsQu0FYxPPe9idjBPTR1LEj4fq8OrPMQqq7qVJSHPJt+ebEFRKLRlrzl0?= =?us-ascii?Q?cNDbQm7IhPGVH5RBWclgd92+9RwFNNSnkAr9J1o3UDINqvfFN0Uol/Un8QM5?= =?us-ascii?Q?GtbrnYJMvBHTo4kvToei1uUkYiiV3qnQfdz5qJe8Vi0623Lmkc5bdhqYrszK?= =?us-ascii?Q?BqiUSZgbjxXCJYyrLSdQo4sJntN4tS7k2A4luDzS1umyA3IgqgRTkCfCD7w+?= =?us-ascii?Q?0wf2sMagQs1sGLIPZPn30XRB2XwXmbkYWuVGczyDLruGdiRAvKlZHUto6Khn?= =?us-ascii?Q?5+aB6b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XJaKsjaAPU9Esto+K?= =?us-ascii?Q?MQg1asuC+fXOeP+ZF4jLFkMPgsdiLhePJS+aX6fB4CONo9seldsNO+vpJKYu?= =?us-ascii?Q?kmwtOo2L/ZqEIsAzygUEdUYUF71sOAfibScZy/hdTTMOd6rE/xSVN75DhHEf?= =?us-ascii?Q?JHPObnmmWGAVFKCLAGPBTYw4YvxQDTQxaj6oTzQ5?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91cf7c2a-0a6b-4f19-fbcd-08db2c764e45 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2023 14:44:43.6529 (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: 9pUPr3OFxZk0+uPjUCX+p5HMlcA4rPfg+dz4cNCE/NBWAqorKqEOWXGXZ0n2UX/b X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5608 X-Spam-Status: No, score=-0.2 required=5.0 tests=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 autolearn=unavailable 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 Fri, Mar 24, 2023 at 08:47:20AM +0000, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Tuesday, March 21, 2023 7:49 PM > > > > On Tue, Mar 21, 2023 at 08:34:00AM +0000, Tian, Kevin wrote: > > > > > > > Rephrasing that to put into a design: the IOCTL would pass a > > > > > user pointer to the queue, the size of the queue, then a head > > > > > pointer and a tail pointer? Then the kernel reads out all the > > > > > commands between the head and the tail and handles all those > > > > > invalidation commands only? > > > > > > > > Yes, that is one possible design > > > > > > If we cannot have the short path in the kernel then I'm not sure the > > > value of using native format and queue in the uAPI. Batching can > > > be enabled over any format. > > > > SMMUv3 will have a hardware short path where the HW itself runs the > > VM's command queue and does this logic. > > > > So I like the symmetry of the SW path being close to that. > > > > Out of curiosity. VCMDQ is per SMMU. Does it imply that Qemu needs > to create multiple vSMMU instances if devices assigned to it are behind > different physical SMMUs (plus one instance specific for emulated > devices), to match VCMDQ with a specific device? Yes > btw is VCMDQ in standard SMMU spec or a NVIDIA specific extension? > If the latter does it require extra changes in guest smmu driver? It is a mash up of ARM standard ECMDQ with a few additions. I hope ARM will standardize something someday > The symmetry of the SW path has another merit beyond performance. > It allows live migration falling back to the sw short-path with not-so-bad > overhead when the dest machine cannot afford the same number of > VCMDQ's as the src. Well, that requires SW emulation of the VCMDQ thing, but yes > But still the main open for in-kernel short-path is what would be the > framework to move part of vIOMMU emulation into the kernel. If this > can be done cleanly then it's better than vhost-iommu which lacks > behind significantly regarding to advanced features. But if it cannot > be done cleanly leaving each vendor move random emulation logic > into the kernel then vhost-iommu sounds more friendly to the kernel > though lots of work remains to fill the feature gap. I assume there are reasonable ways to hook the kernel to kvm, vhost does it. I've never looked at it. At worst we need to factor some of the vhost code into some library to allow it. We want a kernel thread to wakeup on a doorbell ring basically. Jason